| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 GdkWindow* gwind = gdk_window_lookup_for_display(gdisp, xwindow); | 173 GdkWindow* gwind = gdk_window_lookup_for_display(gdisp, xwindow); |
| 174 Widget* widget = FindWidgetForGdkWindow(gwind); | 174 Widget* widget = FindWidgetForGdkWindow(gwind); |
| 175 if (widget) { | 175 if (widget) { |
| 176 RootView* root = widget->GetRootView(); | 176 RootView* root = widget->GetRootView(); |
| 177 switch (xev->type) { | 177 switch (xev->type) { |
| 178 case KeyPress: | 178 case KeyPress: |
| 179 case KeyRelease: { | 179 case KeyRelease: { |
| 180 Event::FromNativeEvent2 from_native; | 180 Event::FromNativeEvent2 from_native; |
| 181 KeyEvent keyev(xev, from_native); | 181 KeyEvent keyev(xev, from_native); |
| 182 InputMethod* ime = widget->GetInputMethod(); | 182 return widget->OnKeyEvent(keyev); |
| 183 // Always dispatch key events to the input method first, to make sure | |
| 184 // that the input method's hotkeys work all time. | |
| 185 if (ime) { | |
| 186 ime->DispatchKeyEvent(keyev); | |
| 187 return true; | |
| 188 } | |
| 189 return root->ProcessKeyEvent(keyev); | |
| 190 } | 183 } |
| 191 | 184 |
| 192 case ButtonPress: | 185 case ButtonPress: |
| 193 case ButtonRelease: { | 186 case ButtonRelease: { |
| 194 if (xev->xbutton.button == 4 || xev->xbutton.button == 5) { | 187 if (xev->xbutton.button == 4 || xev->xbutton.button == 5) { |
| 195 // Scrolling the wheel triggers button press/release events. | 188 // Scrolling the wheel triggers button press/release events. |
| 196 Event::FromNativeEvent2 from_native; | 189 Event::FromNativeEvent2 from_native; |
| 197 MouseWheelEvent wheelev(xev, from_native); | 190 MouseWheelEvent wheelev(xev, from_native); |
| 198 return root->OnMouseWheel(wheelev); | 191 return root->OnMouseWheel(wheelev); |
| 199 } else { | 192 } else { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } | 238 } |
| 246 | 239 |
| 247 base::MessagePumpGlibXDispatcher::DispatchStatus | 240 base::MessagePumpGlibXDispatcher::DispatchStatus |
| 248 AcceleratorHandler::DispatchX(XEvent* xev) { | 241 AcceleratorHandler::DispatchX(XEvent* xev) { |
| 249 return DispatchXEvent(xev) ? | 242 return DispatchXEvent(xev) ? |
| 250 base::MessagePumpGlibXDispatcher::EVENT_PROCESSED : | 243 base::MessagePumpGlibXDispatcher::EVENT_PROCESSED : |
| 251 base::MessagePumpGlibXDispatcher::EVENT_IGNORED; | 244 base::MessagePumpGlibXDispatcher::EVENT_IGNORED; |
| 252 } | 245 } |
| 253 | 246 |
| 254 } // namespace views | 247 } // namespace views |
| OLD | NEW |