src/video/x11/SDL_x11events.c


Log

Author Commit Date CI Message
Pierre Wendling d0bbfdbf 2022-12-01T16:07:03 Clang-Tidy fixes (#6725) (cherry picked from commit 3c501b963dd8f0605a6ce7978882df39ba76f9cd)
Sam Lantinga b8d85c69 2022-11-30T12:51:59 Update for SDL3 coding style (#6717) I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base. In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted. The script I ran for the src directory is added as build-scripts/clang-format-src.sh This fixes: #6592 #6593 #6594 (cherry picked from commit 5750bcb174300011b91d1de20edb288fcca70f8c)
Sylvain Becker fb0ce375 2022-11-27T17:38:43 Cleanup add brace (#6545) * Add braces after if conditions * More add braces after if conditions * Add braces after while() conditions * Fix compilation because of macro being modified * Add braces to for loop * Add braces after if/goto * Move comments up * Remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements after merge * Fix inconsistent patterns are xxx == NULL vs !xxx * More "{}" for "if() break;" and "if() continue;" * More "{}" after if() short statement * More "{}" after "if () return;" statement * More fix inconsistent patterns are xxx == NULL vs !xxx * Revert some modificaion on SDL_RLEaccel.c * SDL_RLEaccel: no short statement * Cleanup 'if' where the bracket is in a new line * Cleanup 'while' where the bracket is in a new line * Cleanup 'for' where the bracket is in a new line * Cleanup 'else' where the bracket is in a new line (cherry picked from commit 6a2200823c66e53bd3cda4a25f0206b834392652 to reduce conflicts merging between SDL2 and SDL3)
Sylvain ce5da5d5 2022-11-16T21:47:43 Don't compare pointer against '0', but NULL
Sam Lantinga ab06a307 2022-10-29T09:21:17 Don't report windows being maximized when fullscreen on X11 This is a functional state for some window managers (tested using stock Ubuntu 22.04.1), and removing that state, e.g. using SDL_RestoreWindow(), results in a window centered and floating, and not visually covering the rest of the desktop.
Sam Lantinga 99f2a503 2022-10-13T22:40:24 X11 scancode mapping cleanup * Consolidated scancode mapping tables into a single location for all backends * Verified that the xfree86_scancode_table2 is largely identical to the Linux scancode table * Updated the Linux scancode table with the latest kernel keycodes (still unmapped) * Route X11 keysym -> scancode mapping through the linux scancode table (which a few hand-written exceptions), which will allow mappings to automatically get picked up as they are added in the Linux scancode table * Disabled verbose reporting of missing keysym mappings, we have enough data for now
DS ac5b9bc4 2022-09-14T18:28:35 Add support for X11 primary selection (#6132) X11 has a so-called primary selection, which you can use by marking text and middle-clicking elsewhere to copy the marked text. There are 3 new API functions in `SDL_clipboard.h`, which work exactly like their clipboard equivalents. ## Test Instructions * Run the tests (just a copy of the clipboard tests): `$ ./test/testautomation --filter Clipboard` * Build and run this small application: <details> ```C #include <SDL.h> #include <unistd.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <time.h> void print_error(const char *where) { const char *errstr = SDL_GetError(); if (errstr == NULL || errstr[0] == '\0') return; fprintf(stderr, "SDL Error after '%s': %s\n", where, errstr); SDL_ClearError(); } int main() { char text_buf[256]; srand(time(NULL)); SDL_Init(SDL_INIT_VIDEO); print_error("SDL_INIT()"); SDL_Window *window = SDL_CreateWindow("Primary Selection Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 400, 400, SDL_WINDOW_SHOWN); print_error("SDL_CreateWindow()"); SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); print_error("SDL_CreateRenderer()"); bool quit = false; unsigned int do_render = 0; while (!quit) { SDL_Event event; while (SDL_PollEvent(&event)) { print_error("SDL_PollEvent()"); switch (event.type) { case SDL_QUIT: { quit = true; break; } case SDL_KEYDOWN: { switch (event.key.keysym.sym) { case SDLK_ESCAPE: case SDLK_q: quit = true; break; case SDLK_c: snprintf(text_buf, sizeof(text_buf), "foo%d", rand()); SDL_SetClipboardText(text_buf); print_error("SDL_SetClipboardText()"); printf("clipboard: set_to=\"%s\"\n", text_buf); break; case SDLK_v: { printf("clipboard: has=%d, ", SDL_HasClipboardText()); print_error("SDL_HasClipboardText()"); char *text = SDL_GetClipboardText(); print_error("SDL_GetClipboardText()"); printf("text=\"%s\"\n", text); SDL_free(text); break; } case SDLK_d: snprintf(text_buf, sizeof(text_buf), "bar%d", rand()); SDL_SetPrimarySelectionText(text_buf); print_error("SDL_SetPrimarySelectionText()"); printf("primselec: set_to=\"%s\"\n", text_buf); break; case SDLK_f: { printf("primselec: has=%d, ", SDL_HasPrimarySelectionText()); print_error("SDL_HasPrimarySelectionText()"); char *text = SDL_GetPrimarySelectionText(); print_error("SDL_GetPrimarySelectionText()"); printf("text=\"%s\"\n", text); SDL_free(text); break; } default: break; } break; } default: { break; }} } // create less noise with WAYLAND_DEBUG=1 if (do_render == 0) { SDL_RenderPresent(renderer); print_error("SDL_RenderPresent()"); } do_render += 1; usleep(12000); } SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window); SDL_Quit(); print_error("quit"); return 0; } ``` </details> * Use c,v,d,f to get and set the clipboard and primary selection. * Mark text and middle-click also in other applications. * For wayland under x: * `$ mutter --wayland --no-x11 --nested` * `$ XDG_SESSION_TYPE=wayland SDL_VIDEODRIVER=wayland ./<path_to_test_appl_binary>`
Sam Lantinga 3a6cb7e7 2022-08-01T10:28:29 Convert XLookupString Latin-1 text to UTF-8 Fixes bug https://github.com/libsdl-org/SDL/issues/4699
Cameron Gutman 8b438f7b 2022-07-31T15:34:03 keyboard: Only send SDL_KEYMAPCHANGED when the keymap actually changes
Ryan C. Gordon a236bf4f 2022-06-06T02:13:37 x11: Hook up display hotplug notifications. Obviously this needs XRandR support. Fixes #4977.
Ryan C. Gordon 53dea983 2022-04-25T13:51:15 x11: revert checks for _NET_WM_STATE_FULLSCREEN changes. This reverts commit 85977354fbce9ecb2add660a88e6bec3532c3e26. This reverts commit 0249df9d960f9bc28b476e1171c5501fc37cca12. Fixes #5572. Reopens #5390.
Sam Lantinga 02225aa7 2022-04-18T22:57:03 Fixed build
Ryan C. Gordon 49a2e4b0 2022-04-19T00:36:53 x11: Revert "Fix keymap updating for X11 backend" This reverts commit de6d290266d1def0eef9df81bf9be41c12a98c61. This patch had multiple issues, discussed in #5520.
Ryan C. Gordon 67e0f546 2022-04-15T18:24:57 x11: Update the display when the WM changes a window's fullscreen state. Fixes #5390.
Sam Lantinga 49b9e347 2022-04-07T08:24:03 Only update modifier state for keys that are pressed in another application Fixes https://github.com/libsdl-org/SDL/issues/4432
Ryan C. Gordon 0249df9d 2022-04-05T23:04:19 x11: Try to keep SDL_WINDOW_FULLSCREEN* in sync with window manager. So if Gnome/KDE/etc have a keyboard shortcut or titlebar decoration to make any window go fullscreen (with the _NET_WM_FULLSCREEN flag on the _NET_WM_STATE property), we update the SDL window flag. Fixes #5390.
Weng Xuetian 138d96c8 2022-04-05T19:30:25 Send key release event to input method. (#5281) Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
Sylvain 6c56193a 2022-03-24T18:09:45 Fixed bug #1650: X11 doesn't set KMOD_NUM and KMOD_CAPS to system state
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
rohlem 0403fa8a 2022-01-02T02:36:23 X11_WaitEventTimeout: remove unreachable return If that condition was reachable, the return value should be negative to indicate that waiting for the timeout failed. Otherwise, SDL_WaitEventTimeout would incorrectly return early.
Sylvain d31251b0 2021-11-21T22:30:48 use SDL's functions version inplace of libc version
Sam Lantinga eda4c407 2021-11-10T12:46:54 Make sure the X event is an Xkb event before checking the Xkb event type
Sam Lantinga fd79607e 2021-11-08T21:34:48 Added SDL_GetWindowMouseRect() Also guarantee that we won't get mouse movement outside the confining area, even if the OS implementation allows it (e.g. macOS)
Cameron Gutman 9c95c249 2021-11-08T20:01:56 x11: Use XCheckIfEvent() instead of XNextEvent() for thread-safety A racing reader could read from our fd between SDL_IOReady()/X11_Pending() and our call to XNextEvent() which will cause XNextEvent() to block for more data. Avoid this by using XCheckIfEvent() which will never block. This also fixes a bug where we could poll() for data, even when events were already read and pending in the queue. Unlike the Wayland implementation, this isn't totally thread-safe because nothing prevents a racing reader from reading events into the queue between our XCheckIfEvent() and SDL_IOReady() calls, but I think this is the best we can do with Xlib.
Ethan Lee 4b42c05b 2021-11-08T13:52:48 video: Add SDL_SetWindowMouseRect. This API and implementation comes from the Unreal Engine branch of SDL, which originally called this "SDL_ConfineCursor". Some minor cleanup and changes for consistency with the rest of SDL_video, but there are two major changes: 1. The coordinate system has been changed so that `rect` is _window_ relative and not _screen_ relative, making it easier to implement without having global access to the display. 2. The UE version unset all rects when passing `NULL` as a parameter for `window`, this has been removed as it was an unused feature anyhow. Currently this is only implemented for X, but can be supported on Wayland and Windows at minimum too.
Cameron Gutman a5598649 2021-10-30T19:30:34 x11/wayland: Fix signal handling while blocking in WaitEventTimeout() Add a new flag to avoid suppressing EINTR in SDL_IOReady(). Pass the flag in WaitEventTimeout() to ensure that a SIGINT will wake up SDL_WaitEvent() without another event coming in.
Cameron Gutman c97c4687 2021-10-30T15:56:54 core: Convert SDL_IOReady()'s 2nd parameter to flags
Cameron Gutman f499168c 2021-10-24T15:54:57 x11: Use SDL_IOReady() instead of calling select() directly SDL_IOReady() properly handles EINTR and can use poll() if available.
Cacodemon345 19dee1cd 2021-10-22T06:37:20 Add SDL_GetWindowICCProfile(). (#4314) * Add SDL_GetWindowICCProfile * Add new SDL display events * Implement ICC profile change event for macOS * Implement ICC profile notification for Windows * Fix SDL_GetWindowICCProfile() for X11 * Fix compile errors
Rokas Kupstys 515b7e93 2021-08-27T17:02:07 Fix horizontal wheel scroll direction of X11.
Sam Lantinga cb1e20b0 2021-08-10T17:50:17 Added KMOD_SCROLL to track the scroll lock state Fixes https://github.com/libsdl-org/SDL/issues/4566
Adam a2031948 2021-07-28T14:06:51 Added in a MIME-type to the X11 clipboard. (#4385)
Sam Lantinga ff1b5e1b 2021-07-24T15:10:57 Implemented the window flash operations for X11
Francesco Abbate 0dd7024d 2021-03-12T21:58:20 Modifies WaitEvent and WaitEventTimeout to actually wait instead of polling When possible use native os functions to make a blocking call waiting for an incoming event. Previous behavior was to continuously poll the event queue with a small delay between each poll. The blocking call uses a new optional video driver event, WaitEventTimeout, if available. It is called only if an window already shown is available. If present the window is designated using the variable wakeup_window to receive a wakeup event if needed. The WaitEventTimeout function accept a timeout parameter. If positive the call will wait for an event or return if the timeout expired without any event. If the timeout is zero it will implement a polling behavior. If the timeout is negative the function will block indefinetely waiting for an event. To let the main thread sees events sent form a different thread a "wake-up" signal is sent to the main thread if the main thread is in a blocking state. The wake-up event is sent to the designated wakeup_window if present. The wake-up event is sent only if the PushEvent call is coming from a different thread. Before sending the wake-up event the ID of the thread making the blocking call is saved using the variable blocking_thread_id and it is compared to the current thread's id to decide if the wake-up event should be sent. Two new optional video device methods are introduced: WaitEventTimeout SendWakeupEvent in addition the mutex wakeup_lock which is defined and initialized but only for the drivers supporting the methods above. If the methods are not present the system behaves as previously performing a periodic polling of the events queue. The blocking call is disabled if a joystick or sensor is detected and falls back to previous behavior.
ReNoM de6d2902 2021-04-19T21:48:11 Fix keymap updating for X11 backend
Cameron Gutman 808249a5 2021-01-27T19:40:55 X11: Ungrab the keyboard when the mouse leaves the window GNOME Mutter requires keyboard grab for certain important functionality like window resizing, interaction with the application context menu, and opening the Activites view. To allow Mutter to grab the keyboard as needed, we'll ungrab when the mouse leaves our window. To be safe, we'll do this for all WMs since forks of Mutter and Matacity (and possibly others) may have the same behavior, and we don't want to have to keep track of those.
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Sam Lantinga cb361896 2020-12-09T07:16:22 Fixed bug 5235 - All internal sources should include SDL_assert.h Ryan C. Gordon We should really stick this in SDL_internal.h or something so it's always available.
Ryan C. Gordon 0ff5d55a 2020-11-23T21:07:28 x11: Don't try to grab the pointer on an unmapped window (thanks, Lee!) Fixes Bugzilla #5352.
Sam Lantinga 1ef45c18 2020-11-08T23:40:17 Fixed bug 5339 - Minor memory leak in SDL_x11events.c wcodelyokoyt The atom name that X11_GetAtomName() returns never gets freed, which result in a minor memory leak (14 bytes?) every time the user drops a file on a window. You can see the line in question here: https://github.com/spurious/SDL-mirror/blob/6b6170caf69b4189c9a9d14fca96e97f09bbcc41/src/video/x11/SDL_x11events.c#L1350 Fix: call XFree on name after the while loop.
Alberts Muktup?vels 73010da4 2020-10-19T17:26:33 x11events: ignore UnmapNotify events from XReparentWindow UnmapNotify event does not mean that window has been iconified. It just reports that window changed state from mapped to unmapped. XReparentWindow can unmap and remap window if it was mapped. This causes unnecessary events - HIDDEN, MINIMIZED, RESTORED and SHOW. These events are problematic with Metacity 3.36+ which started to remove window decorations from fullscreen windows. - SDL makes decorated window fullscreen - Metacity removes decorations - SDL gets UnmapNotify and exits from fullscreen - Metacity re-adds decorations As SDL will also get MapNotify event it will try to restore window state causing above steps to repeat. https://bugzilla.libsdl.org/show_bug.cgi?id=5314
James Legg f1d5ced1 2020-06-17T12:48:40 x11: Fix spurious keyboard focus events
Sam Lantinga eadc8693 2020-05-11T14:31:04 Fixed bug 5103 - Port fcitx support to both fcitx 4 & 5 wengxt Due to the new major fcitx version is coming close, the existing code need to be ported to use new Fcitx dbus interface. The new dbus interface is supported by both fcitx 4 and 5, and has a good side effect, which is that it will work with flatpak for free. Also the patch remove the dependency on fcitx header. Instead, it just hardcodes a few enum value in the code so need to handle the different header for fcitx4 or 5.
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Ozkan Sezer 9340cfa9 2019-12-27T23:01:10 SDL_x11events.c (X11_DispatchEvent): remove FIXME and use SDL_strtokr().
Alex Smith e5af951e 2019-12-02T15:41:25 Fix sending SDL_WINDOWEVENT_RESTORED after unminimizing windows on X11 SDL_SendWindowEvent will only send a RESTORED event if the window has the minimized or maximized flag set. However, for a SHOWN event, it will clear the minimized flag. Since the SHOWN event was being sent first for a MapNotify event, the RESTORED event would never be sent. Swapping the SendWindowEvent calls around fixes this. https://bugzilla.libsdl.org/show_bug.cgi?id=4821
Ozkan Sezer 4953e050 2019-07-31T05:11:40 use SDL_zeroa at more places where the argument is an array.
Sam Lantinga 8dea23c7 2019-05-19T10:44:14 Fixed bug 3911 - SYSWM generic X11 events missing event data Andrei Drexler For X11 GenericEvents, the associated data is only available between a call to XGetEventData and the matching XFreeEventData, i.e. in X11_HandleGenericEvent. Trying to call XGetEventData a second time on the same event will fail, so an application that wants to inspect XInput2 events (e.g. for stylus pressure) has no way of retrieving its data from queued SYSWM events. The attached patch (based on SDL-2.0.7-11629) sends SYSWM messages from X11_HandleGenericEvent while the data is still available, allowing client code to register an event filter/watcher and process the event inside the callback.
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Ryan C. Gordon e58c7920 2017-08-25T12:51:42 x11: Patched to compile with DEBUG_XEVENTS defined.
Sam Lantinga a4cfa936 2017-08-14T21:28:04 Fixed bug 2293 - Precise scrolling events Martijn Courteaux I implemented precise scrolling events. I have been through all the folders in /src/video/[platform] to implement where possible. This works on OS X, but I can't speak for others. Build farm will figure that out, I guess. I think this patch should introduce precise scrolling on OS X, Wayland, Mir, Windows, Android, Nacl, Windows RT. The way I provide precise scrolling events is by adding two float fields to the SDL_MouseWheelScrollEvent datastructure, called "preciseX" and "preciseY". The old integer fields "x" and "y" are still present. The idea is that every platform specific code normalises the scroll amounts and forwards them to the SDL_SendMouseWheel function. It is this function that will now accumulate these (using a static variable, as I have seen how it was implemented in the Windows specific code) and once we hit a unit size, set the traditional integer "x" and "y" fields. I believe this is pretty solid way of doing it, although I'm not the expert here. There is also a fix in the patch for a typo recently introduced, that might need to be taken away by the time anybody merges this in. There is also a file in Nacl which I have stripped a horrible amount of trailing whitespaces. (Leave that part out if you want).
Sam Lantinga fb835f9e 2017-08-14T20:22:19 Fixed bug 2330 - Debian bug report: SDL2 X11 driver buffer overflow with large X11 file descriptor manuel.montezelo Original bug report (note that it was against 2.0.0, it might have been fixed in between): http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=733015 -------------------------------------------------------- Package: libsdl2-2.0-0 Version: 2.0.0+dfsg1-3 Severity: normal Tags: patch I have occasional crashes here caused by the X11 backend of SDL2. It seems to be caused by the X11_Pending function trying to add a high number (> 1024) file descriptor to a fd_set before doing a select on it to avoid busy waiting on X11 events. This causes a buffer overflow because the file descriptor is larger (or equal) than the limit FD_SETSIZE. Attached is a possible workaround patch. Please also keep in mind that fd_set are also used in following files which may have similar problems. src/audio/bsd/SDL_bsdaudio.c src/audio/paudio/SDL_paudio.c src/audio/qsa/SDL_qsa_audio.c src/audio/sun/SDL_sunaudio.c src/joystick/linux/SDL_sysjoystick.c -------------------------------------------------------- On Tuesday 24 December 2013 00:43:13 Sven Eckelmann wrote: > I have occasional crashes here caused by the X11 backend of SDL2. It seems > to be caused by the X11_Pending function trying to add a high number (> > 1024) file descriptor to a fd_set before doing a select on it to avoid busy > waiting on X11 events. This causes a buffer overflow because the file > descriptor is larger (or equal) than the limit FD_SETSIZE. I personally experienced this problem while hacking on the python bindings package for SDL2 [1] (while doing make runtest). But it easier to reproduce in a smaller, synthetic testcase.
Ryan C. Gordon 2ffd6d02 2017-07-31T13:49:22 x11: Make a separate unmapped window to own clipboard selections. Now the clipboard isn't lost if you destroy a specific SDL_Window, as it works on other platforms. You will still lose the clipboard data on SDL_Quit() or process termination, but that's X11 for you; run a Clipboard Manager daemon. Fixes Bugzilla #3222. Fixes Bugzilla #3718.
Ryan C. Gordon 5574b433 2017-07-31T12:22:18 x11: Pass generic XEvents by pointer instead of copying to stack for XInput2.
Philipp Wiesemann 90ed3daa 2017-05-26T22:45:52 Changed messages about not recognized keys to include discourse link.
Bastien Bouclet 545fba78 2017-04-22T19:53:52 x11: Don't send duplicate events when reconciling the keyboard state Failing to check if a key was known to be pressed by SDL was causing SDL_SendKeyboardKey to send duplicate key pressed events with the repeat property set to true. Fixes Bugzilla #3637.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Sam Lantinga 57d01d7d 2016-11-13T22:57:41 Patch from Sylvain to fix clang warnings
Sam Lantinga baadd546 2016-11-02T02:56:54 Fixed text input events with UIM Alex Baines I realized overnight that my patch probably broke text input events with UIM, and I confirmed that it does. Can't believe I overlooked that... I've been making stupid mistakes in these patches recently, sorry. Anyway, *this* one seems to fix it properly. Knowing my luck it probably breaks something else.
Alex Baines 8eb76276 2016-11-01T17:38:05 Skip duplicate key events sent by IMEs like uim.
Alex Baines 5fe98497 2016-10-28T01:28:58 Fix double events / no repeat flag on key events when built withoutibus/fcitx Uses XkbSetDetectableKeyRepeat, and falls back to forcing @im=none if it's not supported.
Sam Lantinga 27d4f099 2016-10-07T23:40:44 Implemented SDL_GetHintBoolean() to make it easier to check boolean hints
Sam Lantinga 808c75d1 2016-10-07T18:57:40 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)
Sam Lantinga 8b64a78d 2016-10-07T17:26:25 Fixed bug 2956 - De-reference videodata without NULL check in X11_DispatchEvent(_THIS) function
Alex Baines 752931d8 2016-10-03T11:35:34 Improve X11 key handling when XKB isn't available + add xvnc scancodes. Based on a patch by Bill Lash (see bug 3094).
Ryan C. Gordon b2510d9c 2016-09-29T23:01:43 x11: fixed incorrect SDL_GetWindowPosition() after resize (thanks, Jason!). Fixes Bugzilla #3272.
Sam Lantinga 67bdbcca 2016-09-29T16:05:29 Implemented SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH on X11
Ryan C. Gordon 02f49fdb 2016-03-04T18:47:19 x11: Deal with window borders better. - Cache the _NET_FRAME_EXTENTS data locally, so we don't have to query the X server for them (instead, we update our cached data when PropertyNotify events alert us to a change). - Use our cached extents for X11_GetWindowBordersSize(), so it's a fast call. - Window position was meant to refer to the client area, not the window decorations, so adjust appropriately when getting/setting the position.
Ryan C. Gordon 0e2badc1 2016-02-12T00:27:21 x11: Patched to compile with DEBUG_XEVENTS on C89 compilers.
Ryan C. Gordon ed620333 2016-01-07T19:58:00 x11: make last mouse coords sane upon window entry (thanks, Cengiz!). (and thanks to Cengiz for many of the previous Unreal-related patches! They were generically credited to Epic Games, but a large amount of that work was his contribution.) Fixes Bugzilla #3067.
Ryan C. Gordon dc532c70 2016-01-05T02:27:50 Added SDL_WINDOWEVENT_TAKE_FOCUS. This is for corner cases where a multi-window app is activated and wants to make a decision about where focus should go. This patch came from Unreal Engine 4's fork of SDL, compliments of Epic Games.
Ryan C. Gordon f9b73793 2016-01-05T02:26:45 Added SDL_DROPTEXT event, for dragging and dropping string data. This patch is based on work in Unreal Engine 4's fork of SDL, compliments of Epic Games.
Ryan C. Gordon 8e855f2f 2016-01-05T01:42:00 Added SDL_DROPBEGIN and SDL_DROPCOMPLETE events, plus window IDs for drops. This allows an app to know when a set of drops are coming in a grouping of some sort (for example, a user selected multiple files and dropped them all on the window with a single drag), and when that set is complete. This also adds a window ID to the drop events, so the app can determine to which window a given drop was delivered. For application-level drops (for example, you launched an app by dropping a file on its icon), the window ID will be zero.
Ryan C. Gordon 6df5e1e5 2016-01-04T16:25:27 x11: Support _NET_WM_USER_TIME and give _NET_ACTIVE_WINDOW a valid timestamp. Fixes Bugzilla #3056.
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
Ryan C. Gordon 257b7af2 2015-12-28T13:07:44 Sync up the caps/numlock state properly without sending key events. Partially fixes Bugzilla #2736 and #3125.
Sam Lantinga 2b0140a9 2015-10-27T11:17:32 Add a new SDL_KEYMAPCHANGED SDL event to abstract notification of keyboard layout or input language changes.
Alex Baines 7543092a 2015-09-30T04:16:09 Call setlocale + XSetModifiers before XOpenIM, Work around ibus+xim duplicate events.
Ryan C. Gordon 81457603 2015-08-15T00:36:39 X11: Handle keyboard layout changing during app's run on Ubuntu 12.04 (etc). Fixes Bugzilla #3050 (in addition to Jason Wyatt's patch, prior to this).
Ryan C. Gordon f2f8e6f5 2015-08-13T21:40:32 X11: only send mouse button up events if not a mousewheel "button" (Brackets in the wrong place, my bad!)
Ryan C. Gordon 874bf865 2015-08-13T17:40:28 X11: Simplified mousewheel event handling. Under load, this would race and report an incorrect mouse button event instead of a wheel event. Fixes Bugzilla #2987.
Ryan C. Gordon 0c19501e 2015-07-11T00:59:56 x11: Patched to compile on systems without the Xutf8LookupString() function.
Ryan C. Gordon 20ec1377 2015-06-30T14:41:17 X11: Call XRefreshKeyboardMapping() when we get various MappingNotify events. According to the Xlib docs, you need to do this or Xlib's internal state gets out of sync.
Ryan C. Gordon acdb494f 2015-06-30T14:39:39 X11: Don't ignore keyboard mapping changes. MappingNotify events don't have a window associated with them, so SDL was dropping these before the point where we would have handled them.
Sam Lantinga f1b7a843 2015-06-25T07:17:08 Fixed compiling if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM is not defined
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().
Ryan C. Gordon 360d05bf 2015-06-04T15:41:39 X11: Fixed SelectionRequest replies for target TARGETS. Fixes Google Chrome, etc, freezing up when SDL owns the clipboard selection and actually sends thems the correct text for pasting. Confirmed working with Unicode strings in UTF-8 format. There were a few tweaks in this patch, but the specific fix is that event.xselection.target in the SelectionNotify event we send back in reply must be set to the same atom as the request ("TARGETS" in this case), and we failed to do that in this special case. Things that don't ask for a target, like the Gnome Terminal app, worked fine because they don't ask for TARGETS and just go right to asking for a UTF8_STRING, and Mozilla apparently just was more liberal in what they accepted in reply. Chrome would reject our wrong reply and freeze up waiting for a valid one. Someone should fix that in Chrome, too. :) Fixes Bugzilla #2926.
Ryan C. Gordon 96aef8cb 2015-06-04T10:59:02 X11: Fixed compiler warnings in DEBUG_XEVENTS sections.
Ryan C. Gordon e58a5c43 2015-05-31T00:58:43 X11: Fixed high mouse buttons mappings and horizontal wheels (thanks, Daniel!). Fixes Bugzilla #2472.
Sam Lantinga cb24f4de 2015-05-28T10:44:46 Fixed bug 2772 - SDL2 doesn't handle X KeymapNotify events Jason Wyatt Currently the keymapnotify event handling is commented out as FIXME in SDL_x11events.c (It looks like this may have functioned SDL1.2). Not handling this event means that if a window manager shortcut such as ALT+SPACE is used, SDL will send an ALT key down signal, but not an up signal. Also querying SDL about the key state, it believes the ALT key remains pressed. X passes the events keypress (alt), ?focusout?, ?focusin?, keymapnotify.
Sam Lantinga 719bb6fc 2015-05-28T09:52:48 Fixed X11 build, added code to print initial modifiers to checkkeys
Sam Lantinga 0694baf2 2015-05-28T09:33:47 Fixed bug 2736 - X11 doesn't set KMOD_NUM and KMOD_CAPS to system state Zack Middleton Using X11 (on Debian Wheezy), SDL_GetModState() & KMOD_NUM and KMOD_CAPS are not set to system state (numlock/capslock LEDs). Pressing numlock or capslock toggles the mod state, though if num/caps lock is enabled before starting the program it's still reversed from system state. This makes getting KMOD_NUM and KMOD_CAPS in programs unreliable. This can be seen using the checkkeys test program. The function that appears to have handle this in SDL 1.2 is X11_SetKeyboardState. The function call is commented out with "FIXME:" in SDL 2. Using Windows backend through WINE; on first key press if numlock and/or capslock is enabled on system, numlock/capslock SDL_SendKeyboardKey is run and toggles KMOD_NUM/KMOD_CAPS to the correct state. On X11 this does not happen. The attached patch makes X11 backend set keyboard state on window focus if no window was previously focused. It sets all keys to system up/down state and toggles KMOD_NUM/KMOD_CAPS via SDL_SendKeyboardKey to match system if needed. The patch is based on SDL 1.2's X11_SetKeyboardState.
Ryan C. Gordon c69a5592 2015-05-26T21:29:45 X11: generate clipboard update events (thanks, "chw"!). Partially fixes Bugzilla #2266.
Alex Baines ae6555df 2015-05-26T20:22:14 Pump IBus events after X events.
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
Ryan C. Gordon 589c46dd 2015-05-01T01:20:28 X11: send keypress events before textinput events.
Dimitris Zenios d9d1a1b9 2015-04-26T13:53:46 X11: Use our own cut-buffer for intermediate clipboard storage. XA_CUTBUFFER0 is not defined for holding UTF8 strings.
Ryan C. Gordon aa4952fd 2015-04-21T10:10:59 Added SDL_WINDOWEVENT_HIT_TEST. This lets windows know when they are dropping a mouse event because their hit test reported something other than SDL_HITTEST_NORMAL. It lets them know exactly where in the event queue this happened. This patch is based on work in Unreal Engine 4's fork of SDL, compliments of Epic Games.
Ryan C. Gordon b72938c8 2015-04-20T12:22:44 Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.