summaryrefslogtreecommitdiffstats
path: root/src/compositor/wayland_wrapper
diff options
context:
space:
mode:
authorPier Luigi Fiorini <pierluigi.fiorini@gmail.com>2012-11-05 22:11:15 +0100
committerAndy Nichols <andy.nichols@digia.com>2013-01-04 14:26:23 +0100
commit819d3b1f159d34116fb27f00468371410322c1c8 (patch)
tree9dd364b254ba525fad65472372aa0bbe5eec2829 /src/compositor/wayland_wrapper
parent4323bf663ea131897857ff564943b17e914ccd9b (diff)
Set surface class name.
The class name identifies the general class of applications to which the surface belongs. The class is the name of the desktop file and is derived from the process name. We might want to add a new method to QWindow in order to set a custom class name. It's quiet similar to WM_CLASS on X11, for more information see https://live.gnome.org/GnomeShell/ApplicationBased Change-Id: I5be90fb45e82e79710dda376f42c18c126d2a80f Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Diffstat (limited to 'src/compositor/wayland_wrapper')
-rw-r--r--src/compositor/wayland_wrapper/wlshellsurface.cpp4
-rw-r--r--src/compositor/wayland_wrapper/wlsurface.cpp8
-rw-r--r--src/compositor/wayland_wrapper/wlsurface.h4
3 files changed, 14 insertions, 2 deletions
diff --git a/src/compositor/wayland_wrapper/wlshellsurface.cpp b/src/compositor/wayland_wrapper/wlshellsurface.cpp
index 8f837fc7a..aed1ee64f 100644
--- a/src/compositor/wayland_wrapper/wlshellsurface.cpp
+++ b/src/compositor/wayland_wrapper/wlshellsurface.cpp
@@ -284,8 +284,8 @@ void ShellSurface::set_class(struct wl_client *client,
const char *class_)
{
Q_UNUSED(client);
- Q_UNUSED(resource);
- Q_UNUSED(class_);
+ ShellSurface *self = static_cast<ShellSurface *>(resource->data);
+ self->surface()->setClassName(QString::fromUtf8(class_));
}
const struct wl_shell_surface_interface ShellSurface::shell_surface_interface = {
diff --git a/src/compositor/wayland_wrapper/wlsurface.cpp b/src/compositor/wayland_wrapper/wlsurface.cpp
index d05f36b52..d0586a90b 100644
--- a/src/compositor/wayland_wrapper/wlsurface.cpp
+++ b/src/compositor/wayland_wrapper/wlsurface.cpp
@@ -501,6 +501,14 @@ void Surface::surface_commit(wl_client *client, wl_resource *resource)
resolve<Surface>(resource)->commit();
}
+void Surface::setClassName(const QString &className)
+{
+ if (m_className != className) {
+ m_className = className;
+ emit waylandSurface()->classNameChanged();
+ }
+}
+
void Surface::setTitle(const QString &title)
{
if (m_title != title) {
diff --git a/src/compositor/wayland_wrapper/wlsurface.h b/src/compositor/wayland_wrapper/wlsurface.h
index 642e8f790..8ec87fa36 100644
--- a/src/compositor/wayland_wrapper/wlsurface.h
+++ b/src/compositor/wayland_wrapper/wlsurface.h
@@ -123,6 +123,9 @@ public:
static const struct wl_surface_interface surface_interface;
+ QString className() const { return m_className; }
+ void setClassName(const QString &className);
+
QString title() const { return m_title; }
void setTitle(const QString &title);
@@ -157,6 +160,7 @@ private:
QPointF m_position;
QSize m_size;
+ QString m_className;
QString m_title;
bool m_transientInactive;