diff options
author | Dave Davenport <qball@gmpclient.org> | 2016-03-04 08:02:54 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2016-03-04 08:02:54 +0100 |
commit | 9d7d8a9aeb331a72fcebe6dda7d2e060998a95ba (patch) | |
tree | bb9d106376911dd4dd032c79568057a92fd36f90 /source | |
parent | fc75a204d575315b4369a4ea57d67049b5496dd9 (diff) |
Be able to run without compose table.
Diffstat (limited to 'source')
-rw-r--r-- | source/rofi.c | 15 | ||||
-rw-r--r-- | source/view.c | 38 |
2 files changed, 28 insertions, 25 deletions
diff --git a/source/rofi.c b/source/rofi.c index 21723770..25683337 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -631,12 +631,12 @@ int main ( int argc, char *argv[] ) 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_ewmh_init_atoms_replies ( &xcb->ewmh, ac, &errors ); if ( errors ) { 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, @@ -690,7 +690,7 @@ int main ( int argc, char *argv[] ) }; xcb_xkb_select_events ( xcb->connection, xkb.device_id, required_events, /* affectWhich */ 0, /* clear */ - 0, /* selectAll */ + required_events, /* selectAll */ required_map_parts, /* affectMap */ required_map_parts, /* map */ &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.compose.table = xkb_compose_table_new_from_locale ( xkb.context, setlocale ( LC_CTYPE, NULL ), 0 ); - if ( xkb.compose.table == NULL ) { - fprintf(stderr, "Failed to load compose table.\n"); - return EXIT_FAILURE; + if ( xkb.compose.table != NULL ) { + xkb.compose.state = xkb_compose_state_new ( xkb.compose.table, 0 ); + } + 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 ); main_loop = g_main_loop_new ( NULL, FALSE ); diff --git a/source/view.c b/source/view.c index b9e4b0e8..d5e25453 100644 --- a/source/view.c +++ b/source/view.c @@ -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 ); - 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. - * This is default behaviour with Xlib */ - case XKB_COMPOSE_COMPOSING: - key = XKB_KEY_NoSymbol; - break; - case XKB_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_NOTHING: - break; - } - if ( key == XKB_KEY_NoSymbol ) { - break; + if ( xkb->compose.state != NULL ) { + 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. + * This is default behaviour with Xlib */ + case XKB_COMPOSE_COMPOSING: + key = XKB_KEY_NoSymbol; + break; + case XKB_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_NOTHING: + break; + } + if ( key == XKB_KEY_NoSymbol ) { + break; + } } } |