Be able to run without compose table.

This commit is contained in:
Dave Davenport 2016-03-04 08:02:54 +01:00
parent fc75a204d5
commit 9d7d8a9aeb
2 changed files with 28 additions and 25 deletions

View File

@ -631,12 +631,12 @@ int main ( int argc, char *argv[] )
xcb->screen = xcb_aux_get_screen ( xcb->connection, xcb->screen_nbr ); xcb->screen = xcb_aux_get_screen ( xcb->connection, xcb->screen_nbr );
xcb_intern_atom_cookie_t *ac = xcb_ewmh_init_atoms ( xcb->connection, &xcb->ewmh ); xcb_intern_atom_cookie_t *ac = xcb_ewmh_init_atoms ( xcb->connection, &xcb->ewmh );
xcb_generic_error_t *errors = NULL; xcb_generic_error_t *errors = NULL;
xcb_ewmh_init_atoms_replies ( &xcb->ewmh, ac, &errors ); xcb_ewmh_init_atoms_replies ( &xcb->ewmh, ac, &errors );
if ( errors ) { if ( errors ) {
fprintf ( stderr, "Failed to create EWMH atoms\n" ); fprintf ( stderr, "Failed to create EWMH atoms\n" );
free(errors); free ( errors );
} }
if ( xkb_x11_setup_xkb_extension ( xcb->connection, XKB_X11_MIN_MAJOR_XKB_VERSION, XKB_X11_MIN_MINOR_XKB_VERSION, if ( xkb_x11_setup_xkb_extension ( xcb->connection, XKB_X11_MIN_MAJOR_XKB_VERSION, XKB_X11_MIN_MINOR_XKB_VERSION,
@ -690,7 +690,7 @@ int main ( int argc, char *argv[] )
}; };
xcb_xkb_select_events ( xcb->connection, xkb.device_id, required_events, /* affectWhich */ xcb_xkb_select_events ( xcb->connection, xkb.device_id, required_events, /* affectWhich */
0, /* clear */ 0, /* clear */
0, /* selectAll */ required_events, /* selectAll */
required_map_parts, /* affectMap */ required_map_parts, /* affectMap */
required_map_parts, /* map */ required_map_parts, /* map */
&details ); &details );
@ -699,11 +699,12 @@ int main ( int argc, char *argv[] )
xkb.state = xkb_x11_state_new_from_device ( xkb.keymap, xcb->connection, xkb.device_id ); 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.table = xkb_compose_table_new_from_locale ( xkb.context, setlocale ( LC_CTYPE, NULL ), 0 );
if ( xkb.compose.table == NULL ) { if ( xkb.compose.table != NULL ) {
fprintf(stderr, "Failed to load compose table.\n"); xkb.compose.state = xkb_compose_state_new ( xkb.compose.table, 0 );
return EXIT_FAILURE; }
else {
fprintf ( stderr, "Failed to get keyboard compose table. Trying to limp on.\n" );
} }
xkb.compose.state = xkb_compose_state_new ( xkb.compose.table, 0 );
x11_setup ( &xkb ); x11_setup ( &xkb );
main_loop = g_main_loop_new ( NULL, FALSE ); main_loop = g_main_loop_new ( NULL, FALSE );

View File

@ -1324,24 +1324,26 @@ static void rofi_view_mainloop_iter ( RofiViewState *state, xcb_generic_event_t
key = xkb_state_key_get_one_sym ( xkb->state, xkpe->detail ); key = xkb_state_key_get_one_sym ( xkb->state, xkpe->detail );
if ( ( key != XKB_KEY_NoSymbol ) && ( xkb_compose_state_feed ( xkb->compose.state, key ) == XKB_COMPOSE_FEED_ACCEPTED ) ) { if ( xkb->compose.state != NULL ) {
switch ( xkb_compose_state_get_status ( xkb->compose.state ) ) 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_CANCELLED: {
/* Eat the keysym that cancelled the compose sequence. case XKB_COMPOSE_CANCELLED:
* This is default behaviour with Xlib */ /* Eat the keysym that cancelled the compose sequence.
case XKB_COMPOSE_COMPOSING: * This is default behaviour with Xlib */
key = XKB_KEY_NoSymbol; case XKB_COMPOSE_COMPOSING:
break; key = XKB_KEY_NoSymbol;
case XKB_COMPOSE_COMPOSED: break;
key = xkb_compose_state_get_one_sym ( xkb->compose.state ); case XKB_COMPOSE_COMPOSED:
len = xkb_compose_state_get_utf8 ( xkb->compose.state, pad, sizeof ( pad ) ); key = xkb_compose_state_get_one_sym ( xkb->compose.state );
break; len = xkb_compose_state_get_utf8 ( xkb->compose.state, pad, sizeof ( pad ) );
case XKB_COMPOSE_NOTHING: break;
break; case XKB_COMPOSE_NOTHING:
} break;
if ( key == XKB_KEY_NoSymbol ) { }
break; if ( key == XKB_KEY_NoSymbol ) {
break;
}
} }
} }