summaryrefslogtreecommitdiffstats
path: root/views/controls/menu/menu_host_gtk.cc
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-26 20:12:59 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-26 20:12:59 +0000
commit345dd30a55dd5219c39a31df9621e715a8947924 (patch)
tree3562329aa4aac7361ff092ffb4976d28c59944a1 /views/controls/menu/menu_host_gtk.cc
parentf278f74b49f068b3bc1de49a0d90b33cb0d5c005 (diff)
downloadchromium_src-345dd30a55dd5219c39a31df9621e715a8947924.zip
chromium_src-345dd30a55dd5219c39a31df9621e715a8947924.tar.gz
chromium_src-345dd30a55dd5219c39a31df9621e715a8947924.tar.bz2
Reverts menu patch.
BUG=none TEST=none TBR=ben@chromium.org Review URL: http://codereview.chromium.org/173508 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24509 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/menu/menu_host_gtk.cc')
-rw-r--r--views/controls/menu/menu_host_gtk.cc48
1 files changed, 9 insertions, 39 deletions
diff --git a/views/controls/menu/menu_host_gtk.cc b/views/controls/menu/menu_host_gtk.cc
index 9990aab..b87aa23 100644
--- a/views/controls/menu/menu_host_gtk.cc
+++ b/views/controls/menu/menu_host_gtk.cc
@@ -17,8 +17,7 @@ namespace views {
MenuHost::MenuHost(SubmenuView* submenu)
: WidgetGtk(WidgetGtk::TYPE_POPUP),
closed_(false),
- submenu_(submenu),
- did_pointer_grab_(false) {
+ submenu_(submenu) {
// TODO(sky): make sure this is needed.
GdkModifierType current_event_mod;
if (gtk_get_current_event_state(&current_event_mod)) {
@@ -40,26 +39,7 @@ void MenuHost::Init(gfx::NativeView parent,
// TODO(sky): see if there is some way to show without changing focus.
Show();
if (do_capture) {
- // Release the current grab.
- GtkWidget* current_grab_window = gtk_grab_get_current();
- if (current_grab_window)
- gtk_grab_remove(current_grab_window);
-
- // Make sure all app mouse events are targetted at us only.
DoGrab();
-
- // And do a grab.
- // NOTE: we do this to ensure we get mouse events from other apps, a grab
- // done with gtk_grab_add doesn't get events from other apps.
- GdkGrabStatus grab_status =
- gdk_pointer_grab(window_contents()->window, FALSE,
- static_cast<GdkEventMask>(
- GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_MASK),
- NULL, NULL, GDK_CURRENT_TIME);
- did_pointer_grab_ = (grab_status == GDK_GRAB_SUCCESS);
- DCHECK(did_pointer_grab_);
- // need keyboard grab.
#ifdef DEBUG_MENU
DLOG(INFO) << "Doing capture";
#endif
@@ -81,8 +61,8 @@ void MenuHost::Hide() {
// remove them so that View doesn't try to access deleted objects.
static_cast<MenuHostRootView*>(GetRootView())->suspend_events();
GetRootView()->RemoveAllChildViews(false);
- ReleaseGrab();
closed_ = true;
+ ReleaseGrab();
WidgetGtk::Hide();
}
@@ -100,16 +80,14 @@ RootView* MenuHost::CreateRootView() {
return new MenuHostRootView(this, submenu_);
}
-gboolean MenuHost::OnGrabBrokeEvent(GtkWidget* widget, GdkEvent* event) {
- if (!closed_)
- submenu_->GetMenuItem()->GetMenuController()->Cancel(true);
- return WidgetGtk::OnGrabBrokeEvent(widget, event);
-}
-
-void MenuHost::OnGrabNotify(GtkWidget* widget, gboolean was_grabbed) {
- if (!closed_ && (widget != window_contents() || !was_grabbed))
+void MenuHost::OnCancelMode() {
+ // TODO(sky): see if there is an equivalent to this.
+ if (!closed_) {
+#ifdef DEBUG_MENU
+ DLOG(INFO) << "OnCanceMode, closing menu";
+#endif
submenu_->GetMenuItem()->GetMenuController()->Cancel(true);
- WidgetGtk::OnGrabNotify(widget, was_grabbed);
+ }
}
// Overriden to return false, we do NOT want to release capture on mouse
@@ -118,12 +96,4 @@ bool MenuHost::ReleaseCaptureOnMouseReleased() {
return false;
}
-void MenuHost::ReleaseGrab() {
- WidgetGtk::ReleaseGrab();
- if (did_pointer_grab_) {
- did_pointer_grab_ = false;
- gdk_pointer_ungrab(GDK_CURRENT_TIME);
- }
-}
-
} // namespace views