Commit Graph

63 Commits

Author SHA1 Message Date
Philipp Wiesemann
343c84b28b Linux: Fixed error message. 2017-03-04 23:05:11 +01:00
Sam Lantinga
05be9212ad We only need the first few keymaps corresponding to the following constants:
K_NORMTAB, K_SHIFTTAB, K_ALTTAB, K_ALTSHIFTTAB

In the normal case we'll load all the keymaps from the kernel, but this reduces the size of the SDL library for the fallback case when we can't get to the tty.
2017-01-09 11:58:01 -08:00
Sam Lantinga
78328cd67d Implemented full evdev keyboard text support
This is based on the Linux kernel driver, and has fallback mapping tables in case we aren't connected to a virtual terminal.
2017-01-09 02:54:42 -08:00
Sam Lantinga
c733b3c0a0 Fixed bug 3545 - SDL_EVDEV_do_text_input() may be too eager to find error cases
Rob

I've ran into an issue where I successfully receive SDL_KEY[UP,DOWN] events but not SDL_TEXTINPUT or SDL_TEXTEDITING.  In my case the code in SDL_EVDEV_do_text_input() is returning early (on error) prior to calling SDL_SendKeyboardText().  I'm running on the RaspberryPi 3, without X11.

In SDL_EVDEV_do_text_input() there is a condition to check keysyms with a type value below 0xf0, then subtract 0xf0 from type.  Without understanding the purpose of this code, I disabled it, recompiled, and I'm getting correct SDL_TEXTINPUT events.  I'm going to guess that my hack/fix is going to be problematic in some other environment, but after some initial testing it looks like everything is running fine in my setup.
2017-01-08 20:03:18 -08:00
Sam Lantinga
164fc4a1a5 Removed console check, let the kernel decide whether muting is appropriate on this terminal.
We don't fail the init if we can't mute the terminal (we might be running from ssh, or on a system without virtual terminals, etc.)
2017-01-08 19:04:38 -08:00
Sam Lantinga
87ee83abcb SDL_evdev.c: fix building against old kernel headers (K_OFF may not be defined.) 2017-01-08 10:15:22 -08:00
Sam Lantinga
bf17aaf493 Don't fail if we can't open the tty, this can be a legitimate use case. 2017-01-07 16:49:23 -08:00
Ryan C. Gordon
bda48fafc9 Replaced a few single-line "//" comments. 2017-01-07 17:09:14 -05:00
Sam Lantinga
09a8d2db85 Fixed bug 3469 - Keypresses leak to the console with 2.0.5
tvc

I believe this patch should fix it, instead of looping through all the tty's and seemingly selecting the wrong one and corrupting the console I've just made SDL open /dev/tty which is the console attached to the current process anyway.
2017-01-07 10:13:04 -08:00
Sam Lantinga
a5fe411e09 Fixed bug 3546 - SDL_EVDEV_is_console() uses type of wrong size when calling ioctl
Rob

When calling ioctl(fd, KDGKBTYPE, &type) in SDL_EVDEV_is_console(), we declare type as an 'int'.  This should be a 'char'.  The subsequent syscall, and kernel code, only writes the lower byte of the word.

See: http://lxr.free-electrons.com/source/drivers/tty/vt/vt_ioctl.c?v=4.4#L399

ucval = KB_101;
ret = put_user(ucval, (char __user *)arg);

I've observed intermittent behavior related to this, and I can force an error condition by using an int initialized to 0xFFFFFFFF.  The resulting ioctl will set type to 0XFFFFFF02, and the conditional return in SDL_EVDEV_is_console() will fail.

Recommend changing to char, or masking off unused bits.
2017-01-05 23:26:13 -08:00
Sam Lantinga
d77ab77a7a Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga
7f0b81eebd Fixed bug 3517 - Compiler warnings with gcc -Wstrict-prototypes
felix

Compiling even a simple SDL2 'hello world' program with gcc -Wstrict-prototypes (GCC 6.2.1) results in warnings like:

/usr/include/SDL2/SDL_gamecontroller.h:143:1: attention : function declaration isn't a prototype [-Wstrict-prototypes]
 extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings();
 ^~~~~~

It seems there is a missing 'void' between the parentheses.
2016-12-26 02:12:21 -08:00
Sam Lantinga
f7eea9848d Avoid conflicts with multiple versions of udev by first trying the library that is linked with the executable, if any, and then picking the one that is in the build environment.
This fixes joystick detection for applications using the Steam Linux Runtime
2016-11-29 05:34:20 -08:00
Sam Lantinga
9cc7ce9008 Renaming of guard header names to quiet -Wreserved-id-macro
Patch contributed by Sylvain
2016-11-20 21:34:54 -08:00
Sam Lantinga
2ae04deb92 Removed unused constants
Except for SDL_bmp.c where they are historically interesting and I've left them in.
2016-11-15 01:24:58 -08:00
Sam Lantinga
5e1151257d Patch from Sylvain to fix clang warnings 2016-11-13 22:57:41 -08:00
Sam Lantinga
85bae43dc0 Fixed bug 3473 - can't build on linux with an old kernel 2016-11-01 10:33:44 -07:00
Philipp Wiesemann
9c939bab22 Linux: Fixed compile warnings about unused variables. 2016-10-15 20:02:17 +02:00
Sam Lantinga
fa961623d4 Fixed warning about redefining DECLSPEC 2016-10-14 08:22:48 -07:00
Sam Lantinga
bb5e67d540 Fixed warning about missing field initializers in SDL_DBusContext
Static variables are automatically initialized to zero.
2016-10-14 08:20:40 -07:00
Sam Lantinga
032bd3f6e8 Fixed building with cmake when fcitx isn't installed 2016-10-14 01:04:21 -07:00
Philipp Wiesemann
ccd64798e1 Linux: Removed redundant function call. 2016-10-12 23:36:29 +02:00
Sam Lantinga
7ec488f511 Fixed building and using fcitx IME support on Linux 2016-10-08 11:30:07 -07:00
Sam Lantinga
fa696929a9 Fixed bug 2824 - Add Fcitx Input Method Support
Weitian Leung

