1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Support combined characters.

This commit is contained in:
Dave Davenport 2015-04-23 22:14:31 +02:00
parent c90e240c90
commit 0b7fe775ca
4 changed files with 24 additions and 8 deletions

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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 ) ) {