ObjFW  Check-in [27d64d775a]

Overview
Comment:Improve compatibility with old evdev headers
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 27d64d775a3676eba5ac014c1694e6063a5a291881dffd6f9e07399670b73c6f
User & Date: js on 2024-08-20 20:44:43
Other Links: manifest | tags
Context
2024-08-20
21:55
forwardingTargetForSelector: for PowerPC 64/ELF v1 check-in: d7797ded66 user: js tags: trunk
20:44
Improve compatibility with old evdev headers check-in: 27d64d775a user: js tags: trunk
2024-08-19
22:04
OFSCTPSocket: Initialize flags for sctp_recvv to 0 check-in: 12289e98ac user: js tags: trunk
Changes

Modified src/hid/OHDualSenseGamepad.m from [7debc1d55c] to [f0385ed720].

25
26
27
28
29
30
31

32
33
34
35
36
37
38
#import "OHEmulatedGameControllerTriggerButton.h"
#import "OHGameControllerAxis.h"
#import "OHGameControllerButton.h"
#import "OHGameControllerDirectionalPad.h"

#if defined(OF_LINUX) && defined(OF_HAVE_FILES)
# include <linux/input.h>

#endif

static OFString *const buttonNames[] = {
	@"Triangle", @"Cross", @"Square", @"Circle", @"L1", @"R1", @"L3", @"R3",
	@"Options", @"Create", @"PS"
};
static const size_t numButtons = sizeof(buttonNames) / sizeof(*buttonNames);







>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#import "OHEmulatedGameControllerTriggerButton.h"
#import "OHGameControllerAxis.h"
#import "OHGameControllerButton.h"
#import "OHGameControllerDirectionalPad.h"

#if defined(OF_LINUX) && defined(OF_HAVE_FILES)
# include <linux/input.h>
# import "evdev_compat.h"
#endif

static OFString *const buttonNames[] = {
	@"Triangle", @"Cross", @"Square", @"Circle", @"L1", @"R1", @"L3", @"R3",
	@"Options", @"Create", @"PS"
};
static const size_t numButtons = sizeof(buttonNames) / sizeof(*buttonNames);

Modified src/hid/OHDualShock4Gamepad.m from [20f286b482] to [18a893f1a6].

25
26
27
28
29
30
31

32
33
34
35
36
37
38
#import "OHEmulatedGameControllerTriggerButton.h"
#import "OHGameControllerAxis.h"
#import "OHGameControllerButton.h"
#import "OHGameControllerDirectionalPad.h"

#if defined(OF_LINUX) && defined(OF_HAVE_FILES)
# include <linux/input.h>

#endif

static OFString *const buttonNames[] = {
	@"Triangle", @"Cross", @"Square", @"Circle", @"L1", @"R1", @"L3", @"R3",
	@"Options", @"Share", @"PS"
};
static const size_t numButtons = sizeof(buttonNames) / sizeof(*buttonNames);







>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#import "OHEmulatedGameControllerTriggerButton.h"
#import "OHGameControllerAxis.h"
#import "OHGameControllerButton.h"
#import "OHGameControllerDirectionalPad.h"

#if defined(OF_LINUX) && defined(OF_HAVE_FILES)
# include <linux/input.h>
# import "evdev_compat.h"
#endif

static OFString *const buttonNames[] = {
	@"Triangle", @"Cross", @"Square", @"Circle", @"L1", @"R1", @"L3", @"R3",
	@"Options", @"Share", @"PS"
};
static const size_t numButtons = sizeof(buttonNames) / sizeof(*buttonNames);

Modified src/hid/OHEvdevGameController.m from [f0e6f8f999] to [ed0a8b42b6].

54
55
56
57
58
59
60


61
62
63
64
65
66
67
#include <linux/input.h>

#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFOpenItemFailedException.h"
#import "OFOutOfRangeException.h"
#import "OFReadFailedException.h"



