1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Fix crasher with fixed-lines off and 0 visible rows

This commit is contained in:
QC 2015-04-05 13:36:39 +02:00
parent d6ced176d4
commit 9b415e60a0
3 changed files with 18 additions and 0 deletions

View file

@ -261,4 +261,5 @@ struct _Switcher
switcher_free free; switcher_free free;
}; };
void menu_unmap ( void );
#endif #endif

View file

@ -482,6 +482,10 @@ static SwitcherMode window_mode_result ( int mretv, G_GNUC_UNUSED char **input,
retv = selected_line; retv = selected_line;
} }
else if ( ( mretv & ( MENU_OK | MENU_CUSTOM_INPUT ) ) && rmpd->cmd_list[selected_line] ) { else if ( ( mretv & ( MENU_OK | MENU_CUSTOM_INPUT ) ) && rmpd->cmd_list[selected_line] ) {
// Window is going to be removed later (retv == MODE_EXIT).
// Unmap it first, so (not so)awesomewm does not get confused and give application beneath
// rofi focus on destory.
menu_unmap ();
if ( rmpd->config_i3_mode ) { if ( rmpd->config_i3_mode ) {
// Hack for i3. // Hack for i3.
i3_support_focus_window ( rmpd->ids->array[selected_line] ); i3_support_focus_window ( rmpd->ids->array[selected_line] );

View file

@ -115,6 +115,17 @@ GC gc = NULL;
Colormap map = None; Colormap map = None;
XVisualInfo vinfo; XVisualInfo vinfo;
void menu_unmap ( void )
{
if ( main_window != None ) {
release_keyboard(display);
XUnmapWindow(display, main_window);
}
}
/** /**
* @param display Connection to the X server. * @param display Connection to the X server.
* @param x11_fd File descriptor from the X server to listen on. * @param x11_fd File descriptor from the X server to listen on.
@ -410,6 +421,8 @@ static void menu_calculate_rows_columns ( MenuState *state )
( state->num_lines + ( state->columns - state->num_lines % state->columns ) % ( state->num_lines + ( state->columns - state->num_lines % state->columns ) %
state->columns ) / ( state->columns ) state->columns ) / ( state->columns )
) ); ) );
// Always have at least one row.
state->max_rows = MAX( 1, state->max_rows);
if ( config.fixed_num_lines == TRUE ) { if ( config.fixed_num_lines == TRUE ) {
state->max_elements = state->menu_lines * state->columns; state->max_elements = state->menu_lines * state->columns;