Commit Graph

92 Commits

Author SHA1 Message Date
Sam Lantinga
818d1d3e80 Fixed bug 1646 - Warnings from clang with -Weverything 2016-11-15 01:30:08 -08:00
Sam Lantinga
0d24495b15 Removed unused constants
Except for SDL_bmp.c where they are historically interesting and I've left them in.
2016-11-15 01:24:58 -08:00
Sam Lantinga
57d01d7d67 Patch from Sylvain to fix clang warnings 2016-11-13 22:57:41 -08:00
Sam Lantinga
74e1dd4c6f Define _GNU_SOURCE when building SDL 2016-11-11 13:14:00 -08:00
Sam Lantinga
d780031277 Fixed bug 3476 - round() needs _GNU_SOURCE on some old systems
Ozkan Sezer

On systems with old glibc, such mine with glibc-2.8, the following warning
is issued and is fixed easily by defining _GNU_SOURCE:

/home/me/SDL2-2.0.5/src/video/x11/SDL_x11modes.c: In function 'CalculateXRandRRefreshRate':
/home/me/SDL2-2.0.5/src/video/x11/SDL_x11modes.c:263: warning: implicit declaration of function 'round'
/home/me/SDL2-2.0.5/src/video/x11/SDL_x11modes.c:263: warning: incompatible implicit declaration of built-in function 'round'
2016-11-06 09:30:06 -08:00
Sam Lantinga
baadd54686 Fixed text input events with UIM
Alex Baines

I realized overnight that my patch probably broke text input events with UIM, and I confirmed that it does. Can't believe I overlooked that... I've been making stupid mistakes in these patches recently, sorry.

Anyway, *this* one seems to fix it properly. Knowing my luck it probably breaks something else.
2016-11-02 02:56:54 -07:00
Alex Baines
8eb762769e Skip duplicate key events sent by IMEs like uim. 2016-11-01 17:38:05 +00: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
Sam Lantinga
a1f427651d Patch from Tapani P?lli to fix a memory leak in X11_GL_CreateContext 2016-11-01 10:46:47 -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
Philipp Wiesemann
f6bcfa0175 X11: Fixed compile warning about unused variable. 2016-10-12 23:38:31 +02:00
Alex Baines
d9e3972acb Fix invalid read from poor setlocale usage. 2016-10-03 15:31:11 +01:00
Sam Lantinga
42f85aa29e Fixed building and using fcitx IME support on Linux 2016-10-08 11:30:07 -07:00
Sam Lantinga
27d4f09929 Implemented SDL_GetHintBoolean() to make it easier to check boolean hints 2016-10-07 23:40:44 -07:00
Sam Lantinga
808c75d1cf Fixed bug 2824 - Add Fcitx Input Method Support
Weitian Leung

Just moved ibus direct call to SDL_IME_* related functions, and adds fcitx IME support (uses DBus, too),
enable with env: SDL_IM_MODULE=fcitx (ibus still the default one)
2016-10-07 18:57:40 -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
Bill Lash
cceca2ac99 Additional patch to correct the number key assignments, and add assignments for keys that were missed 2015-08-15 00:25:52 -05:00
Sam Lantinga
8b64a78da9 Fixed bug 2956 - De-reference videodata without NULL check in X11_DispatchEvent(_THIS) function 2016-10-07 17:26:25 -07:00
Sam Lantinga
d2c8c5094c Fixed build for X11 2016-10-01 14:54:05 -07:00
Sam Lantinga
fa0f417631 Fixed build warnings and errors 2016-10-01 14:48:18 -07: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
Sam Lantinga
0250eb3c4f Fixed bug 3134 - CalculateXRandRRefreshRate() returns incorrect refresh rate due to floating point truncation.
Michael

In SDL_x11modes.c the CalculateXRandRRefreshRate() function performs integer math on values that may return fractional results. This causes a value that would be calculated as 59.99972... to be returned as 59. In Linux the xrandr command returns 60Hz for this particular display mode yet SDL returns 59Hz.

I suggest this function be updated to correctly round the result of the calculation instead of truncating the result.
2016-10-01 14:16:04 -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
4f4c4b629f Added SDL_SetWindowResizable(). (thanks, Ethan!) 2016-09-29 22:52:41 -04:00
Sam Lantinga
67bdbcca44 Implemented SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH on X11 2016-09-29 16:05:29 -07:00
Philipp Wiesemann
d7b9d321fa X11: Fixed typos in error messages and source comments. 2016-05-20 22:15:28 +02:00
Philipp Wiesemann
81235118ab X11: Fixed missing error message if SDL_GetDisplayDPI() failed. 2016-05-20 22:14:40 +02:00
Philipp Wiesemann
e964d00f64 X11: Fixed SDL_GL_GetSwapInterval() returning -1 if interval is unknown.
It should return 0 as a safe default if the interval can not be determined.
2016-05-11 21:11:12 +02:00
Ryan C. Gordon
f647dfe874 x11: Fix a few more XMoveWindow() calls to adjust for border size.
Also, fix my inability to do basic math ('+' should have been '-').
2016-03-04 19:41:16 -05:00
Ryan C. Gordon
02f49fdb53 x11: Deal with window borders better.
- Cache the _NET_FRAME_EXTENTS data locally, so we don't have to query
the X server for them (instead, we update our cached data when PropertyNotify
events alert us to a change).