const uint16_t OHEvdevButtonIDs[] = {
	BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_TL, BTN_TR, BTN_TL2,
	BTN_TR2, BTN_SELECT, BTN_START, BTN_MODE, BTN_THUMBL, BTN_THUMBR,
	BTN_DPAD_UP, BTN_DPAD_DOWN, BTN_DPAD_LEFT, BTN_DPAD_RIGHT,
	BTN_TRIGGER_HAPPY1, BTN_TRIGGER_HAPPY2, BTN_TRIGGER_HAPPY3,
	BTN_TRIGGER_HAPPY4, BTN_TRIGGER_HAPPY5, BTN_TRIGGER_HAPPY6,







>
>







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <linux/input.h>

#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFOpenItemFailedException.h"
#import "OFOutOfRangeException.h"
#import "OFReadFailedException.h"

#import "evdev_compat.h"

const uint16_t OHEvdevButtonIDs[] = {
	BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_TL, BTN_TR, BTN_TL2,
	BTN_TR2, BTN_SELECT, BTN_START, BTN_MODE, BTN_THUMBL, BTN_THUMBR,
	BTN_DPAD_UP, BTN_DPAD_DOWN, BTN_DPAD_LEFT, BTN_DPAD_RIGHT,
	BTN_TRIGGER_HAPPY1, BTN_TRIGGER_HAPPY2, BTN_TRIGGER_HAPPY3,
	BTN_TRIGGER_HAPPY4, BTN_TRIGGER_HAPPY5, BTN_TRIGGER_HAPPY6,

Modified src/hid/OHEvdevGameControllerProfile.m from [b041d2d6ee] to [98130bdc10].

21
22
23
24
25
26
27


28
29
30
31
32
33
34

#import "OHEvdevGameControllerProfile.h"
#import "OFDictionary.h"
#import "OHGameControllerAxis.h"
#import "OHGameControllerButton.h"

#include <linux/input.h>



static OFString *
buttonToName(uint16_t button, uint16_t vendorID, uint16_t productID)
{
	switch (button) {
	case BTN_A:
		return @"A";







>
>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

#import "OHEvdevGameControllerProfile.h"
#import "OFDictionary.h"
#import "OHGameControllerAxis.h"
#import "OHGameControllerButton.h"

#include <linux/input.h>

#import "evdev_compat.h"

static OFString *
buttonToName(uint16_t button, uint16_t vendorID, uint16_t productID)
{
	switch (button) {
	case BTN_A:
		return @"A";

Modified src/hid/OHLeftJoyCon.m from [b0e442383e] to [e350cc695f].

24
25
26
27
28
29
30

31
32
33
34
35
36
37
#import "OFDictionary.h"
#import "OHGameControllerAxis.h"
#import "OHGameControllerButton.h"
#import "OHGameControllerDirectionalPad.h"

#if defined(OF_LINUX) && defined(OF_HAVE_FILES)
# include <linux/input.h>

#endif

static OFString *const buttonNames[] = {
	@"L", @"ZL", @"Left Thumbstick", @"-", @"Capture", @"SL", @"SR"
};
static const size_t numButtons = sizeof(buttonNames) / sizeof(*buttonNames);








>







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#import "OFDictionary.h"
#import "OHGameControllerAxis.h"
#import "OHGameControllerButton.h"
#import "OHGameControllerDirectionalPad.h"

#if defined(OF_LINUX) && defined(OF_HAVE_FILES)
# include <linux/input.h>
# import "evdev_compat.h"
#endif

static OFString *const buttonNames[] = {
	@"L", @"ZL", @"Left Thumbstick", @"-", @"Capture", @"SL", @"SR"
};
static const size_t numButtons = sizeof(buttonNames) / sizeof(*buttonNames);

Modified src/hid/OHRightJoyCon.m from [337b6baa07] to [c000bbc06a].

24
25
26
27
28
29
30

31
32
33
34
35
36
37
#import "OFDictionary.h"
#import "OHGameControllerAxis.h"
#import "OHGameControllerButton.h"
#import "OHGameControllerDirectionalPad.h"

#if defined(OF_LINUX) && defined(OF_HAVE_FILES)
# include <linux/input.h>

#endif

static OFString *const buttonNames[] = {
	@"X", @"B", @"A", @"Y", @"R", @"ZR", @"Right Thumbstick", @"+",
	@"Home", @"SL", @"SR"
};
static const size_t numButtons = sizeof(buttonNames) / sizeof(*buttonNames);







>







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#import "OFDictionary.h"
#import "OHGameControllerAxis.h"
#import "OHGameControllerButton.h"
#import "OHGameControllerDirectionalPad.h"

#if defined(OF_LINUX) && defined(OF_HAVE_FILES)
# include <linux/input.h>
# import "evdev_compat.h"
#endif

static OFString *const buttonNames[] = {
	@"X", @"B", @"A", @"Y", @"R", @"ZR", @"Right Thumbstick", @"+",
	@"Home", @"SL", @"SR"
};
static const size_t numButtons = sizeof(buttonNames) / sizeof(*buttonNames);

Added src/hid/evdev_compat.h version [20e5b10cb1].

































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
 *
 * All rights reserved.
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License version 3.0 only,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * version 3.0 for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3.0 along with this program. If not, see
 * <https://www.gnu.org/licenses/>.
 */

/* Provide compatibility defines for old evdev headers. */

#include <linux/input.h>

#ifndef BTN_NORTH
# define BTN_NORTH BTN_X
#endif
#ifndef BTN_SOUTH
# define BTN_SOUTH BTN_A
#endif
#ifndef BTN_WEST
# define BTN_WEST BTN_Y
#endif
#ifndef BTN_EAST
# define BTN_EAST BTN_B
#endif

#ifndef BTN_DPAD_UP
# define BTN_DPAD_UP 0x220
#endif
#ifndef BTN_DPAD_DOWN
# define BTN_DPAD_DOWN 0x221
#endif
#ifndef BTN_DPAD_LEFT
# define BTN_DPAD_LEFT 0x222
#endif
#ifndef BTN_DPAD_RIGHT
# define BTN_DPAD_RIGHT 0x223
#endif