Index: chrome/test/base/ui_controls_aurax11.cc |
diff --git a/chrome/test/base/ui_controls_aurax11.cc b/chrome/test/base/ui_controls_aurax11.cc |
index 9d57fbc9b5c8b37f4d0d8013823875ff32747b4d..7e914e32c06015d4c4ff7a6aa88d12d8ec6b1ed5 100644 |
--- a/chrome/test/base/ui_controls_aurax11.cc |
+++ b/chrome/test/base/ui_controls_aurax11.cc |
@@ -166,30 +166,35 @@ class UIControlsX11 : public UIControlsAura { |
xbutton->x = mouse_loc.x(); |
xbutton->y = mouse_loc.y(); |
xbutton->same_screen = True; |
+ // According to http://tronche.com/gui/x/xlib/events/keyboard-pointer/ |
dcheng
2013/04/18 21:10:34
Nit: Just looking at the diff, it's not 100% clear
|
+ // keyboard-pointer.html#XButtonEvent, the state should be set to the |
+ // button state just prior to the event. |
+ xbutton->state = button_down_mask; |
+ unsigned button = 0; |
switch (type) { |
case LEFT: |
xbutton->button = Button1; |
- xbutton->state = Button1Mask; |
+ button = Button1Mask; |
break; |
case MIDDLE: |
xbutton->button = Button2; |
- xbutton->state = Button2Mask; |
+ button = Button2Mask; |
break; |
case RIGHT: |
xbutton->button = Button3; |
- xbutton->state = Button3Mask; |
+ button = Button3Mask; |
break; |
} |
// RootWindow will take care of other necessary fields. |
if (state & DOWN) { |
xevent.xbutton.type = ButtonPress; |
root_window_->PostNativeEvent(&xevent); |
- button_down_mask |= xbutton->state; |
+ button_down_mask |= button; |
} |
if (state & UP) { |
xevent.xbutton.type = ButtonRelease; |
root_window_->PostNativeEvent(&xevent); |
- button_down_mask = (button_down_mask | xbutton->state) ^ xbutton->state; |
+ button_down_mask &= ~button; |
} |
RunClosureAfterAllPendingUIEvents(closure); |
return true; |