| OLD | NEW |
| (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 |
| OLD | NEW |