Quit on error msg fail.

This commit is contained in:
Dave Davenport 2016-03-03 08:21:28 +01:00
parent 3d2f0a07db
commit 06d25c0ca2
4 changed files with 12 additions and 7 deletions

View File

@ -130,7 +130,7 @@ void rofi_view_set_active ( RofiViewState *state );
*
* The error message to show.
*/
void rofi_view_error_dialog ( const char *msg, int markup );
int rofi_view_error_dialog ( const char *msg, int markup );
/**
* Queue a redraw.

View File

@ -264,10 +264,9 @@ int show_error_message ( const char *msg, int markup )
{
int pfd = setup ();
if ( pfd < 0 ) {
return EXIT_FAILURE;
return FALSE;
}
rofi_view_error_dialog ( msg, markup );
return EXIT_SUCCESS;
return rofi_view_error_dialog ( msg, markup );
}
/**
@ -524,7 +523,9 @@ static gboolean startup ( G_GNUC_UNUSED gpointer data )
if ( find_arg ( "-markup" ) >= 0 ) {
markup = TRUE;
}
show_error_message ( msg, markup );
if ( !show_error_message ( msg, markup ) ) {
g_main_loop_quit ( main_loop );
}
}
else if ( find_arg_str ( "-show", &sname ) == TRUE ) {
int index = switcher_get ( sname );

View File

@ -1703,7 +1703,7 @@ static void __error_dialog_event_loop ( RofiViewState *state, xcb_generic_event_
rofi_view_update ( state );
}
void process_result_error ( RofiViewState *state );
void rofi_view_error_dialog ( const char *msg, int markup )
int rofi_view_error_dialog ( const char *msg, int markup )
{
RofiViewState *state = __rofi_view_state_create ();
state->retv = MENU_CANCEL;
@ -1729,7 +1729,7 @@ void rofi_view_error_dialog ( const char *msg, int markup )
int has_keyboard = take_keyboard ( xcb_stuff_get_root_window ( xcb ) );
if ( !has_keyboard ) {
fprintf ( stderr, "Failed to grab keyboard, even after %d uS.", 500 * 1000 );
return;
return FALSE;
}
rofi_view_calculate_window_and_element_width ( state );
@ -1757,6 +1757,7 @@ void rofi_view_error_dialog ( const char *msg, int markup )
sn_launchee_context_complete ( xcb->sncontext );
}
rofi_view_set_active ( state );
return TRUE;
}
void rofi_view_cleanup ()

View File

@ -199,6 +199,9 @@ void monitor_dimensions ( int x, int y, workarea *mon )
fprintf ( stderr, "Couldn't query Xinerama\n" );
return;
}
if ( is_active == NULL ) {
return;
}
if ( !is_active->state ) {
free ( is_active );
return;