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

Fix multiple -theme-str lines parsing, fix num lines

This commit is contained in:
Dave Davenport 2017-01-08 17:18:49 +01:00
parent ce2cf6b2d9
commit 26efbecbc3
4 changed files with 41 additions and 8 deletions

View file

@ -100,14 +100,14 @@ void listview_nav_down ( listview *lv );
*/
void listview_nav_right ( listview *lv );
/**
* @param lv The listview handle
* @param lv The listview handle
*
* Move the selection one column to the left.
* - No wrap around.
*/
void listview_nav_left ( listview *lv );
/**
* @param lv The listview handle
* @param lv The listview handle
*
* Move the selection one page down.
* - No wrap around.
@ -116,7 +116,7 @@ void listview_nav_left ( listview *lv );
void listview_nav_page_next ( listview *lv );
/**
* @param lv The listview handle
* @param lv The listview handle
*
* Move the selection one page up.
* - No wrap around.
@ -185,6 +185,23 @@ void listview_set_num_lines ( listview *lv, unsigned int num_lines );
* @returns get the numger of lines to display.
*/
unsigned int listview_get_num_lines ( listview *lv );
/**
* @param lv Handler to the listview object.
*
* Get the fixed-height property.
*
* @returns get fixed-height.
*/
gboolean listview_get_fixed_num_lines ( listview *lv );
/**
* @param lv Handler to the listview object.
*
* Set fixed num lines mode.
*/
void listview_set_fixed_num_lines ( listview *lv );
/**
* @param lv Handler to the listview object.
* @param max_lines the maximum number of lines to display.

View file

@ -309,7 +309,7 @@ const char ** find_arg_strv ( const char *const key )
int index = 0;
for ( int i = 0; i < stored_argc; i++ ) {
if ( strcasecmp ( stored_argv[i], key ) == 0 && i < (stored_argc -1 ) ){
retv[index] = stored_argv[i+1];
retv[index++] = stored_argv[i+1];
}
}
}

View file

@ -255,7 +255,7 @@ static void rofi_view_calculate_window_position ( RofiViewState *state )
{
int location = rofi_theme_get_position ( WIDGET ( state->main_window ), "location", config.location );
int anchor = location;
if ( !config.fixed_num_lines ) {
if ( !listview_get_fixed_num_lines ( state->list_view ) ) {
anchor = location;
if ( location == WL_CENTER ) {
anchor = WL_NORTH;
@ -1547,7 +1547,9 @@ RofiViewState *rofi_view_create ( Mode *sw,
listview_set_multi_select ( state->list_view, ( state->menu_flags & MENU_INDICATOR ) == MENU_INDICATOR );
listview_set_scroll_type ( state->list_view, config.scroll_method );
listview_set_mouse_activated_cb ( state->list_view, rofi_view_listview_mouse_activated_cb, state );
listview_set_num_lines ( state->list_view, config.menu_lines );
int lines = rofi_theme_get_integer ( WIDGET (state->list_view ), "lines", config.menu_lines );
listview_set_num_lines ( state->list_view, lines );
listview_set_max_lines ( state->list_view, state->num_lines );
box_add ( state->main_box, WIDGET ( state->list_view ), TRUE, 3);
@ -1561,7 +1563,7 @@ RofiViewState *rofi_view_create ( Mode *sw,
widget_resize ( WIDGET ( state->main_window ), state->width, 100);
// Only needed when window is fixed size.
if (( CacheState.flags & MENU_NORMAL_WINDOW ) == MENU_NORMAL_WINDOW ) {
config.fixed_num_lines = TRUE;
listview_set_fixed_num_lines ( state->list_view );
rofi_view_window_update_size ( state );
}
// Move the window to the correct x,y position.
@ -1596,7 +1598,7 @@ int rofi_view_error_dialog ( const char *msg, int markup )
// Make sure we enable fixed num lines when in normal window mode.
if ( (CacheState.flags&MENU_NORMAL_WINDOW) == MENU_NORMAL_WINDOW){
config.fixed_num_lines = TRUE;
listview_set_fixed_num_lines ( state->list_view );
}
rofi_view_calculate_window_width ( state );
// Need to resize otherwise calculated desired height is wrong.

View file

@ -605,3 +605,17 @@ void listview_set_max_lines ( listview *lv, unsigned int max_lines )
lv->max_displayed_lines = max_lines;
}
}
gboolean listview_get_fixed_num_lines ( listview *lv )
{
if ( lv ) {
return lv->fixed_num_lines;
}
return FALSE;
}
void listview_set_fixed_num_lines ( listview *lv )
{
if ( lv ) {
lv->fixed_num_lines = TRUE;
}
}