diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-19 23:26:44 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-19 23:26:44 +0000 |
commit | faeaa946158d500de841248de8a0caab3d597309 (patch) | |
tree | 684918c2a0e34fe8f3c6cbbdf9ed2ab8ba8e0217 /views/widget/widget_gtk.h | |
parent | 2c0494456175ace10c2d83ddaab9aa4f5b0ed0cd (diff) | |
download | chromium_src-faeaa946158d500de841248de8a0caab3d597309.zip chromium_src-faeaa946158d500de841248de8a0caab3d597309.tar.gz chromium_src-faeaa946158d500de841248de8a0caab3d597309.tar.bz2 |
Fixes delivery of mouse events in WidgetGtk. Also fixes GetRootWidget
and GetWidget to match windows.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/113603
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16431 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget/widget_gtk.h')
-rw-r--r-- | views/widget/widget_gtk.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/views/widget/widget_gtk.h b/views/widget/widget_gtk.h index a86a31b..cebc686 100644 --- a/views/widget/widget_gtk.h +++ b/views/widget/widget_gtk.h @@ -20,7 +20,7 @@ class View; class WindowGtk; // Widget implementation for GTK. -class WidgetGtk : public Widget { +class WidgetGtk : public Widget, public MessageLoopForUI::Observer { public: // Type of widget. enum Type { @@ -64,6 +64,10 @@ class WidgetGtk : public Widget { virtual Window* GetWindow(); virtual const Window* GetWindow() const; + // MessageLoopForUI::Observer. + virtual void WillProcessEvent(GdkEvent* event) {} + virtual void DidProcessEvent(GdkEvent* event); + protected: virtual void OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation); virtual void OnPaint(GtkWidget* widget, GdkEventExpose* event); @@ -87,11 +91,20 @@ class WidgetGtk : public Widget { GdkEventVisibility* event) { return false; } + virtual gboolean OnGrabBrokeEvent(GtkWidget* widget, GdkEvent* event); + virtual void OnGrabNotify(GtkWidget* widget, gboolean was_grabbed); + + // Returns whether capture should be released on mouse release. The default + // is true. + virtual bool ReleaseCaptureOnMouseReleased() { return true; } // Sets and retrieves the WidgetGtk in the userdata section of the widget. static WindowGtk* GetWindowForNative(GtkWidget* widget); static void SetWindowForNative(GtkWidget* widget, WindowGtk* window); + // Are we a subclass of WindowGtk? + bool is_window_; + private: virtual RootView* CreateRootView(); @@ -121,12 +134,17 @@ class WidgetGtk : public Widget { static gboolean CallScroll(GtkWidget* widget, GdkEventScroll* event); static gboolean CallVisibilityNotify(GtkWidget* widget, GdkEventVisibility* event); + static gboolean CallGrabBrokeEvent(GtkWidget* widget, GdkEvent* event); + static void CallGrabNotify(GtkWidget* widget, gboolean was_grabbed); + // Returns the first ancestor of |widget| that is a window. static Window* GetWindowImpl(GtkWidget* widget); // Creates the GtkWidget. void CreateGtkWidget(); + void HandleGrabBroke(); + const Type type_; // Our native views. If we're a window/popup, then widget_ is the window and @@ -141,6 +159,9 @@ class WidgetGtk : public Widget { // If true, the mouse is currently down. bool is_mouse_down_; + // Have we done a mouse grab? + bool has_capture_; + // The following are used to detect duplicate mouse move events and not // deliver them. Displaying a window may result in the system generating // duplicate move events even though the mouse hasn't moved. |