diff options
Diffstat (limited to 'views/controls/menu/native_menu_gtk.h')
-rw-r--r-- | views/controls/menu/native_menu_gtk.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/views/controls/menu/native_menu_gtk.h b/views/controls/menu/native_menu_gtk.h index a8ba37c..5f33b8b 100644 --- a/views/controls/menu/native_menu_gtk.h +++ b/views/controls/menu/native_menu_gtk.h @@ -10,6 +10,7 @@ #include <vector> #include "app/gtk_signal.h" +#include "base/message_loop.h" #include "base/task.h" #include "views/controls/menu/menu_wrapper.h" @@ -28,7 +29,8 @@ namespace views { // then notify. // // TODO(beng): rename to MenuGtk once the old class is dead. -class NativeMenuGtk : public MenuWrapper { +class NativeMenuGtk : public MenuWrapper, + public MessageLoopForUI::Dispatcher { public: explicit NativeMenuGtk(Menu2* menu); virtual ~NativeMenuGtk(); @@ -43,6 +45,9 @@ class NativeMenuGtk : public MenuWrapper { virtual void AddMenuListener(MenuListener* listener); virtual void RemoveMenuListener(MenuListener* listener); + // Overriden from MessageLoopForUI::Dispatcher: + virtual bool Dispatch(GdkEvent* event); + private: CHROMEGTK_CALLBACK_0(NativeMenuGtk, void, OnMenuHidden); CHROMEGTK_CALLBACK_1(NativeMenuGtk, void, OnMenuMoveCurrent, @@ -93,7 +98,11 @@ class NativeMenuGtk : public MenuWrapper { GtkWidget* menu_; - bool menu_shown_; + // Has the menu been hidden? + // NOTE: this is maintained by us and do to the asynchronous nature of X may + // be out of sync with whether the window is actually hidden. None-the-less if + // true the menu is either truly hidden or in the process of hiding. + bool menu_hidden_; // A flag used to avoid misfiring ActivateAt call on the menu model. // This is necessary as GTK menu fires an activate signal even when the |