diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-16 05:29:32 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-16 05:29:32 +0000 |
commit | 1e498ed00f877c07964760a7045ef576452fe42d (patch) | |
tree | 1a69ad606b0f898c59e5ef1e372da04744b26223 /views/window | |
parent | 19e9aad1795387d97f0ab6849321a2c0f95ef49b (diff) | |
download | chromium_src-1e498ed00f877c07964760a7045ef576452fe42d.zip chromium_src-1e498ed00f877c07964760a7045ef576452fe42d.tar.gz chromium_src-1e498ed00f877c07964760a7045ef576452fe42d.tar.bz2 |
Gtk views code touch up
- Fix wrong mouse event coordinates in gtk event handlers. Gtk events
could be propogate to parent if child does not handle it and we need
to translate the coordinates in gtk event in this case;
- Consume button pressed event if a widget is not transparent;
- Move mouse cursor reset handling on mouse leave from WindowGtk into
RootView. This is because once WindowGtk set a mouse cursor, it stucks
there and RootView could not change it.
BUG=None
TEST=Verify the following two cases: 1. Click on top of a tab should not move chrome; 2. Dock devtools and mouse cursor should change correct on the split and change back to left pointer on leave the split;
Review URL: http://codereview.chromium.org/997002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41681 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window')
-rw-r--r-- | views/window/window_gtk.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc index fbfa3ce..1c7fd88 100644 --- a/views/window/window_gtk.cc +++ b/views/window/window_gtk.cc @@ -259,8 +259,11 @@ void WindowGtk::FrameTypeChanged() { // WindowGtk, WidgetGtk overrides: gboolean WindowGtk::OnButtonPress(GtkWidget* widget, GdkEventButton* event) { + int x = 0, y = 0; + GetContainedWidgetEventCoordinates(event, &x, &y); + int hittest_code = - non_client_view_->NonClientHitTest(gfx::Point(event->x, event->y)); + non_client_view_->NonClientHitTest(gfx::Point(x, y)); switch (hittest_code) { case HTCAPTION: { MouseEvent mouse_pressed(Event::ET_MOUSE_PRESSED, event->x, event->y, @@ -314,13 +317,18 @@ gboolean WindowGtk::OnConfigureEvent(GtkWidget* widget, } gboolean WindowGtk::OnMotionNotify(GtkWidget* widget, GdkEventMotion* event) { + int x = 0, y = 0; + GetContainedWidgetEventCoordinates(event, &x, &y); + // Update the cursor for the screen edge. int hittest_code = - non_client_view_->NonClientHitTest(gfx::Point(event->x, event->y)); - GdkCursorType cursor_type = HitTestCodeToGdkCursorType(hittest_code); - GdkCursor* cursor = gdk_cursor_new(cursor_type); - gdk_window_set_cursor(widget->window, cursor); - gdk_cursor_destroy(cursor); + non_client_view_->NonClientHitTest(gfx::Point(x, y)); + if (hittest_code != HTCLIENT) { + GdkCursorType cursor_type = HitTestCodeToGdkCursorType(hittest_code); + GdkCursor* cursor = gdk_cursor_new(cursor_type); + gdk_window_set_cursor(widget->window, cursor); + gdk_cursor_destroy(cursor); + } return WidgetGtk::OnMotionNotify(widget, event); } |