mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
parent
34810e72be
commit
d47b1515b5
3 changed files with 7 additions and 16 deletions
|
@ -232,13 +232,6 @@ void listview_set_scroll_type(listview *lv, ScrollType type);
|
|||
void listview_set_mouse_activated_cb(listview *lv,
|
||||
listview_mouse_activated_cb cb,
|
||||
void *udata);
|
||||
/**
|
||||
* @param lv Handler to the listview object.
|
||||
* @param num_lines the maximum number of lines to display.
|
||||
*
|
||||
* Set the maximum number of lines to display.
|
||||
*/
|
||||
void listview_set_num_lines(listview *lv, unsigned int num_lines);
|
||||
|
||||
/**
|
||||
* @param lv Handler to the listview object.
|
||||
|
|
|
@ -2166,9 +2166,6 @@ static void rofi_view_add_widget(RofiViewState *state, widget *parent_widget,
|
|||
listview_set_mouse_activated_cb(
|
||||
state->list_view, rofi_view_listview_mouse_activated_cb, state);
|
||||
|
||||
int lines = rofi_theme_get_integer(WIDGET(state->list_view), "lines",
|
||||
DEFAULT_MENU_LINES);
|
||||
listview_set_num_lines(state->list_view, lines);
|
||||
listview_set_max_lines(state->list_view, state->num_lines);
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -607,7 +607,11 @@ static void listview_resize(widget *wid, short w, short h) {
|
|||
lv->widget.h = MAX(0, h);
|
||||
int height = lv->widget.h - widget_padding_get_padding_height(WIDGET(lv));
|
||||
int spacing_vert = distance_get_pixel(lv->spacing, ROFI_ORIENTATION_VERTICAL);
|
||||
lv->max_rows = (spacing_vert + height) / (lv->element_height + spacing_vert);
|
||||
if ( lv->widget.h == 0 ) {
|
||||
lv->max_rows = lv->menu_lines;
|
||||
} else {
|
||||
lv->max_rows = (spacing_vert + height) / (lv->element_height + spacing_vert);
|
||||
}
|
||||
lv->max_elements = lv->max_rows * lv->menu_columns;
|
||||
|
||||
widget_move(WIDGET(lv->scrollbar),
|
||||
|
@ -758,6 +762,8 @@ listview *listview_create(widget *parent, const char *name,
|
|||
lv->spacing = rofi_theme_get_distance(WIDGET(lv), "spacing", DEFAULT_SPACING);
|
||||
lv->menu_columns =
|
||||
rofi_theme_get_integer(WIDGET(lv), "columns", DEFAULT_MENU_COLUMNS);
|
||||
lv->menu_lines =
|
||||
rofi_theme_get_integer(WIDGET(lv), "lines", DEFAULT_MENU_LINES);
|
||||
lv->fixed_num_lines = rofi_theme_get_boolean(WIDGET(lv), "fixed-height",
|
||||
config.fixed_num_lines);
|
||||
lv->dynamic = rofi_theme_get_boolean(WIDGET(lv), "dynamic", TRUE);
|
||||
|
@ -1080,11 +1086,6 @@ void listview_set_mouse_activated_cb(listview *lv,
|
|||
lv->mouse_activated_data = udata;
|
||||
}
|
||||
}
|
||||
void listview_set_num_lines(listview *lv, unsigned int num_lines) {
|
||||
if (lv) {
|
||||
lv->menu_lines = num_lines;
|
||||
}
|
||||
}
|
||||
|
||||
void listview_set_max_lines(listview *lv, unsigned int max_lines) {
|
||||
if (lv) {
|
||||
|
|
Loading…
Reference in a new issue