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

Side by Side Diff: views/controls/menu/native_menu_gtk.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, 1 month 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/native_menu_gtk.h ('k') | views/controls/menu/nested_dispatcher_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/native_menu_gtk.h" 5 #include "views/controls/menu/native_menu_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "app/keyboard_code_conversion_gtk.h" 11 #include "app/keyboard_code_conversion_gtk.h"
12 #include "app/keyboard_codes.h" 12 #include "app/keyboard_codes.h"
13 #include "app/menus/menu_model.h" 13 #include "app/menus/menu_model.h"
14 #include "base/gtk_util.h" 14 #include "base/gtk_util.h"
15 #include "base/i18n/rtl.h" 15 #include "base/i18n/rtl.h"
16 #include "base/message_loop.h" 16 #include "base/message_loop.h"
17 #include "base/time.h" 17 #include "base/time.h"
18 #include "base/utf_string_conversions.h" 18 #include "base/utf_string_conversions.h"
19 #include "gfx/font.h" 19 #include "gfx/font.h"
20 #include "gfx/gtk_util.h" 20 #include "gfx/gtk_util.h"
21 #include "third_party/skia/include/core/SkBitmap.h" 21 #include "third_party/skia/include/core/SkBitmap.h"
22 #include "views/accelerator.h" 22 #include "views/accelerator.h"
23 #include "views/controls/menu/menu_2.h" 23 #include "views/controls/menu/menu_2.h"
24 #include "views/controls/menu/nested_dispatcher_gtk.h" 24 #include "views/controls/menu/nested_dispatcher_gtk.h"
25 25
26 #if defined(TOUCH_UI)
27 #include "views/focus/accelerator_handler.h"
28 #endif
29
26 namespace { 30 namespace {
27 31
28 const char kPositionString[] = "position"; 32 const char kPositionString[] = "position";
29 const char kAccelGroupString[] = "accel_group"; 33 const char kAccelGroupString[] = "accel_group";
30 34
31 // Key for the property set on the gtk menu that gives the handle to the hosting 35 // Key for the property set on the gtk menu that gives the handle to the hosting
32 // NativeMenuGtk. 36 // NativeMenuGtk.
33 const char kNativeMenuGtkString[] = "native_menu_gtk"; 37 const char kNativeMenuGtkString[] = "native_menu_gtk";
34 38
35 // Data passed to the MenuPositionFunc from gtk_menu_popup 39 // Data passed to the MenuPositionFunc from gtk_menu_popup
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 listeners_.erase(iter); 210 listeners_.erase(iter);
207 return; 211 return;
208 } 212 }
209 } 213 }
210 } 214 }
211 215
212 void NativeMenuGtk::SetMinimumWidth(int width) { 216 void NativeMenuGtk::SetMinimumWidth(int width) {
213 gtk_widget_set_size_request(menu_, width, -1); 217 gtk_widget_set_size_request(menu_, width, -1);
214 } 218 }
215 219
220 #if defined(TOUCH_UI)
221 bool NativeMenuGtk::Dispatch(XEvent* xevent) {
222 return DispatchXEvent(xevent);
223 }
224 #endif
225
216 bool NativeMenuGtk::Dispatch(GdkEvent* event) { 226 bool NativeMenuGtk::Dispatch(GdkEvent* event) {
217 if (menu_hidden_) { 227 if (menu_hidden_) {
218 // The menu has been closed but the message loop is still nested. Don't 228 // The menu has been closed but the message loop is still nested. Don't
219 // dispatch a message, otherwise we might spawn another message loop. 229 // dispatch a message, otherwise we might spawn another message loop.
220 return false; // Exits the nested message loop. 230 return false; // Exits the nested message loop.
221 } 231 }
222 switch (event->type) { 232 switch (event->type) {
223 case GDK_BUTTON_PRESS: 233 case GDK_BUTTON_PRESS:
224 case GDK_2BUTTON_PRESS: 234 case GDK_2BUTTON_PRESS:
225 case GDK_3BUTTON_PRESS: { 235 case GDK_3BUTTON_PRESS: {
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 #if !defined(OS_CHROMEOS) 525 #if !defined(OS_CHROMEOS)
516 526
517 // static 527 // static
518 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { 528 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) {
519 return new NativeMenuGtk(menu); 529 return new NativeMenuGtk(menu);
520 } 530 }
521 531
522 #endif // OS_CHROMEOS 532 #endif // OS_CHROMEOS
523 533
524 } // namespace views 534 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/menu/native_menu_gtk.h ('k') | views/controls/menu/nested_dispatcher_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698