src/video/x11


Log

Author Commit Date CI Message
Ryan C. Gordon 4ca7b378 2022-08-21T11:35:14 x11: Specify windowed dimensions when creating fullscreen windows. This lets the window manager adjust the window correctly if it ever leaves fullscreen mode. Fixes #5725.
Sam Lantinga 8acb4e45 2022-08-17T14:25:30 Fixed interactions between mouse capture and grab on X11 Fixes https://github.com/libsdl-org/SDL/issues/6072
Ryan C. Gordon b599205d 2022-08-09T09:50:55 x11: Don't look up xinput2 devices unless we're in relative mode.
Ozkan Sezer 293d29b7 2022-08-04T10:11:02 SDL_x11xinput2.c: fix build for macOS
Ryan C. Gordon 5907db56 2022-08-04T02:11:21 x11: Attempt to deal with XInput2 devices with absolute coordinates. This is untested! Reference Issue #1836.
Shootfast 60d1944e 2022-07-06T20:12:30 SDL_video: Added SDL_GL_FLOATBUFFERS to allow Cocoa GL contexts to use EDR
Sam Lantinga 3a6cb7e7 2022-08-01T10:28:29 Convert XLookupString Latin-1 text to UTF-8 Fixes bug https://github.com/libsdl-org/SDL/issues/4699
Cameron Gutman 8b438f7b 2022-07-31T15:34:03 keyboard: Only send SDL_KEYMAPCHANGED when the keymap actually changes
Sam Lantinga dbf79405 2022-07-27T10:31:24 Enable capturing raw Xinput2 touch events and use to flag global mouse state as dirty - Touch events may be translated to mouse movement events without the normal Xinput2 raw motion events being sent. Not all touch events will necessarily move the mouse but this ensures we update the global mouse state just in case. - Fix up some formatting CR: saml
Ryan C. Gordon 20a76b0e 2022-07-25T23:06:58 video: removed unused devindex argument from bootstrap's create method.
Ryan C. Gordon fdb86b82 2022-07-04T12:48:32 x11: Don't try to use XInput2 multitouch if not supported. Fixes #5889.
rohlem b085c182 2022-07-04T16:38:05 make SDL_SetTextInputRect take a pointer to const The documentation doesn't state that the argument is ever modified, and no implementation does so currently. This is a non-breaking change to guarantee as much to callers.
Ryan C. Gordon 12b371ee 2022-06-21T14:49:00 x11: Don't send diplay-add events for displays connected at init time. Reference Issue #4977.
Simon McVittie 63b3b9a5 2022-06-13T16:02:40 Fix some typos in diagnostic messages Detected by Debian's packaging QA tool, Lintian. Signed-off-by: Simon McVittie <smcv@collabora.com>
Ryan C. Gordon b75cd2b3 2022-06-10T14:12:03 x11: Force window back to expected size after SDL_SetWindowBordered. This helps if the window manager decided to let it fill the space that an existing border was using before its removal. Fixes #5718.
Ryan C. Gordon ec0204d2 2022-06-06T14:38:26 x11: Don't use GetXftDPI() when XRandR can tell us the DPI per-output. Fixes #5764.
Ryan C. Gordon a236bf4f 2022-06-06T02:13:37 x11: Hook up display hotplug notifications. Obviously this needs XRandR support. Fixes #4977.
Simon McVittie 412ceb84 2022-05-24T16:27:54 video: Only check major version in SDL_GetWindowWMInfo Since #5602, SDL is intended to have the same ABI across the whole major-version 2 cycle, so we should not check that the minor version matches the one that was used to compile an application. There are two checks that could make sense here. The first check is that the major version matches the expected major version. This is usually unnecessary and is not usually done (if we're calling into the wrong library we'll likely crash anyway), but since we have the information, we might as well continue to use it. The second check is whether the version provided by the caller is equal to or greater than a threshold version at which additional fields were added to the struct. If it is, we should populate those fields; if it is not, then we cannot. This is only useful on platforms where additional fields have genuinely been added during the lifetime of SDL 2, like Windows and DirectFB (but not X11). This commit changes the first check to be consistent about only looking at the minor version, while leaving the second check using SDL_VERSIONNUM (which will be removed or widened in SDL 3, but it's fine for now). Resolves: https://github.com/libsdl-org/SDL/issues/5711 Fixes: cd7c2f1 "Switch versioning scheme to be the same as GLib and Flatpak" Signed-off-by: Simon McVittie <smcv@collabora.com>
Ryan C. Gordon 9edd411a 2022-05-19T17:15:10 x11: send move/resize events when waiting on fullscreen change. Otherwise we ignore the Configure/etc events when they come in because the window is already in an identical state as far as SDL is concerned. Fixes #5593. May also fix: Issue #5572. Issue #5595.
Pierre Wendling 501a4991 2022-05-05T18:44:32 Add clang-format on/off comments where necessary. Comments were added in places where INDENT-ON/OFF comments are. Places like stdlib's asm don't need it as clang-format doesn't try to indent it.
Sam Lantinga c7dff3a2 2022-05-19T00:35:22 Attempt to get the X1 and X2 button state on X11 by using the current event state instead of direct X11 query.
Sam Lantinga 57130b75 2022-05-19T00:31:20 Revert "x11: get x1/x2 button state in GetGlobalMouseState" This reverts commit 3fcc2cb500a752698687ad0c8bb14778e6cb84c3. Button4 and Button5 are for the scrollwheel, not the extended buttons. I don't know of a way to query the state of the extended buttons using X11.
Ryan C. Gordon 2317a96c 2022-05-16T10:50:13 x11: Use XC_top_left_corner/XC_top_right_corner instead of XC_fleur. On Gnome (and hopefully others!), this produces something that actually matches SDL_SYSTEM_CURSOR_SIZENWSE/SDL_SYSTEM_CURSOR_SIZENESW. On other desktop enviroments, it probably fits the spirit better than XC_fleur in any case. Reference Issue #2123.
emily 3fcc2cb5 2022-05-03T11:19:39 x11: get x1/x2 button state in GetGlobalMouseState
Ozkan Sezer 12f15aaa 2022-04-27T10:03:32 fix build
Ryan C. Gordon 05bd225a 2022-04-26T23:14:44 x11: If XRandR isn't available, add a generic display. We can get _some_ of the info we need out of standard Xlib and report a single display (which might actually be multiple physical displays mushed into a single desktop). This is better than nothing, but you should really just build with XRandR support and get a better X server. :)
Ryan C. Gordon ccc70e64 2022-04-26T23:14:21 x11: Fixed some compiler warnings.
Ryan C. Gordon 7d7ec9c9 2022-04-26T16:41:28 x11: Remove XVidMode and Xinerama support. Fixes #1782.
Sam Lantinga 01ef98a5 2022-04-26T10:19:03 Don't force keyboard auto-repeat on, if the user has disabled it for some reason Fixes https://github.com/libsdl-org/SDL/issues/2400
Ryan C. Gordon 53dea983 2022-04-25T13:51:15 x11: revert checks for _NET_WM_STATE_FULLSCREEN changes. This reverts commit 85977354fbce9ecb2add660a88e6bec3532c3e26. This reverts commit 0249df9d960f9bc28b476e1171c5501fc37cca12. Fixes #5572. Reopens #5390.
Sam Lantinga 02225aa7 2022-04-18T22:57:03 Fixed build
Ryan C. Gordon 49a2e4b0 2022-04-19T00:36:53 x11: Revert "Fix keymap updating for X11 backend" This reverts commit de6d290266d1def0eef9df81bf9be41c12a98c61. This patch had multiple issues, discussed in #5520.
Ryan C. Gordon 67e0f546 2022-04-15T18:24:57 x11: Update the display when the WM changes a window's fullscreen state. Fixes #5390.
Sam Lantinga 49b9e347 2022-04-07T08:24:03 Only update modifier state for keys that are pressed in another application Fixes https://github.com/libsdl-org/SDL/issues/4432
Ryan C. Gordon 85977354 2022-04-07T09:14:33 x11: Treat WM setting the window "fullscreen" like FULLSCREEN_DESKTOP. Fixes #5390.
Ryan C. Gordon 0249df9d 2022-04-05T23:04:19 x11: Try to keep SDL_WINDOW_FULLSCREEN* in sync with window manager. So if Gnome/KDE/etc have a keyboard shortcut or titlebar decoration to make any window go fullscreen (with the _NET_WM_FULLSCREEN flag on the _NET_WM_STATE property), we update the SDL window flag. Fixes #5390.
Weng Xuetian 138d96c8 2022-04-05T19:30:25 Send key release event to input method. (#5281) Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
Ryan C. Gordon 8bae343f 2022-04-05T22:19:25 x11: when waiting on fullscreen changes, not window position _and_ size. This makes sure the window doesn't have outdated values if you try to access them (or call something that does, like SDL_SetWindowMinimumSize). Fixes #5233.
Ryan C. Gordon a5672b85 2022-04-05T11:10:41 x11: Wait a bit to see if window pos changes when changing fullscreen. Helps prevent window from moving to 0,0 when leaving fullscreen. Fixes #4749.
Cameron Gutman 45372b1c 2022-04-04T21:36:25 x11: Don't unload libGL.so to prevent a crash in XCloseDisplay() libGL.so may register callbacks that can be invoked upon XCloseDisplay(). If XCloseDisplay() is called after libGL.so is unloaded, the callback pointer will point at freed memory and invoking it will crash. The texture framebuffer check optimized out in f37e4a9 was causing libGL.so to never be unloaded as a side-effect. Skipping it exposed this bug by allowing libGL.so to actually unload.
Ryan C. Gordon 1c7bf478 2022-03-31T10:09:02 x11: Ignore BadValue for extremely small XRRSetScreenSize resolutions. Reference Issue #4840.
Ryan C. Gordon 7e15ad2f 2022-03-30T14:15:52 x11: Catch X11 errors in X11_SetWindowPosition and X11_SetWindowSize. The functions can go south if other operations are in progress, like X11_SetWindowBordered, which might be doing something traumatic behind the scenes of the window manager. We can't make these tasks totally synchronous, which would fix the problem, because not only can the window manager block however long it wants, it might also decide to deny our requests without any notification, so we'd be waiting forever for a window change that isn't coming. :( Fixes #5274.
Ryan C. Gordon d597a9b4 2022-03-24T14:25:00 x11: Minor cleanups and corrections in X11_ShowMessageBox. Reference issue #3254.
Sylvain 6c56193a 2022-03-24T18:09:45 Fixed bug #1650: X11 doesn't set KMOD_NUM and KMOD_CAPS to system state
Sylvain 85e65000 2022-02-11T11:08:08 X11 Segmentation fault with multiple windows and renderers (see #5256)
Sylvain 8c660ccb 2022-01-25T17:14:01 Fixed bug #5256: X11 Segmentation fault with multiple windows and renderers First window is created and it triggers and 'EnterNotify' event which calls SDL_SetMouseFocus() and X11_ShowCursor() while the second windows hasn't finished to be created (eg window->driverdata isn't set) Just check for a valid 'driverdata'
Ryan C. Gordon 42302d0a 2022-01-11T21:17:21 x11: Let apps specify a custom _NET_WM_WINDOW_TYPE. Fixes #5185.
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
rohlem 0403fa8a 2022-01-02T02:36:23 X11_WaitEventTimeout: remove unreachable return If that condition was reachable, the return value should be negative to indicate that waiting for the timeout failed. Otherwise, SDL_WaitEventTimeout would incorrectly return early.
Sylvain 6101499c 2021-12-16T09:07:31 BigEndian: fix code that generates illegal instruction with gcc-4.9.2 on powerpc Program received signal SIGILL, Illegal instruction. X11_InitKeyboard (_this=0x1001f8f0) at /home/sdl/SDL_git/src/video/x11/SDL_x11keyboard.c:273 273 XKeyboardState values = { .global_auto_repeat = AutoRepeatModeOff };
David Gow 9da93d07 2021-12-08T12:38:16 video: x11: Set XImage's byte_order field (fix #5081) If the X server's byte order is different from the client, things might display in the wrong colour. Apparently we can just set the byte_order field to the client's byte order, and the X server will adjust everything automatically: https://xorg.freedesktop.narkive.com/GbSD1aPq/ximage-s-byte-order-field
Ozkan Sezer 03019c91 2021-12-06T20:37:52 autotools, cmake: tighten Xfixes check && explicitly test BarrierEventID Apparently the older versions of libXi doesn't have it. Fixes the build break issue reported at: https://github.com/libsdl-org/SDL/commit/4b42c05ba1eaaaa9a4ef803acea8f13402271039#commitcomment-61427659
David Gow f6fdbc1e 2021-11-29T21:16:15 video: x11: Fix an invalid SDL_LogError() call This fixes a compile warning — and possible invalid memory read — introduced in 9c03d255 ("Add back X11 legacy WM_NAME encodings"), which was part of PR #5029, fixing Bug #4924. The issue is with one of the added warnings in X11_GetWindowTitle(). Basically, the "title" variable passed to SDL_LogError() hasn't been initialised yet: we could pass propdata in directly, but it's better to move the SDL_LogError() call until after title is set, IMHO. This fixes the following warning from gcc (SUSE Linux) 11.2.1: In file included from /home/david/Development/SDL/src/video/x11/../../SDL_internal.h:45, from /home/david/Development/SDL/src/video/x11/SDL_x11window.c:21: /home/david/Development/SDL/src/video/x11/SDL_x11window.c: In function 'X11_GetWindowTitle': /home/david/Development/SDL/src/video/x11/../../dynapi/SDL_dynapi_overrides.h:33:22: warning: '%s' directive argument is null [-Wformat-overflow=] 33 | #define SDL_LogDebug SDL_LogDebug_REAL /home/david/Development/SDL/src/video/x11/SDL_x11window.c:720:13: note: in expansion of macro 'SDL_LogDebug' 720 | SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Failed to convert WM_NAME title expecting UTF8! Title: %s", title); | ^~~~~~~~~~~~
Fredrick Brennan b5d47aa2 2021-11-28T23:15:31 Fix comment style for old compilers (`//`⇒`/**/`)
Fredrick Brennan 367684b0 2021-11-28T22:56:24 Add patches suggested by @slouken in round 1 review
Fredrick Brennan 9c03d255 2021-11-28T16:18:39 Add back X11 legacy WM_NAME encodings Closes #4924. Based on patches of the past, such as this work by James Cloos in July 2010: https://github.com/exg/rxvt-unicode/commit/d7d98751b7385416ad1694b5f1fde6c312ba20d5, as well as code comments in the Perl module X11::Protocol::WM (https://metacpan.org/pod/X11::Protocol::WM) and even the code to Xlib itself, which taught me that we should never have been using `XStoreName`, all it does is call `XChangeProperty`, hardcoded to `XA_STRING`! What can I say, when the task is old school, the sources are too 😂
Sylvain fae70349 2021-11-23T10:33:12 Fix warnings: static, include, un-initialized vairables
Sylvain 8dd6edec 2021-11-23T09:30:42 Fixed bug #3232 - Integer overflow generates Illegal instruction under sanitizers + see bug #4995
Sylvain 9fcc630f 2021-11-22T16:37:34 X11: use SDL_malloc
Sylvain b4aeaa30 2021-11-22T11:20:52 Use SDL_calloc / SDL_free
Sylvain d31251b0 2021-11-21T22:30:48 use SDL's functions version inplace of libc version
Ozkan Sezer 7dfd22ac 2021-11-14T02:32:00 fix XGetDefault signature - its first and second params are _Xconst
Cameron Gutman eb3f1462 2021-11-12T18:26:15 x11: Fix memory leak in X11_CreatePixmapCursor()
Sam Lantinga c2dd50a9 2021-11-12T08:28:02 Fixed whitespace
Sam Lantinga eda4c407 2021-11-10T12:46:54 Make sure the X event is an Xkb event before checking the Xkb event type
Sam Lantinga 18e69827 2021-11-08T22:29:02 Fixed Linux build
Sam Lantinga fd79607e 2021-11-08T21:34:48 Added SDL_GetWindowMouseRect() Also guarantee that we won't get mouse movement outside the confining area, even if the OS implementation allows it (e.g. macOS)
Cameron Gutman 9c95c249 2021-11-08T20:01:56 x11: Use XCheckIfEvent() instead of XNextEvent() for thread-safety A racing reader could read from our fd between SDL_IOReady()/X11_Pending() and our call to XNextEvent() which will cause XNextEvent() to block for more data. Avoid this by using XCheckIfEvent() which will never block. This also fixes a bug where we could poll() for data, even when events were already read and pending in the queue. Unlike the Wayland implementation, this isn't totally thread-safe because nothing prevents a racing reader from reading events into the queue between our XCheckIfEvent() and SDL_IOReady() calls, but I think this is the best we can do with Xlib.
Sam Lantinga 7d21322d 2021-11-08T16:29:19 Implemented SDL_SetWindowMouseRect() on Windows
Ethan Lee 4b42c05b 2021-11-08T13:52:48 video: Add SDL_SetWindowMouseRect. This API and implementation comes from the Unreal Engine branch of SDL, which originally called this "SDL_ConfineCursor". Some minor cleanup and changes for consistency with the rest of SDL_video, but there are two major changes: 1. The coordinate system has been changed so that `rect` is _window_ relative and not _screen_ relative, making it easier to implement without having global access to the display. 2. The UE version unset all rects when passing `NULL` as a parameter for `window`, this has been removed as it was an unused feature anyhow. Currently this is only implemented for X, but can be supported on Wayland and Windows at minimum too.
Sam Lantinga 6c56e275 2021-11-08T07:05:17 Set both _NET_WM_NAME and WM_NAME so SDL windows can be shared in the browser. Fixes https://github.com/libsdl-org/SDL/issues/4924
Cameron Gutman a5598649 2021-10-30T19:30:34 x11/wayland: Fix signal handling while blocking in WaitEventTimeout() Add a new flag to avoid suppressing EINTR in SDL_IOReady(). Pass the flag in WaitEventTimeout() to ensure that a SIGINT will wake up SDL_WaitEvent() without another event coming in.
Cameron Gutman c97c4687 2021-10-30T15:56:54 core: Convert SDL_IOReady()'s 2nd parameter to flags
Cameron Gutman f499168c 2021-10-24T15:54:57 x11: Use SDL_IOReady() instead of calling select() directly SDL_IOReady() properly handles EINTR and can use poll() if available.
Cacodemon345 19dee1cd 2021-10-22T06:37:20 Add SDL_GetWindowICCProfile(). (#4314) * Add SDL_GetWindowICCProfile * Add new SDL display events * Implement ICC profile change event for macOS * Implement ICC profile notification for Windows * Fix SDL_GetWindowICCProfile() for X11 * Fix compile errors
Sylvain 649a33ae 2021-10-18T23:00:43 X11: remove redundant 'wakeup_lock' mutex creation
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.