src/video/x11


Log

Author Commit Date CI Message
Cameron Gutman 6b057c67 2021-01-26T19:16:17 Expose separate keyboard and mouse grab support This adds SDL_SetWindowKeyboardGrab(), SDL_GetWindowKeyboardGrab(), SDL_SetWindowMouseGrab(), SDL_GetWindowMouseGrab(), and new SDL_WINDOW_KEYBOARD_GRABBED flag. It also updates the test harness to exercise this functionality and makes a minor fix to X11 that I missed in https://hg.libsdl.org/SDL/rev/02a2d609369b To fit in with this new support, SDL_WINDOW_INPUT_CAPTURE has been renamed to SDL_WINDOW_MOUSE_CAPTURE with the old name remaining as an alias for backwards compatibility with older code.
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.
Cameron Gutman e1f73e64 2021-01-23T16:22:44 Refactor keyboard grab to be managed by the video core This gives us flexibility to add others hints to control keyboard grab behavior without having to touch all of the backends. It also allows us to possibly expose keyboard grab separately from mouse grab for applications that want to manage those independently.
Cameron Gutman a0d3c6c6 2021-01-25T21:42:14 Rename SetWindowGrab() to SetWindowMouseGrab()
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Sam Lantinga 93ccdee8 2020-12-23T13:47:49 Fixed bug 5404 - stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf Cameron Cawley stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf The default implementation is based on the one used in the Windows RT video driver.
Ozkan Sezer 5c212cb0 2020-12-10T12:24:24 remove a few stale NULL message/title checks after commit e2b729b1756a top-level guarantees non-NULL message / title passed in messageboxdata
Ozkan Sezer f1cab8ae 2020-12-10T11:20:56 fix bug #5253: handle NULL title or message fields in SDL_MessageBoxData - SDL_video.c (SDL_ShowMessageBox): replace messageboxdata, set title or message field to "" if either of them is NULL. - SDL_video.c (SDL_ShowSimpleMessageBox): set title or message to "" if either of them is NULL for EMSCRIPTEN builds. - SDL_bmessagebox.cc: add empty string check along with NULL check for title and message fields. - SDL_windowsmessagebox.c (AddDialogString): remove NULL string check - SDL_windowsmessagebox.c (AddDialogControl): add empty string check along with the NULL check. - SDL_x11messagebox.c: revert commit 677c4cd68069 - SDL_os2messagebox.c: revert commit 2c2a489d76e7 - test/testmessage.c: Add NULL title and NULL message tests.
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.
Ryan C. Gordon 335cfa10 2020-11-18T11:24:08 x11: Don't crash if a messagebox has a NULL title string. Fixes Bugzilla #5253.
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
Sam Lantinga 76980e30 2020-10-08T16:42:20 Added events for dynamically connecting and disconnecting displays, with an iOS implementation
Sam Lantinga 8709f67e 2020-09-08T08:42:30 Fixed bug 5215 - Fixing filenames passed to dlopen for OpenBSD Brad Smith Attached is a patch to use the proper filenames when trying to dlopen the respective shared libraries on OpenBSD.
Cameron Gutman 9a769da0 2020-09-07T20:10:50 X11: Remove our X11 error callback in X11_DeleteDevice() If we don't remove it, we will infinitely recurse if X11_CreateDevice() is called again and orig_x11_errhandler becomes X11_SafetyNetErrHandler().
M Stoeckl 8669a87f 2020-07-14T21:13:27 Reuse X11 connection from availability check Instead of creating an X11 connection to test that X11 is available, closing the connection, and then reconnecting for real, use the same connection to handle both cases. The X11 connection retry delay mechanism in the case where X11 is dynamically loaded has been removed. It was only necessary to avoid authetnication token reuse from the XOpenDisplay call that used to exist in X11_Available. Now that this call is only made once, it is no longer needed. Also drop unused and inapplicable code from a comment. ***
M Stoeckl 052a1373 2020-07-12T19:11:15 Merge VideoBootStrap::available into VideoBootStrap::create The two are only ever called together, and combining them makes it possible to eliminate redundant symbol loading and redundant attempts to connect to a display server.
Sam Lantinga ce293eed 2020-06-23T10:12:24 Fixed bug 5208 - Fix libGL loading on OpenBSD
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 589d636b 2020-04-22T14:57:06 Fixed rare crash when creating an X11 window
Sam Lantinga b6afbe63 2020-04-07T09:38:57 Added SDL_log.h to SDL_internal.h so logging is available everywhere
Sam Lantinga e05d92a1 2020-04-05T09:01:33 Fixed bug 5075 - Don't assume a GL library version number on NetBSD. Nia Alarie If you install X as part of NetBSD, the GL library is libGL.so.3, but if you install the GL library later as a package, it's libGL.so.1.
Ryan C. Gordon 1b82606e 2020-02-17T16:11:18 x11: Wait a bit in SDL_SetWindowSize() to see if window manager vetoed change. Same idea as the fix for Bugzilla #4646. Fixes Bugzilla #4727.
Ryan C. Gordon e7315225 2020-02-17T15:02:37 x11: Don't delay an extra 10ms if we were just going to break out of the loop.
Ryan C. Gordon 367a8b97 2020-02-17T15:00:02 x11: Don't wait for the window to move if it's already in the place we want it.
Ryan C. Gordon d1df3437 2020-02-14T13:17:18 x11: SDL_SetWindowPosition should try to wait for the window manager. Wait up to 100 milliseconds, since the window manager might alter or outright veto the window change...or not respond at all. In a well-functioning system, though, this should help make sure that SDL_SetWindowPosition's results match reality. Fixes Bugzilla #4646.
Sam Lantinga 4b585e75 2020-02-03T08:06:52 Fixed bug 4833 - Use EGL for X11? Martin Fiedler To be precise, this is about *desktop OpenGL* on X11. For OpenGL ES, EGL is already used (as it's the only way to get an OpenGL ES context), as Sylvain noted above. To shine some light on why this is needed: In 99% of all cases, using GLX on X11 is fine, even though it's effectively deprecated in favor of EGL [1]. However, there's at least one use case that *requires* the OpenGL context being created with EGL instead of GLX, and that's DRM_PRIME interoperability: The function glEGLImageTargetTexture2DOES simply doesn't work with GLX. (Currently, Mesa actually crashes when trying that.) Some example code: https://gist.github.com/kajott/d1b29c613be30893c855621edd1f212e Runs on Intel and open-source AMD drivers just fine (others unconfirmed), but with #define USE_EGL 0 (i.e. forcing it to GLX), it crashes. The same happens when using SDL for window and context creation. The good news is that most of the pieces for EGL support on X11 are already in place: SDL_egl.c is pretty complete (and used for desktop OpenGL on Wayland, for example), and SDL_x11opengl.c has the aforementioned OpenGL-ES-on-EGL support. However, when it comes to desktop OpenGL, it's hardcoded to fall back to GLX. I'm not advocating to make EGL the default for desktop OpenGL on X11; don't fix what ain't broken. But something like an SDL_HINT_VIDEO_X11_FORCE_EGL would be very appreciated to make use cases like the above work with SDL. [1] source: Eric Anholt, major Linux graphics stack developer, 7 years ago already - see last paragraph of https://www.phoronix.com/scan.php?page=news_item&px=MTE3MTI
Ryan C. Gordon 39563b7b 2020-01-28T13:51:24 x11: Use XSync when changing window position instead of XFlush. Attempt to fix regression in Bugzilla #4646.
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Dmitry V. Levin 2b1edf41 2020-01-04T11:05:06 X11_InitKeyboard: do not call XAutoRepeatOn unnecessarily Use XGetKeyboardControl to initialize the current XKeyboardState, and skip XAutoRepeatOn invocation if global_auto_repeat is AutoRepeatModeOn. This fixes SDL2 when the X11 client is untrusted.
Dmitry V. Levin ed514cd0 2020-01-04T11:03:04 have_mitshm: use XShmQueryExtension to check for MIT-SHM extension Do not try to guess MIT_SHM extension availability from the string returned by XDisplayName, use the appropriate API instead. This fixes SDL2 inside hasher.
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
Sam Lantinga b1539c4c 2019-11-16T22:35:48 Fixed bug 4819 - Attempting to create an OpenGL ES context with unachievable MSAA parameters under X11 dooms the program Solra Bizna I have written a program that, in the event that the user requests more MSAA samples than their hardware supports, attempts to gracefully fall back to the best MSAA available. This code works with my conventional OpenGL renderer, but if I change nothing about the code except to make it request an OpenGL ES profile instead, Xlib kills the program with an error that looks like: X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 4 (X_DestroyWindow) Resource id in failed request: 0x5c00008 Serial number of failed request: 188 Current serial number in output stream: 193 To trigger the bug, attempt to create a window with the SDL_WINDOW_OPENGL flag, with SDL_GL_CONTEXT_PROFILE_MASK set to SDL_GL_CONTEXT_PROFILE_ES, and with SDL_GL_MULTISAMPLESAMPLES set to any unsupported value. SDL_CreateWindow properly returns NULL, but at this point the program is already doomed. Xlib will shortly terminate the program with an error. Calling SDL_CreateWindow again will immediately trigger this termination. I have attached a skeletal program that reproduces this bug for me. Replacing SDL_GL_CONTEXT_PROFILE_ES with SDL_GL_CONTEXT_PROFILE_COMPATIBILITY avoids the bug (but, obviously, doesn't create an OpenGL ES context). As I suspected, the problem was with XDestroyWindow being called twice on the same window. The X11_CreateWindow function in src/video/x11/SDL_x11window.c calls SetupWindowData. If initialization fails after that point, XDestroyWindow gets called on the window by a subsequent call to X11_DestroyWindow. But, later in the same function, iff a GLES context is requested and initializing it fails, X11_XDestroyWindow (which wraps XDestroyWindow) is manually called. Shortly after, the intended call to X11_DestroyWindow occurs, which attempts to destroy the same window again. Boom. (The above confusing summary involves three separate, similarly-named functions: XDestroyWindow, X11_DestroyWindow, X11_XDestroyWindow) I have attached a simple patch that removes the redundant X11_XDestroyWindow calls. I've tested that XDestroyWindow still gets called for the windows in question, and that it only gets called once.
Sylvain Becker ce308a78 2019-10-30T16:33:32 revert this const parameter for X11 function
Sylvain Becker d4a67e25 2019-10-30T16:06:51 Readability: change some pointer parameter to be pointer to const
Sylvain Becker b458d7a2 2019-10-30T15:13:55 Readability: remove redundant cast to the same type
Sylvain Becker 735691ec 2019-10-30T14:29:41 Remove nested redundant #ifndef
Ryan C. Gordon c0255be4 2019-10-26T23:58:55 x11: check if the X server honored our XMoveWindow() call (thanks, R.E. Rust!). This can happen if a window is still grabbed when we try to move it, or if the X11 ecosystem is just in a bad mood, I guess. This makes sure that SDL will report the correct position for a window; otherwise, SDL_GetWindowPosition will just report whatever the last SDL_SetWindowPosition call requested, even if the window didn't actually move. Fixes Bugzilla #4646.
Ryan C. Gordon ed7483f8 2019-10-15T22:36:08 x11: On macOS, look for X11 install in /opt/X11 instead of /usr/X11R6. This is where Apple installs XQuartz now (and apparently, the compatibility symlink at /usr/X11R6 can be missing). Fixes Bugzilla #4706.
Sam Lantinga e5580e18 2019-09-04T09:27:58 x11: add a hint to force the VisualID used when creating a window.
Alex Szpakowski 2fb71ac5 2019-08-04T00:34:23 Implement touch window IDs on x11/xinput2.
Sam Lantinga 63197c43 2019-08-02T17:19:50 Fix bug where the wrong button was the default in the old message box because buttons were added backwards, breaking the indexing used by GetButtonIndex. Add messagebox flags to explicilty request left-to-right button order or right-to-left. If neither is specified it'll be some platform default.
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.
Ozkan Sezer 4953e050 2019-07-31T05:11:40 use SDL_zeroa at more places where the argument is an array.
Sylvain Becker 86965eec 2019-07-10T10:06:28 x11: prevent a synthetic mouse event when using a touchscreen With multitouch, register to receive XI_Motion (which desctivates MotionNotify), so that we can distinguish real mouse motions from synthetic one. (bug 4690)
Ryan C. Gordon 6ef01e52 2019-07-09T17:28:02 x11: set some modality things on message boxes with parent windows.
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
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.
Micha? Janiszewski 91820998 2018-10-28T21:36:48 Add and update include guards Include guards in most changed files were missing, I added them keeping the same style as other SDL files. In some cases I moved the include guards around to be the first thing the header has to take advantage of any possible improvements compiler may have for inclusion guards.
Ryan C. Gordon 1ec56f73 2018-10-20T21:35:48 x11: Fixed incorrect function signature for XkbSetDetectableAutoRepeat. It needs to use Bool (which is an int) and not BOOL (which is CARD8), which causes problems on platforms with different byte order and alignment, etc. Fixes Bugzilla #4326.
Ryan C. Gordon dae4a013 2018-10-15T00:46:43 x11: Don't hardcode limit on lines of text in message boxes. Plus other text parsing fixes. Fixes Bugzilla #4306.
Sam Lantinga 5febdfce 2018-09-24T11:49:25 Fixed whitespace
Ryan C. Gordon e061a92d 2018-08-02T16:03:47 Some drag'and'drop improvements. First: disable d'n'd events by default; most apps don't need these at all, and if an app doesn't explicitly handle these, each drop on the window will cause a memory leak if the events are enabled. This follows the guidelines we have for SDL_TEXTINPUT events already. Second: when events are enabled or disabled, signal the video layer, as it might be able to inform the OS, causing UI changes or optimizations (for example, dropping a file icon on a Cocoa app that isn't accepting drops will cause macOS to show a rejection animation instead of the drop operation just vanishing into the ether, X11 might show a different cursor when dragging onto an accepting window, etc). Third: fill in the drop event details in the test library and enable the events in testwm.c for making sure this all works as expected.
Ryan C. Gordon 8f0cc4a4 2018-07-22T19:42:08 Backed out changeset 2e42ec46061e. This change isn't correct. See comments in Bugzilla #4183.
Marc Di Luzio c3178e67 2018-07-12T16:52:45 Ensure we still clear the X locale modifiers even if not compiled with ibus or fcitx support
Ryan C. Gordon 59574fe2 2018-06-24T13:57:22 x11: Normalize x11xinput2 touch x to be 1.0 at width (thanks, Zach!). "Applications (such as SDL's testgesture) do "event.tfinger.x * window_width" to find window coord. Currently the X11 XInput2 backend expects application to do "event.tfinger.x * (window_width-1)" instead. X11 XInput2 touch events are normalized so x is 1.0 at "width - 1" but other SDL backends appear to have x be 1.0 at "width". Same issue for touch event y with regards to height." Fixes Bugzilla #4183.
Sam Lantinga 8ddebfa0 2018-02-16T10:23:10 Fixed bug 4085 - X11: Allow configuring _NET_WM_BYPASS_COMPOSITOR through SDL hints Callum McGing This patch allows the user to disable the behaviour that blocks the compositor through a new hint: SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR. This allows tools or other windowed applications to behave properly under KWin.
sezero 40b27fd5 2018-02-12T17:00:00 revert the recent typecast assignment changes (see bug #4079) also change the void* typedefs for the two vulkan function pointers added in vulkan_internal.h into generic function pointer typedefs.
Sam Lantinga 90e72bf4 2018-01-30T18:08:34 Fixed ISO C99 compatibility SDL now builds with gcc 7.2 with the following command line options: -Wall -pedantic-errors -Wno-deprecated-declarations -Wno-overlength-strings --std=c99
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Sam Lantinga c5429bd9 2017-11-04T22:06:40 Fixed bug 3939 - Remove static vm_error and vm_event from SDL_x11modes.c tomwardio Remove static int vm_error and vm_event, use local variables instead. This fixes unused variable errors when compiling with SDL_VIDEO_DRIVER_X11_XINERAMA undefined. src/video/x11/SDL_x11modes.c:505:22: error: unused variable 'vm_error' [-Werror,-Wunused-variable] src/video/x11/SDL_x11modes.c:505:12: error: unused variable 'vm_event' [-Werror,-Wunused-variable]
Sven Hesse b89cac67 2017-10-22T20:24:58 Don't X error in SDL_CreateWindow with unsupported GL attributes
Sam Lantinga 5bed4ca9 2017-10-12T08:27:22 Fixed divide by zero with a 1x1 sized window
Sam Lantinga c0019b7f 2017-10-11T13:31:21 Fixed bug 3871 - Touch events are not normalised on X11 Trent Gamblin The documentation for SDL_TouchFingerEvent says that the x and y coordinates are normalised between 0-1. I've found that to be true on Windows, Android and iOS but on X11 they are in pixel coordinates. This patch fixes the issue. This was the cleanest way I could do it with what was available without changing things around a lot but you may know a better way.
Ryan C. Gordon c9e73c3e 2017-09-05T16:15:54 x11: make sure SDL_GetGlobalMouseState notices mouse warping through SDL APIs.
Sam Lantinga 0782f9be 2017-09-05T08:24:38 Fixed bug 3273 - Fix for slow video subsystem initialization when using XRandR. Mart?n Golini I'm having a very slow initialization of the video subsystem that locks the window creation for about 500 ms ( tested in at least 4 different systems ). What i found is that X11_InitModes_XRandR is using XRRGetScreenResources, that explicitly ask to poll the hardware for changes. This is not really necessary since if the data is already available you can use XRRGetScreenResourcesCurrent. I attached a tentative patch that fix this issue. With the patch there's no lock when the subsystem is initialized and the window creation is instant in my applications. The patch only uses XRRGetScreenResourcesCurrent in X11_InitModes_XRandR but it could be potentially used in X11_GetDisplayModes and X11_SetDisplayMode.
Ryan C. Gordon 74043994 2017-09-01T14:08:09 x11: Correctly restore previous GL context after sacrificial context is done.
Ryan C. Gordon a3dda100 2017-09-01T14:00:11 x11: don't try to make a NULL GL context current when we already did that.
Ryan C. Gordon 4649ac46 2017-09-01T13:57:40 x11: Clean up sacrificial GL context code. Check for failures, restore any previously-current context.
Ryan C. Gordon 507659c6 2017-09-01T13:27:53 x11: Make a sacrificial glX context to check for extensions during init. This is necessary because we need to see if GLES compat extensions exist. All of this code (including ShouldUseTextureFramebuffer()) should be revisited after 2.0.6 ships; ideally we don't make throwaway contexts if we can avoid it...but maybe we can't. I hear Vulkan is pretty cool. Fixes Bugzilla #3725.
Sam Lantinga 3c7f9d69 2017-08-28T00:51:14 Fixed redefinition of typedef warnings and errors on BSD
Sam Lantinga 50efbda7 2017-08-28T00:43:14 Fixed mingw Windows build, since SDL_vulkan_internal.h includes windows.h
Sam Lantinga 0d011ec6 2017-08-28T00:22:23 Renaming of guard header names to quiet -Wreserved-id-macro
Sam Lantinga ce2b1644 2017-08-28T00:11:38 Be clear that disabling Vulkan surface support disables the entire SDL Vulkan integration
Ryan C. Gordon 25e3a1ec 2017-08-27T22:15:57 vulkan: Initial Vulkan support! This work was done by Jacob Lifshay and Mark Callow; I'm just merging it into revision control.
Ryan C. Gordon e58c7920 2017-08-25T12:51:42 x11: Patched to compile with DEBUG_XEVENTS defined.
Ethan Lee 685890a2 2017-08-24T22:57:42 Fix KHR_no_error support
Ryan C. Gordon d8fc70ea 2017-08-24T21:30:53 opengl: add support for GL_KHR_no_error. This is completely untested! Fixes Bugzilla #3721.
Brandon Schaefer 17453d49 2017-08-21T23:44:46 x11: Move screen_w/h inside the only ifdef they are referenced in to avoid compiler warnings
Ryan C. Gordon f5a38f23 2017-08-21T00:42:06 x11: specify event mask for buttons when grabbing pointer (thanks, Stas!). This fixes a strange corner case (notes appended below), and should be safe to do anyhow. Fixes Bugzilla #3674. "I did more tests. It appears the bug only happens if there is another window on the screen that has "always on top" property. For me it is xawtv - it is always opened in a screen corner. Closing xawtv or removing "always on top" property from it makes the problem to go away. Plus, it doesn't appear like the buttons are not delivered at all. It appears that instead the button presses are delivered on some mouse positions, but not delivered when you move the mouse to other part of the window... So this is really weird and is likely somewhere deep in the Xorg. Maybe somehow it happens that the cursor is actually above the xawtv window, but, because my app uses grab, it is not visible there, and in that case the events are not delivered to my app? But with my patch the button events are always delivered flawlessly, it seems. Hmm, and that indeed seems to explain my problem: if the mask is set properly and my app uses grab, then, even if the mouse is above some other window, the events would still be delivered to the grabbing app, which is what actually wanted because my app uses relative mouse mode, so it doesn't know the pointer can cross some other window (my app draws the pointer itself). So my current theory is that my patch only enforces the mouse grab, which otherwise can be tricked by some other window preventing the button events delivery (but motion events are still delivered via xinput2, which makes it all look very obscure)."
Ryan C. Gordon 01e0d8fc 2017-08-19T15:02:03 opengl: Add support for [GLX|WGL]_ARB_create_context_robustness. This patch was originally written by Marc Di Luzio for glX and enhanced by Maximilian Malek for WGL, etc. Thanks to both of you! Fixes Bugzilla #3643. Fixes Bugzilla #3735.
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 362d5496 2017-08-14T10:28:47 Fixed bug 2500 - X11: SDL tries (and fails) to hide foreign windows Alvin I'm interested in this bug as well. I have experienced it when trying to embed an SDL_Window into a FLTK application. To do this, I create a FLTK window (window inside a window - think video player) and then use SDL_CreateWindowFrom() on the inner most window's Xlib Window*. After which, I create a renderer. In my situation I am using the FLTK GUI toolkit. What I have experienced is that the SDL_CreateRender() will recreate the window in order to properly setup OpenGL capability. As part of this process, the window is hidden and a call is executed that waits indefinitely for an acknowledgement that the window was indeed unmapped. This is where my program hangs. Please correct me if I am wrong, but should SDL2 not make Xlib calls that effect the Xlib Window in this situation (e.g. When SDL_CreateWindowFrom() is used)? The toolkit being used typically assumes responsibility and, I presume, tracks all Xlib Windows it creates. On line src/video/SDL_video.c:1372 the comment associated with setting SDL_WINDOW_FOREIGN reads: /* Can't destroy and re-create foreign windows, hrm */ Since I do not know the reason for hiding the window in the first place, the attached patch simply does not wait for a response when X11_XWithdrawWindow() and X11_XMapRaised() are issued by X11_HideWindow() and X11_ShowWindow(), respectively. I presume that the GUI toolkit (GTK, FLTK, etc.) has or will consume the acknowledging event as it is managing the Xlib Window (or it thinks it is). I have tested the patch against hg 5c645d037de2 and I have successfully tested: * Embedding the SDL_Window inside a FLTK application. * Calling SDL_SetWindowSize() when FLTK resizes the window (e.g. dragging cursor on the edge of the window). * Filling the renderer's default target blue and drawing a red fill square at the centre (exciting, I know!) * Calling SDL_Quit() when the application terminates I do not receive any Xlib erorr messages (BadWindow, etc.) in any of those situations.
Sam Lantinga eb06aba8 2017-08-13T21:16:58 Fixed bug 3742 - minor warning fixes
Ryan C. Gordon 18cceb5c 2017-08-13T01:00:01 x11: Patched to compile.
Ryan C. Gordon 0a1b905b 2017-08-13T00:58:23 x11: Fix message box titles with Unicode chars on some window managers. Fixes Bugzilla #2971.
Sam Lantinga d226594f 2017-08-12T16:48:46 Workaround for bug 3049 - SDL_Init(SDL_INIT_VIDEO) - XDM authorization key matches an existing client! malferit Hello, I began a little program with SDL2 on Linux in C, and when I call SDL_Init(SDL_INIT_VIDEO) I get an error and this is printed in the console: XDM authorization key matches an existing client! I searched through Internet, and found that some people suggest to run 'xhost +' or to specify this in /etc/X11/xdm/xdm-config: DisplayManager*authName: MIT-MAGIC-COOKIE-1 I don't think an end user needs to know that... But what bothered me is that first I started this little program in Pascal using the Freepascal compiler and it works. In freepascal you only use some thin header bindings in Pascal and then it links with the dynamic SDL library, so I don't understood why it worked with Freepascal and not in C. I run ldd to the two generated applications: Application in C: linux-gate.so.1 (0xffffe000) libSDL2-2.0.so.0 => /usr/lib/libSDL2-2.0.so.0 (0xb76ac000) libpthread.so.0 => /lib/libpthread.so.0 (0xb766e000) libc.so.6 => /lib/libc.so.6 (0xb74e2000) libm.so.6 => /lib/libm.so.6 (0xb74a0000) libdl.so.2 => /lib/libdl.so.2 (0xb749a000) librt.so.1 => /lib/librt.so.1 (0xb7491000) /lib/ld-linux.so.2 (0xb77b3000) Application compiled with Freepascal: linux-gate.so.1 (0xffffe000) libSDL2-2.0.so.0 => /usr/lib/libSDL2-2.0.so.0 (0xb762a000) libX11.so.6 => /usr/lib/libX11.so.6 (0xb74f3000) libc.so.6 => /lib/libc.so.6 (0xb7367000) libm.so.6 => /lib/libm.so.6 (0xb7325000) libdl.so.2 => /lib/libdl.so.2 (0xb731f000) libpthread.so.0 => /lib/libpthread.so.0 (0xb7305000) librt.so.1 => /lib/librt.so.1 (0xb72fc000) libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb72dc000) libXau.so.6 => /usr/lib/libXau.so.6 (0xb72d9000) libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb72d3000) /lib/ld-linux.so.2 (0xb7755000) It seems that Freepascal is linking with libX11, libxcb, libXau and libXdmcp . Linking my C application with libxcb solved the problem (linking with libXau and/or libXdmcp without libxcb didn't work). Linking with X11 links all the other libraries and works as well. So I fill this bug report mainly to let you know about this. I don't know if it is a problem that can be solved on the libSDL side or not, but at least I hope it will help. Hi, some tests: 1. Disabled XDM. Login in console and running 'startx'. The program works without having to link with X11. 2. Enabled XDM. Added 'DisplayManager*authName: MIT-MAGIC-COOKIE-1' to /etc/X11/xdm/xdm-config.The program works without having to link with X11. 3. Enabled XDM without 'DisplayManager*authName: MIT-MAGIC-COOKIE-1' in /etc/X11/xdm/xdm-config . I get the authentication error unless I link with X11.
Sam Lantinga 082f32d1 2017-08-02T10:28:13 Fixed bug 3722 - Fall back to xinerama/xvidmode if xrandr modes initialization fails Levi Bard In some environments, xrandr modes initialization can fail even though xrandr support is present and of a sufficient version. (The one I encountered was an AWS instance running a virtual display) The attached patch allows SDL to keep trying other methods if xrandr modes initialization fails (still subject to SDL_VIDEO_X11_REQUIRE_XRANDR).
Sam Lantinga 56363ebf 2017-08-02T10:22:48 Fixed bug 3690 - SDL2 KMS/DRM render context support Manuel The attached patch adds support for KMS/DRM context graphics. It builds with no problem on X86_64 GNU/Linux systems, provided the needed libraries are present, and on ARM GNU/Linux systems that have KMS/DRM support and a GLES2 implementation. Tested on Raspberry Pi: KMS/DRM is what the Raspberry Pi will use as default in the near future, once the propietary DispmanX API by Broadcom is overtaken by open graphics stack, it's possible to boot current Raspbian system in KMS mode by adding "dtoverlay=vc4-kms-v3d" to config.txt on Raspbian's boot partition. X86 systems use KMS right away in every current GNU/Linux system. Simple build instructions: $./autogen.sh $./configure --enable-video-kmsdrm $make
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.
Sam Lantinga 177f19af 2017-07-20T10:52:43 Fixed bug 3410 - SDL_WINDOW_HIDDEN flag is inaccurate. Jason Wyatt After hiding the window, SDL_WINDOW_HIDDEN/SDL_WINDOW_SHOWN flags on a window are correctly updated. However on the next SDL_PumpEvents, they are set incorrectly. This appears to be because X11_GetNetWMState does not check whether the _NET_WM_STATE property exists (it shouldn't on unmapped windows, see https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html#idm140130317598336). This results in an empty list of atoms for the state, which would imply that the window is not hidden. (Seen on Fedora 24, Gnome) -- Dan Ginsburg More details on my proposed patch: I am on Kubuntu 16.04.2. I ran into this same bug, but with Jason's patch I found that actualType != None was true so the SDL_WINDOW_HIDDEN would still not be set. My fix instead is to explicitly check for whether the window is unmapped rather than relying on the returned values in XGetWindowProperty.
Ryan C. Gordon c80c3419 2017-07-04T20:44:07 x11: pass a long to XChangeProperty, not an int. The Xlib documentation demands that 32-bit values here be passed in a long, even when long itself isn't a 32-bit value. Otherwise libx11 might read memory incorrectly. Fixes Bugzilla #3692.
Philipp Wiesemann 4b47fa38 2017-06-04T23:15:47 Removed duplicate includes.
Ryan C. Gordon b3f94acb 2017-05-28T07:11:52 linux: Simplify D-Bus interface, remove lots of boilerplate.