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

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

Issue 11024010: Use correct location for Enter/LeaveNotify (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adressed comments Created 8 years, 2 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 | « no previous file | ui/base/x/events_x_unittest.cc » ('j') | 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/event_constants.h" 5 #include "ui/base/events/event_constants.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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 } 811 }
812 break; 812 break;
813 } 813 }
814 } 814 }
815 NOTREACHED(); 815 NOTREACHED();
816 return base::TimeDelta(); 816 return base::TimeDelta();
817 } 817 }
818 818
819 gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) { 819 gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) {
820 switch (native_event->type) { 820 switch (native_event->type) {
821 case EnterNotify:
822 case LeaveNotify:
823 return gfx::Point(native_event->xcrossing.x, native_event->xcrossing.y);
821 case ButtonPress: 824 case ButtonPress:
822 case ButtonRelease: 825 case ButtonRelease:
823 return gfx::Point(native_event->xbutton.x, native_event->xbutton.y); 826 return gfx::Point(native_event->xbutton.x, native_event->xbutton.y);
824 case MotionNotify: 827 case MotionNotify:
825 return gfx::Point(native_event->xmotion.x, native_event->xmotion.y); 828 return gfx::Point(native_event->xmotion.x, native_event->xmotion.y);
826 case GenericEvent: { 829 case GenericEvent: {
827 XIDeviceEvent* xievent = 830 XIDeviceEvent* xievent =
828 static_cast<XIDeviceEvent*>(native_event->xcookie.data); 831 static_cast<XIDeviceEvent*>(native_event->xcookie.data);
829 832
830 #if defined(USE_XI2_MT) 833 #if defined(USE_XI2_MT)
(...skipping 25 matching lines...) Expand all
856 859
857 return gfx::Point(static_cast<int>(x), static_cast<int>(y)); 860 return gfx::Point(static_cast<int>(x), static_cast<int>(y));
858 } 861 }
859 } 862 }
860 return gfx::Point(); 863 return gfx::Point();
861 } 864 }
862 865
863 gfx::Point EventSystemLocationFromNative( 866 gfx::Point EventSystemLocationFromNative(
864 const base::NativeEvent& native_event) { 867 const base::NativeEvent& native_event) {
865 switch (native_event->type) { 868 switch (native_event->type) {
869 case EnterNotify:
870 case LeaveNotify: {
871 return gfx::Point(native_event->xcrossing.x_root,
872 native_event->xcrossing.y_root);
873 }
866 case ButtonPress: 874 case ButtonPress:
867 case ButtonRelease: { 875 case ButtonRelease: {
868 return gfx::Point(native_event->xbutton.x_root, 876 return gfx::Point(native_event->xbutton.x_root,
869 native_event->xbutton.y_root); 877 native_event->xbutton.y_root);
870 } 878 }
871 case MotionNotify: { 879 case MotionNotify: {
872 return gfx::Point(native_event->xmotion.x_root, 880 return gfx::Point(native_event->xmotion.x_root,
873 native_event->xmotion.y_root); 881 native_event->xmotion.y_root);
874 } 882 }
875 case GenericEvent: { 883 case GenericEvent: {
(...skipping 14 matching lines...) Expand all
890 898
891 return (xievent->sourceid == xievent->deviceid) ? 899 return (xievent->sourceid == xievent->deviceid) ?
892 ui::GetMappedButton(button) : button; 900 ui::GetMappedButton(button) : button;
893 } 901 }
894 902
895 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { 903 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) {
896 return KeyboardCodeFromXKeyEvent(native_event); 904 return KeyboardCodeFromXKeyEvent(native_event);
897 } 905 }
898 906
899 bool IsMouseEvent(const base::NativeEvent& native_event) { 907 bool IsMouseEvent(const base::NativeEvent& native_event) {
900 if (native_event->type == ButtonPress || 908 if (native_event->type == EnterNotify ||
909 native_event->type == LeaveNotify ||
910 native_event->type == ButtonPress ||
901 native_event->type == ButtonRelease || 911 native_event->type == ButtonRelease ||
902 native_event->type == MotionNotify) 912 native_event->type == MotionNotify)
903 return true; 913 return true;
904 if (native_event->type == GenericEvent) { 914 if (native_event->type == GenericEvent) {
905 XIDeviceEvent* xievent = 915 XIDeviceEvent* xievent =
906 static_cast<XIDeviceEvent*>(native_event->xcookie.data); 916 static_cast<XIDeviceEvent*>(native_event->xcookie.data);
907 return xievent->evtype == XI_ButtonPress || 917 return xievent->evtype == XI_ButtonPress ||
908 xievent->evtype == XI_ButtonRelease || 918 xievent->evtype == XI_ButtonRelease ||
909 xievent->evtype == XI_Motion; 919 xievent->evtype == XI_Motion;
910 } 920 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 noop->xclient.format = 8; 1069 noop->xclient.format = 8;
1060 DCHECK(!noop->xclient.display); 1070 DCHECK(!noop->xclient.display);
1061 } 1071 }
1062 // Make sure we use atom from current xdisplay, which may 1072 // Make sure we use atom from current xdisplay, which may
1063 // change during the test. 1073 // change during the test.
1064 noop->xclient.message_type = GetNoopEventAtom(); 1074 noop->xclient.message_type = GetNoopEventAtom();
1065 return noop; 1075 return noop;
1066 } 1076 }
1067 1077
1068 } // namespace ui 1078 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/base/x/events_x_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698