]> khamidou — GitHub mirrors - electron.git/commitdiff
gtk: Fix lack of x11_util implementations.
authorCheng Zhao <zcbenz@gmail.com>
Sun, 29 Jun 2014 05:31:11 +0000 (05:31 +0000)
committerCheng Zhao <zcbenz@gmail.com>
Sun, 29 Jun 2014 05:31:11 +0000 (05:31 +0000)
atom.gyp
atom/browser/ui/gtk/x11_util.cc [new file with mode: 0644]

index 191c0428c9eed11e1aff76170d6c379acc279fba..53e4a4990697458741dac88b7ab60fc266cd1046 100644 (file)
--- a/atom.gyp
+++ b/atom.gyp
       'atom/browser/ui/gtk/status_icon.h',
       'atom/browser/ui/gtk/work_area_watcher_x.cc',
       'atom/browser/ui/gtk/work_area_watcher_x.h',
+      'atom/browser/ui/gtk/x11_util.cc',
       'atom/browser/ui/message_box.h',
       'atom/browser/ui/message_box_gtk.cc',
       'atom/browser/ui/message_box_mac.mm',
diff --git a/atom/browser/ui/gtk/x11_util.cc b/atom/browser/ui/gtk/x11_util.cc
new file mode 100644 (file)
index 0000000..94dbe5b
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file defines utility functions for X11 (Linux only). This code has been
+// ported from XCB since we can't use XCB on Ubuntu while its 32-bit support
+// remains woefully incomplete.
+
+#include "ui/base/x/x11_util.h"
+
+#include "ui/gfx/gdk_compat.h"
+
+namespace ui {
+
+Atom GetAtom(const char* name) {
+#if defined(TOOLKIT_GTK)
+  return gdk_x11_get_xatom_by_name_for_display(
+      gdk_display_get_default(), name);
+#else
+  // TODO(derat): Cache atoms to avoid round-trips to the server.
+  return XInternAtom(gfx::GetXDisplay(), name, false);
+#endif
+}
+
+}  // namespace ui