]> www.fi.muni.cz Git - evince.git/commitdiff
[libview] Make sure annot popups never show up outside the main window
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sat, 10 Jul 2010 15:50:34 +0000 (17:50 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Sat, 10 Jul 2010 15:53:43 +0000 (17:53 +0200)
Fixes bug #604125.

libview/ev-view.c

index 1adf772c346281b9b4c7d4844170cc0c4d71a551..71470fbe43c20b511a8a489436f40afca67579ff 100644 (file)
@@ -2400,11 +2400,19 @@ ev_view_window_child_move (EvView            *view,
                           gint               x,
                           gint               y)
 {
+       GtkAllocation allocation;
+       gint          width, height;
+
+       gtk_widget_get_allocation (GTK_WIDGET (view), &allocation);
+       gtk_window_get_size (GTK_WINDOW (child->window), &width, &height);
+
        child->x = x;
        child->y = y;
        gtk_window_move (GTK_WINDOW (child->window),
-                        MAX (child->parent_x, x),
-                        MAX (child->parent_y, y));
+                        CLAMP (x, child->parent_x,
+                               child->parent_x + allocation.width - width),
+                        CLAMP (y, child->parent_y,
+                               child->parent_y + allocation.height - height));
 }
 
 static void