OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |