Merge lp:~3v1n0/appmenu-qt5/avoid-x11-calls-in-other-envs into lp:appmenu-qt5

Proposed by Marco Trevisan (Treviño)
Status: Superseded
Proposed branch: lp:~3v1n0/appmenu-qt5/avoid-x11-calls-in-other-envs
Merge into: lp:appmenu-qt5
Diff against target: 94 lines (+22/-4)
4 files modified
debian/control (+1/-0)
src/appmenuplatformmenubar.cpp (+14/-3)
src/appmenuplatformsystemtrayicon.cpp (+6/-0)
src/src.pro (+1/-1)
To merge this branch: bzr merge lp:~3v1n0/appmenu-qt5/avoid-x11-calls-in-other-envs
Reviewer Review Type Date Requested Status
Indicator Applet Developers Pending
Review via email: mp+311676@code.launchpad.net

This proposal has been superseded by a proposal from 2016-11-24.

Commit message

AppMenuPlatformMenuBar: Don't initialize X11 related functions in other environments

To post a comment you must log in.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-07-15 08:55:13 +0000
3+++ debian/control 2016-11-24 02:15:59 +0000
4@@ -10,6 +10,7 @@
5 libfontconfig1-dev,
6 libinput-dev,
7 libmtdev-dev,
8+ libqt5x11extras5-dev,
9 libudev-dev,
10 libxrender-dev,
11 qtbase5-dev (>= 5.2.0),
12
13=== modified file 'src/appmenuplatformmenubar.cpp'
14--- src/appmenuplatformmenubar.cpp 2014-12-13 15:38:51 +0000
15+++ src/appmenuplatformmenubar.cpp 2016-11-24 02:15:59 +0000
16@@ -35,6 +35,7 @@
17 #include <QDebug>
18 #include <QList>
19 #include <QVariant>
20+#include <QX11Info>
21
22 #undef signals // Needed to make sure we can include gtk.h
23 #include <gtk/gtk.h>
24@@ -229,6 +230,10 @@
25 /* Helper function, as copy-pasted from Qt 5.2.1 gtk2 platformthemeplugin */
26 static QString gtkSetting(const gchar *propertyName)
27 {
28+ if (!QX11Info::isPlatformX11()) {
29+ return QString();
30+ }
31+
32 GtkSettings *settings = gtk_settings_get_default();
33 gchararray value;
34 g_object_get(settings, propertyName, &value, NULL);
35@@ -261,13 +266,19 @@
36 GnomeAppMenuPlatformTheme::GnomeAppMenuPlatformTheme()
37 : QGnomeTheme()
38 {
39- int (*oldErrorHandler)(Display *, XErrorEvent *) = XSetErrorHandler(NULL);
40- gtk_init(0, 0);
41- XSetErrorHandler(oldErrorHandler);
42+ if (QX11Info::isPlatformX11()) {
43+ int (*oldErrorHandler)(Display *, XErrorEvent *) = XSetErrorHandler(NULL);
44+ gtk_init(0, 0);
45+ XSetErrorHandler(oldErrorHandler);
46+ }
47 }
48
49 QVariant GnomeAppMenuPlatformTheme::themeHint(QPlatformTheme::ThemeHint hint) const
50 {
51+ if (!QX11Info::isPlatformX11()) {
52+ return QVariant(QVariant::String);
53+ }
54+
55 switch (hint) {
56 case QPlatformTheme::SystemIconThemeName:
57 return QVariant(gtkSetting("gtk-icon-theme-name"));
58
59=== modified file 'src/appmenuplatformsystemtrayicon.cpp'
60--- src/appmenuplatformsystemtrayicon.cpp 2016-05-11 14:54:49 +0000
61+++ src/appmenuplatformsystemtrayicon.cpp 2016-11-24 02:15:59 +0000
62@@ -21,6 +21,7 @@
63 #include <QtDBus/qdbusconnection.h>
64 #include <QtDBus/qdbusconnectioninterface.h>
65 #include <QtDBus/qdbusinterface.h>
66+#include <QX11Info>
67 #include "appmenuplatformmenu.h"
68 #include "appmenuplatformsystemtrayicon.h"
69 #include "iconcache.h"
70@@ -223,6 +224,11 @@
71 {
72 Q_UNUSED(x);
73 Q_UNUSED(y);
74+ // Workarounds LP: #627195
75+ if (QX11Info::isPlatformX11() &&
76+ QString::fromUtf8(getenv("XDG_CURRENT_DESKTOP")).split(':').contains("Unity")) {
77+ QX11Info::setAppUserTime(0);
78+ }
79 emit activated(Trigger);
80 }
81
82
83=== modified file 'src/src.pro'
84--- src/src.pro 2014-12-13 15:38:51 +0000
85+++ src/src.pro 2016-11-24 02:15:59 +0000
86@@ -4,7 +4,7 @@
87 PLUGIN_CLASS_NAME = AppMenuPlatformThemePlugin
88 load(qt_plugin)
89
90-QT += core-private gui-private platformsupport-private dbus widgets
91+QT += core-private gui-private platformsupport-private dbus widgets x11extras
92 DBUS_INTERFACES += com.canonical.AppMenu.Registrar.xml
93 DBUS_ADAPTORS += org.kde.StatusNotifierItem.xml
94 QDBUSXML2CPP_ADAPTOR_HEADER_FLAGS += -i dbusstructures.h

Subscribers

People subscribed via source and target branches