diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-24 03:31:02 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-24 03:31:02 +0000 |
commit | 3a535b0727f125452cc37733fac880753b14a503 (patch) | |
tree | 1951566bcb8f62b0e4f56e211745706aee88c97b /chrome/common/gtk_util.cc | |
parent | 172c55057003795131ecb2ad5dd012b0c1785171 (diff) | |
download | chromium_src-3a535b0727f125452cc37733fac880753b14a503.zip chromium_src-3a535b0727f125452cc37733fac880753b14a503.tar.gz chromium_src-3a535b0727f125452cc37733fac880753b14a503.tar.bz2 |
show back/forward menu on right click
http://crbug.com/15100
TEST=do it
Review URL: http://codereview.chromium.org/146062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19101 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/gtk_util.cc')
-rw-r--r-- | chrome/common/gtk_util.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc index 1a07831..1a89b9b 100644 --- a/chrome/common/gtk_util.cc +++ b/chrome/common/gtk_util.cc @@ -257,4 +257,22 @@ int MirroredLeftPointForRect(GtkWidget* widget, const gfx::Rect& bounds) { return widget->allocation.width - bounds.x() - bounds.width(); } +bool WidgetContainsCursor(GtkWidget* widget) { + gint x = 0; + gint y = 0; + gtk_widget_get_pointer(widget, &x, &y); + + // To quote the gtk docs: + // + // Widget coordinates are a bit odd; for historical reasons, they are + // defined as widget->window coordinates for widgets that are not + // GTK_NO_WINDOW widgets, and are relative to widget->allocation.x, + // widget->allocation.y for widgets that are GTK_NO_WINDOW widgets. + // + // So the base is always (0,0). + gfx::Rect widget_allocation(0, 0, widget->allocation.width, + widget->allocation.height); + return widget_allocation.Contains(x, y); +} + } // namespace gtk_util |