diff options
author | Carlos Garcia Campos <carlosgc@gnome.org> | 2010-07-10 15:50:34 (GMT) |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2010-07-10 15:53:43 (GMT) |
commit | 70a15c80d722d7974328550498bd2cfc3cc03302 (patch) | |
tree | e8d3a59188b163e44a55de2e1d5190005cde3416 /libview | |
parent | e43e4dd2cd871eb03e3c051c528766ce14481f72 (diff) |
[libview] Make sure annot popups never show up outside the main window
Fixes bug #604125.
Diffstat (limited to 'libview')
-rw-r--r-- | libview/ev-view.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libview/ev-view.c b/libview/ev-view.c index 1adf772..71470fb 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -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 |