diff --git a/include/rofi.h b/include/rofi.h index c790b0f6..bf534d73 100644 --- a/include/rofi.h +++ b/include/rofi.h @@ -33,7 +33,7 @@ typedef enum typedef void ( *switcher_free )( Switcher *data ); -typedef char * ( *get_display_value )( unsigned int selected_line, const Switcher *data, int *state, int get_entry ); +typedef char * ( *get_display_value )( const Switcher *sw, unsigned int selected_line, int *state, int get_entry ); typedef char * ( *get_completion )( const Switcher *sw, unsigned int selected_line ); /** diff --git a/source/dialogs/combi.c b/source/dialogs/combi.c index 7c72aab4..3b9d34a8 100644 --- a/source/dialogs/combi.c +++ b/source/dialogs/combi.c @@ -203,13 +203,13 @@ static int combi_mode_match ( const Switcher *sw, char **tokens, int not_ascii, abort (); return 0; } -static char * combi_mgrv ( unsigned int selected_line, const Switcher *sw, int *state, int get_entry ) +static char * combi_mgrv ( const Switcher *sw, unsigned int selected_line, int *state, int get_entry ) { CombiModePrivateData *pd = sw->private_data; if ( !get_entry ) { for ( unsigned i = 0; i < pd->num_switchers; i++ ) { if ( selected_line >= pd->starts[i] && selected_line < ( pd->starts[i] + pd->lengths[i] ) ) { - pd->switchers[i]->mgrv ( selected_line - pd->starts[i], (void *) pd->switchers[i], state, FALSE ); + pd->switchers[i]->mgrv ( pd->switchers[i], selected_line - pd->starts[i], state, FALSE ); return NULL; } } @@ -217,7 +217,7 @@ static char * combi_mgrv ( unsigned int selected_line, const Switcher *sw, int * } for ( unsigned i = 0; i < pd->num_switchers; i++ ) { if ( selected_line >= pd->starts[i] && selected_line < ( pd->starts[i] + pd->lengths[i] ) ) { - char * str = pd->switchers[i]->mgrv ( selected_line - pd->starts[i], (void *) pd->switchers[i], state, TRUE ); + char * str = pd->switchers[i]->mgrv ( pd->switchers[i], selected_line - pd->starts[i], state, TRUE ); char * retv = g_strdup_printf ( "(%s) %s", pd->switchers[i]->name, str ); g_free ( str ); return retv; @@ -247,7 +247,7 @@ static char * combi_get_completion ( const Switcher *sw, unsigned int index ) } else { int state; - str = pd->switchers[i]->mgrv ( index - pd->starts[i], (void *) pd->switchers[i], &state, TRUE ); + str = pd->switchers[i]->mgrv ( pd->switchers[i], index - pd->starts[i], &state, TRUE ); } return str; } diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c index 5161fbf0..e310c7fb 100644 --- a/source/dialogs/dmenu.c +++ b/source/dialogs/dmenu.c @@ -137,7 +137,7 @@ static void parse_ranges ( char *input, struct range_pair **list, unsigned int * } } -static char *get_display_data ( unsigned int index, const Switcher *data, int *state, int get_entry ) +static char *get_display_data ( const Switcher *data, unsigned int index, int *state, int get_entry ) { Switcher *sw = (Switcher *) data; DmenuModePrivateData *pd = (DmenuModePrivateData *) sw->private_data; diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c index 981caedd..8d27617d 100644 --- a/source/dialogs/drun.c +++ b/source/dialogs/drun.c @@ -275,7 +275,7 @@ static void drun_mode_destroy ( Switcher *sw ) } } -static char *mgrv ( unsigned int selected_line, const Switcher *sw, int *state, int get_entry ) +static char *mgrv ( const Switcher *sw, unsigned int selected_line, int *state, int get_entry ) { DRunModePrivateData *pd = (DRunModePrivateData *) sw->private_data; *state |= MARKUP; diff --git a/source/dialogs/run.c b/source/dialogs/run.c index 00e54a5c..3ce143aa 100644 --- a/source/dialogs/run.c +++ b/source/dialogs/run.c @@ -326,7 +326,7 @@ static void run_mode_destroy ( Switcher *sw ) } } -static char *mgrv ( unsigned int selected_line, const Switcher *sw, G_GNUC_UNUSED int *state, int get_entry ) +static char *mgrv ( const Switcher *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, int get_entry ) { const RunModePrivateData *rmpd = (const RunModePrivateData *) sw->private_data; return get_entry ? g_strdup ( rmpd->cmd_list[selected_line] ) : NULL; diff --git a/source/dialogs/script.c b/source/dialogs/script.c index 179554f8..ec136b57 100644 --- a/source/dialogs/script.c +++ b/source/dialogs/script.c @@ -156,7 +156,7 @@ static void script_mode_destroy ( Switcher *sw ) sw->private_data = NULL; } } -static char *mgrv ( unsigned int selected_line, const Switcher *sw, G_GNUC_UNUSED int *state, int get_entry ) +static char *mgrv ( const Switcher *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, int get_entry ) { ScriptModePrivateData *rmpd = sw->private_data; return get_entry ? g_strdup ( rmpd->cmd_list[selected_line] ) : NULL; diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c index 82e4f229..3c4fe4c8 100644 --- a/source/dialogs/ssh.c +++ b/source/dialogs/ssh.c @@ -376,7 +376,7 @@ static void ssh_mode_destroy ( Switcher *sw ) } } -static char *mgrv ( unsigned int selected_line, const Switcher *sw, G_GNUC_UNUSED int *state, int get_entry ) +static char *mgrv ( const Switcher *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, int get_entry ) { SSHModePrivateData *rmpd = (SSHModePrivateData *) sw->private_data; return get_entry ? g_strdup ( rmpd->cmd_list[selected_line] ) : NULL; diff --git a/source/dialogs/window.c b/source/dialogs/window.c index c7b8b45c..99ea2d42 100644 --- a/source/dialogs/window.c +++ b/source/dialogs/window.c @@ -559,7 +559,7 @@ static void window_mode_destroy ( Switcher *sw ) } } -static char *mgrv ( unsigned int selected_line, const Switcher *sw, int *state, int get_entry ) +static char *mgrv ( const Switcher *sw, unsigned int selected_line, int *state, int get_entry ) { SwitcherModePrivateData *rmpd = sw->private_data; if ( window_client ( display, rmpd->ids->array[selected_line] )->demands ) { diff --git a/source/rofi.c b/source/rofi.c index 5e89cc6c..f1625ffb 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -649,7 +649,7 @@ static int menu_keyboard_navigation ( MenuState *state, KeySym key, unsigned int str = state->sw->get_completion ( state->sw, state->line_map[state->selected] ); } else { - str = state->sw->mgrv ( state->line_map[state->selected], state->sw, &st, TRUE ); + str = state->sw->mgrv ( state->sw, state->line_map[state->selected], &st, TRUE ); } textbox_text ( state->text, str ); g_free ( str ); @@ -771,7 +771,7 @@ static void filter_elements ( thread_state *t, G_GNUC_UNUSED gpointer user_data t->state->line_map[t->start + t->count] = i; if ( config.levenshtein_sort ) { // This is inefficient, need to fix it. - char * str = t->state->sw->mgrv ( i, t->state->sw, &st, TRUE ); + char * str = t->state->sw->mgrv ( t->state->sw, i, &st, TRUE ); t->state->distance[i] = levenshtein ( t->state->text->text, str ); g_free ( str ); } @@ -943,7 +943,7 @@ static void menu_draw ( MenuState *state, cairo_t *d ) { TextBoxFontType type = ( ( ( i % state->max_rows ) & 1 ) == 0 ) ? NORMAL : ALT; int fstate = 0; - char *text = state->sw->mgrv ( state->line_map[i + offset], state->sw, &fstate, TRUE ); + char *text = state->sw->mgrv ( state->sw, state->line_map[i + offset], &fstate, TRUE ); TextBoxFontType tbft = fstate | ( ( i + offset ) == state->selected ? HIGHLIGHT : type ); textbox_font ( state->boxes[i], tbft ); textbox_text ( state->boxes[i], text ); @@ -958,7 +958,7 @@ static void menu_draw ( MenuState *state, cairo_t *d ) for ( i = 0; i < max_elements; i++ ) { TextBoxFontType type = ( ( ( i % state->max_rows ) & 1 ) == 0 ) ? NORMAL : ALT; int fstate = 0; - state->sw->mgrv ( state->line_map[i + offset], state->sw, &fstate, FALSE ); + state->sw->mgrv ( state->sw, state->line_map[i + offset], &fstate, FALSE ); TextBoxFontType tbft = fstate | ( ( i + offset ) == state->selected ? HIGHLIGHT : type ); textbox_font ( state->boxes[i], tbft ); textbox_draw ( state->boxes[i], d );