| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 default: | 55 default: |
| 56 return false; | 56 return false; |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 #endif // HAVE_XINPUT2 | 59 #endif // HAVE_XINPUT2 |
| 60 | 60 |
| 61 } // namespace | 61 } // namespace |
| 62 | 62 |
| 63 #if defined(HAVE_XINPUT2) | 63 #if defined(HAVE_XINPUT2) |
| 64 bool DispatchX2Event(RootView* root, XEvent* xev) { | 64 bool DispatchX2Event(RootView* root, XEvent* xev) { |
| 65 XGenericEventCookie* cookie = &xev->xcookie; |
| 66 |
| 65 if (X2EventIsTouchEvent(xev)) { | 67 if (X2EventIsTouchEvent(xev)) { |
| 68 // Hide the cursor when a touch event comes in. |
| 69 TouchFactory::GetInstance()->SetCursorVisibility(false); |
| 70 |
| 66 // Create a TouchEvent, and send it off to |root|. If the event | 71 // Create a TouchEvent, and send it off to |root|. If the event |
| 67 // is processed by |root|, then return. Otherwise let it fall through so it | 72 // is processed by |root|, then return. Otherwise let it fall through so it |
| 68 // can be used (if desired) as a mouse event. | 73 // can be used (if desired) as a mouse event. |
| 69 | |
| 70 TouchEvent touch(xev); | 74 TouchEvent touch(xev); |
| 71 if (root->OnTouchEvent(touch) != views::View::TOUCH_STATUS_UNKNOWN) | 75 if (root->OnTouchEvent(touch) != views::View::TOUCH_STATUS_UNKNOWN) |
| 72 return true; | 76 return true; |
| 77 } else { |
| 78 // Make sure the cursor is visible when there is an event from a non-touch |
| 79 // pointer device. |
| 80 switch (cookie->evtype) { |
| 81 case XI_ButtonPress: |
| 82 case XI_ButtonRelease: |
| 83 case XI_Motion: |
| 84 TouchFactory::GetInstance()->SetCursorVisibility(true); |
| 85 break; |
| 86 } |
| 73 } | 87 } |
| 74 | 88 |
| 75 XGenericEventCookie* cookie = &xev->xcookie; | |
| 76 | |
| 77 switch (cookie->evtype) { | 89 switch (cookie->evtype) { |
| 78 case XI_KeyPress: | 90 case XI_KeyPress: |
| 79 case XI_KeyRelease: { | 91 case XI_KeyRelease: { |
| 80 // TODO(sad): We don't capture XInput2 events from keyboard yet. | 92 // TODO(sad): We don't capture XInput2 events from keyboard yet. |
| 81 break; | 93 break; |
| 82 } | 94 } |
| 83 case XI_ButtonPress: | 95 case XI_ButtonPress: |
| 84 case XI_ButtonRelease: { | 96 case XI_ButtonRelease: { |
| 85 MouseEvent mouseev(xev); | 97 MouseEvent mouseev(xev); |
| 86 if (cookie->evtype == XI_ButtonPress) { | 98 if (cookie->evtype == XI_ButtonPress) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 195 } |
| 184 | 196 |
| 185 base::MessagePumpGlibXDispatcher::DispatchStatus AcceleratorHandler::Dispatch( | 197 base::MessagePumpGlibXDispatcher::DispatchStatus AcceleratorHandler::Dispatch( |
| 186 XEvent* xev) { | 198 XEvent* xev) { |
| 187 return DispatchXEvent(xev) ? | 199 return DispatchXEvent(xev) ? |
| 188 base::MessagePumpGlibXDispatcher::EVENT_PROCESSED : | 200 base::MessagePumpGlibXDispatcher::EVENT_PROCESSED : |
| 189 base::MessagePumpGlibXDispatcher::EVENT_IGNORED; | 201 base::MessagePumpGlibXDispatcher::EVENT_IGNORED; |
| 190 } | 202 } |
| 191 | 203 |
| 192 } // namespace views | 204 } // namespace views |
| OLD | NEW |