src/video/wayland/SDL_waylandevents.c


Log

Author Commit Date CI Message
Ethan Lee 7ed415d2 2021-09-23T14:07:38 wayland: Reuse KeySymToUcs4 to replicate X11 keymap behavior
Ethan Lee 1a4e2e5e 2021-09-23T14:31:54 wayland: For text, ignore key events when Ctrl is held Fixes #4695
Aleksey Rybalkin 402b86f2 2021-08-15T14:41:56 waylandevents: prevent segfault if xkb compose table is not found this can happen e.g. on pure wayland system where there is no X11 locales for xkbcommon to find.
David Gow fbc36490 2021-08-14T22:29:05 Use the new SDL_clamp() macro where sensible There were a few places throughout the SDL code where values were clamped using SDL_min() and SDL_max(). Now that we have an SDL_clamp() macro, use this instead.
Ethan Lee 32f909f7 2021-08-03T13:30:57 wayland: Remove redundant waylanddyn.h includes. All files including waylanddyn.h already include waylandvideo.h first.
Sebastian Krzyszkowiak 54aea244 2021-08-01T05:36:12 wayland: Disable key repeat when repeat rate equals 0 This fixes a crash on pressing keyboard button when compositor sends zero as repeat rate, indicating that key repeat should be disabled. From Wayland protocol spec: > Negative values for either rate or delay are illegal. A rate of zero > will disable any repeating (regardless of the value of delay).
Sam Lantinga 9984891b 2021-07-29T14:46:24 Use the wl_touch object as a touch ID on Wayland (thanks @russelltg!) This fixes https://github.com/libsdl-org/SDL/issues/4517
Ethan Lee 74162b74 2021-07-29T13:27:31 wayland: Add support for text-input-unstable-v3
David Gow 1fb4429b 2021-07-28T21:50:48 wayland: Avoid a pointer→TouchID cast warning As of [1], SDL now compiles with a warning in SDL_waylandevents.c on 32-bit systems under gcc 10.3.0: /tmp/SDL/src/video/wayland/SDL_waylandevents.c: In function 'seat_handle_capabilities': /tmp/SDL/src/video/wayland/SDL_waylandevents.c:958:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 958 | SDL_AddTouch((SDL_TouchID)seat, SDL_TOUCH_DEVICE_DIRECT, "wayland_touch"); | ^ /tmp/SDL/src/video/wayland/SDL_waylandevents.c:964:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 964 | SDL_DelTouch((SDL_TouchID)seat); | ^ This is due to SDL_TouchID always being 32-bit, but seat being a pointer which is (obviously) only 32-bit on 32-bit systems. The conversion is therefore harmless, so silence it with an extra cast via intptr_t. This is what the cocoa backend does (and is similar to what the Win32 backend does, except with size_t). Fixes: 03c19efbd1 ("Added support for multiple seats with touch input on Wayland") [1]: https://github.com/libsdl-org/SDL/commit/03c19efbd17f72f70ee021de6d2549eb0be3bb56
Simon Zeni 6aae5b44 2021-07-27T17:12:26 Remove wl-shell and xdg-shell-unstable-v6 support (#4323) * wayland-protocol: update wayland.xml to 1.19.0 * wayland: remove shell_surface field from SDL_SysWMinfo * wayland: remove wl_shell support * waypand-protocols: update xdg-shell.xml to 1.20 * wayland: remove xdg-shell-unstable-v6 support * wayland: deprecate wl shell surface syswm info, add xdg surface
Christian Rauch 9e6fcbe7 2020-06-11T22:10:28 wayland: client-side decoration
Sam Lantinga 03c19efb 2021-07-24T15:25:50 Added support for multiple seats with touch input on Wayland This fixes bug https://github.com/libsdl-org/SDL/issues/4517
meyraud705 4ada14a2 2021-07-21T13:39:10 Replace libc functions to SDL equivalent in wayland video subsystem Wayland video subsystem uses a mix of libc and SDL function. This patch switches libc functions to SDL ones and fixes a mismatch in memory allocation/dealoccation of SDL_Cursor in SDL_waylandmouse.c (calloc on line 201 and SDL_free on line 313) which caused memory corruption if custom memory allocator where provided to SDL.
Ethan Lee 8e3ec34d 2021-04-20T12:40:40 wayland: Refactor toplevel mapping, implement HideWindow
Luis Cáceres 5c78df9c 2021-04-14T00:56:50 Support key composing (i.e. dead keys) in Wayland driver (#4296) Based on an old patch by chw from the old Bugzilla issue tracker. Authored-by: chw Co-authored-by: Sam Lantinga <slouken@libsdl.org>
Ethan Lee dfcd5fbc 2021-04-08T21:57:58 wayland: Set the keymap in keyboard_handle_modifiers
Ethan Lee 875f839d 2021-04-08T14:14:46 wayland: A bunch of clipboard safety fixes. Also removed Wayland_get_data_device because it was a pointless getter function.
Ethan Lee 7510245a 2021-04-08T14:08:35 wayland: Create the data_device only after both device_manager and input exist. There is no guarantee on what order the Wayland interfaces will come in, but the callbacks were assuming that wl_data_device_manager would could before wl_seat. This would cause certain desktops to not have any data_device to work with, meaning certain features like the clipboard would silently no-op.
Ethan Lee eeee7308 2021-03-29T16:57:03 wayland: Implement IME support. Note that this is purely to make it possible to enter text that requires composition - for example, before this commit Kanji input didn't work at all. The big problem this still has is that we need the window position, and this is still not implemented. Once we have this information we can do the equivalent of XTranslateCoordinates to put the rectangle where we want it.
Cameron Gutman 8c5b7af2 2021-02-25T19:30:47 Wayland: Fix mouse pointer hiding on Plasma Wayland Unlike Mutter and Sway, KWin actually checks the serial passed in wl_pointer_set_cursor(). The serial provided is supposed to be the serial of the pointer enter event, but We were always passing 0. This caused KWin to drop our requests to hide the cursor. Thanks to the KDE folks for spotting this in my debug logs. Fixes #3576
Cameron Gutman d133a5f6 2021-01-24T17:19:48 wayland: cancel key repeat when keyboard focus is lost SDL_SetKeyboardFocus(NULL) will lift any keys still pressed when keyboard focus leaves the window, but then key repeat comes behind our backs and presses the key down again. This results in an infinite stream of SDL_KEYDOWN events when focus leaves the window with a key down (particularly noticeable with Alt+Tab).
Cameron Gutman 7ff3832e 2021-01-22T19:22:17 Fix continuous scrolling speed on Wayland Wayland compositors seem to have standardized on 10 units per "wheel tick" for continuous scroll events, so we need to convert these axis values to ticks by dividing by 10 before reporting them in SDL_MOUSEWHEEL events.
Cameron Gutman cf84ec44 2021-01-20T23:19:24 Improve reliability of cursor hiding on GNOME Wayland Hiding the cursor doesn't appear to work reliably on GNOME when another window steals mouse focus right as we call SDL_ShowCursor(SDL_DISABLE). This can happen when the keyboard shortcut inhibition permission prompt appears in response to a call to SDL_SetRelativeMouseMode() with SDL_HINT_GRAB_KEYBOARD=1. The result is that the default cursor is stuck locked in position and visible on screen indefinitely. By redrawing the cursor on pointer focus enter, the cursor now disappears upon the first mouse motion event. It's not perfect but it's way better than the current behavior.
Cameron Gutman d789ba83 2021-01-19T18:20:07 Implement keyboard grab support for Wayland Use zwp_keyboard_shortcuts_inhibit_manager_v1 to allow SDL applications to capture system keyboard shortcuts like Alt+Tab when keyboard grab is enabled via SDL_HINT_GRAB_KEYBOARD.
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.
Sam Lantinga f311e0a8 2020-10-19T17:29:16 Removed debug log message
Yiding Jia f31ad57f 2020-10-05T19:17:52 Implement keyboard repeat in wayland video driver
Tudor Brindus c0943328 2020-07-21T13:14:24 wayland: defer pointer confine creation until pointer unlock It is a protocol error to attempt to create a pointer confine (i.e. `SDL_SetWindowGrab`) while a locked pointer is active, and vice-versa. Instead of aborting due to a protocol error, this commit makes SDL gracefully downgrade locked pointers to confines when appropriate.
Tudor Brindus a6ca61d7 2020-05-21T00:06:09 wayland: update pointer position on initial enter event
Tudor Brindus 1a291ab1 2020-04-17T13:55:44 wayland: add support for SDL_SetWindowGrab
Ryan C. Gordon 02469877 2020-04-07T13:30:46 wayland: Support wayland compositors with wl_seat version < 5 (thanks, Nia!). Fixes Bugzilla #5074.
Sam Lantinga b6afbe63 2020-04-07T09:38:57 Added SDL_log.h to SDL_internal.h so logging is available everywhere
Sam Lantinga 67f44788 2020-02-03T00:57:12 Fixed bug 4917 - Wayland: handle discrete pointer axis events Luis Caceres The current handling of Wayland mouse pointer events only handles wl_pointer.axis events, which, according to the Wayland documentation, deal with mouse wheel scroll events on a continuous scale. While this is reasonable for some input sources (e.g. touchpad two-finger scrolling), it is not for mouse wheel clicks which generate wl_pointer.axis events with large deltas. This patch adds handling for wl_pointer.axis_discrete and wl_pointer.frame events and prefers to report SDL_MouseWheelEvent in discrete units if they are available. This means that for mouse wheel scrolling we count in clicks, but for touchpad two-finger scrolling we still use whatever units Wayland uses. This behaviour is closer to that of the X11 backend. Since these events are only available since version 5 of the wl_seat interface, this patch also checks for this and falls back to the previous behaviour if its not available. I also had to add definitions for some of the pointer and keyboard events specified in versions 2-5 but these are just stubs and do nothing.
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Michael Forney cdbeae52 2019-12-29T23:10:39 wayland: support wl_data_device_manager version < 3
Sylvain Becker 88ba6798 2019-10-30T21:12:36 Wayland: touch events, use of memory after it is freed
Sam Lantinga afdb40af 2019-08-05T23:38:48 Fixed bug 4689 - SDL fails to detect compositor shutdown on Wayland -- program keeps running M Stoeckl To reproduce: 1. Run any SDL-based program with a Wayland compositor, orphaning it so that it doesn't have an immediate parent process. (For example, from a terminal, running `supertux2 & disown`.) The program should use the wayland backend, i.e. by setting environment variable SDL_VIDEODRIVER=wayland. 2. Kill the compositor process. Results: - The SDL program will keep running. Expected results: - The SDL program should close. (What close should mean here, I'm not sure - is injecting an SDL_Quit the appropriate action when a video driver disconnects?) Build data: 2019-06-22, hg tip (12901:bf8d9d29cbf1), Linux, can reproduce with sway, weston, and other Wayland oompositors.
Alex Szpakowski d5ec735a 2019-08-01T18:22:12 Add a windowID field to SDL_TouchFingerEvent (bug #4331). This is unimplemented on some platforms and will cause compile errors when building those platform backends for now.
Sylvain Becker 236b8606 2019-04-02T18:07:27 Bug 4576: one more warning
Sylvain Becker b8e5c561 2019-04-02T17:07:54 Bug 4576: remove touch/mouse duplication for Wayland
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Brandon Schaefer f9192ab8 2018-12-06T10:39:33 wayland: Do not try to lock on an invalid pointer This happens if you try to lock the pointer and (caps & WL_SEAT_CAPABILITY_POINTER) is false Leading to input->pointer being NULL which ends up bringing the wayland client down (at lease on weston)
Ryan C. Gordon bd3ee07c 2018-12-05T16:49:38 wayland: Send SDL_TOUCH_MOUSEID mouse events for touches.
Alex Szpakowski 5029d50e 2018-11-10T16:15:48 Add SDL_TouchDeviceType enum and SDL_GetTouchDeviceType(SDL_TouchID id). Touch device types include SDL_TOUCH_DEVICE_DIRECT (a touch screen with window-relative coordinates for touches), SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE (a trackpad-style device with absolute device coordinates), and SDL_TOUCH_DEVICE_INDIRECT_RELATIVE (a trackpad-style device with screen cursor-relative coordinates). Phone screens are an example of a direct device type. Mac trackpads are the indirect-absolute touch device type. The Apple TV remote is an indirect-relative touch device type.
Sam Lantinga 5febdfce 2018-09-24T11:49:25 Fixed whitespace
Thomas Perl 84e78320 2018-08-23T14:47:38 Fix "unresponsible application" issues in Wayland Polling without wl_display_flush() never responds to ping requests. In that case ping-pong works only on other events, such as user input or on frame swapped. From https://git.merproject.org/mer-core/libsdl/merge_requests/3 Original author: Alexander Akulich <a.akulich@omprussia.ru>
Ryan C. Gordon c8ac9096 2018-06-24T22:42:36 wayland: Implemented xdg-wm-base support. This is just in parity with the existing zxdg-shell-unstable-v6 code. Making the Wayland target robust (and uh, with title bars) is going to take a lot of work on top of this.
Ryan C. Gordon cd532207 2018-02-07T13:13:55 wayland: Add support for xdg-shell protocol (unstable v6). This is meant to be the desktop-enhanced version of wl_shell. Right now we just match what the existing wl_shell code does, but there are other areas of functionality available to us now, that we can fill in later. This uses the "unstable" API, since this is what ships in Ubuntu 17.10 (as part of Wayland 1.10), but Wayland 1.12 promotes this to stable with extremely minor changes. We will add support for the stable version when it makes sense to do so.
Sam Lantinga 1fa4bcca 2018-01-03T10:43:01 Fixed bug 4012 - Wayland: invalid direction on mouse wheel Vladimir Invalid direction on mouse wheel Patch tested in Centos 7 + Weston
Sam Lantinga 6bc38737 2018-01-03T10:07:27 Fixed bug 4011 - Wayland: fix free cursor Vladimir Sometimes SDL application crashes on cursor free. Patch tested under Centos 7 + weston
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Brandon Schaefer e27f12e0 2017-09-29T10:07:37 wayland: Fix bug 3814 -Wmissing-field-initializers
Sam Lantinga 834ab350 2017-08-21T11:19:38 Fixed bug 3644 - Wayland touch event support Moritz Bitsch Attached is a small patch which enables multitouch events on Wayland.
Sam Lantinga 1d0584d5 2017-08-14T21:35:16 Hopefully fixed Wayland build
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.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Sam Lantinga d767a450 2016-11-06T08:34:27 Fixed 2942 - Wayland: Drag and Drop / Clipboard x414e54 I have implemented Drag and Drop and Clipboard support for Wayland. Drag and dropping files from nautilus to the testdropfile application seems to work and also copy and paste.
Sam Lantinga f11a4409 2016-09-01T01:26:56 wayland: Add support for relative mouse mode, by Jonas ?dahl <jadahl@gmail.com> Generate the C protocol files from the protocol XML files installed by wayland-protocols, and use them to implement support for relative pointer motions and pointer locking. Note that at the time, the protocol is unstable and may change in the future. Any future breaking changes will, however, fail gracefully and result in no regressions compared to before this patch.
Philipp Wiesemann 31cbb34e 2016-04-14T21:11:43 Wayland: Removed not needed including and setting of errno. One internal function was setting errno on error but it was not read afterwards.
Philipp Wiesemann be34036e 2016-03-02T20:25:23 Wayland: Fixed fault in event handling which might have caused a crash someday. Found by Cppcheck.
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
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 bea1854c 2015-05-27T19:00:56 Patched to compile on C89 compilers.
Ryan C. Gordon 9c343681 2015-05-27T18:54:06 Wayland: Avoid NULL dereference after window destruction (thanks, "x414e54"!). Fixes Bugzilla #2934.
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
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.
Ryan C. Gordon 3a027059 2015-04-12T21:02:21 Patched to compile on C89 compilers.
Ryan C. Gordon c539b3f9 2015-04-12T20:59:48 Make X11 and Wayland ProcessHitTest() code less verbose.
Ryan C. Gordon d10201be 2015-04-12T20:40:06 Implemented SetWindowHitTest() for Wayland (thanks, x414e54!). Fixes Bugzilla #2941.
Alex Szpakowski fe6c797c 2015-04-10T23:30:31 Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
Edward Rudd b88ca1b4 2015-02-10T16:28:56 the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here. Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture. More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
Philipp Wiesemann b48e54aa 2015-01-26T22:00:29 Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation Jonas Kulla The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c. I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
David Ludwig 70438be2 2014-12-03T10:55:23 WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
Edward Rudd 5b5823ee 2014-11-23T21:09:54 add in support for passing down the "natural" (or flipped) scrolling direction in the MouseWheelEvent event
Philipp Wiesemann 9c398852 2014-11-22T22:20:40 Corrected header file documentation comment.
Pierre-Loup A. Griffais 24c86b55 2014-09-11T19:24:42 [X11] Reconcile logical keyboard state with physical state on FocusIn since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
David Ludwig 3dcb451f 2014-04-09T21:29:19 Added a README file regarding WinRT support To note, this file is currently formatted with CRLF line endings, rather than LF, to allow the file to be viewed with Notepad.
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
Gabriel Jacobo f52d7f5e 2014-01-28T11:39:37 [Wayland] Fixes segfault when mouse enters window
Ryan C. Gordon 2ddd0c58 2014-01-20T12:53:44 Patched to compile if Wayland is disabled via SDL_config.h (thanks, Martin!). Fixes Bugzilla #2351.
Gabriel Jacobo 272ebb8e 2014-01-09T13:56:21 Dynamic loading support for Wayland
Gabriel Jacobo ec1cb49e 2013-12-14T20:18:43 Wayland support Based on the original port to Wayland by: Joel Teichroeb, Benjamin Franzke, Scott Moreau, et al. Additional changes in this commit, done by me: * Wayland uses the common EGL framework * EGL can now create a desktop OpenGL context * testgl2 loads GL functions dynamically, no need to link to libGL anymore * Assorted fixes to the Wayland backend Tested on the Weston Compositor (v1.0.5) that ships with Ubuntu 13.10, running Weston under X. Tests ran: testrendercopyex (all backends), testgl2, testgles2,testintersections