summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-26 20:41:36 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-26 20:41:36 +0000
commit6cfbaff187b755e27246669c19c0b56e2c70110c (patch)
tree68e94374f6c55e56fdfc9612a852cfd344b0c100 /chrome/browser
parent62861aee477cb57845a606a5a272ed6a617b4737 (diff)
downloadchromium_src-6cfbaff187b755e27246669c19c0b56e2c70110c.zip
chromium_src-6cfbaff187b755e27246669c19c0b56e2c70110c.tar.gz
chromium_src-6cfbaff187b755e27246669c19c0b56e2c70110c.tar.bz2
gtk: button-press events return coordinates relative to the gdk window in which the button was pressed. Convert this point to a browser window-relative coordinate when handling resizing the custom frame.
BUG=18308 TEST=Click the last pixel of the tabstrip and drag the mouse. You should not be able to resize the browser window. Review URL: http://codereview.chromium.org/173319 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24520 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index 0a441ac..d3adae5 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -1823,9 +1823,15 @@ gboolean BrowserWindowGtk::OnButtonPressEvent(GtkWidget* widget,
// Handle left, middle and right clicks. In particular, we care about clicks
// in the custom frame border and clicks in the titlebar.
+
+ // Make the button press coordinate relative to the browser window.
+ int win_x, win_y;
+ gdk_window_get_origin(GTK_WIDGET(browser->window_)->window, &win_x, &win_y);
+
GdkWindowEdge edge;
- bool has_hit_edge = browser->GetWindowEdge(static_cast<int>(event->x),
- static_cast<int>(event->y), &edge);
+ gfx::Point point(event->x_root - win_x, event->y_root - win_y);
+ bool has_hit_edge = browser->GetWindowEdge(point.x(), point.y(), &edge);
+
// Ignore clicks that are in/below the browser toolbar.
GtkWidget* toolbar = browser->toolbar_->widget();
if (!GTK_WIDGET_VISIBLE(toolbar)) {