summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/menu_gtk.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-19 00:36:21 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-19 00:36:21 +0000
commitc1d4a1d6fad0b27b9df5490f8f496019d074c7ee (patch)
tree28208354af6401fa0069537c7bbac8d912bbc01e /chrome/browser/gtk/menu_gtk.cc
parentfd367aa0ef3e542ad63e6bb46d0c997b46e27a74 (diff)
downloadchromium_src-c1d4a1d6fad0b27b9df5490f8f496019d074c7ee.zip
chromium_src-c1d4a1d6fad0b27b9df5490f8f496019d074c7ee.tar.gz
chromium_src-c1d4a1d6fad0b27b9df5490f8f496019d074c7ee.tar.bz2
GTK: Fix popup menu positioning.
Don't go off end of screen. push_in doesn't actually work as well as one might hope. BUG=27800 Review URL: http://codereview.chromium.org/408017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32449 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/menu_gtk.cc')
-rw-r--r--chrome/browser/gtk/menu_gtk.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/chrome/browser/gtk/menu_gtk.cc b/chrome/browser/gtk/menu_gtk.cc
index 862039e..4db7082 100644
--- a/chrome/browser/gtk/menu_gtk.cc
+++ b/chrome/browser/gtk/menu_gtk.cc
@@ -322,6 +322,14 @@ void MenuGtk::PointMenuPositionFunc(GtkMenu* menu,
gfx::Point* point = reinterpret_cast<gfx::Point*>(userdata);
*x = point->x();
*y = point->y();
+
+ GtkRequisition menu_req;
+ gtk_widget_size_request(GTK_WIDGET(menu), &menu_req);
+ GdkScreen* screen = gdk_screen_get_default();
+ gint screen_height = gdk_screen_get_height(screen);
+
+ if (*y + menu_req.height >= screen_height)
+ *y -= menu_req.height;
}
void MenuGtk::UpdateMenu() {