diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-27 19:04:07 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-27 19:04:07 +0000 |
commit | 10763c2048e2f576a95a1e3a5bbcd8252e83ed15 (patch) | |
tree | e7d5fbec08064d3222a52add9af308fe4f090083 | |
parent | 531ff92b9d71556473c2be8abe8be0a4a46f0d2b (diff) | |
download | chromium_src-10763c2048e2f576a95a1e3a5bbcd8252e83ed15.zip chromium_src-10763c2048e2f576a95a1e3a5bbcd8252e83ed15.tar.gz chromium_src-10763c2048e2f576a95a1e3a5bbcd8252e83ed15.tar.bz2 |
Avoid calls to gtk_widget_get_pointer during mouse move if
not necessary. This is to work around janky scrolling behavior
that brad was seeing. I can't repro, so he'll have to tell me if
this works for him
BUG=16786
Review URL: http://codereview.chromium.org/160179
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21675 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/gtk/browser_window_gtk.cc | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index eb2a8a7..2161f4f 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -1339,16 +1339,24 @@ gboolean BrowserWindowGtk::OnGtkAccelerator(GtkAccelGroup* accel_group, // static gboolean BrowserWindowGtk::OnMouseMoveEvent(GtkWidget* widget, GdkEventMotion* event, BrowserWindowGtk* browser) { - // Get the mouse position relative to |widget|. We can't just use event->x - // and event->y because that's relative to the gdk window that got the - // event. - gint x = 0; - gint y = 0; - gtk_widget_get_pointer(widget, &x, &y); + // This method is used to update the mouse cursor when over the edge of the + // custom frame. If the custom frame is off or we're over some other widget, + // do nothing. + if (!browser->use_custom_frame_.GetValue() || + event->window != widget->window) { + // Reset the cursor. + if (browser->frame_cursor_) { + gdk_cursor_unref(browser->frame_cursor_); + browser->frame_cursor_ = NULL; + gdk_window_set_cursor(GTK_WIDGET(browser->window_)->window, NULL); + } + return FALSE; + } // Update the cursor if we're on the custom frame border. GdkWindowEdge edge; - bool has_hit_edge = browser->GetWindowEdge(x, y, &edge); + bool has_hit_edge = browser->GetWindowEdge(static_cast<int>(event->x), + static_cast<int>(event->y), &edge); GdkCursorType new_cursor = GDK_LAST_CURSOR; if (has_hit_edge) new_cursor = GdkWindowEdgeToGdkCursorType(edge); |