| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(cookie->data); | 92 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(cookie->data); |
| 93 if (xievent->detail == 4 || xievent->detail == 5) { | 93 if (xievent->detail == 4 || xievent->detail == 5) { |
| 94 MouseWheelEvent wheelev(xev); | 94 MouseWheelEvent wheelev(xev); |
| 95 return root->ProcessMouseWheelEvent(wheelev); | 95 return root->ProcessMouseWheelEvent(wheelev); |
| 96 } | 96 } |
| 97 | 97 |
| 98 MouseEvent mouseev(xev); | 98 MouseEvent mouseev(xev); |
| 99 if (!touch_event) { | 99 if (!touch_event) { |
| 100 // Show the cursor, and decide whether or not the cursor should be | 100 // Show the cursor, and decide whether or not the cursor should be |
| 101 // automatically hidden after a certain time of inactivity. | 101 // automatically hidden after a certain time of inactivity. |
| 102 int button_flags = mouseev.flags() & (ui::EF_RIGHT_BUTTON_DOWN | | 102 int button_flags = mouseev.GetFlags() & (ui::EF_RIGHT_BUTTON_DOWN | |
| 103 ui::EF_MIDDLE_BUTTON_DOWN | ui::EF_LEFT_BUTTON_DOWN); | 103 ui::EF_MIDDLE_BUTTON_DOWN | ui::EF_LEFT_BUTTON_DOWN); |
| 104 bool start_timer = false; | 104 bool start_timer = false; |
| 105 | 105 |
| 106 switch (cookie->evtype) { | 106 switch (cookie->evtype) { |
| 107 case XI_ButtonPress: | 107 case XI_ButtonPress: |
| 108 start_timer = false; | 108 start_timer = false; |
| 109 break; | 109 break; |
| 110 case XI_ButtonRelease: | 110 case XI_ButtonRelease: |
| 111 // For a release, start the timer if this was only button pressed | 111 // For a release, start the timer if this was only button pressed |
| 112 // that is being released. | 112 // that is being released. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 123 } | 123 } |
| 124 | 124 |
| 125 // Dispatch the event. | 125 // Dispatch the event. |
| 126 switch (cookie->evtype) { | 126 switch (cookie->evtype) { |
| 127 case XI_ButtonPress: | 127 case XI_ButtonPress: |
| 128 return root->OnMousePressed(mouseev); | 128 return root->OnMousePressed(mouseev); |
| 129 case XI_ButtonRelease: | 129 case XI_ButtonRelease: |
| 130 root->OnMouseReleased(mouseev, false); | 130 root->OnMouseReleased(mouseev, false); |
| 131 return true; | 131 return true; |
| 132 case XI_Motion: { | 132 case XI_Motion: { |
| 133 if (mouseev.type() == ui::ET_MOUSE_DRAGGED) { | 133 if (mouseev.GetType() == ui::ET_MOUSE_DRAGGED) { |
| 134 return root->OnMouseDragged(mouseev); | 134 return root->OnMouseDragged(mouseev); |
| 135 } else { | 135 } else { |
| 136 root->OnMouseMoved(mouseev); | 136 root->OnMouseMoved(mouseev); |
| 137 return true; | 137 return true; |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 } | 142 } |
| 143 | 143 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } else { | 181 } else { |
| 182 root->OnMouseReleased(mouseev, false); | 182 root->OnMouseReleased(mouseev, false); |
| 183 return true; // Assume the event has been processed to make sure we | 183 return true; // Assume the event has been processed to make sure we |
| 184 // don't process it twice. | 184 // don't process it twice. |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 | 188 |
| 189 case MotionNotify: { | 189 case MotionNotify: { |
| 190 MouseEvent mouseev(xev); | 190 MouseEvent mouseev(xev); |
| 191 if (mouseev.type() == ui::ET_MOUSE_DRAGGED) { | 191 if (mouseev.GetType() == ui::ET_MOUSE_DRAGGED) { |
| 192 return root->OnMouseDragged(mouseev); | 192 return root->OnMouseDragged(mouseev); |
| 193 } else { | 193 } else { |
| 194 root->OnMouseMoved(mouseev); | 194 root->OnMouseMoved(mouseev); |
| 195 return true; | 195 return true; |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 #if defined(HAVE_XINPUT2) | 199 #if defined(HAVE_XINPUT2) |
| 200 case GenericEvent: { | 200 case GenericEvent: { |
| 201 return DispatchX2Event(root, xev); | 201 return DispatchX2Event(root, xev); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 221 } | 221 } |
| 222 | 222 |
| 223 base::MessagePumpGlibXDispatcher::DispatchStatus AcceleratorHandler::Dispatch( | 223 base::MessagePumpGlibXDispatcher::DispatchStatus AcceleratorHandler::Dispatch( |
| 224 XEvent* xev) { | 224 XEvent* xev) { |
| 225 return DispatchXEvent(xev) ? | 225 return DispatchXEvent(xev) ? |
| 226 base::MessagePumpGlibXDispatcher::EVENT_PROCESSED : | 226 base::MessagePumpGlibXDispatcher::EVENT_PROCESSED : |
| 227 base::MessagePumpGlibXDispatcher::EVENT_IGNORED; | 227 base::MessagePumpGlibXDispatcher::EVENT_IGNORED; |
| 228 } | 228 } |
| 229 | 229 |
| 230 } // namespace views | 230 } // namespace views |
| OLD | NEW |