diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-06 10:18:15 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-06 10:18:15 +0000 |
commit | 81fe28f02b80af5f80c455fe3a28ab32f95d782d (patch) | |
tree | c375d1a7ea3459930fee5a8dc026a5f0bd96ab19 /chrome/browser/automation/ui_controls_aurax11.cc | |
parent | 576383d6bcf037b6f66f4840c1443fa31b017bb8 (diff) | |
download | chromium_src-81fe28f02b80af5f80c455fe3a28ab32f95d782d.zip chromium_src-81fe28f02b80af5f80c455fe3a28ab32f95d782d.tar.gz chromium_src-81fe28f02b80af5f80c455fe3a28ab32f95d782d.tar.bz2 |
process all ui events before posting closure because menu depends on ui events to quit.
Add new RunClosureAfterAllPendingUIEvents for toolkit views.
BUG=104359
TEST=BookmarkBarViewTest in interactive_ui_tests will pass
Review URL: http://codereview.chromium.org/8799020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113177 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/ui_controls_aurax11.cc')
-rw-r--r-- | chrome/browser/automation/ui_controls_aurax11.cc | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/chrome/browser/automation/ui_controls_aurax11.cc b/chrome/browser/automation/ui_controls_aurax11.cc index d7dbe69..20c4c17 100644 --- a/chrome/browser/automation/ui_controls_aurax11.cc +++ b/chrome/browser/automation/ui_controls_aurax11.cc @@ -70,22 +70,6 @@ bool Matcher(const base::NativeEvent& event) { event->xclient.message_type == MarkerEventAtom(); } -void RunClosureAfterEvents(const base::Closure closure) { - if (closure.is_null()) - return; - static XEvent* marker_event = NULL; - if (!marker_event) { - marker_event = new XEvent(); - marker_event->xclient.type = ClientMessage; - marker_event->xclient.display = NULL; - marker_event->xclient.window = None; - marker_event->xclient.format = 8; - } - marker_event->xclient.message_type = MarkerEventAtom(); - aura::Desktop::GetInstance()->PostNativeEvent(marker_event); - new EventWaiter(closure, &Matcher); -} - } // namespace namespace ui_controls { @@ -133,9 +117,7 @@ bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, SetMaskAndKeycodeThenSend(&xevent, ShiftMask, XK_Shift_L); if (alt) SetMaskAndKeycodeThenSend(&xevent, Mod1Mask, XK_Alt_L); - xevent.xkey.keycode = - XKeysymToKeycode(base::MessagePumpX::GetDefaultXDisplay(), - ui::XKeysymForWindowsKeyCode(key, shift)); + xevent.xkey.keycode = ui::XKeysymForWindowsKeyCode(key, shift); aura::Desktop::GetInstance()->PostNativeEvent(&xevent); // Send key release events. @@ -148,7 +130,7 @@ bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, if (control) SetKeycodeAndSendThenUnmask(&xevent, ControlMask, XK_Control_L); DCHECK(!xevent.xkey.state); - RunClosureAfterEvents(closure); + RunClosureAfterAllPendingUIEvents(closure); return true; } @@ -165,7 +147,7 @@ bool SendMouseMoveNotifyWhenDone(long x, long y, const base::Closure& closure) { xmotion->same_screen = True; // Desktop will take care of other necessary fields. aura::Desktop::GetInstance()->PostNativeEvent(&xevent); - RunClosureAfterEvents(closure); + RunClosureAfterAllPendingUIEvents(closure); return false; } @@ -208,7 +190,7 @@ bool SendMouseEventsNotifyWhenDone(MouseButton type, xevent.xbutton.type = ButtonRelease; desktop->PostNativeEvent(&xevent); } - RunClosureAfterEvents(closure); + RunClosureAfterAllPendingUIEvents(closure); return false; } @@ -226,4 +208,20 @@ void MoveMouseToCenterAndPress(views::View* view, MouseButton button, SendMouseEventsNotifyWhenDone(button, state, closure); } +void RunClosureAfterAllPendingUIEvents(const base::Closure& closure) { + if (closure.is_null()) + return; + static XEvent* marker_event = NULL; + if (!marker_event) { + marker_event = new XEvent(); + marker_event->xclient.type = ClientMessage; + marker_event->xclient.display = NULL; + marker_event->xclient.window = None; + marker_event->xclient.format = 8; + } + marker_event->xclient.message_type = MarkerEventAtom(); + aura::Desktop::GetInstance()->PostNativeEvent(marker_event); + new EventWaiter(closure, &Matcher); +} + } // namespace ui_controls |