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

[i1437] [View] Do the sizing based on the desired window width.

issue: #1437
This commit is contained in:
Dave Davenport 2021-09-06 22:42:33 +02:00
parent 154e03efc1
commit 46ac770fcc

View file

@ -1667,7 +1667,7 @@ static int rofi_view_calculate_height(RofiViewState *state) {
} }
// Autosize based on widgets. // Autosize based on widgets.
widget *main_window = WIDGET(state->main_window); widget *main_window = WIDGET(state->main_window);
return widget_get_desired_height(main_window, main_window->w); return widget_get_desired_height(main_window, state->width);
} }
static WidgetTriggerActionResult textbox_button_trigger_action( static WidgetTriggerActionResult textbox_button_trigger_action(
@ -1994,8 +1994,6 @@ RofiViewState *rofi_view_create(Mode *sw, const char *input,
state->distance = (int *)g_malloc0_n(state->num_lines, sizeof(int)); state->distance = (int *)g_malloc0_n(state->num_lines, sizeof(int));
rofi_view_calculate_window_width(state); rofi_view_calculate_window_width(state);
// Need to resize otherwise calculated desired height is wrong.
widget_resize(WIDGET(state->main_window), state->width, 100);
// Only needed when window is fixed size. // Only needed when window is fixed size.
if ((CacheState.flags & MENU_NORMAL_WINDOW) == MENU_NORMAL_WINDOW) { if ((CacheState.flags & MENU_NORMAL_WINDOW) == MENU_NORMAL_WINDOW) {
listview_set_fixed_num_lines(state->list_view); listview_set_fixed_num_lines(state->list_view);
@ -2048,11 +2046,7 @@ int rofi_view_error_dialog(const char *msg, int markup) {
listview_set_fixed_num_lines(state->list_view); listview_set_fixed_num_lines(state->list_view);
} }
rofi_view_calculate_window_width(state); rofi_view_calculate_window_width(state);
// Need to resize otherwise calculated desired height is wrong. state->height = rofi_view_calculate_height(state);
// widget_resize(WIDGET(state->main_window), state->width, 100);
// resize window vertically to suit
state->height =
widget_get_desired_height(WIDGET(state->main_window), state->width);
// Calculate window position. // Calculate window position.
rofi_view_calculate_window_position(state); rofi_view_calculate_window_position(state);