summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/xkb-internal.h5
-rw-r--r--source/rofi.c4
-rw-r--r--source/view.c27
3 files changed, 35 insertions, 1 deletions
diff --git a/include/xkb-internal.h b/include/xkb-internal.h
index 76606460..d9a3debc 100644
--- a/include/xkb-internal.h
+++ b/include/xkb-internal.h
@@ -2,6 +2,7 @@
#define ROFI_XKB_INTERNAL_H
#include <xkbcommon/xkbcommon.h>
+#include <xkbcommon/xkbcommon-compose.h>
struct xkb_stuff {
xcb_connection_t *xcb_connection;
@@ -10,6 +11,10 @@ struct xkb_stuff {
int32_t device_id;
struct xkb_keymap *keymap;
struct xkb_state *state;
+ struct {
+ struct xkb_compose_table *table;
+ struct xkb_compose_state * state;
+ } compose;
};
#endif
diff --git a/source/rofi.c b/source/rofi.c
index 18b9c76f..3842ee14 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -38,6 +38,7 @@
#include <xcb/xcb_aux.h>
#include <xcb/xkb.h>
#include <xkbcommon/xkbcommon.h>
+#include <xkbcommon/xkbcommon-compose.h>
#include <xkbcommon/xkbcommon-x11.h>
#include <X11/X.h>
#include <X11/Xatom.h>
@@ -868,6 +869,9 @@ int main ( int argc, char *argv[] )
xkb.keymap = xkb_x11_keymap_new_from_device ( xkb.context, xcb_connection, xkb.device_id, XKB_KEYMAP_COMPILE_NO_FLAGS );
xkb.state = xkb_x11_state_new_from_device ( xkb.keymap, xcb_connection, xkb.device_id );
+ xkb.compose.table = xkb_compose_table_new_from_locale ( xkb.context, setlocale ( LC_CTYPE, NULL ), 0 );
+ xkb.compose.state = xkb_compose_state_new ( xkb.compose.table, 0 );
+
main_loop = g_main_loop_new ( NULL, FALSE );
TICK_N ( "Setup mainloop" );
diff --git a/source/view.c b/source/view.c
index ffde0a32..13f5a6e9 100644
--- a/source/view.c
+++ b/source/view.c
@@ -1310,7 +1310,32 @@ static void rofi_view_mainloop_iter ( RofiViewState *state, xcb_generic_event_t
int len = 0;
key = xkb_state_key_get_one_sym ( xkb->state, xkpe->detail );
- len = xkb_state_key_get_utf8 ( xkb->state, xkpe->detail, pad, sizeof ( pad ) );
+
+ if ( ( key != XKB_KEY_NoSymbol ) && ( xkb_compose_state_feed ( xkb->compose.state, key ) == XKB_COMPOSE_FEED_ACCEPTED ) ) {
+ switch ( xkb_compose_state_get_status ( xkb->compose.state ) )
+ {
+ case XKB_COMPOSE_COMPOSING:
+ g_debug ( "[COMPOSE] composing" );
+ key = XKB_KEY_NoSymbol;
+ break;
+ case XKB_COMPOSE_COMPOSED:
+ g_debug ( "[COMPOSE] composed" );
+ key = xkb_compose_state_get_one_sym ( xkb->compose.state );
+ len = xkb_compose_state_get_utf8 ( xkb->compose.state, pad, sizeof ( pad ) );
+ break;
+ case XKB_COMPOSE_CANCELLED:
+ g_debug ( "[COMPOSE] cancelled" );
+ case XKB_COMPOSE_NOTHING:
+ break;
+ }
+ if ( key == XKB_KEY_NoSymbol ) {
+ break;
+ }
+ }
+
+ if ( len == 0 ) {
+ len = xkb_state_key_get_utf8 ( xkb->state, xkpe->detail, pad, sizeof ( pad ) );
+ }
if ( key != XKB_KEY_NoSymbol ) {
// Handling of paste