]> khamidou — GitHub mirrors - electron.git/commitdiff
gtk: Implement accelerator_util.
authorCheng Zhao <zcbenz@gmail.com>
Thu, 2 Jan 2014 14:12:05 +0000 (14:12 +0000)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 2 Jan 2014 14:12:05 +0000 (14:12 +0000)
atom.gyp
browser/ui/accelerator_util_gtk.cc [new file with mode: 0644]

index 0bf9983115c6f64c1f26bf622dd6f9069dbcf97b..5d379fe04dc64b8b775e21676291786780400a8b 100644 (file)
--- a/atom.gyp
+++ b/atom.gyp
       'browser/net/url_request_string_job.h',
       'browser/ui/accelerator_util.cc',
       'browser/ui/accelerator_util.h',
+      'browser/ui/accelerator_util_gtk.cc',
       'browser/ui/accelerator_util_mac.mm',
       'browser/ui/accelerator_util_win.cc',
       'browser/ui/atom_event_processing_window.h',
diff --git a/browser/ui/accelerator_util_gtk.cc b/browser/ui/accelerator_util_gtk.cc
new file mode 100644 (file)
index 0000000..ac14b26
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright (c) 2013 GitHub, Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "browser/ui/accelerator_util.h"
+
+#include "ui/base/accelerators/accelerator.h"
+#include "ui/base/accelerators/platform_accelerator_gtk.h"
+
+namespace accelerator_util {
+
+void SetPlatformAccelerator(ui::Accelerator* accelerator) {
+  scoped_ptr<ui::PlatformAccelerator> platform_accelerator(
+      new ui::PlatformAcceleratorGtk(
+          GetGdkKeyCodeForAccelerator(*accelerator),
+          GetGdkModifierForAccelerator(*accelerator)));
+  accelerator->set_platform_accelerator(platform_accelerator.Pass());
+}
+
+}  // namespace accelerator_util