bc2648e525
- Support legacy 'pulse' alias for PulseAudio driver - Fix handling of Ctrl key on Wayland - Add support for HiDPI cursors on Wayland - Fix keymap support on Wayland (rhbz#2007969) - Use EGL_EXT_present_opaque when available on Wayland - Expose xdg_toplevel to SysWM on Wayland
105 lines
3.4 KiB
Diff
105 lines
3.4 KiB
Diff
From 7ed415d2edfa44e554605a0b5616c836680756ed Mon Sep 17 00:00:00 2001
|
|
From: Ethan Lee <flibitijibibo@gmail.com>
|
|
Date: Thu, 23 Sep 2021 14:07:38 -0400
|
|
Subject: [PATCH] wayland: Reuse KeySymToUcs4 to replicate X11 keymap behavior
|
|
|
|
---
|
|
src/{video/x11 => events}/imKStoUCS.c | 7 +++----
|
|
src/{video/x11 => events}/imKStoUCS.h | 2 +-
|
|
src/video/wayland/SDL_waylandevents.c | 3 ++-
|
|
src/video/x11/SDL_x11keyboard.c | 4 ++--
|
|
4 files changed, 8 insertions(+), 8 deletions(-)
|
|
rename src/{video/x11 => events}/imKStoUCS.c (99%)
|
|
rename src/{video/x11 => events}/imKStoUCS.h (96%)
|
|
|
|
diff --git a/src/video/x11/imKStoUCS.c b/src/events/imKStoUCS.c
|
|
similarity index 99%
|
|
rename from src/video/x11/imKStoUCS.c
|
|
rename to src/events/imKStoUCS.c
|
|
index 40e224243..4aa85d423 100644
|
|
--- a/src/video/x11/imKStoUCS.c
|
|
+++ b/src/events/imKStoUCS.c
|
|
@@ -24,10 +24,9 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
-#include "../../SDL_internal.h"
|
|
+#include "../SDL_internal.h"
|
|
|
|
-#if SDL_VIDEO_DRIVER_X11
|
|
-#include <X11/X.h>
|
|
+#if SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_WAYLAND
|
|
#include "imKStoUCS.h"
|
|
|
|
static unsigned short const keysym_to_unicode_1a1_1ff[] = {
|
|
@@ -294,7 +293,7 @@ static unsigned short const keysym_to_unicode_20a0_20ac[] = {
|
|
};
|
|
|
|
unsigned int
|
|
-X11_KeySymToUcs4(KeySym keysym)
|
|
+SDL_KeySymToUcs4(Uint32 keysym)
|
|
{
|
|
/* 'Unicode keysym' */
|
|
if ((keysym & 0xff000000) == 0x01000000)
|
|
diff --git a/src/video/x11/imKStoUCS.h b/src/events/imKStoUCS.h
|
|
similarity index 96%
|
|
rename from src/video/x11/imKStoUCS.h
|
|
rename to src/events/imKStoUCS.h
|
|
index fe4381d98..485ace59f 100644
|
|
--- a/src/video/x11/imKStoUCS.h
|
|
+++ b/src/events/imKStoUCS.h
|
|
@@ -27,6 +27,6 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
-extern unsigned int X11_KeySymToUcs4(KeySym keysym);
|
|
+extern unsigned int SDL_KeySymToUcs4(Uint32 keysym);
|
|
|
|
#endif /* _imKStoUCS_h */
|
|
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
|
|
index 82df0fb05..4cfd0f1cd 100644
|
|
--- a/src/video/wayland/SDL_waylandevents.c
|
|
+++ b/src/video/wayland/SDL_waylandevents.c
|
|
@@ -60,6 +60,7 @@
|
|
#include <unistd.h>
|
|
#include <xkbcommon/xkbcommon.h>
|
|
#include <xkbcommon/xkbcommon-compose.h>
|
|
+#include "../../events/imKStoUCS.h"
|
|
|
|
/* Weston uses a ratio of 10 units per scroll tick */
|
|
#define WAYLAND_WHEEL_AXIS_UNIT 10
|
|
@@ -870,7 +871,7 @@ Wayland_keymap_iter(struct xkb_keymap *keymap, xkb_keycode_t key, void *data)
|
|
}
|
|
|
|
if (WAYLAND_xkb_keymap_key_get_syms_by_level(keymap, key, sdlKeymap->layout, 0, &syms) > 0) {
|
|
- uint32_t keycode = WAYLAND_xkb_keysym_to_utf32(syms[0]);
|
|
+ uint32_t keycode = SDL_KeySymToUcs4(syms[0]);
|
|
if (keycode) {
|
|
sdlKeymap->keymap[scancode] = keycode;
|
|
} else {
|
|
diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c
|
|
index bcc994f9f..2d8c24ccc 100644
|
|
--- a/src/video/x11/SDL_x11keyboard.c
|
|
+++ b/src/video/x11/SDL_x11keyboard.c
|
|
@@ -31,7 +31,7 @@
|
|
#include <X11/keysym.h>
|
|
#include <X11/XKBlib.h>
|
|
|
|
-#include "imKStoUCS.h"
|
|
+#include "../../events/imKStoUCS.h"
|
|
|
|
#ifdef X_HAVE_UTF8_STRING
|
|
#include <locale.h>
|
|
@@ -205,7 +205,7 @@ X11_KeyCodeToUcs4(_THIS, KeyCode keycode, unsigned char group)
|
|
return 0;
|
|
}
|
|
|
|
- return X11_KeySymToUcs4(keysym);
|
|
+ return SDL_KeySymToUcs4(keysym);
|
|
}
|
|
|
|
KeySym
|
|
--
|
|
2.32.0
|
|
|