Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: ui/base/x/events_x.cc

Issue 10830293: Fixes bug where Env/RootWindow would cache the wrong button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to trunk Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/win/events_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/base/events.h" 5 #include "ui/base/events.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <X11/extensions/XInput.h> 8 #include <X11/extensions/XInput.h>
9 #include <X11/extensions/XInput2.h> 9 #include <X11/extensions/XInput2.h>
10 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 if (native_event->type == GenericEvent) { 856 if (native_event->type == GenericEvent) {
857 XIDeviceEvent* xievent = 857 XIDeviceEvent* xievent =
858 static_cast<XIDeviceEvent*>(native_event->xcookie.data); 858 static_cast<XIDeviceEvent*>(native_event->xcookie.data);
859 return xievent->evtype == XI_ButtonPress || 859 return xievent->evtype == XI_ButtonPress ||
860 xievent->evtype == XI_ButtonRelease || 860 xievent->evtype == XI_ButtonRelease ||
861 xievent->evtype == XI_Motion; 861 xievent->evtype == XI_Motion;
862 } 862 }
863 return false; 863 return false;
864 } 864 }
865 865
866 int GetChangedMouseButtonFlagsFromNative(
867 const base::NativeEvent& native_event) {
868 switch (native_event->type) {
869 case ButtonPress:
870 case ButtonRelease:
871 return GetEventFlagsFromXState(native_event->xbutton.state);
872 case GenericEvent: {
873 XIDeviceEvent* xievent =
874 static_cast<XIDeviceEvent*>(native_event->xcookie.data);
875 switch (xievent->evtype) {
876 case XI_ButtonPress:
877 case XI_ButtonRelease:
878 return GetEventFlagsForButton(EventButtonFromNative(native_event));
879 default:
880 break;
881 }
882 }
883 default:
884 break;
885 }
886 return 0;
887 }
888
866 int GetMouseWheelOffset(const base::NativeEvent& native_event) { 889 int GetMouseWheelOffset(const base::NativeEvent& native_event) {
867 int button = native_event->type == GenericEvent 890 int button = native_event->type == GenericEvent
868 ? EventButtonFromNative(native_event) : native_event->xbutton.button; 891 ? EventButtonFromNative(native_event) : native_event->xbutton.button;
869 892
870 switch (button) { 893 switch (button) {
871 case 4: 894 case 4:
872 return kWheelScrollAmount; 895 return kWheelScrollAmount;
873 case 5: 896 case 5:
874 return -kWheelScrollAmount; 897 return -kWheelScrollAmount;
875 default: 898 default:
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 noop->xclient.format = 8; 1011 noop->xclient.format = 8;
989 DCHECK(!noop->xclient.display); 1012 DCHECK(!noop->xclient.display);
990 } 1013 }
991 // Make sure we use atom from current xdisplay, which may 1014 // Make sure we use atom from current xdisplay, which may
992 // change during the test. 1015 // change during the test.
993 noop->xclient.message_type = GetNoopEventAtom(); 1016 noop->xclient.message_type = GetNoopEventAtom();
994 return noop; 1017 return noop;
995 } 1018 }
996 1019
997 } // namespace ui 1020 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/win/events_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698