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 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 | 872 |
873 // Always reset |should_handle_menu_key_release_| unless we are handling a | 873 // Always reset |should_handle_menu_key_release_| unless we are handling a |
874 // VKEY_MENU key release event. It ensures that VKEY_MENU accelerator can only | 874 // VKEY_MENU key release event. It ensures that VKEY_MENU accelerator can only |
875 // be activated when handling a VKEY_MENU key release event which is preceded | 875 // be activated when handling a VKEY_MENU key release event which is preceded |
876 // by an unhandled VKEY_MENU key press event. | 876 // by an unhandled VKEY_MENU key press event. |
877 if (key_code != base::VKEY_MENU || event->type != GDK_KEY_RELEASE) | 877 if (key_code != base::VKEY_MENU || event->type != GDK_KEY_RELEASE) |
878 should_handle_menu_key_release_ = false; | 878 should_handle_menu_key_release_ = false; |
879 | 879 |
880 if (event->type == GDK_KEY_PRESS) { | 880 if (event->type == GDK_KEY_PRESS) { |
881 // VKEY_MENU is triggered by key release event. | 881 // VKEY_MENU is triggered by key release event. |
| 882 // FocusManager::OnKeyEvent() returns false when the key has been consumed. |
882 if (key_code != base::VKEY_MENU) | 883 if (key_code != base::VKEY_MENU) |
883 handled = focus_manager_->OnKeyEvent(key); | 884 handled = !focus_manager_->OnKeyEvent(key); |
884 else | 885 else |
885 should_handle_menu_key_release_ = true; | 886 should_handle_menu_key_release_ = true; |
886 } else if (key_code == base::VKEY_MENU && should_handle_menu_key_release_ && | 887 } else if (key_code == base::VKEY_MENU && should_handle_menu_key_release_ && |
887 (key.GetFlags() & ~Event::EF_ALT_DOWN) == 0) { | 888 (key.GetFlags() & ~Event::EF_ALT_DOWN) == 0) { |
888 // Trigger VKEY_MENU when only this key is pressed and released, and both | 889 // Trigger VKEY_MENU when only this key is pressed and released, and both |
889 // press and release events are not handled by others. | 890 // press and release events are not handled by others. |
890 Accelerator accelerator(base::VKEY_MENU, false, false, false); | 891 Accelerator accelerator(base::VKEY_MENU, false, false, false); |
891 handled = focus_manager_->ProcessAccelerator(accelerator); | 892 handled = focus_manager_->ProcessAccelerator(accelerator); |
892 } | 893 } |
893 | 894 |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1610 GtkWindow* window = GTK_WINDOW(element->data); | 1611 GtkWindow* window = GTK_WINDOW(element->data); |
1611 DCHECK(window); | 1612 DCHECK(window); |
1612 RootView *root_view = FindRootView(window); | 1613 RootView *root_view = FindRootView(window); |
1613 if (root_view) | 1614 if (root_view) |
1614 root_view->NotifyLocaleChanged(); | 1615 root_view->NotifyLocaleChanged(); |
1615 } | 1616 } |
1616 g_list_free(window_list); | 1617 g_list_free(window_list); |
1617 } | 1618 } |
1618 | 1619 |
1619 } // namespace views | 1620 } // namespace views |
OLD | NEW |