Add close request to the PlasmaWindow interfaces
This commit is contained in:
parent
abf42dfdc3
commit
93c1521624
2 changed files with 19 additions and 4 deletions
|
@ -78,6 +78,10 @@ public:
|
||||||
private:
|
private:
|
||||||
static void unbind(wl_resource *resource);
|
static void unbind(wl_resource *resource);
|
||||||
static void destroyListenerCallback(wl_listener *listener, void *data);
|
static void destroyListenerCallback(wl_listener *listener, void *data);
|
||||||
|
static void closeCallback(wl_client *client, wl_resource *resource);
|
||||||
|
static Private *cast(wl_resource *resource) {
|
||||||
|
return reinterpret_cast<Private*>(wl_resource_get_user_data(resource));
|
||||||
|
}
|
||||||
|
|
||||||
PlasmaWindowInterface *q;
|
PlasmaWindowInterface *q;
|
||||||
PlasmaWindowManagementInterface *wm;
|
PlasmaWindowManagementInterface *wm;
|
||||||
|
@ -86,7 +90,7 @@ private:
|
||||||
quint32 m_virtualDesktop = 0;
|
quint32 m_virtualDesktop = 0;
|
||||||
quint32 m_state = 0;
|
quint32 m_state = 0;
|
||||||
wl_listener listener;
|
wl_listener listener;
|
||||||
// static const struct org_kde_plasma_window_interface s_interface;
|
static const struct org_kde_plasma_window_interface s_interface;
|
||||||
};
|
};
|
||||||
|
|
||||||
PlasmaWindowManagementInterface::Private::Private(PlasmaWindowManagementInterface *q, Display *d)
|
PlasmaWindowManagementInterface::Private::Private(PlasmaWindowManagementInterface *q, Display *d)
|
||||||
|
@ -199,8 +203,9 @@ PlasmaWindowInterface *PlasmaWindowManagementInterface::createWindow(QObject *pa
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
// const struct org_kde_plasma_window_interface PlasmaWindowInterface::Private::s_interface = {
|
const struct org_kde_plasma_window_interface PlasmaWindowInterface::Private::s_interface = {
|
||||||
// };
|
closeCallback
|
||||||
|
};
|
||||||
|
|
||||||
PlasmaWindowInterface::Private::Private(PlasmaWindowManagementInterface *wm, PlasmaWindowInterface *q)
|
PlasmaWindowInterface::Private::Private(PlasmaWindowManagementInterface *wm, PlasmaWindowInterface *q)
|
||||||
: q(q)
|
: q(q)
|
||||||
|
@ -255,7 +260,7 @@ void PlasmaWindowInterface::Private::createResource(wl_resource *parent)
|
||||||
r.destroyListener->notify = destroyListenerCallback;
|
r.destroyListener->notify = destroyListenerCallback;
|
||||||
r.destroyListener->link.prev = nullptr;
|
r.destroyListener->link.prev = nullptr;
|
||||||
r.destroyListener->link.next = nullptr;
|
r.destroyListener->link.next = nullptr;
|
||||||
wl_resource_set_implementation(resource, nullptr, this, unbind);
|
wl_resource_set_implementation(resource, &s_interface, this, unbind);
|
||||||
wl_resource_add_destroy_listener(resource, r.destroyListener);
|
wl_resource_add_destroy_listener(resource, r.destroyListener);
|
||||||
resources << r;
|
resources << r;
|
||||||
|
|
||||||
|
@ -331,6 +336,13 @@ void PlasmaWindowInterface::Private::setState(org_kde_plasma_window_management_s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlasmaWindowInterface::Private::closeCallback(wl_client *client, wl_resource *resource)
|
||||||
|
{
|
||||||
|
Q_UNUSED(client)
|
||||||
|
Private *p = cast(resource);
|
||||||
|
emit p->q->closeRequested();
|
||||||
|
}
|
||||||
|
|
||||||
PlasmaWindowInterface::PlasmaWindowInterface(PlasmaWindowManagementInterface *wm, QObject *parent)
|
PlasmaWindowInterface::PlasmaWindowInterface(PlasmaWindowManagementInterface *wm, QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, d(new Private(wm, this))
|
, d(new Private(wm, this))
|
||||||
|
|
|
@ -85,6 +85,9 @@ public:
|
||||||
|
|
||||||
void unmap();
|
void unmap();
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void closeRequested();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class PlasmaWindowManagementInterface;
|
friend class PlasmaWindowManagementInterface;
|
||||||
explicit PlasmaWindowInterface(PlasmaWindowManagementInterface *wm, QObject *parent);
|
explicit PlasmaWindowInterface(PlasmaWindowManagementInterface *wm, QObject *parent);
|
||||||
|
|
Loading…
Reference in a new issue