src/video/x11


Log

Author Commit Date CI Message
Ethan Lee 7ed415d2 2021-09-23T14:07:38 wayland: Reuse KeySymToUcs4 to replicate X11 keymap behavior
Ryan C. Gordon 478f9eed 2021-09-20T10:20:04 x11: Don't include X11/extensions/extutil.h We don't use it, it was a leftover from 1.2, I think, and it doesn't exist on Solaris, so this should hopefully fix the build there. This also means we don't need the configure/cmake checks for SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY, so that was removed also. Fixes #1666.
Rokas Kupstys 515b7e93 2021-08-27T17:02:07 Fix horizontal wheel scroll direction of X11.
Ryan C. Gordon d5fe9c30 2021-08-24T14:18:47 x11: Log a warning if we decide to use XVidMode. Reference issue #1782.
Simon McVittie 25cd749a 2021-08-12T15:12:04 x11: Don't change mode if we are already in the correct mode If we are already in the desired mode, changing it is a no-op at best, and harmful at worst: on Xwayland, it sometimes happens that we disable the crtc and cannot re-enable it. Resolves: https://github.com/libsdl-org/SDL/issues/4630 Signed-off-by: Simon McVittie <smcv@collabora.com>
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
Ozkan Sezer 77c8d111 2021-08-10T20:55:50 configuration updates for dlopen: - cmake, configure (CheckDLOPEN): --enable-sdl-dlopen is now history.. detach the dl api discovery from SDL_LOADSO_DLOPEN functionality. define HAVE_DLOPEN. also define DYNAPI_NEEDS_DLOPEN (CheckDLOPEN is called only for relevant platforms.) - update SDL_config.in and SDL_config.cmake accordingly. - SDL_dynapi.h: set SDL_DYNAMIC_API to 0 if DYNAPI_NEEDS_DLOPEN is defined, but HAVE_DLOPEN is not. - pthread/SDL_systhread.c: conditionalize dl api use to HAVE_DLOPEN - SDL_x11opengl.c, SDL_DirectFB_opengl.c, SDL_naclopengles.c: rely on HAVE_DLOPEN, not SDL_LOADSO_DLOPEN. - SDL_config_android.h, SDL_config_iphoneos.h, SDL_config_macosx.h, SDL_config_pandora.h, and SDL_config_wiz.h: define HAVE_DLOPEN. Closes: https://github.com/libsdl-org/SDL/pull/4351
Cameron Gutman 6ae227d0 2021-08-08T23:27:08 x11/wayland: fix screensaver suspension via D-Bus b08b1bde introduced a subtle bug. Despite not using D-Bus types directly, the code used the SDL_USE_LIBDBUS definition set by SDL_dbus.h to conditionally compile calls SDL_DBus_ScreensaverTickle() and SDL_DBus_ScreensaverInhibit(). As a result, it still compiled without SDL_dbus.h included, but screensaver suspension silently failed to work. The D-Bus stuff could probably use some tweaks to be harder to accidentally break, but for now just restore the header includes.
Cameron Gutman b08b1bde 2021-08-03T22:50:58 linux: remove d-bus lazy init dead code Lazy init in X11/Wayland is dead code since dbdbae4
Sam Lantinga b033cd0d 2021-07-31T16:01:48 Fixed XSync sequence to match other cases where we set the X11 error handler
Ryan C. Gordon 4c7825f6 2021-07-31T18:27:14 x11: XSync while trying to catch XRRSetScreenSize error. Reference issue #4561
Ryan C. Gordon d0effadf 2021-07-31T15:56:30 x11: Don't let XRRSetScreenSize fire a BadMatch error. This is a workaround and not a proper fix, but this is possibly complicated, and possibly a corner case, so this will do for 2.0.16, if not the foreseeable future. Reference issue #4561
Jessica Clarke 8f38ba4d 2021-07-29T18:02:47 Fix casts that should be using uintptr_t This is needed to support CHERI, and thus Arm's experimental Morello prototype, where pointers are implemented using unforgeable capabilities that include bounds and permissions metadata to provide fine-grained spatial and referential memory safety, as well as revocation by sweeping memory to provide heap temporal memory safety. On most systems (anything with a flat memory hierarchy rather than using segment-based addressing), size_t and uintptr_t are the same type. However, on CHERI, size_t is just an integer offset, whereas uintptr_t is still a capability as described above. Casting a pointer to size_t will strip the metadata and validity tag, and casting from size_t to a pointer will result in a null-derived capability whose validity tag is not set, and thus cannot be dereferenced without faulting. The audio and cursor casts were harmless as they intend to stuff an integer into a pointer, but using uintptr_t is the idiomatic way to do that and silences our compiler warnings (which our build tool makes fatal by default as they often indicate real problems). The iconv and egl casts were true positives as SDL_iconv_t and iconv_t are pointer types, as is NativeDisplayType on most OSes, so this would have trapped at run time when using the round-tripped pointers. The gles2 casts were also harmless; the OpenGL API defines this argument to be a pointer type (and uses the argument name "pointer"), but it in fact represents an integer offset, so like audio and cursor the additional idiomatic cast is needed to silence the warning.
Aaron Plattner 1e07dba0 2021-06-09T15:26:38 x11: Use glXChooseFBConfig when available in X11_GL_GetVisual When choosing an X11 Visual for a window based on its GLX capabilities, first try glXChooseFBConfig (if available) before falling back to glXChooseVisual. This normally does not make a difference because most GLX drivers create a Visual for every GLXFBConfig, exposing all of the same capabilities. For GLX render offload configurations (also know as "PRIME") where one GPU is providing GLX rendering support for windows on an X screen running on a different GPU, the GPU doing the offloading needs to use the Visuals that were created by the host GPU's driver rather than being able to add its own. This means that there may be fewer Visuals available for all of the GLXFBConfigs the guest driver wants to expose. In order to handle that situation, the NVIDIA GLX driver creates many GLXFBConfigs that map to the same Visual when running in a render offload configuration. This can result in a glXChooseVisual request failing to find a supported Visual when there is a GLXFBConfig for that configuration that would have worked. For example, when the game "Unnamed SDVX Clone" [1] tries to create a configuration with multisample, glXChooseVisual fails because the Visual assigned to the multisample GLXFBConfigs is shared with the GLXFBConfigs without multisample. Avoid this problem by using glXChooseFBConfig, when available, to find a GLXFBConfig with the requested capabilities and then using glXGetVisualFromFBConfig to find the corresponding X11 Visual. This allows the game to run, although it doesn't make me any better at actually playing it... Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Fixes: https://forums.developer.nvidia.com/t/prime-run-cannot-create-window-x-glxcreatecontext/180214 [1] https://github.com/Drewol/unnamed-sdvx-clone
Adam a2031948 2021-07-28T14:06:51 Added in a MIME-type to the X11 clipboard. (#4385)
Mathieu Eyraud 8e604a5f 2021-07-25T18:44:33 Fix error handling in X11_SetWindowTitle X11_XChangeProperty return 1 on success.
Sam Lantinga ff1b5e1b 2021-07-24T15:10:57 Implemented the window flash operations for X11
Sam Lantinga f1633127 2021-07-24T13:41:55 Added a window flash operation to be explicit about window flash behavior
Sam Lantinga e1c3a250 2021-07-24T12:11:27 Changed SDL_FlashWindow() so it doesn't take a flash count, and added the hint SDL_HINT_WINDOW_FLASH_COUNT to control behavior on Windows
Austin Shafer 16e3bfe8 2021-06-28T11:29:16 SetDisplayMode: Call XRRSetScreenSize before setting CRTC config X11_SetDisplayMode currently calls X11_XRRSetCrtcConfig alone. This results in the monitor's viewport getting changed, but the underlying screen dimensions stay the same. The spec indicates that RRSetCrtcConfig only changes the crtc mode and has no effect on the screen dimensions, only mentioning that the new crtc must fit entirely within the screen size. For the size to change, RRSetScreenSize also needs to be called. This affects Metro Exodus on Linux, when changing the resolution in the in-game settings Metro gets stuck in a loop waiting for the size of its vulkan surface to change. Because XRRSetScreenSize is not called the screen size is never changed, the vulkan surface dimensions do not change, and Metro hangs forever watching for a surface size update that will never come. This change disables the CRTC, calls XRRSetScreenSize, and then updates the CRTC configuration. This fixes changing the resolution from the Metro settings. Tested with: Metro Exodus, Portal 2
Ryan C. Gordon e65a6583 2021-06-09T22:10:20 x11: Add a hint to force override-redirect. Fixes #3776.
Jupeyy 64724db0 2021-06-04T19:55:30 Implement bare minimum for SDL_FlashWindow
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.
Kyle Schaefer 4522cb1d 2021-05-25T03:17:03 Changing variable from float to int, this way we can check it's value without having to do an unnecessary conversion. Then do explicit conversions later on if we need.
Kyle Schaefer c289bad9 2021-03-22T11:22:31 In x11, GetDisplayDPI can give incorrect or unusable DPI information. Using XGetDefaults to get the Xft DPI if it's available and returning that. This could allow you to figure out DPI scale.
Sylvain 62a562de 2021-05-12T23:37:18 X11: use x11sym loaded functions (see bug #3978)
Sylvain 531d83bf 2021-05-12T23:13:48 X11: allow using touchscreen, while pointer is grabbed (see bug #3978)
Fredrick Brennan c5dd9964 2021-04-07T12:14:16 Copied X11 error handler code from SDL_x11opengl.c Avoids needing to malloc to hold the error string.
Fredrick Brennan b3b4677e 2021-04-07T11:17:52 (X11) Set _NET_WM_NAME properly, fixes Unicode window titles Removes deprecated code meant to support extremely ancient, pre-UTF-8 versions of Xorg. Uses new xlib API's for doing this same thing. Closes #4288.
Ryan C. Gordon 1f482174 2021-04-25T12:44:35 x11: Mark backing_store as NotUseful when creating windows. This can give some performance boost, and save some resources, as there's no reason to keep a copy of an SDL window's contents on the server: most SDL apps are redrawing completely every frame, and the API allows for expose events to tell an app a redraw is needed anyhow. (And compositors are free to ignore this setting if it makes sense to do so, according to the Xlib docs.) Reference Issue #3776.
Ryan C. Gordon 9c063468 2021-04-24T19:47:10 x11: call XSync before XSetInputFocus during SDL_ShowWindow. This only happens when using a non-NET_WM window manager, as we might try to set the focus before the window is mapped. Fixes #3949.
Cacodemon345 0838f53d 2021-04-21T11:41:08 Implement SDL_SetWindowAlwaysOnTop for X11
ReNoM de6d2902 2021-04-19T21:48:11 Fix keymap updating for X11 backend
Ryan C. Gordon dbdbae44 2021-04-02T14:35:11 linux: (de)initialize d-bus at init and quit. Previously we had different subsystems quitting it, in conflict, and risked multiple threads racing to init it at the same time. Fixes #3643.
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 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 a0d3c6c6 2021-01-25T21:42:14 Rename SetWindowGrab() to SetWindowMouseGrab()
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.
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