gimp r25167 - in trunk: . app/widgets etc



Author: neo
Date: Fri Mar 21 23:43:21 2008
New Revision: 25167
URL: http://svn.gnome.org/viewvc/gimp?rev=25167&view=rev

Log:
2008-03-22  Sven Neumann  <sven gimp org>

	* app/widgets/gimpsessioninfo.c 
(gimp_session_info_set_geometry):
	deal with negative positions read from the sessionrc file and
	interpret them as a hint to align the window with the right,
	respective bottom edge of the screen.

	* etc/sessionrc: position the toolbox in the upper left, the
	additional dock in the upper right corner of the screen.



Modified:
   trunk/ChangeLog
   trunk/app/widgets/gimpsessioninfo.c
   trunk/etc/sessionrc

Modified: trunk/app/widgets/gimpsessioninfo.c
==============================================================================
--- trunk/app/widgets/gimpsessioninfo.c	(original)
+++ trunk/app/widgets/gimpsessioninfo.c	Fri Mar 21 23:43:21 2008
@@ -383,52 +383,71 @@
 gimp_session_info_set_geometry (GimpSessionInfo *info)
 {
   GdkScreen   *screen;
-  GdkRectangle monitor;
+  GdkRectangle rect;
   gchar        geom[32];
+  gint         monitor;
+  gboolean     right_aligned  = FALSE;
+  gboolean     bottom_aligned = FALSE;
+  gboolean     use_size;
 
   g_return_if_fail (info != NULL);
   g_return_if_fail (GTK_IS_WINDOW (info->widget));
 
   screen = gtk_widget_get_screen (info->widget);
 
-  if ((! info->toplevel_entry || info->toplevel_entry->remember_size) &&
-      (info->width > 0 && info->height > 0))
+  use_size = ((! info->toplevel_entry || info->toplevel_entry->remember_size) &&
+              (info->width > 0 && info->height > 0));
+
+  if (use_size)
     {
-      gdk_screen_get_monitor_geometry (screen,
-                                       get_appropriate_monitor (screen,
-                                                                info->x,
-                                                                info->y,
-                                                                info->width,
-                                                                info->height),
-                                       &monitor);
-
-      info->x = CLAMP (info->x,
-                       monitor.x, monitor.x + monitor.width  - info->width);
-      info->y = CLAMP (info->y,
-                       monitor.y, monitor.y + monitor.height - info->height);
+      monitor = get_appropriate_monitor (screen,
+                                         MAX (0, info->x),
+                                         MAX (0, info->y),
+                                         info->width,
+                                         info->height);
     }
   else
     {
-      gdk_screen_get_monitor_geometry (screen,
-                                       gdk_screen_get_monitor_at_point (screen,
-                                                                        info->x,
-                                                                        info->y),
-                                       &monitor);
-
-      info->x = CLAMP (info->x, monitor.x, monitor.x + monitor.width  - 128);
-      info->y = CLAMP (info->y, monitor.y, monitor.y + monitor.height - 128);
+      monitor = gdk_screen_get_monitor_at_point (screen,
+                                                 MAX (0, info->x),
+                                                 MAX (0, info->y));
     }
 
-  g_snprintf (geom, sizeof (geom), "+%d+%d", info->x, info->y);
+  gdk_screen_get_monitor_geometry (screen, monitor, &rect);
 
-  gtk_window_parse_geometry (GTK_WINDOW (info->widget), geom);
+  if (info->x < 0)
+    {
+      right_aligned = TRUE;
+      info->x = 0;
+    }
+  else
+    {
+      gint max = rect.x + rect.width - (info->width > 0 ? info->width : 128);
+
+      info->x = CLAMP (info->x, rect.x, max);
+    }
 
-  if (! info->toplevel_entry || info->toplevel_entry->remember_size)
+  if (info->y < 0)
     {
-      if (info->width > 0 && info->height > 0)
-        gtk_window_set_default_size (GTK_WINDOW (info->widget),
-                                     info->width, info->height);
+      bottom_aligned = TRUE;
+      info->y = 0;
     }
+  else
+    {
+      gint max = rect.y + rect.height - (info->height > 0 ? info->height : 128);
+
+      info->y = CLAMP (info->y, rect.y, max);
+    }
+
+  g_snprintf (geom, sizeof (geom), "%c%d%c%d",
+              right_aligned  ? '-' : '+', info->x,
+              bottom_aligned ? '-' : '+', info->y);
+
+  gtk_window_parse_geometry (GTK_WINDOW (info->widget), geom);
+
+  if (use_size)
+    gtk_window_set_default_size (GTK_WINDOW (info->widget),
+                                 info->width, info->height);
 }
 
 void

Modified: trunk/etc/sessionrc
==============================================================================
--- trunk/etc/sessionrc	(original)
+++ trunk/etc/sessionrc	Fri Mar 21 23:43:21 2008
@@ -6,14 +6,14 @@
 # you quit GIMP. If this file isn't found, defaults are used.
 
 (session-info "toolbox" "dock"
-    (position 48 48)
+    (position 0 0)
     (size 204 720)
     (open-on-exit)
     (dock
         (book
             (dockable "gimp-tool-options"))))
 (session-info "dock" "dock"
-    (position 300 48)
+    (position -1 0)
     (size 240 720)
     (open-on-exit)
     (aux-info



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