From ef417cb8c249a12032e0bb3dd904f45b9cc62b61 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 21 Oct 2014 11:47:52 +0800 Subject: [PATCH 1/5] linux: Fix compilation warning from dbus --- atom.gyp | 1 + 1 file changed, 1 insertion(+) diff --git a/atom.gyp b/atom.gyp index b2856bb852dc..19e241c3ca9a 100644 --- a/atom.gyp +++ b/atom.gyp @@ -570,6 +570,7 @@ 'cflags': [ '-Wno-deprecated-register', '-Wno-empty-body', + '-Wno-reserved-user-defined-literal', ], 'dependencies': [ 'vendor/breakpad/breakpad.gyp:breakpad_client', From 593dce23a5cfc956b6780c6d5d3f84c14ae38df4 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 21 Oct 2014 12:07:10 +0800 Subject: [PATCH 2/5] Link with dbus --- atom.gyp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/atom.gyp b/atom.gyp index 19e241c3ca9a..63f7e711cfe9 100644 --- a/atom.gyp +++ b/atom.gyp @@ -561,6 +561,10 @@ '-rpath \$$ORIGIN', # Make native module dynamic loading work. '-rdynamic', + ' Date: Tue, 21 Oct 2014 12:07:34 +0800 Subject: [PATCH 3/5] linux: Fix detect global menu bar It seems that detecting the bus name "com.canonical.AppMenu.Registrar" is the most reliable way to detect whether the appmenu is available, see http://git.io/JmP7Yg for the discussion. --- atom/browser/native_window_views.cc | 43 +++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index ec5a9a666a9a..2ac747e33477 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -37,6 +37,9 @@ #include "base/nix/xdg_util.h" #include "base/strings/stringprintf.h" #include "chrome/browser/ui/libgtk2ui/unity_service.h" +#include "dbus/bus.h" +#include "dbus/object_proxy.h" +#include "dbus/message.h" #include "ui/base/x/x11_util.h" #include "ui/gfx/x/x11_types.h" #include "ui/views/window/native_frame_view.h" @@ -64,16 +67,38 @@ const int kMenuBarHeight = 25; // window role for X11. int kWindowsCreated = 0; +// Returns true if the bus name "com.canonical.AppMenu.Registrar" is available. bool ShouldUseGlobalMenuBar() { - // Some DE would pretend to be Unity but don't have global application menu, - // so we can not trust unity::IsRunning(). - scoped_ptr env(base::Environment::Create()); - bool is_unity = unity::IsRunning() && - base::nix::GetDesktopEnvironment(env.get()) == - base::nix::DESKTOP_ENVIRONMENT_UNITY; - std::string menu_proxy; - return is_unity && env->GetVar("UBUNTU_MENUPROXY", &menu_proxy) && - menu_proxy.length() > 1; + dbus::Bus::Options options; + scoped_refptr bus(new dbus::Bus(options)); + + dbus::ObjectProxy* object_proxy = + bus->GetObjectProxy(DBUS_SERVICE_DBUS, dbus::ObjectPath(DBUS_PATH_DBUS)); + dbus::MethodCall method_call(DBUS_INTERFACE_DBUS, "ListNames"); + scoped_ptr response(object_proxy->CallMethodAndBlock( + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); + if (!response) { + bus->ShutdownAndBlock(); + return false; + } + + dbus::MessageReader reader(response.get()); + dbus::MessageReader array_reader(NULL); + if (!reader.PopArray(&array_reader)) { + bus->ShutdownAndBlock(); + return false; + } + while (array_reader.HasMoreData()) { + std::string name; + if (array_reader.PopString(&name) && + name == "com.canonical.AppMenu.Registrar") { + bus->ShutdownAndBlock(); + return true; + } + } + + bus->ShutdownAndBlock(); + return false; } #endif From 5162275b9b6136f2b97d195384bb9979a0d79bfc Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 21 Oct 2014 14:23:39 +0800 Subject: [PATCH 4/5] Upgrade libchromiumcontent for dbus headers --- script/lib/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/lib/config.py b/script/lib/config.py index 7b6bc574fd67..09ea75cbb8f5 100644 --- a/script/lib/config.py +++ b/script/lib/config.py @@ -4,7 +4,7 @@ import platform import sys BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' -LIBCHROMIUMCONTENT_COMMIT = '9f5271d31e0f32eac5a20ef6f543e3f1d43ad645' +LIBCHROMIUMCONTENT_COMMIT = '56984fa0e4c3c745652510f342c0fb2724d846c2' ARCH = { 'cygwin': '32bit', From b06d59fcb29dbae115a58430e17a87f1d62c90d3 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 21 Oct 2014 15:01:24 +0800 Subject: [PATCH 5/5] linux: Add libdbus-1-dev as requirement --- docs/development/build-instructions-linux.md | 2 +- script/cibuild | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/development/build-instructions-linux.md b/docs/development/build-instructions-linux.md index d5c9883d6812..bf67f1673076 100644 --- a/docs/development/build-instructions-linux.md +++ b/docs/development/build-instructions-linux.md @@ -8,7 +8,7 @@ On Ubuntu you could install the libraries via: ```bash -$ sudo apt-get install build-essential clang libgtk2.0-dev libnotify-dev gcc-multilib g++-multilib +$ sudo apt-get install build-essential clang libdbus-1-dev libgtk2.0-dev libnotify-dev gcc-multilib g++-multilib ``` Latest Node.js could be installed via ppa: diff --git a/script/cibuild b/script/cibuild index f481c2869afe..b8939775c301 100755 --- a/script/cibuild +++ b/script/cibuild @@ -10,6 +10,7 @@ from lib.util import execute, rm_rf, scoped_env SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) LINUX_DEPS = [ + 'libdbus-1-dev', 'libgnome-keyring-dev', 'libgtk2.0-dev', 'libnotify-dev',