summaryrefslogtreecommitdiffstats
path: root/source/view.c
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-01-03 12:19:07 +0100
committerDave Davenport <qball@gmpclient.org>2017-01-03 12:19:07 +0100
commit23e1bf95660814247f30d7b20c7308c1f00897d9 (patch)
tree79260a7ec8719d25423f3d73d4a10f57369a2214 /source/view.c
parentf82129aab87467d93c31340ebce225ff842a59d7 (diff)
Resize widgets in width before determining initial height.
- Solves Rasi weird sizing issue.
Diffstat (limited to 'source/view.c')
-rw-r--r--source/view.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source/view.c b/source/view.c
index 5208fa73..60569a16 100644
--- a/source/view.c
+++ b/source/view.c
@@ -1509,6 +1509,8 @@ RofiViewState *rofi_view_create ( Mode *sw,
state->distance = (int *) g_malloc0_n ( state->num_lines, sizeof ( int ) );
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.
if (( CacheState.flags & MENU_NORMAL_WINDOW ) == MENU_NORMAL_WINDOW ) {
config.fixed_num_lines = TRUE;
@@ -1542,16 +1544,20 @@ int rofi_view_error_dialog ( const char *msg, int markup )
state->text = textbox_create ( "message", ( TB_AUTOHEIGHT | TB_WRAP ) + ( ( markup ) ? TB_MARKUP : 0 ),
NORMAL, ( msg != NULL ) ? msg : "" );
box_add ( state->main_box, WIDGET ( state->text ), TRUE, FALSE );
- unsigned int line_height = textbox_get_height ( state->text );
+
// 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;
}
+ rofi_view_calculate_window_width ( state );
+ // Need to resize otherwise calculated desired height is wrong.
+ widget_resize ( WIDGET ( state->main_window ), state->width, 100);
+ unsigned int line_height = textbox_get_height ( state->text );
// resize window vertically to suit
- state->height = line_height + window_get_border_width ( state->main_window)+widget_padding_get_padding_height ( WIDGET(state->main_window) );
+ state->height = line_height + window_get_border_width ( state->main_window);
+ state->height = widget_padding_get_padding_height ( WIDGET(state->main_window) );
- rofi_view_calculate_window_width ( state );
// Calculte window position.
rofi_view_calculate_window_position ( state );