Just moved ibus direct call to SDL_IME_* related functions, and adds fcitx IME support (uses DBus, too),
enable with env: SDL_IM_MODULE=fcitx (ibus still the default one)
2016-10-07 18:57:40 -07:00
Sam Lantinga
41f15322f1 Fixed compiler warning about missing field initializers 2016-10-04 03:42:42 -07:00
Sam Lantinga
74c4f02d1a Fixed build on older Raspberry Pi environments 2016-10-01 15:04:13 -07:00
Sam Lantinga
c8ea0cbc3d Fixed warning and code style in SDL_evdev.c 2016-10-01 14:56:53 -07:00
Sam Lantinga
823be1b075 Fixed bug 3157 - Rudimentary touchscreen support in SDL_evdev (supports Raspberry Pi)
tvc

I've spent the last few days implementing touchscreen support in core/linux/SDL_evdev.c. It's fairly rudimentary at the moment, as can be seen from the multiple TODO's and FIXME's littered throughout, but I'm mainly submitting this patch for review. I've tested this patch on my Raspberry Pi 2 with the official touchscreen and it works fantastically, reporting all 10 multitouch points. I'm happy to work on this further, the evdev logic also needs a bit of a cleanup I think (I may have included a few changes). But if it's good enough in its current state to be committed then I'm sure there'd be plenty of people pleased, as currently the only other framework/library that supports touchscreens on the Raspberry Pi is Kivy.
2016-10-01 13:51:56 -07:00
Sam Lantinga
255c182471 Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Sam Lantinga
797525f534 Fixed whitespace in SDL_evdev.c 2015-06-24 17:55:38 -07:00
Sam Lantinga
705e5df32d Fixed an issue with mouse/keyboard removal
Sometimes, on removal SDL_EVDEV_udev_callback() gets called with zero udev_class. This in turn seems to be caused the SDL_udev.c:guess_device_class() failing to find the attributes of the parent device.

Apparently this is normal, attributes are not guaranteed to be in place during removal, depending on timing. This lack of attributes causes guess_device_class() to return zero.

This fix mimics the code in linux/SDL_sysjoystick.c:joystick_udev_callback() which effectively has the same fix already in place.
2015-06-24 17:54:39 -07:00
Ryan C. Gordon
1854d3de07 Make some string literals "const char *", not "char *" (thanks, Martin!).
Fixes Bugzilla #3007.
2015-06-12 11:58:31 -04:00
Ryan C. Gordon
0e3c2534ca Fixed a memory leak (thanks, Zack!).
We should probably rework this piece of code a little more after 2.0.4 ships,
though.

Fixes Bugzilla #3004.
2015-06-07 17:54:39 -04:00
Ryan C. Gordon
6109f0d1dc Changed a static function to match the naming scheme of rest of source file. 2015-06-01 01:25:22 -04:00
Alex Baines
fa21b5b628 [IBus] Only register interest in messages sent to our input context. 2015-02-27 21:17:29 +00:00
Alex Baines
6609e24b9f [ibus] Send an empty TextEditing event when the text is cleared by pressing backspace. 2015-02-01 21:08:54 +00:00
Sam Lantinga
78f2198e6c Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Sam Lantinga
8f14ca455d Wait for devices to finish initializing when inserted, before using them. Fixes hotplug issue with XBox 360 game controller. 2015-05-25 16:22:09 -07:00
Alex Baines
9d7f5e9ae6 Fix DBus error message if IBus couldn't be initialized. 2015-03-20 19:47:03 +00:00
Sam Lantinga
acb5492583 Fixed detecting the NVIDIA controller which shows up as both a mouse and a game controller 2015-04-01 19:18:56 -07:00
Edward Rudd
555eff59b7 handle the case where the ibus address can't be found. (prevents nasty crash) 2015-04-01 16:11:37 -04:00
Sam Lantinga
825dd6dd85 Treat any key device as a keyboard
This matches commit b8e85a5ac99a for when udev is not running
2014-12-13 13:20:19 -08:00
Edward Rudd
835d487683 add in support for passing down the "natural" (or flipped) scrolling direction in the MouseWheelEvent event 2014-12-03 11:00:56 -05:00
Gabriel Jacobo
d9bcf961c1 [udev] Fixes #2654, ID_INPUT_KEY devices are ignored.
Also added some references to udev code where these flags are set.
2014-10-16 09:41:42 -03:00
Sam Lantinga
33e438b7be Fixed input device detection on systems that aren't running the udev daemon 2014-10-15 09:10:50 -07:00
Sam Lantinga
2af49b5e11 Fixed crash if the event subsystem didn't initialize properly 2014-10-15 09:09:57 -07:00
Sam Lantinga
a1a614d0b1 May have fixed the Linux build again 2014-08-23 19:06:54 -07:00
Sam Lantinga
ce2cb1ace7 Fixed Linux build 2014-08-23 11:00:16 -07:00
Ryan C. Gordon
2e017ec0c7 Fix declaration-after-statement errors in ibus code. 2014-08-21 23:22:46 -04:00
Ryan C. Gordon
7c0b589f6d Adjusted code style slightly for SDL_ibus.c 2014-08-21 23:15:17 -04:00