1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Small cleanup

This commit is contained in:
QC 2015-03-27 20:50:48 +01:00
parent f5c8c3a55d
commit 888260b06b
3 changed files with 10 additions and 22 deletions

View file

@ -79,7 +79,6 @@ typedef int ( *menu_match_cb )( char **tokens, const char *input, int case_sensi
* @param num_lines Length of the array with strings to display.
* @param input A pointer to a string where the inputted data is placed.
* @param prompt The prompt to show.
* @param time The current time (used for window interaction.)
* @param shift pointer to integer that is set to the state of the shift key.
* @param mmc Menu menu match callback, used for matching user input.
* @param mmc_data data to pass to mmc.
@ -90,9 +89,8 @@ typedef int ( *menu_match_cb )( char **tokens, const char *input, int case_sensi
* @returns The command issued (see MenuReturn)
*/
MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prompt,
Time *time,
menu_match_cb mmc, void *mmc_data,
int *selected_line, int sorting ) __attribute__ ( ( nonnull ( 1, 3, 4, 8 ) ) );
int *selected_line, int sorting ) __attribute__ ( ( nonnull ( 1, 3, 4, 7 ) ) );
/**
* @param sig The caught signal
*

View file

@ -83,7 +83,7 @@ int dmenu_switcher_dialog ( char **input )
find_arg_int ( "-l", &selected_line );
do {
int mretv = menu ( list, length, input, dmenu_prompt, NULL,
int mretv = menu ( list, length, input, dmenu_prompt,
token_match, NULL, &selected_line, FALSE );
// We normally do not want to restart the loop.

View file

@ -922,7 +922,7 @@ static void menu_paste ( MenuState *state, XSelectionEvent *xse )
}
}
MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prompt, Time *time,
MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prompt,
menu_match_cb mmc, void *mmc_data, int *selected_line, int sorting )
{
int shift = FALSE;
@ -1148,10 +1148,6 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
// Key press event.
else if ( ev.type == KeyPress ) {
do {
if ( time ) {
*time = ev.xkey.time;
}
KeySym key = XkbKeycodeToKeysym ( display, ev.xkey.keycode, 0, 0 );
// Handling of paste
@ -1823,26 +1819,20 @@ int main ( int argc, char *argv[] )
SwitcherMode switcher_run ( char **input, Switcher *sw )
{
char *prompt = g_strdup_printf ( "%s:", sw->name );
int selected_line = 0;
SwitcherMode retv = MODE_EXIT;
unsigned int cmd_list_length = 0;
char **cmd_list = NULL;
cmd_list = sw->get_data ( &cmd_list_length, sw );
if ( cmd_list == NULL ) {
cmd_list = g_malloc_n ( 2, sizeof ( char * ) );
cmd_list[0] = g_strdup ( "No applications found" );
cmd_list[1] = NULL;
}
int mretv = menu ( cmd_list, cmd_list_length,
input, prompt,
sw->token_match, sw,
&selected_line,
config.levenshtein_sort );
char *prompt = g_strdup_printf ( "%s:", sw->name );
int mretv = menu ( cmd_list, cmd_list_length, input, prompt,
NULL, sw->token_match, sw, &selected_line,
config.levenshtein_sort );
retv = sw->result ( mretv, input, selected_line, sw );
SwitcherMode retv = sw->result ( mretv, input, selected_line, sw );
g_free ( prompt );