summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-01-08 17:18:49 +0100
committerDave Davenport <qball@gmpclient.org>2017-01-08 17:18:49 +0100
commit26efbecbc3c1c4c0102cb99a4c7a5aac84ff8f38 (patch)
treed4aa34801d8d3d00b9fee59dbf6cc6f809c394a5 /source
parentce2cf6b2d991450439ede056d8f89bcf788ee410 (diff)
Fix multiple -theme-str lines parsing, fix num lines
Diffstat (limited to 'source')
-rw-r--r--source/helper.c2
-rw-r--r--source/view.c10
-rw-r--r--source/widgets/listview.c14
3 files changed, 21 insertions, 5 deletions
diff --git a/source/helper.c b/source/helper.c
index dd26d828..bbaf03c3 100644
--- a/source/helper.c
+++ b/source/helper.c
@@ -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];
}
}
}
diff --git a/source/view.c b/source/view.c
index f2d3233a..2763a003 100644
--- a/source/view.c
+++ b/source/view.c
@@ -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.
diff --git a/source/widgets/listview.c b/source/widgets/listview.c
index 716855ce..d3b6aebb 100644
--- a/source/widgets/listview.c
+++ b/source/widgets/listview.c
@@ -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;
+ }
+}