gimp r26741 - in trunk: . app/display



Author: martinn
Date: Sun Aug 24 08:56:02 2008
New Revision: 26741
URL: http://svn.gnome.org/viewvc/gimp?rev=26741&view=rev

Log:
2008-08-24  Martin Nordholts  <martinn svn gnome org>

	* app/display/gimpnavigationeditor.c
	(gimp_navigation_editor_popup): Prevent the popup from being
	positioned far away from the click position. This is further work
	on bug #362915.


Modified:
   trunk/ChangeLog
   trunk/app/display/gimpnavigationeditor.c

Modified: trunk/app/display/gimpnavigationeditor.c
==============================================================================
--- trunk/app/display/gimpnavigationeditor.c	(original)
+++ trunk/app/display/gimpnavigationeditor.c	Sun Aug 24 08:56:02 2008
@@ -275,6 +275,7 @@
   /* Position the popup */
   {
     gint x_origin, y_origin;
+    gint popup_width, popup_height;
     gint border_width, border_height;
     gint screen_click_x, screen_click_y;
     
@@ -284,6 +285,8 @@
     screen_click_y = y_origin + click_y;
     border_width   = style->xthickness * 4;
     border_height  = style->ythickness * 4;
+    popup_width    = GIMP_VIEW (view)->renderer->width  - border_width;
+    popup_height   = GIMP_VIEW (view)->renderer->height - border_height;
 
     x = screen_click_x -
         border_width -
@@ -295,6 +298,13 @@
         view_marker_y -
         view_marker_height / 2;
 
+    /* When the image is zoomed out and overscrolled, the above
+     * calculation risks positioning the popup far far away from the
+     * click coordinate. We don't want that, so perform some clamping.
+     */
+    x = CLAMP (x, screen_click_x - popup_width,  screen_click_x);
+    y = CLAMP (y, screen_click_y - popup_height, screen_click_y);
+
     /* If the popup doesn't fit into the screen, we have a problem.
      * We move the popup onscreen and risk that the pointer is not
      * in the square representing the viewable area anymore. Moving
@@ -304,13 +314,8 @@
      *
      * Warping the pointer would be another solution ...
      */
-
-    x = CLAMP (x, 0, gdk_screen_get_width (screen)  -
-               GIMP_VIEW (view)->renderer->width  -
-               border_width);
-    y = CLAMP (y, 0, gdk_screen_get_height (screen) -
-               GIMP_VIEW (view)->renderer->height -
-               border_height);
+    x = CLAMP (x, 0, gdk_screen_get_width (screen)  - popup_width);
+    y = CLAMP (y, 0, gdk_screen_get_height (screen) - popup_height);
 
     gtk_window_move (GTK_WINDOW (shell->nav_popup), x, y);
   }



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