summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2014-04-05 10:11:02 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-12 13:23:38 +0200
commit3712ecc7295b91176f51763a048a83a9c7b98d01 (patch)
tree50033216a09f29f6da72b1bc55e2c9404f2f62fb /src
parent437c68fbff0f5b92272acd3fd6ef6ff7a1ad8e8e (diff)
downloadqtx11extras-3712ecc7295b91176f51763a048a83a9c7b98d01.tar.gz
QX11Info: add nextStartupId/setNextStartupId - for startup-notification
This controls what the next window to be shown will send as startup-notification message. http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt Change-Id: Ia1b5e6ba004d61ca6fdfd6683d2e22dfcd0c42fb Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'src')
-rw-r--r--src/x11extras/qx11info_x11.cpp47
-rw-r--r--src/x11extras/qx11info_x11.h3
2 files changed, 50 insertions, 0 deletions
diff --git a/src/x11extras/qx11info_x11.cpp b/src/x11extras/qx11info_x11.cpp
index 2a7e495..fb70ba8 100644
--- a/src/x11extras/qx11info_x11.cpp
+++ b/src/x11extras/qx11info_x11.cpp
@@ -287,6 +287,53 @@ unsigned long QX11Info::getTimestamp()
}
/*!
+ Returns the startup ID that will be used for the next window to be shown by this process.
+
+ After the next window is shown, the next startup ID will be empty.
+
+ http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt
+
+ \since 5.4
+ \sa setNextStartupId()
+*/
+QByteArray QX11Info::nextStartupId()
+{
+ if (!qApp)
+ return 0;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return 0;
+ return static_cast<char *>(native->nativeResourceForIntegration("startupid"));
+}
+
+/*!
+ Sets the next startup ID to \a id.
+
+ This is the startup ID that will be used for the next window to be shown by this process.
+
+ The startup ID of the first window comes from the environment variable DESKTOP_STARTUP_ID.
+ This method is useful for subsequent windows, when the request comes from another process
+ (e.g. via DBus).
+
+ \since 5.4
+ \sa nextStartupId()
+*/
+void QX11Info::setNextStartupId(const QByteArray &id)
+{
+ if (!qApp)
+ return;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return;
+ typedef void (*SetStartupIdFunc)(const char*);
+ SetStartupIdFunc func = reinterpret_cast<SetStartupIdFunc>(native->nativeResourceFunctionForIntegration("setstartupid"));
+ if (func)
+ func(id.constData());
+ else
+ qWarning("Internal error: QPA plugin doesn't implement setStartupId");
+}
+
+/*!
Returns the default display for the application.
\sa appScreen()
diff --git a/src/x11extras/qx11info_x11.h b/src/x11extras/qx11info_x11.h
index d5d00f3..6e07ba7 100644
--- a/src/x11extras/qx11info_x11.h
+++ b/src/x11extras/qx11info_x11.h
@@ -69,6 +69,9 @@ public:
static unsigned long getTimestamp();
+ static QByteArray nextStartupId();
+ static void setNextStartupId(const QByteArray &id);
+
static Display *display();
static xcb_connection_t *connection();