[gimp/gimp-2-8] Bug 694665 - SWM should distribute remaining space to main frame



commit 26d40c10c62722f5d1ccbc68c00757cbefd45847
Author: Michael Natterer <mitch gimp org>
Date:   Wed Feb 27 23:46:00 2013 +0100

    Bug 694665 - SWM should distribute remaining space to main frame
    
    Save the "right-docks-position" as negative value in pixels from the
    right window border. Change the image window restoring code to
    interpret negative values like that, but keep the meaning of positive
    values for compatibility with existing sessionrc files.
    (cherry picked from commit 9da0f489e151d36043bd4fe0ab4404dac47adb0b)

 app/display/gimpimagewindow.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index 49a1f0e..9a4cc77 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -808,6 +808,7 @@ gimp_image_window_get_aux_info (GimpSessionManaged *session_managed)
   if (config->single_window_mode)
     {
       GimpSessionInfoAux *aux;
+      GtkAllocation       allocation;
       gchar               widthbuf[128];
 
       g_snprintf (widthbuf, sizeof (widthbuf), "%d",
@@ -815,8 +816,14 @@ gimp_image_window_get_aux_info (GimpSessionManaged *session_managed)
       aux = gimp_session_info_aux_new (GIMP_IMAGE_WINDOW_LEFT_DOCKS_WIDTH, widthbuf);
       aux_info = g_list_append (aux_info, aux);
 
+      gtk_widget_get_allocation (private->right_hpane, &allocation);
+
+      /* a negative number will be interpreted as the width of the second
+       * child of the pane
+       */
       g_snprintf (widthbuf, sizeof (widthbuf), "%d",
-                  gtk_paned_get_position (GTK_PANED (private->right_hpane)));
+                  gtk_paned_get_position (GTK_PANED (private->right_hpane)) -
+                  allocation.width);
       aux = gimp_session_info_aux_new (GIMP_IMAGE_WINDOW_RIGHT_DOCKS_POS, widthbuf);
       aux_info = g_list_append (aux_info, aux);
 
@@ -838,7 +845,10 @@ gimp_image_window_set_right_hpane_position (GtkPaned      *paned,
 
   g_return_if_fail (GTK_IS_PANED (paned));
 
-  gtk_paned_set_position (paned, position);
+  if (position > 0)
+    gtk_paned_set_position (paned, position);
+  else
+    gtk_paned_set_position (paned, position + allocation->width);
 
   g_signal_handlers_disconnect_by_func (paned,
                                         gimp_image_window_set_right_hpane_position,
@@ -892,7 +902,7 @@ gimp_image_window_set_aux_info (GimpSessionManaged *session_managed,
   if (right_docks_pos > 0 &&
       gtk_paned_get_position (GTK_PANED (private->right_hpane)) != right_docks_pos)
     {
-      if (wait_with_right_docks)
+      if (wait_with_right_docks || right_docks_pos < 0)
         {
           /* We must wait on a size allocation before we can set the
            * position


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