mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-11 13:50:48 -05:00
Cleanups.
This commit is contained in:
parent
038346b640
commit
9121732e36
4 changed files with 11 additions and 18 deletions
|
@ -44,9 +44,6 @@
|
||||||
// We limit at 1000000 rows for now.
|
// We limit at 1000000 rows for now.
|
||||||
#define DMENU_MAX_ROWS 1000000
|
#define DMENU_MAX_ROWS 1000000
|
||||||
|
|
||||||
// TODO HACK TO BE REMOVED
|
|
||||||
extern Display *display;
|
|
||||||
|
|
||||||
struct range_pair
|
struct range_pair
|
||||||
{
|
{
|
||||||
unsigned int start;
|
unsigned int start;
|
||||||
|
@ -359,7 +356,7 @@ Mode dmenu_mode =
|
||||||
.free = NULL
|
.free = NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static void dmenu_finish ( RofiViewState *state, int retv)
|
static void dmenu_finish ( RofiViewState *state, int retv )
|
||||||
{
|
{
|
||||||
if ( retv == FALSE ) {
|
if ( retv == FALSE ) {
|
||||||
rofi_set_return_code ( EXIT_FAILURE );
|
rofi_set_return_code ( EXIT_FAILURE );
|
||||||
|
@ -378,7 +375,7 @@ static void dmenu_finish ( RofiViewState *state, int retv)
|
||||||
static void dmenu_finalize ( RofiViewState *state )
|
static void dmenu_finalize ( RofiViewState *state )
|
||||||
{
|
{
|
||||||
int retv = FALSE;
|
int retv = FALSE;
|
||||||
DmenuModePrivateData *pd = (DmenuModePrivateData *) (Mode *) ( rofi_view_get_mode ( state ) )->private_data;
|
DmenuModePrivateData *pd = (DmenuModePrivateData *) rofi_view_get_mode ( state )->private_data;
|
||||||
unsigned int cmd_list_length = pd->cmd_list_length;
|
unsigned int cmd_list_length = pd->cmd_list_length;
|
||||||
char **cmd_list = pd->cmd_list;
|
char **cmd_list = pd->cmd_list;
|
||||||
|
|
||||||
|
@ -389,7 +386,6 @@ static void dmenu_finalize ( RofiViewState *state )
|
||||||
|
|
||||||
int restart = 0;
|
int restart = 0;
|
||||||
// Special behavior.
|
// Special behavior.
|
||||||
// TODO clean this up!
|
|
||||||
if ( pd->only_selected ) {
|
if ( pd->only_selected ) {
|
||||||
/**
|
/**
|
||||||
* Select item mode.
|
* Select item mode.
|
||||||
|
@ -406,9 +402,9 @@ static void dmenu_finalize ( RofiViewState *state )
|
||||||
retv = TRUE;
|
retv = TRUE;
|
||||||
if ( ( mretv & MENU_QUICK_SWITCH ) ) {
|
if ( ( mretv & MENU_QUICK_SWITCH ) ) {
|
||||||
retv = 10 + ( mretv & MENU_LOWER_MASK );
|
retv = 10 + ( mretv & MENU_LOWER_MASK );
|
||||||
}
|
}
|
||||||
g_free ( input );
|
g_free ( input );
|
||||||
dmenu_finish(state, retv);
|
dmenu_finish ( state, retv );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pd->selected_line = next_pos - 1;
|
pd->selected_line = next_pos - 1;
|
||||||
|
@ -417,7 +413,7 @@ static void dmenu_finalize ( RofiViewState *state )
|
||||||
rofi_view_restart ( state );
|
rofi_view_restart ( state );
|
||||||
rofi_view_set_selected_line ( state, pd->selected_line );
|
rofi_view_set_selected_line ( state, pd->selected_line );
|
||||||
if ( !restart ) {
|
if ( !restart ) {
|
||||||
dmenu_finish(state, retv);
|
dmenu_finish ( state, retv );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -479,7 +475,7 @@ static void dmenu_finalize ( RofiViewState *state )
|
||||||
rofi_view_set_selected_line ( state, pd->selected_line );
|
rofi_view_set_selected_line ( state, pd->selected_line );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dmenu_finish(state,retv);
|
dmenu_finish ( state, retv );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,8 +535,10 @@ int dmenu_switcher_dialog ( void )
|
||||||
g_strfreev ( tokens );
|
g_strfreev ( tokens );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// TODO remove
|
RofiViewState *state = rofi_view_create (
|
||||||
RofiViewState *state = rofi_view_create ( &dmenu_mode, input, pd->prompt, pd->message, menu_flags, dmenu_finalize );
|
&dmenu_mode, input,
|
||||||
|
pd->prompt, pd->message,
|
||||||
|
menu_flags, dmenu_finalize );
|
||||||
rofi_view_set_selected_line ( state, pd->selected_line );
|
rofi_view_set_selected_line ( state, pd->selected_line );
|
||||||
rofi_view_set_active ( state );
|
rofi_view_set_active ( state );
|
||||||
|
|
||||||
|
|
|
@ -270,9 +270,6 @@ int show_error_message ( const char *msg, int markup )
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
rofi_view_error_dialog ( msg, markup );
|
rofi_view_error_dialog ( msg, markup );
|
||||||
//teardown ( pfd );
|
|
||||||
// TODO this looks incorrect.
|
|
||||||
// g_main_loop_quit ( main_loop );
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1665,8 +1665,7 @@ void rofi_view_error_dialog ( const char *msg, int markup )
|
||||||
state->update = TRUE;
|
state->update = TRUE;
|
||||||
state->border = config.padding + config.menu_bw;
|
state->border = config.padding + config.menu_bw;
|
||||||
state->x11_event_loop = __error_dialog_event_loop;
|
state->x11_event_loop = __error_dialog_event_loop;
|
||||||
// TODO fix
|
state->finalize = process_result_error;
|
||||||
state->finalize = process_result_error;
|
|
||||||
|
|
||||||
// Try to grab the keyboard as early as possible.
|
// Try to grab the keyboard as early as possible.
|
||||||
// We grab this using the rootwindow (as dmenu does it).
|
// We grab this using the rootwindow (as dmenu does it).
|
||||||
|
|
|
@ -509,7 +509,6 @@ void x11_parse_key ( char *combo, unsigned int *mod, KeySym *key )
|
||||||
KeySym sym = XStringToKeysym ( combo + i );
|
KeySym sym = XStringToKeysym ( combo + i );
|
||||||
|
|
||||||
if ( sym == NoSymbol || ( !modmask && ( strchr ( combo, '-' ) || strchr ( combo, '+' ) ) ) ) {
|
if ( sym == NoSymbol || ( !modmask && ( strchr ( combo, '-' ) || strchr ( combo, '+' ) ) ) ) {
|
||||||
// TODO popup
|
|
||||||
g_string_append_printf ( str, "Sorry, rofi cannot understand the key combination: <i>%s</i>\n", combo );
|
g_string_append_printf ( str, "Sorry, rofi cannot understand the key combination: <i>%s</i>\n", combo );
|
||||||
g_string_append ( str, "\nRofi supports the following modifiers:\n\t" );
|
g_string_append ( str, "\nRofi supports the following modifiers:\n\t" );
|
||||||
g_string_append ( str, "<i>Shift,Control,Alt,AltGR,SuperL,SuperR," );
|
g_string_append ( str, "<i>Shift,Control,Alt,AltGR,SuperL,SuperR," );
|
||||||
|
|
Loading…
Reference in a new issue