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

Side by Side Diff: ui/base/accelerators/accelerator_gtk.cc

Issue 10446010: wip: Add ui::EventType parameter. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: wip - views_unittests Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/base/accelerators/accelerator_gtk.h" 5 #include "ui/base/accelerators/accelerator_gtk.h"
6 6
7 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h" 7 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h"
8 #include "ui/base/keycodes/keyboard_codes_posix.h" 8 #include "ui/base/keycodes/keyboard_codes_posix.h"
9 9
10 namespace ui { 10 namespace ui {
11 11
12 AcceleratorGtk::AcceleratorGtk() : gdk_key_code_(0) { 12 AcceleratorGtk::AcceleratorGtk() : gdk_key_code_(0) {
13 } 13 }
14 14
15 AcceleratorGtk::AcceleratorGtk(guint key_code, GdkModifierType modifier_type) 15 AcceleratorGtk::AcceleratorGtk(guint key_code, GdkModifierType modifier_type)
16 : Accelerator(WindowsKeyCodeForGdkKeyCode(key_code), modifier_type), 16 : Accelerator(WindowsKeyCodeForGdkKeyCode(key_code),
17 modifier_type,
18 ET_KEY_PRESSED),
17 gdk_key_code_(key_code) { 19 gdk_key_code_(key_code) {
18 } 20 }
19 21
20 AcceleratorGtk::AcceleratorGtk(KeyboardCode key_code, 22 AcceleratorGtk::AcceleratorGtk(KeyboardCode key_code,
21 bool shift_pressed, 23 bool shift_pressed,
22 bool ctrl_pressed, 24 bool ctrl_pressed,
23 bool alt_pressed) 25 bool alt_pressed)
24 : Accelerator(key_code, 0), 26 : Accelerator(key_code, 0, ET_KEY_PRESSED),
25 gdk_key_code_(0) { 27 gdk_key_code_(0) {
26 if (shift_pressed) 28 if (shift_pressed)
27 modifiers_ |= GDK_SHIFT_MASK; 29 modifiers_ |= GDK_SHIFT_MASK;
28 if (ctrl_pressed) 30 if (ctrl_pressed)
29 modifiers_ |= GDK_CONTROL_MASK; 31 modifiers_ |= GDK_CONTROL_MASK;
30 if (alt_pressed) 32 if (alt_pressed)
31 modifiers_ |= GDK_MOD1_MASK; 33 modifiers_ |= GDK_MOD1_MASK;
32 } 34 }
33 35
34 AcceleratorGtk::~AcceleratorGtk() { 36 AcceleratorGtk::~AcceleratorGtk() {
35 } 37 }
36 38
37 guint AcceleratorGtk::GetGdkKeyCode() const { 39 guint AcceleratorGtk::GetGdkKeyCode() const {
38 if (gdk_key_code_ > 0) 40 if (gdk_key_code_ > 0)
39 return gdk_key_code_; 41 return gdk_key_code_;
40 42
41 // The second parameter is false because accelerator keys are expressed in 43 // The second parameter is false because accelerator keys are expressed in
42 // terms of the non-shift-modified key. 44 // terms of the non-shift-modified key.
43 return GdkKeyCodeForWindowsKeyCode(key_code_, false); 45 return GdkKeyCodeForWindowsKeyCode(key_code_, false);
44 } 46 }
45 47
46 } // namespace ui 48 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/accelerators/accelerator_cocoa.mm ('k') | ui/base/accelerators/accelerator_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698