OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/focus/accelerator_handler.h" | 5 #include "views/focus/accelerator_handler.h" |
6 | 6 |
7 #include <bitset> | 7 #include <bitset> |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #if defined(HAVE_XINPUT2) | 9 #if defined(HAVE_XINPUT2) |
10 #include <X11/extensions/XInput2.h> | 10 #include <X11/extensions/XInput2.h> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } // namespace | 90 } // namespace |
91 | 91 |
92 #if defined(HAVE_XINPUT2) | 92 #if defined(HAVE_XINPUT2) |
93 bool DispatchX2Event(RootView* root, XEvent* xev) { | 93 bool DispatchX2Event(RootView* root, XEvent* xev) { |
94 if (X2EventIsTouchEvent(xev)) { | 94 if (X2EventIsTouchEvent(xev)) { |
95 // Create a TouchEvent, and send it off to |root|. If the event | 95 // Create a TouchEvent, and send it off to |root|. If the event |
96 // is processed by |root|, then return. Otherwise let it fall through so it | 96 // is processed by |root|, then return. Otherwise let it fall through so it |
97 // can be used (if desired) as a mouse event. | 97 // can be used (if desired) as a mouse event. |
98 | 98 |
99 TouchEvent touch(xev); | 99 TouchEvent touch(xev); |
100 if (root->OnTouchEvent(touch)) | 100 if (root->OnTouchEvent(touch) != views::View::TOUCH_STATUS_UNKNOWN) |
101 return true; | 101 return true; |
102 } | 102 } |
103 | 103 |
104 XGenericEventCookie* cookie = &xev->xcookie; | 104 XGenericEventCookie* cookie = &xev->xcookie; |
105 | 105 |
106 switch (cookie->evtype) { | 106 switch (cookie->evtype) { |
107 case XI_KeyPress: | 107 case XI_KeyPress: |
108 case XI_KeyRelease: { | 108 case XI_KeyRelease: { |
109 // TODO(sad): We don't capture XInput2 events from keyboard yet. | 109 // TODO(sad): We don't capture XInput2 events from keyboard yet. |
110 break; | 110 break; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 } | 212 } |
213 | 213 |
214 base::MessagePumpGlibXDispatcher::DispatchStatus AcceleratorHandler::Dispatch( | 214 base::MessagePumpGlibXDispatcher::DispatchStatus AcceleratorHandler::Dispatch( |
215 XEvent* xev) { | 215 XEvent* xev) { |
216 return DispatchXEvent(xev) ? | 216 return DispatchXEvent(xev) ? |
217 base::MessagePumpGlibXDispatcher::EVENT_PROCESSED : | 217 base::MessagePumpGlibXDispatcher::EVENT_PROCESSED : |
218 base::MessagePumpGlibXDispatcher::EVENT_IGNORED; | 218 base::MessagePumpGlibXDispatcher::EVENT_IGNORED; |
219 } | 219 } |
220 | 220 |
221 } // namespace views | 221 } // namespace views |
OLD | NEW |