- Use our cached extents for X11_GetWindowBordersSize(), so it's a fast call.

- Window position was meant to refer to the client area, not the window
decorations, so adjust appropriately when getting/setting the position.
2016-03-04 18:47:19 -05:00
Ryan C. Gordon
2436ca200d x11: better fix for the previous commit's fullscreen vs maximized issue. 2016-02-20 01:03:39 -05:00
Ryan C. Gordon
a4627c5eda x11: Don't mess with fullscreen vs maximized window state on unmapped windows. 2016-02-20 00:44:42 -05: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
Ryan C. Gordon
0e2badc144 x11: Patched to compile with DEBUG_XEVENTS on C89 compilers. 2016-02-12 00:27:21 -05:00
Ryan C. Gordon
45407d0eac x11: Removed an assert.
This assert triggers when run under XMonad. It's safe to pass a zero here
anyhow, as this will still work "well enough" and the original
problem--GNOME printing a warning message--is still fixed because GNOME's
window manager gives us a chance to grab a non-zero user-time value before
this code is run.
2016-02-15 21:49:09 -05:00
Ryan C. Gordon
5ed63ae317 x11: Updated imKStoUCS.* to latest from x.org.
This was a version from XFree86 before now.  :)  Although not much has
changed.
2016-02-08 01:08:21 -05:00
Alex Szpakowski
325921789a x11: Fix AltGr generating an invalid keycode (bug #3244). Thanks Thomas! 2016-01-31 09:39:42 -04:00
Ryan C. Gordon
ed62033366 x11: make last mouse coords sane upon window entry (thanks, Cengiz!).
(and thanks to Cengiz for many of the previous Unreal-related
patches! They were generically credited to Epic Games, but a large
amount of that work was his contribution.)

Fixes Bugzilla #3067.
2016-01-07 19:58:00 -05:00
Ryan C. Gordon
eeb899999f Patched to compile. 2016-01-05 05:22:35 -05:00
Ryan C. Gordon
7605ccf68a Use SDL's stdinc functions instead of C runtime calls. 2016-01-05 02:29:16 -05:00
Ryan C. Gordon
dc532c70e8 Added SDL_WINDOWEVENT_TAKE_FOCUS.
This is for corner cases where a multi-window app is activated and wants to
make a decision about where focus should go.

This patch came from Unreal Engine 4's fork of SDL, compliments of Epic Games.
2016-01-05 02:27:50 -05:00
Ryan C. Gordon
aa4952fdef Added SDL_WINDOWEVENT_HIT_TEST.
This lets windows know when they are dropping a mouse event because their
hit test reported something other than SDL_HITTEST_NORMAL. It lets them know
exactly where in the event queue this happened.

This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.
2015-04-21 10:10:59 -04:00
Ryan C. Gordon
d4aedf9951 Added SDL_SetWindowModalFor().
This is currently only implemented for X11.

This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.
2015-04-21 09:45:58 -04:00
Ryan C. Gordon
e497e46515 Added SDL_SetWindowInputFocus().
This is currently only implemented for X11.

This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.
2016-01-05 02:28:56 -05:00
Ryan C. Gordon
3bdaf4c611 Added SDL_SetWindowOpacity() and SDL_GetWindowOpacity().
This is currently implemented for X11, Cocoa, Windows, and DirectFB.

This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.
2016-01-05 02:46:10 -05:00
Ryan C. Gordon
5696e88e6b Added SDL_GetWindowBordersSize().
This is currently only implemented for X11.

This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.
2016-01-05 02:29:06 -05:00
Ryan C. Gordon
f9af0c0376 x11: Put a matching window_group wmhint on every window created.
This is useful to the Window Manager, so it can know to associate multiple SDL
windows with a single app.
2016-01-05 02:27:26 -05:00
Ryan C. Gordon
8e855f2fbc Added SDL_DROPBEGIN and SDL_DROPCOMPLETE events, plus window IDs for drops.
This allows an app to know when a set of drops are coming in a grouping of
some sort (for example, a user selected multiple files and dropped them all
on the window with a single drag), and when that set is complete.

This also adds a window ID to the drop events, so the app can determine to
which window a given drop was delivered. For application-level drops (for
example, you launched an app by dropping a file on its icon), the window ID
will be zero.
2016-01-05 01:42:00 -05:00