address last comments of review 125871

This commit is contained in:
Marco Martin 2015-11-04 17:32:53 +01:00
parent 29a4f496cf
commit 2867b84101

View file

@ -88,7 +88,7 @@ private:
static void setStateCallback(wl_client *client, wl_resource *resource, uint32_t flags, uint32_t state); static void setStateCallback(wl_client *client, wl_resource *resource, uint32_t flags, uint32_t state);
static void setVirtualDesktopCallback(wl_client *client, wl_resource *resource, uint32_t number); static void setVirtualDesktopCallback(wl_client *client, wl_resource *resource, uint32_t number);
static void closeCallback(wl_client *client, wl_resource *resource); static void closeCallback(wl_client *client, wl_resource *resource);
static void setTaskGeometryCallback(wl_client *client, wl_resource *resource, wl_resource *panel, uint32_t x, uint32_t y, uint32_t width, uint32_t height); static void setMinimizedGeometryCallback(wl_client *client, wl_resource *resource, wl_resource *panel, uint32_t x, uint32_t y, uint32_t width, uint32_t height);
static void unsetMinimizedGeometryCallback(wl_client *client, wl_resource *resource, wl_resource *panel); static void unsetMinimizedGeometryCallback(wl_client *client, wl_resource *resource, wl_resource *panel);
static Private *cast(wl_resource *resource) { static Private *cast(wl_resource *resource) {
return reinterpret_cast<Private*>(wl_resource_get_user_data(resource)); return reinterpret_cast<Private*>(wl_resource_get_user_data(resource));
@ -247,7 +247,7 @@ PlasmaWindowInterface *PlasmaWindowManagementInterface::createWindow(QObject *pa
const struct org_kde_plasma_window_interface PlasmaWindowInterface::Private::s_interface = { const struct org_kde_plasma_window_interface PlasmaWindowInterface::Private::s_interface = {
setStateCallback, setStateCallback,
setVirtualDesktopCallback, setVirtualDesktopCallback,
setTaskGeometryCallback, setMinimizedGeometryCallback,
unsetMinimizedGeometryCallback, unsetMinimizedGeometryCallback,
closeCallback closeCallback
}; };
@ -447,7 +447,7 @@ void PlasmaWindowInterface::Private::setStateCallback(wl_client *client, wl_reso
} }
} }
void PlasmaWindowInterface::Private::setTaskGeometryCallback(wl_client *client, wl_resource *resource, wl_resource *panel, uint32_t x, uint32_t y, uint32_t width, uint32_t height) void PlasmaWindowInterface::Private::setMinimizedGeometryCallback(wl_client *client, wl_resource *resource, wl_resource *panel, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
{ {
Q_UNUSED(client) Q_UNUSED(client)
Private *p = cast(resource); Private *p = cast(resource);
@ -457,10 +457,14 @@ void PlasmaWindowInterface::Private::setTaskGeometryCallback(wl_client *client,
return; return;
} }
if (p->minimizedGeometries.value(panelSurface) == QRect(x, y, width, height)) {
return;
}
p->minimizedGeometries[panelSurface] = QRect(x, y, width, height); p->minimizedGeometries[panelSurface] = QRect(x, y, width, height);
emit p->q->minimizedGeometriesChanged(); emit p->q->minimizedGeometriesChanged();
connect(panelSurface, &QObject::destroyed, p->q, [p, panelSurface] () { connect(panelSurface, &QObject::destroyed, p->q, [p, panelSurface] () {
if (p->minimizedGeometries.remove(panelSurface)) {; if (p->minimizedGeometries.remove(panelSurface)) {
emit p->q->minimizedGeometriesChanged(); emit p->q->minimizedGeometriesChanged();
} }
}); });
@ -475,6 +479,9 @@ void PlasmaWindowInterface::Private::unsetMinimizedGeometryCallback(wl_client *c
if (!panelSurface) { if (!panelSurface) {
return; return;
} }
if (!p->minimizedGeometries.contains(panelSurface)) {
return;
}
p->minimizedGeometries.remove(panelSurface); p->minimizedGeometries.remove(panelSurface);
emit p->q->minimizedGeometriesChanged(); emit p->q->minimizedGeometriesChanged();
} }