OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 TouchFactory::GetInstance()->UpdateDeviceList(cookie->display); | 123 TouchFactory::GetInstance()->UpdateDeviceList(cookie->display); |
124 return true; | 124 return true; |
125 } | 125 } |
126 | 126 |
127 XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(cookie->data); | 127 XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(cookie->data); |
128 xwindow = xiev->event; | 128 xwindow = xiev->event; |
129 } | 129 } |
130 #endif | 130 #endif |
131 | 131 |
132 GdkWindow* gwind = gdk_window_lookup_for_display(gdisp, xwindow); | 132 GdkWindow* gwind = gdk_window_lookup_for_display(gdisp, xwindow); |
133 Widget* widget = FindWidgetForGdkWindow(gwind); | 133 Widget* widget = gwind ? FindWidgetForGdkWindow(gwind) : NULL; |
Daniel Erat
2011/05/17 18:33:17
Mention this in the CL description too, assuming t
sadrul
2011/05/17 19:39:55
Nope. This is for this CL. Until now, we have only
| |
134 if (widget) { | 134 if (widget) { |
135 Event::FromNativeEvent2 from_native; | 135 Event::FromNativeEvent2 from_native; |
136 switch (xev->type) { | 136 switch (xev->type) { |
137 case KeyPress: | 137 case KeyPress: |
138 case KeyRelease: { | 138 case KeyRelease: { |
139 KeyEvent keyev(xev, from_native); | 139 KeyEvent keyev(xev, from_native); |
140 InputMethod* ime = widget->GetInputMethod(); | 140 InputMethod* ime = widget->GetInputMethod(); |
141 // Always dispatch key events to the input method first, to make sure | 141 // Always dispatch key events to the input method first, to make sure |
142 // that the input method's hotkeys work all time. | 142 // that the input method's hotkeys work all time. |
143 if (ime) { | 143 if (ime) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 } | 184 } |
185 | 185 |
186 base::MessagePumpGlibXDispatcher::DispatchStatus | 186 base::MessagePumpGlibXDispatcher::DispatchStatus |
187 AcceleratorHandler::DispatchX(XEvent* xev) { | 187 AcceleratorHandler::DispatchX(XEvent* xev) { |
188 return DispatchXEvent(xev) ? | 188 return DispatchXEvent(xev) ? |
189 base::MessagePumpGlibXDispatcher::EVENT_PROCESSED : | 189 base::MessagePumpGlibXDispatcher::EVENT_PROCESSED : |
190 base::MessagePumpGlibXDispatcher::EVENT_IGNORED; | 190 base::MessagePumpGlibXDispatcher::EVENT_IGNORED; |
191 } | 191 } |
192 | 192 |
193 } // namespace views | 193 } // namespace views |
OLD | NEW |