From 91780b71dbcf509afa3f84a0bde4c503c801b27b Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Wed, 27 Jan 2016 23:39:52 +0100 Subject: [PATCH] Small fix. --- include/textbox.h | 18 +++++++++--------- source/dialogs/dmenu.c | 9 ++++++--- source/rofi.c | 3 ++- source/textbox.c | 2 +- source/x11-event-source.c | 2 +- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/include/textbox.h b/include/textbox.h index c321eb47..757b1c62 100644 --- a/include/textbox.h +++ b/include/textbox.h @@ -42,15 +42,15 @@ typedef struct typedef enum { - TB_AUTOHEIGHT = 1 << 0, - TB_AUTOWIDTH = 1 << 1, - TB_LEFT = 1 << 16, - TB_RIGHT = 1 << 17, - TB_CENTER = 1 << 18, - TB_EDITABLE = 1 << 19, - TB_MARKUP = 1 << 20, - TB_WRAP = 1 << 21, - TB_PASSWORD = 1 << 22, + TB_AUTOHEIGHT = 1 << 0, + TB_AUTOWIDTH = 1 << 1, + TB_LEFT = 1 << 16, + TB_RIGHT = 1 << 17, + TB_CENTER = 1 << 18, + TB_EDITABLE = 1 << 19, + TB_MARKUP = 1 << 20, + TB_WRAP = 1 << 21, + TB_PASSWORD = 1 << 22, } TextboxFlags; typedef enum diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c index e8c5e498..cb59f853 100644 --- a/source/dialogs/dmenu.c +++ b/source/dialogs/dmenu.c @@ -399,14 +399,13 @@ int dmenu_switcher_dialog ( void ) } MenuState *state = menu ( &dmenu_mode, input, pd->prompt, pd->message, menu_flags ); - while ( XPending (display) ){ + menu_state_set_selected_line ( state, pd->selected_line ); + while ( XPending ( display ) ) { XEvent ev; XNextEvent ( display, &ev ); menu_state_itterrate ( state, &ev ); } do { - menu_state_restart ( state ); - menu_state_set_selected_line ( state, pd->selected_line ); retv = FALSE; menu_state_set_active ( state ); @@ -495,6 +494,10 @@ int dmenu_switcher_dialog ( void ) restart = FALSE; retv = 10 + ( mretv & MENU_LOWER_MASK ); } + if ( restart ) { + menu_state_restart ( state ); + menu_state_set_selected_line ( state, pd->selected_line ); + } } while ( restart ); menu_state_free ( state ); diff --git a/source/rofi.c b/source/rofi.c index a184e924..9981a6c6 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1600,7 +1600,8 @@ MenuState *menu ( Mode *sw, state->top_offset = state->border * 1 + state->line_height + 2 + config.line_margin * 2; // Move indicator to end. - widget_move ( WIDGET ( state->case_indicator ), state->border + textbox_get_width ( state->prompt_tb ) + entrybox_width, state->border ); + widget_move ( WIDGET ( state->case_indicator ), state->border + textbox_get_width ( state->prompt_tb ) + entrybox_width, + state->border ); textbox_text ( state->case_indicator, get_matching_state () ); state->message_tb = NULL; diff --git a/source/textbox.c b/source/textbox.c index 0c461550..fa5db216 100644 --- a/source/textbox.c +++ b/source/textbox.c @@ -103,7 +103,7 @@ textbox* textbox_create ( TextboxFlags flags, short x, short y, short w, short h tb->blink_timeout = 0; tb->blink = 1; if ( ( flags & TB_EDITABLE ) == TB_EDITABLE ) { - tb->blink_timeout = g_timeout_add ( 1200, textbox_blink, tb ); + // tb->blink_timeout = g_timeout_add ( 1200, textbox_blink, tb ); } return tb; diff --git a/source/x11-event-source.c b/source/x11-event-source.c index b03819ce..f12f883d 100644 --- a/source/x11-event-source.c +++ b/source/x11-event-source.c @@ -18,7 +18,7 @@ static gboolean x11_event_source_prepare ( GSource * base, gint * timeout ) { X11EventSource *xs = (X11EventSource *) base; *timeout = -1; - return /*XPending ( xs->display ) || */g_source_query_unix_fd ( base, xs->fd_x11 ); + return /*XPending ( xs->display ) || */ g_source_query_unix_fd ( base, xs->fd_x11 ); } static gboolean x11_event_source_check ( GSource * base )