aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/platform/gui/xcb/CMakeLists.txt4
-rw-r--r--src/platform/gui/xcb/InputMethod.cpp19
-rw-r--r--src/platform/gui/xcb/Keyboard.cpp6
3 files changed, 7 insertions, 22 deletions
diff --git a/src/platform/gui/xcb/CMakeLists.txt b/src/platform/gui/xcb/CMakeLists.txt
index 35feb8bc..5adeb923 100644
--- a/src/platform/gui/xcb/CMakeLists.txt
+++ b/src/platform/gui/xcb/CMakeLists.txt
@@ -1,7 +1,7 @@
-find_library(LIBRARY_CAIRO cairo REQUIRED)
find_library(LIBRARY_XCB xcb REQUIRED)
find_library(LIBRARY_XCB_CURSOR xcb-cursor REQUIRED)
find_library(LIBRARY_XCB_IMDKIT xcb-imdkit REQUIRED)
+find_library(LIBRARY_XKBCOMMON xkbcommon REQUIRED)
add_library(CruPlatformGuiXcb
Cursor.cpp
InputMethod.cpp
@@ -11,5 +11,5 @@ add_library(CruPlatformGuiXcb
)
target_link_libraries(CruPlatformGuiXcb PUBLIC
CruPlatformGui CruPlatformGraphicsCairo
- ${LIBRARY_XCB} ${LIBRARY_XCB_CURSOR} ${LIBRARY_XCB_IMDKIT} ${LIBRARY_CAIRO}
+ ${LIBRARY_XCB} ${LIBRARY_XCB_CURSOR} ${LIBRARY_XCB_IMDKIT} ${LIBRARY_XCB_XKBCOMMON}
)
diff --git a/src/platform/gui/xcb/InputMethod.cpp b/src/platform/gui/xcb/InputMethod.cpp
index 49dadbf1..61753bf3 100644
--- a/src/platform/gui/xcb/InputMethod.cpp
+++ b/src/platform/gui/xcb/InputMethod.cpp
@@ -57,23 +57,6 @@ XcbXimInputMethodManager::XcbXimInputMethodManager(
}
}
}
- },
- .preedit_start =
- [](xcb_xim_t *im, xcb_xic_t ic, void *user_data) {
-
- },
- .preedit_draw =
- [](xcb_xim_t *im, xcb_xic_t ic, xcb_im_preedit_draw_fr_t *frame,
- void *user_data) {
- auto manager = static_cast<XcbXimInputMethodManager *>(user_data);
- CompositionText text;
- if (!(frame->status & 1)) {
- text.text = String::FromUtf8(
- reinterpret_cast<const std::byte *>(frame->preedit_string),
- frame->length_of_preedit_string);
- text.selection = frame->caret;
- }
- manager->DispatchComposition(im, ic, std::move(text));
}};
xcb_compound_text_init();
@@ -235,7 +218,7 @@ void XcbXimInputMethodContext::CreateIc(xcb_window_t window) {
};
uint32_t input_style =
- XCB_IM_PreeditArea | XCB_IM_PreeditCallbacks | XCB_IM_StatusNothing;
+ XCB_IM_PreeditArea | XCB_IM_PreeditPosition | XCB_IM_StatusNothing;
xcb_xim_create_ic(manager_->GetXcbXim(), XimCreateIcCallback, this,
XCB_XIM_XNInputStyle, &input_style, XCB_XIM_XNClientWindow,
&window, XCB_XIM_XNFocusWindow, &window, NULL);
diff --git a/src/platform/gui/xcb/Keyboard.cpp b/src/platform/gui/xcb/Keyboard.cpp
index c52f7cc1..f49cac51 100644
--- a/src/platform/gui/xcb/Keyboard.cpp
+++ b/src/platform/gui/xcb/Keyboard.cpp
@@ -7,6 +7,7 @@
#include <xcb/xcb.h>
#include <xcb/xproto.h>
#include <bitset>
+#include <cctype>
#include <climits>
#include <unordered_map>
#include <utility>
@@ -114,9 +115,10 @@ KeyCode XorgKeycodeToCruKeyCode(XcbUiApplication *application,
return KeyCode::Unknown;
}
-std::string XorgKeysymToUtf8(xcb_keysym_t keysym) {
+std::string XorgKeysymToUtf8(xcb_keysym_t keysym, bool upper) {
if (0x20 <= keysym && keysym <= 0x7e || 0xa0 <= keysym && keysym <= 0xff) {
- return std::string{static_cast<char>(keysym)};
+ return std::string{
+ static_cast<char>(upper ? std::toupper(keysym) : keysym)};
}
if (0x01000100 <= keysym && keysym <= 0x0110FFFF) {