From 07425fd10a035e32dc993ee9736f7bf5349ffc0e Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Tue, 11 Oct 2016 08:11:14 +0200 Subject: [PATCH] Always refilter when switching modi. --- include/widgets/widget.h | 20 ++++++++++++++++++++ source/dialogs/ssh.c | 2 +- source/helper.c | 4 ++-- source/view.c | 1 + source/widgets/widget.c | 4 +--- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/include/widgets/widget.h b/include/widgets/widget.h index 84188318..218e1149 100644 --- a/include/widgets/widget.h +++ b/include/widgets/widget.h @@ -16,6 +16,10 @@ * @{ */ typedef struct _widget widget; + +/** + * Callback for when widget is clicked. + */ typedef gboolean ( *widget_clicked_cb )( widget *, xcb_button_press_event_t *, void * ); /** Macro to get widget from an implementation (e.g. textbox/scrollbar) */ @@ -41,8 +45,24 @@ int widget_intersect ( const widget *widget, int x, int y ); */ void widget_move ( widget *widget, short x, short y ); +/** + * @param widget Handle to widget + * + * Check if widget is enabled. + * @returns TRUE when widget is enabled. + */ gboolean widget_enabled ( widget *widget ); +/** + * @param widget Handle to widget + * + * Disable the widget. + */ void widget_disable ( widget *widget ); +/** + * @param widget Handle to widget + * + * Enable the widget. + */ void widget_enable ( widget *widget ); /** diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c index f11ba3a1..397893dc 100644 --- a/source/dialogs/ssh.c +++ b/source/dialogs/ssh.c @@ -198,7 +198,7 @@ static char **read_hosts_file ( char ** retv, unsigned int *length ) // Reading one line per time. while ( getline ( &buffer, &buffer_length, fd ) > 0 ) { // Evaluate one line. - unsigned int index = 0, ti = 0; + unsigned int index = 0, ti = 0; char *token = buffer; // Tokenize it. diff --git a/source/helper.c b/source/helper.c index ef402ed5..9e420c91 100644 --- a/source/helper.c +++ b/source/helper.c @@ -194,7 +194,7 @@ static GRegex * create_regex ( const char *input, int case_sensitive ) { #define R( s ) g_regex_new ( s, G_REGEX_OPTIMIZE | ( ( case_sensitive ) ? 0 : G_REGEX_CASELESS ), 0, NULL ) GRegex * retv = NULL; - gchar *r; + gchar *r; switch ( config.matching_method ) { case MM_GLOB: @@ -234,7 +234,7 @@ GRegex **tokenize ( const char *input, int case_sensitive ) } char *saveptr = NULL, *token; - GRegex **retv = NULL; + GRegex **retv = NULL; if ( !config.tokenize ) { retv = g_malloc0 ( sizeof ( GRegex* ) * 2 ); retv[0] = (GRegex *) create_regex ( input, case_sensitive ); diff --git a/source/view.c b/source/view.c index 7b91ab0d..065d2b1a 100644 --- a/source/view.c +++ b/source/view.c @@ -1653,5 +1653,6 @@ void rofi_view_switch_mode ( RofiViewState *state, Mode *mode ) rofi_view_restart ( state ); state->reload = TRUE; state->refilter = TRUE; + rofi_view_refilter ( state ); rofi_view_update ( state ); } diff --git a/source/widgets/widget.c b/source/widgets/widget.c index 6b00fccf..9a929f37 100644 --- a/source/widgets/widget.c +++ b/source/widgets/widget.c @@ -102,9 +102,7 @@ void widget_update ( widget *widget ) widget->update ( widget ); } // Recurse back. - if ( widget->parent && widget->parent->update ) { - widget->parent->update ( widget->parent ); - } + widget_update ( widget->parent ); } }