diff --git a/doc/rofi-manpage.markdown b/doc/rofi-manpage.markdown index 5802a4bb..9279a28f 100644 --- a/doc/rofi-manpage.markdown +++ b/doc/rofi-manpage.markdown @@ -639,7 +639,7 @@ and the others slightly transparent. * `Ctrl-Shift-Tab`: Switch to the previous modi. The list can be customized with the `-switchers` argument. * `Ctrl-space`: Set selected item as input text. * `Shift-Del`: Delete entry from history. -* `grave`: Toggle case sensitivity. +* `Ctrl-grave`: Toggle case sensitivity. ## FAQ diff --git a/doc/rofi.1 b/doc/rofi.1 index 2b942f12..d49e2a7d 100644 --- a/doc/rofi.1 +++ b/doc/rofi.1 @@ -837,7 +837,7 @@ and the others slightly transparent. .IP \(bu 2 \fB\fCShift\-Del\fR: Delete entry from history. .IP \(bu 2 -\fB\fCgrave\fR: Toggle case sensitivity. +\fB\fCCtrl\-grave\fR: Toggle case sensitivity. .RE .SH FAQ .PP diff --git a/source/rofi.c b/source/rofi.c index 8dd321c0..8a0b11fa 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1110,9 +1110,11 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom } // Get next event. (might block) XNextEvent ( display, &ev ); - + if ( ev.type == KeymapNotify ) { + XRefreshKeyboardMapping ( &ev.xmapping ); + } // Handle event. - if ( ev.type == Expose ) { + else if ( ev.type == Expose ) { while ( XCheckTypedEvent ( display, Expose, &ev ) ) { ; } @@ -1173,8 +1175,9 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom break; } // Toggle case sensitivity. - else if ( key == XK_grave || key == XK_dead_grave - || key == XK_acute ) { + else if ( ( ev.xkey.state & ControlMask ) == ControlMask && ( + key == XK_grave || key == XK_dead_grave || key == XK_acute + ) ) { config.case_sensitive = !config.case_sensitive; *( state.selected_line ) = 0; state.refilter = TRUE; @@ -1340,7 +1343,6 @@ void error_dialog ( const char *msg ) continue; } XNextEvent ( display, &ev ); - // Handle event. if ( ev.type == Expose ) { while ( XCheckTypedEvent ( display, Expose, &ev ) ) { @@ -1706,6 +1708,15 @@ int main ( int argc, char *argv[] ) display_str = getenv ( "DISPLAY" ); find_arg_str ( "-display", &display_str ); + + if ( !XSupportsLocale () ) { + fprintf ( stderr, "X11 does not support locales\n" ); + return 11; + } + if ( XSetLocaleModifiers ( "@im=none" ) == NULL ) { + fprintf ( stderr, "Failed to set locale modifier.\n" ); + return 10; + } if ( !( display = XOpenDisplay ( display_str ) ) ) { fprintf ( stderr, "cannot open display!\n" ); return EXIT_FAILURE; diff --git a/source/textbox.c b/source/textbox.c index cb2477c7..84c860ea 100644 --- a/source/textbox.c +++ b/source/textbox.c @@ -511,6 +511,12 @@ int textbox_keypress ( textbox *tb, XEvent *ev ) char pad[32]; int len; + // This is needed for letting the Input Method handle combined keys. + // E.g. `e into รจ + if ( XFilterEvent ( ev, tb->window ) ) { + return 0; + } + if ( !( tb->flags & TB_EDITABLE ) ) { return 0; @@ -518,7 +524,6 @@ int textbox_keypress ( textbox *tb, XEvent *ev ) len = Xutf8LookupString ( tb->xic, &ev->xkey, pad, sizeof ( pad ), &key, &stat ); pad[len] = 0; - // Left or Ctrl-b if ( key == XK_Left || ( ( ev->xkey.state & ControlMask ) && key == XK_b ) ) {