Commit Graph

38 Commits

Author SHA1 Message Date
Ryan C. Gordon 7d7ec9c951
x11: Remove XVidMode and Xinerama support.
Fixes #1782.
2022-04-26 23:17:13 -04:00
Sam Lantinga 01ef98a5d0 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
2022-04-26 10:19:52 -07:00
Ryan C. Gordon 49a2e4b0ea
x11: Revert "Fix keymap updating for X11 backend"
This reverts commit de6d290266.

This patch had multiple issues, discussed in #5520.
2022-04-19 00:37:39 -04:00
Sam Lantinga 120c76c84b Updated copyright for 2022 2022-01-03 09:40:21 -08:00
Ozkan Sezer 03019c912a 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:
4b42c05ba1 (commitcomment-61427659)
2021-12-06 20:37:52 +03:00
Fredrick Brennan 367684b0c2 Add patches suggested by @slouken in round 1 review 2021-11-28 21:00:29 -08:00
Fredrick Brennan 9c03d25543 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:
d7d98751b7,
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 😂
2021-11-28 21:00:29 -08:00
Ozkan Sezer 7dfd22ac5e fix XGetDefault signature - its first and second params are _Xconst 2021-11-14 02:32:00 +03:00
Cameron Gutman 9c95c2491c 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.
2021-11-08 19:17:18 -08:00
Ethan Lee 4b42c05ba1 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.
2021-11-08 14:16:54 -08:00
Cacodemon345 19dee1cd16
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
2021-10-21 17:37:20 -07:00
Ryan C. Gordon 478f9eed28
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.
2021-09-20 10:22:50 -04:00
Sam Lantinga ff1b5e1bf7 Implemented the window flash operations for X11 2021-07-24 15:11:36 -07:00
Kyle Schaefer c289bad900 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. 2021-06-01 16:53:39 -07:00
Sylvain 62a562dea2
X11: use x11sym loaded functions (see bug #3978) 2021-05-12 23:37:18 +02:00
ReNoM de6d290266 Fix keymap updating for X11 backend 2021-04-19 15:54:09 -04:00
Sam Lantinga 9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Sam Lantinga a8780c6a28 Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
Dmitry V. Levin 2b1edf4113 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.
2020-01-04 11:05:06 -08:00
Sam Lantinga 5e13087b0f Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Ryan C. Gordon 1ec56f7302 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.
2018-10-20 21:35:48 -04:00
Sam Lantinga 5febdfcece Fixed whitespace 2018-09-24 11:49:25 -07:00
Sam Lantinga e3cc5b2c6b Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Sam Lantinga 0782f9be51 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.
2017-09-05 08:24:38 -07:00
Sam Lantinga 45b774e3f7 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga d0c8bf7f0b Patch from Tapani P?lli to fix a memory leak in X11_InitKeyboard
Patch uses XkbFreeKeyboard to free the memory returned by XkbGetMap.
Earlier implementation called XkbFreeClientMap which frees all the maps
but not data->xkb structure itself, XkbFreeKeyboard will free maps and
the structure.
2016-11-01 10:48:59 -07:00
Alex Baines 5fe984978c Fix double events / no repeat flag on key events when built withoutibus/fcitx
Uses XkbSetDetectableKeyRepeat, and falls back to forcing @im=none if it's not
supported.
2016-10-28 01:28:58 +01:00
Sam Lantinga 5af67f49f4 Fixed bug 3458 - x11: reset deadkeys in StartTextInput/StopTextInput
Eric Wasylishen

The patch makes StartTextInput/StopTextInput call Xutf8ResetIC ( https://www.x.org/releases/X11R7.5/doc/man/man3/XmbResetIC.3.html ) on the XIC of all SDL windows.

This fixes my use case in Quakespasm (Ubuntu 16.04, system keyboard layout set to German. Type the '^' dead key, which opens Quakespasm's developer console and calls SDL_StartTextInput, then press 'e'. I expect the dead key to be ignored.)

Also, here is a patch for sdl2's "checkkeys" for testing this: https://bugzilla-attachments.libsdl.org/attachment.cgi?id=2451
2016-10-17 21:37:26 -07:00
Alex Baines 752931d85e Improve X11 key handling when XKB isn't available + add xvnc scancodes.
Based on a patch by Bill Lash (see bug 3094).
2016-10-03 11:35:34 +01:00
Sam Lantinga 359f59aef5 Fixed bug 3130 - Spacebar not responding
Alex Baines

Make sure group is valid before passing it to XkbKeysymToKeycode.
2016-10-01 14:22:10 -07:00
Alex Baines 7543092add Call setlocale + XSetModifiers before XOpenIM, Work around ibus+xim duplicate events. 2015-09-30 04:16:09 +01:00
Ryan C. Gordon b2510d9cbc x11: fixed incorrect SDL_GetWindowPosition() after resize (thanks, Jason!).
Fixes Bugzilla #3272.
2016-09-29 23:01:43 -04:00
Ryan C. Gordon df4be2f200 x11/wayland/mir: Make the dynamic loading macro salsa a little less messy. 2016-02-18 23:27:58 -05:00
Sam Lantinga 42065e785d Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Jason Wyatt fb37956d9b Supply current group when translating X11 Keycodes to Keysyms. 2015-08-14 16:23:31 +01:00
Ryan C. Gordon c67213f331 X11: Fixed XRandR display detection.
Previously this only worked on X11 when Xinerama was carrying the weight.

Fixes Bugzilla #3062.
2015-08-07 01:02:35 -04:00
Ryan C. Gordon 20ec137763 X11: Call XRefreshKeyboardMapping() when we get various MappingNotify events.
According to the Xlib docs, you need to do this or Xlib's internal state gets
out of sync.
2015-06-30 14:41:17 -04:00
Philipp Wiesemann 0e45984fa0 Fixed crash if initialization of EGL failed but was tried again later.
The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly
uninitialized data structure if loading the library first failed. A later try to
use EGL then skipped initialization and assumed it was previously successful
because the data structure now already existed. This led to at least one crash
in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was
dereferenced to make a call to eglBindAPI().
2015-06-21 17:33:46 +02:00