[gimp] app: brute force the session memorized size when showing a window.



commit 8dbd10b3c6cb61c18fb95f931780c624514a5c6d
Author: Jehan <jehan girinstud io>
Date:   Sat Jan 19 16:12:57 2019 +0100

    app: brute force the session memorized size when showing a window.
    
    The main window height was always bigger than my screen height on
    startup, overriding my previous session's window size.
    
    I could retrace the memorized size being changed when adding the display
    shell with gimp_image_window_add_shell() in gimp_display_new(), just
    before showing the window. Unfortunately this happens after we applied
    the session position/size (in gimp_image_window_session_update() at end
    of image window construction). I'm not sure why adding the shell
    increases the size of the window, especially since the window can be
    manually sized at the expected dimension without any graphical glitch.
    
    Maybe we could investigate this, but simply forcing any session managed
    window to behave as expected upon showing is not a bad move anyway and
    in this specific case, it works fine.

 app/widgets/gimpsessioninfo.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/app/widgets/gimpsessioninfo.c b/app/widgets/gimpsessioninfo.c
index dfaf78cebc..9cff0eed86 100644
--- a/app/widgets/gimpsessioninfo.c
+++ b/app/widgets/gimpsessioninfo.c
@@ -485,6 +485,14 @@ gimp_session_info_dialog_show (GtkWidget       *widget,
 {
   gtk_window_move (GTK_WINDOW (widget),
                    info->p->x, info->p->y);
+
+  if (gimp_session_info_get_remember_size (info) &&
+      info->p->width  > 0 &&
+      info->p->height > 0)
+    {
+      gtk_window_resize (GTK_WINDOW (info->p->widget),
+                         info->p->width, info->p->height);
+    }
 }
 
 static gboolean
@@ -683,6 +691,10 @@ gimp_session_info_apply_geometry (GimpSessionInfo *info,
        *  dock windows. gtk_window_resize() seems to work fine for all
        *  windows. Leave this comment here until we figured what's
        *  going on...
+       *
+       *  XXX If we end up updating this code, also do the same to the
+       *  gtk_window_resize() call in gimp_session_info_dialog_show()
+       *  signal handler.
        */
 #if 1
       gtk_window_resize (GTK_WINDOW (info->p->widget),
@@ -736,7 +748,7 @@ gimp_session_info_apply_geometry (GimpSessionInfo *info,
    *  are shown. This is important especially for transient dialogs,
    *  because window managers behave even "smarter" then...
    */
-  if (GTK_IS_DIALOG (info->p->widget))
+  if (GTK_IS_WINDOW (info->p->widget))
     g_signal_connect (info->p->widget, "show",
                       G_CALLBACK (gimp_session_info_dialog_show),
                       info);
@@ -970,7 +982,7 @@ gimp_session_info_set_widget (GimpSessionInfo *info,
 {
   g_return_if_fail (GIMP_IS_SESSION_INFO (info));
 
-  if (GTK_IS_DIALOG (info->p->widget))
+  if (GTK_IS_WINDOW (info->p->widget))
     g_signal_handlers_disconnect_by_func (info->p->widget,
                                           gimp_session_info_dialog_show,
                                           info);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]