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

Side by Side Diff: views/focus/accelerator_handler_touch.cc

Issue 5110011: A non-GTK version of menus for touchui. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 10 years, 1 month 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
OLDNEW
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 <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #if defined(HAVE_XINPUT2) 8 #if defined(HAVE_XINPUT2)
9 #include <X11/extensions/XInput2.h> 9 #include <X11/extensions/XInput2.h>
10 #else 10 #else
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 94 }
95 95
96 #endif // HAVE_XINPUT2 96 #endif // HAVE_XINPUT2
97 97
98 bool DispatchXEvent(XEvent* xev) { 98 bool DispatchXEvent(XEvent* xev) {
99 GdkDisplay* gdisp = gdk_display_get_default(); 99 GdkDisplay* gdisp = gdk_display_get_default();
100 XID xwindow = xev->xany.window; 100 XID xwindow = xev->xany.window;
101 101
102 #if defined(HAVE_XINPUT2) 102 #if defined(HAVE_XINPUT2)
103 if (xev->type == GenericEvent) { 103 if (xev->type == GenericEvent) {
104 if (XGetEventData(xev->xgeneric.display, &xev->xcookie)) { 104 XGenericEventCookie* cookie = &xev->xcookie;
105 XGenericEventCookie* cookie = &xev->xcookie; 105 XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(cookie->data);
106 XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(cookie->data); 106 xwindow = xiev->event;
Evan Martin 2010/11/22 20:43:26 This seems unrelated to the change. (?)
sadrul 2010/11/22 21:23:06 This is necessary for the change in message_pump_g
107 xwindow = xiev->event;
108 } else {
109 DLOG(WARNING) << "Error fetching XGenericEventCookie for event.";
110 return false;
111 }
112 } 107 }
113 #endif 108 #endif
114 109
115 GdkWindow* gwind = gdk_window_lookup_for_display(gdisp, xwindow); 110 GdkWindow* gwind = gdk_window_lookup_for_display(gdisp, xwindow);
116 111
117 if (RootView* root = FindRootViewForGdkWindow(gwind)) { 112 if (RootView* root = FindRootViewForGdkWindow(gwind)) {
118 switch (xev->type) { 113 switch (xev->type) {
119 case KeyPress: 114 case KeyPress:
120 case KeyRelease: { 115 case KeyRelease: {
121 KeyEvent keyev(xev); 116 KeyEvent keyev(xev);
(...skipping 25 matching lines...) Expand all
147 if (mouseev.GetType() == Event::ET_MOUSE_DRAGGED) { 142 if (mouseev.GetType() == Event::ET_MOUSE_DRAGGED) {
148 return root->OnMouseDragged(mouseev); 143 return root->OnMouseDragged(mouseev);
149 } else { 144 } else {
150 root->OnMouseMoved(mouseev); 145 root->OnMouseMoved(mouseev);
151 return true; 146 return true;
152 } 147 }
153 } 148 }
154 149
155 #if defined(HAVE_XINPUT2) 150 #if defined(HAVE_XINPUT2)
156 case GenericEvent: { 151 case GenericEvent: {
157 bool ret = DispatchX2Event(root, xev); 152 return DispatchX2Event(root, xev);
158 XFreeEventData(xev->xgeneric.display, &xev->xcookie);
159 return ret;
160 } 153 }
161 #endif 154 #endif
162 } 155 }
163 } 156 }
164 157
165 return false; 158 return false;
166 } 159 }
167 160
168 AcceleratorHandler::AcceleratorHandler() {} 161 AcceleratorHandler::AcceleratorHandler() {}
169 162
170 bool AcceleratorHandler::Dispatch(GdkEvent* event) { 163 bool AcceleratorHandler::Dispatch(GdkEvent* event) {
171 gtk_main_do_event(event); 164 gtk_main_do_event(event);
172 return true; 165 return true;
173 } 166 }
174 167
175 bool AcceleratorHandler::Dispatch(XEvent* xev) { 168 bool AcceleratorHandler::Dispatch(XEvent* xev) {
176 return DispatchXEvent(xev); 169 return DispatchXEvent(xev);
177 } 170 }
178 171
179 } // namespace views 172 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698