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

Side by Side Diff: views/widget/widget_gtk.cc

Issue 6823055: Consolidate OnKeyEvent and InputMethod code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nix RootView from extension_input_api, revert mouse and touch event changes. Created 9 years, 8 months 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) 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/widget/widget_gtk.h" 5 #include "views/widget/widget_gtk.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 #include <gdk/gdkx.h> 8 #include <gdk/gdkx.h>
9 #include <X11/extensions/shape.h> 9 #include <X11/extensions/shape.h>
10 #include <X11/Xatom.h> 10 #include <X11/Xatom.h>
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 } 1371 }
1372 1372
1373 void WidgetGtk::DispatchKeyEventPostIME(const KeyEvent& key) { 1373 void WidgetGtk::DispatchKeyEventPostIME(const KeyEvent& key) {
1374 // Always reset |should_handle_menu_key_release_| unless we are handling a 1374 // Always reset |should_handle_menu_key_release_| unless we are handling a
1375 // VKEY_MENU key release event. It ensures that VKEY_MENU accelerator can only 1375 // VKEY_MENU key release event. It ensures that VKEY_MENU accelerator can only
1376 // be activated when handling a VKEY_MENU key release event which is preceded 1376 // be activated when handling a VKEY_MENU key release event which is preceded
1377 // by an unhandled VKEY_MENU key press event. See also HandleKeyboardEvent(). 1377 // by an unhandled VKEY_MENU key press event. See also HandleKeyboardEvent().
1378 if (key.key_code() != ui::VKEY_MENU || key.type() != ui::ET_KEY_RELEASED) 1378 if (key.key_code() != ui::VKEY_MENU || key.type() != ui::ET_KEY_RELEASED)
1379 should_handle_menu_key_release_ = false; 1379 should_handle_menu_key_release_ = false;
1380 1380
1381 bool handled = false; 1381 // Send the key event to View hierarchy first.
1382 1382 bool handled = delegate_->OnKeyEvent(key);
1383 // Dispatch the key event to View hierarchy first.
1384 handled = GetRootView()->ProcessKeyEvent(key);
1385 1383
1386 if (key.key_code() == ui::VKEY_PROCESSKEY || handled) 1384 if (key.key_code() == ui::VKEY_PROCESSKEY || handled)
1387 return; 1385 return;
1388 1386
1389 // Dispatch the key event to native GtkWidget hierarchy. 1387 // Dispatch the key event to native GtkWidget hierarchy.
1390 // To prevent GtkWindow from handling the key event as a keybinding, we need 1388 // To prevent GtkWindow from handling the key event as a keybinding, we need
1391 // to bypass GtkWindow's default key event handler and dispatch the event 1389 // to bypass GtkWindow's default key event handler and dispatch the event
1392 // here. 1390 // here.
1393 GdkEventKey* event = reinterpret_cast<GdkEventKey*>(key.native_event()); 1391 GdkEventKey* event = reinterpret_cast<GdkEventKey*>(key.native_event());
1394 if (!handled && event && GTK_IS_WINDOW(widget_)) 1392 if (!handled && event && GTK_IS_WINDOW(widget_))
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 1738
1741 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view); 1739 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view);
1742 if (native_widget) 1740 if (native_widget)
1743 children->insert(native_widget); 1741 children->insert(native_widget);
1744 gtk_container_foreach(GTK_CONTAINER(native_view), 1742 gtk_container_foreach(GTK_CONTAINER(native_view),
1745 EnumerateChildWidgetsForNativeWidgets, 1743 EnumerateChildWidgetsForNativeWidgets,
1746 reinterpret_cast<gpointer>(children)); 1744 reinterpret_cast<gpointer>(children));
1747 } 1745 }
1748 1746
1749 } // namespace views 1747 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698