Chromium Code Reviews| 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/controls/menu/menu_controller.h" | 5 #include "views/controls/menu/menu_controller.h" |
| 6 | 6 |
| 7 #include "app/keyboard_codes.h" | 7 #include "app/keyboard_codes.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "app/os_exchange_data.h" | 9 #include "app/os_exchange_data.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 854 | 854 |
| 855 // We don't want Gtk to handle keyboard events, otherwise if they get | 855 // We don't want Gtk to handle keyboard events, otherwise if they get |
| 856 // handled by Gtk, unexpected behavior may occur. For example Tab key | 856 // handled by Gtk, unexpected behavior may occur. For example Tab key |
| 857 // may cause unexpected focus traversing. | 857 // may cause unexpected focus traversing. |
| 858 gtk_main_do_event(event); | 858 gtk_main_do_event(event); |
| 859 return exit_type_ == EXIT_NONE; | 859 return exit_type_ == EXIT_NONE; |
| 860 } | 860 } |
| 861 | 861 |
| 862 #if defined(TOUCH_UI) | 862 #if defined(TOUCH_UI) |
| 863 bool MenuController::Dispatch(XEvent* xev) { | 863 bool MenuController::Dispatch(XEvent* xev) { |
| 864 return DispatchXEvent(xev); | 864 if (!DispatchXEvent(xev)) |
| 865 return false; | |
| 866 | |
| 867 // The event was handled and |exit_type_| was set. So terminate the event-loop | |
| 868 // that was started in MenuController::Run. | |
| 869 if (exit_type_ != EXIT_NONE) { | |
| 870 MessageLoopForUI::current()->QuitNow(); | |
|
sky
2010/11/22 17:06:15
How come you need the QuitNow instead of returning
sadrul
2010/11/22 18:48:22
Dispatch(XEvent*) returns a value indicating wheth
sky
2010/11/22 19:23:01
The docs don't indicate that. Doesn't that make fo
| |
| 871 } | |
| 872 return true; | |
| 865 } | 873 } |
| 866 #endif | 874 #endif |
| 867 | 875 |
| 868 #endif | 876 #endif |
| 869 | 877 |
| 870 bool MenuController::OnKeyDown(int key_code | 878 bool MenuController::OnKeyDown(int key_code |
| 871 #if defined(OS_WIN) | 879 #if defined(OS_WIN) |
| 872 , const MSG& msg | 880 , const MSG& msg |
| 873 #else | 881 #else |
| 874 #endif | 882 #endif |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1810 | 1818 |
| 1811 MouseEvent release_event(Event::ET_MOUSE_RELEASED, -1, -1, 0); | 1819 MouseEvent release_event(Event::ET_MOUSE_RELEASED, -1, -1, 0); |
| 1812 // Reset the active_mouse_view_ before sending mouse released. That way if if | 1820 // Reset the active_mouse_view_ before sending mouse released. That way if if |
| 1813 // calls back to use we aren't in a weird state. | 1821 // calls back to use we aren't in a weird state. |
| 1814 View* active_view = active_mouse_view_; | 1822 View* active_view = active_mouse_view_; |
| 1815 active_mouse_view_ = NULL; | 1823 active_mouse_view_ = NULL; |
| 1816 active_view->OnMouseReleased(release_event, true); | 1824 active_view->OnMouseReleased(release_event, true); |
| 1817 } | 1825 } |
| 1818 | 1826 |
| 1819 } // namespace views | 1827 } // namespace views |
| OLD | NEW |