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

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

Issue 9965049: ui/base: Clean up our AcceleratorGtk class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sky review Created 8 years, 8 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
« no previous file with comments | « ui/base/accelerators/accelerator_gtk.h ('k') | ui/base/keycodes/keyboard_codes_posix.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/base/accelerators/accelerator_gtk.h"
6
7 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h"
8 #include "ui/base/keycodes/keyboard_codes_posix.h"
9
10 namespace ui {
11
12 AcceleratorGtk::AcceleratorGtk() : gdk_key_code_(0) {
13 }
14
15 AcceleratorGtk::AcceleratorGtk(guint key_code, GdkModifierType modifier_type)
16 : Accelerator(WindowsKeyCodeForGdkKeyCode(key_code), modifier_type),
17 gdk_key_code_(key_code) {
18 }
19
20 AcceleratorGtk::AcceleratorGtk(KeyboardCode key_code,
21 bool shift_pressed,
22 bool ctrl_pressed,
23 bool alt_pressed)
24 : Accelerator(key_code, 0),
25 gdk_key_code_(0) {
26 if (shift_pressed)
27 modifiers_ |= GDK_SHIFT_MASK;
28 if (ctrl_pressed)
29 modifiers_ |= GDK_CONTROL_MASK;
30 if (alt_pressed)
31 modifiers_ |= GDK_MOD1_MASK;
32 }
33
34 AcceleratorGtk::~AcceleratorGtk() {
35 }
36
37 guint AcceleratorGtk::GetGdkKeyCode() const {
38 if (gdk_key_code_ > 0)
39 return gdk_key_code_;
40
41 // The second parameter is false because accelerator keys are expressed in
42 // terms of the non-shift-modified key.
43 return GdkKeyCodeForWindowsKeyCode(key_code_, false);
44 }
45
46 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/accelerators/accelerator_gtk.h ('k') | ui/base/keycodes/keyboard_codes_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698