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

Side by Side Diff: views/controls/menu/menu_controller.cc

Issue 3801011: touchui: Directly process key and mouse events. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: nit Created 10 years, 2 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
« no previous file with comments | « views/controls/menu/menu_controller.h ('k') | views/controls/menu/native_menu_gtk.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/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"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "gfx/canvas_skia.h" 13 #include "gfx/canvas_skia.h"
14 #include "views/controls/button/menu_button.h" 14 #include "views/controls/button/menu_button.h"
15 #include "views/controls/menu/menu_scroll_view_container.h" 15 #include "views/controls/menu/menu_scroll_view_container.h"
16 #include "views/controls/menu/submenu_view.h" 16 #include "views/controls/menu/submenu_view.h"
17 #include "views/drag_utils.h" 17 #include "views/drag_utils.h"
18 #include "views/screen.h" 18 #include "views/screen.h"
19 #include "views/view_constants.h" 19 #include "views/view_constants.h"
20 #include "views/views_delegate.h" 20 #include "views/views_delegate.h"
21 #include "views/widget/root_view.h" 21 #include "views/widget/root_view.h"
22 #include "views/widget/widget.h" 22 #include "views/widget/widget.h"
23 23
24 #if defined(OS_LINUX) 24 #if defined(OS_LINUX)
25 #include "app/keyboard_code_conversion_gtk.h" 25 #include "app/keyboard_code_conversion_gtk.h"
26 #endif 26 #endif
27 27
28 #if defined(TOUCH_UI)
29 #include "views/focus/accelerator_handler.h"
30 #endif
31
28 using base::Time; 32 using base::Time;
29 using base::TimeDelta; 33 using base::TimeDelta;
30 34
31 // Period of the scroll timer (in milliseconds). 35 // Period of the scroll timer (in milliseconds).
32 static const int kScrollTimerMS = 30; 36 static const int kScrollTimerMS = 30;
33 37
34 // Delay, in ms, between when menus are selected are moused over and the menu 38 // Delay, in ms, between when menus are selected are moused over and the menu
35 // appears. 39 // appears.
36 static const int kShowDelay = 400; 40 static const int kShowDelay = 400;
37 41
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 return true; 845 return true;
842 } 846 }
843 847
844 case GDK_KEY_RELEASE: 848 case GDK_KEY_RELEASE:
845 return true; 849 return true;
846 850
847 default: 851 default:
848 break; 852 break;
849 } 853 }
850 854
851 // We don not want Gtk to handle keyboard events, otherwise if they get 855 // We don't want Gtk to handle keyboard events, otherwise if they get
852 // handled by Gtk, unexpected behavior may occur. For example Tab key 856 // handled by Gtk, unexpected behavior may occur. For example Tab key
853 // may cause unexpected focus traversing. 857 // may cause unexpected focus traversing.
854 gtk_main_do_event(event); 858 gtk_main_do_event(event);
855 return exit_type_ == EXIT_NONE; 859 return exit_type_ == EXIT_NONE;
856 } 860 }
861
862 #if defined(TOUCH_UI)
863 bool MenuController::Dispatch(XEvent* xev) {
864 return DispatchXEvent(xev);
865 }
866 #endif
867
857 #endif 868 #endif
858 869
859 bool MenuController::OnKeyDown(int key_code 870 bool MenuController::OnKeyDown(int key_code
860 #if defined(OS_WIN) 871 #if defined(OS_WIN)
861 , const MSG& msg 872 , const MSG& msg
862 #else 873 #else
863 #endif 874 #endif
864 ) { 875 ) {
865 DCHECK(blocking_run_); 876 DCHECK(blocking_run_);
866 877
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
1799 1810
1800 MouseEvent release_event(Event::ET_MOUSE_RELEASED, -1, -1, 0); 1811 MouseEvent release_event(Event::ET_MOUSE_RELEASED, -1, -1, 0);
1801 // Reset the active_mouse_view_ before sending mouse released. That way if if 1812 // Reset the active_mouse_view_ before sending mouse released. That way if if
1802 // calls back to use we aren't in a weird state. 1813 // calls back to use we aren't in a weird state.
1803 View* active_view = active_mouse_view_; 1814 View* active_view = active_mouse_view_;
1804 active_mouse_view_ = NULL; 1815 active_mouse_view_ = NULL;
1805 active_view->OnMouseReleased(release_event, true); 1816 active_view->OnMouseReleased(release_event, true);
1806 } 1817 }
1807 1818
1808 } // namespace views 1819 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/menu/menu_controller.h ('k') | views/controls/menu/native_menu_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698