Skip to content

Commit

Permalink
SDL_USE_IME
Browse files Browse the repository at this point in the history
  • Loading branch information
Hunt Lin committed Sep 10, 2020
1 parent 93d4c0a commit 75b4260
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
1 change: 1 addition & 0 deletions sdl2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ fn patch_sdl2(sdl2_source_path: &Path) {
("SDL2-2.0.10-CMakeLists.txt.patch", include_str!("patches/SDL2-2.0.10-CMakeLists.txt.patch")),
// https://bugzilla.libsdl.org/show_bug.cgi?id=5105
("SDL2-2.0.10-sndio-shared-linux.patch", include_str!("patches/SDL2-2.0.10-sndio-shared-linux.patch")),
("SDL2-2.0.10-SDL_USE_IME.patch", include_str!("patches/SDL2-2.0.10-SDL_USE_IME.patch")),
];
let sdl_version = format!("SDL2-{}", LASTEST_SDL2_VERSION);

Expand Down
71 changes: 71 additions & 0 deletions sdl2-sys/patches/SDL2-2.0.10-SDL_USE_IME.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
From 278b2210204a68a74c67605fd8b622f155ece5f0 Mon Sep 17 00:00:00 2001
From: Hunt Lin <[email protected]>
Date: Thu, 10 Sep 2020 11:22:20 +0800
Subject: [PATCH] SDL_USE_IME

---
CMakeLists.txt | 14 ++++++++++++++
include/SDL_config.h.cmake | 2 ++
2 files changed, 16 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 610f150..dbc64ec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1062,6 +1062,10 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID)
#endif
int main(int argc, char** argv) {}" HAVE_INPUT_EVENTS)

+ check_c_source_compiles("
+ #include <X11/keysym.h>
+ int main(int argc, char** argv) {}" HAVE_IME)
+
check_c_source_compiles("
#include <linux/kd.h>
#include <linux/keyboard.h>
@@ -1080,6 +1084,10 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID)
set(SDL_INPUT_LINUXEV 1)
endif()

+ if(HAVE_IME)
+ set(SDL_USE_IME 1)
+ endif()
+
if(SDL_HAPTIC AND HAVE_INPUT_EVENTS)
set(SDL_HAPTIC_LINUX 1)
file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/linux/*.c)
@@ -1116,6 +1124,12 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID)
endif()

check_include_file("fcitx/frontend.h" HAVE_FCITX_FRONTEND_H)
+
+ if(HAVE_FCITX_FRONTEND_H)
+ set(SDL_USE_IME 1)
+ endif()
+
+ set(SDL_USE_IME 1)
endif()

if(INPUT_TSLIB)
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index 5e9e5bc..120f4f6 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -198,6 +198,7 @@
#cmakedefine HAVE_ALTIVEC_H 1
#cmakedefine HAVE_DBUS_DBUS_H 1
#cmakedefine HAVE_FCITX_FRONTEND_H 1
+#cmakedefine HAVE_IME 1
#cmakedefine HAVE_IBUS_IBUS_H 1
#cmakedefine HAVE_IMMINTRIN_H 1
#cmakedefine HAVE_LIBSAMPLERATE_H 1
@@ -274,6 +275,7 @@
/* Enable various input drivers */
#cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@
#cmakedefine SDL_INPUT_LINUXKD @SDL_INPUT_LINUXKD@
+#cmakedefine SDL_USE_IME @SDL_USE_IME@
#cmakedefine SDL_INPUT_TSLIB @SDL_INPUT_TSLIB@
#cmakedefine SDL_JOYSTICK_ANDROID @SDL_JOYSTICK_ANDROID@
#cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@
--
2.25.1

0 comments on commit 75b4260

Please sign in to comment.