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

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

Issue 6487002: Add a new constructor to KeyEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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
« no previous file with comments | « views/widget/gtk_views_window.cc ('k') | views/widget/widget_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 10
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 NOTREACHED(); 875 NOTREACHED();
876 return; 876 return;
877 } 877 }
878 gtk_window_set_focus(GTK_WINDOW(GetNativeView()), NULL); 878 gtk_window_set_focus(GTK_WINDOW(GetNativeView()), NULL);
879 } 879 }
880 880
881 bool WidgetGtk::HandleKeyboardEvent(GdkEventKey* event) { 881 bool WidgetGtk::HandleKeyboardEvent(GdkEventKey* event) {
882 if (!focus_manager_) 882 if (!focus_manager_)
883 return false; 883 return false;
884 884
885 KeyEvent key(event); 885 KeyEvent key(reinterpret_cast<NativeEvent>(event));
886 int key_code = key.key_code(); 886 int key_code = key.key_code();
887 bool handled = false; 887 bool handled = false;
888 888
889 // Always reset |should_handle_menu_key_release_| unless we are handling a 889 // Always reset |should_handle_menu_key_release_| unless we are handling a
890 // VKEY_MENU key release event. It ensures that VKEY_MENU accelerator can only 890 // VKEY_MENU key release event. It ensures that VKEY_MENU accelerator can only
891 // be activated when handling a VKEY_MENU key release event which is preceded 891 // be activated when handling a VKEY_MENU key release event which is preceded
892 // by an unhandled VKEY_MENU key press event. 892 // by an unhandled VKEY_MENU key press event.
893 if (key_code != ui::VKEY_MENU || event->type != GDK_KEY_RELEASE) 893 if (key_code != ui::VKEY_MENU || event->type != GDK_KEY_RELEASE)
894 should_handle_menu_key_release_ = false; 894 should_handle_menu_key_release_ = false;
895 895
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 1161
1162 if (type_ == TYPE_CHILD) 1162 if (type_ == TYPE_CHILD)
1163 return false; 1163 return false;
1164 1164
1165 // The top-level window lost focus, store the focused view. 1165 // The top-level window lost focus, store the focused view.
1166 focus_manager_->StoreFocusedView(); 1166 focus_manager_->StoreFocusedView();
1167 return false; 1167 return false;
1168 } 1168 }
1169 1169
1170 gboolean WidgetGtk::OnKeyEvent(GtkWidget* widget, GdkEventKey* event) { 1170 gboolean WidgetGtk::OnKeyEvent(GtkWidget* widget, GdkEventKey* event) {
1171 KeyEvent key(event); 1171 KeyEvent key(reinterpret_cast<NativeEvent>(event));
1172 1172
1173 // Always reset |should_handle_menu_key_release_| unless we are handling a 1173 // Always reset |should_handle_menu_key_release_| unless we are handling a
1174 // VKEY_MENU key release event. It ensures that VKEY_MENU accelerator can only 1174 // VKEY_MENU key release event. It ensures that VKEY_MENU accelerator can only
1175 // be activated when handling a VKEY_MENU key release event which is preceded 1175 // be activated when handling a VKEY_MENU key release event which is preceded
1176 // by an unhandled VKEY_MENU key press event. See also HandleKeyboardEvent(). 1176 // by an unhandled VKEY_MENU key press event. See also HandleKeyboardEvent().
1177 if (key.key_code() != ui::VKEY_MENU || event->type != GDK_KEY_RELEASE) 1177 if (key.key_code() != ui::VKEY_MENU || event->type != GDK_KEY_RELEASE)
1178 should_handle_menu_key_release_ = false; 1178 should_handle_menu_key_release_ = false;
1179 1179
1180 bool handled = false; 1180 bool handled = false;
1181 1181
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 GtkWindow* window = GTK_WINDOW(element->data); 1659 GtkWindow* window = GTK_WINDOW(element->data);
1660 DCHECK(window); 1660 DCHECK(window);
1661 RootView *root_view = FindRootView(window); 1661 RootView *root_view = FindRootView(window);
1662 if (root_view) 1662 if (root_view)
1663 root_view->NotifyLocaleChanged(); 1663 root_view->NotifyLocaleChanged();
1664 } 1664 }
1665 g_list_free(window_list); 1665 g_list_free(window_list);
1666 } 1666 }
1667 1667
1668 } // namespace views 1668 } // namespace views
OLDNEW
« no previous file with comments | « views/widget/gtk_views_window.cc ('k') | views/widget/widget_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698