Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/core/shellhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,13 +772,25 @@ void ShellHandler::registerSurfaceToForeignToplevel(SurfaceWrapper *wrapper)
if (!wrapper->skipDockPreView()) {
m_treelandForeignToplevel->addSurface(wrapper);
}
connect(wrapper, &SurfaceWrapper::skipDockPreViewChanged, this, [this, wrapper] {

QMetaObject::Connection skipConn;
skipConn = connect(wrapper, &SurfaceWrapper::skipDockPreViewChanged, this, [this, wrapper] {
if (wrapper->skipDockPreView()) {
m_treelandForeignToplevel->removeSurface(wrapper);
} else {
m_treelandForeignToplevel->addSurface(wrapper);
}
});

connect(wrapper, &SurfaceWrapper::aboutToBeInvalidated, this, [this, wrapper, skipConn] {
// Only remove if the surface was actually added (skipDockPreView is false).
if (!wrapper->skipDockPreView()) {
m_treelandForeignToplevel->removeSurface(wrapper);
}
// Disconnect skipDockPreViewChanged to prevent double-remove when
// invalidate() calls setSkipDockPreView(true) after this signal.
QObject::disconnect(skipConn);
});
}

void ShellHandler::setupDockPreview()
Expand Down
14 changes: 14 additions & 0 deletions src/modules/input-manager/inputmanagerinterfacev1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,14 @@ void TreelandInputManagerInterfaceV1Private::destroy(Resource *resource)

void TreelandInputManagerInterfaceV1Private::bind_resource(Resource *resource)
{
// Report capabilities available on the seat. wl_seat is created before this
// global, so the client has normally bound it; the null case only occurs in
// the disconnect race. A client without a wl_seat binding cannot receive
// seat-referencing events, so it is skipped by protocol semantics.
TreelandInputManagerInterfaceV1::DeviceTypes types = q->inputDeviceListTypes();
struct wlr_seat_client *seatClient = Helper::instance()->seat()->handle()->client_for_wl_client(resource->client());
if (!seatClient)
return;
struct wl_resource *clientResource;
wl_resource_for_each(clientResource, &seatClient->resources) {
send_capability_available(resource->handle, types.toInt(), clientResource);
Expand Down Expand Up @@ -173,6 +179,8 @@ void TreelandInputManagerInterfaceV1::sendCapabilityAvailable(TreelandInputManag
for (const auto &resource : d->resourceMap()) {
struct wlr_seat_client *seatClient =
Helper::instance()->seat()->handle()->client_for_wl_client(resource->client());
if (!seatClient)
continue; // No wl_seat binding: cannot deliver seat-referencing capability events.
struct wl_resource *clientResource;
wl_resource_for_each(clientResource, &seatClient->resources) {
d->send_capability_available(resource->handle, types.toInt(), clientResource);
Expand All @@ -185,6 +193,8 @@ void TreelandInputManagerInterfaceV1::sendCapabilityUnavailable(TreelandInputMan
for (const auto &resource : d->resourceMap()) {
struct wlr_seat_client *seatClient =
Helper::instance()->seat()->handle()->client_for_wl_client(resource->client());
if (!seatClient)
continue; // No wl_seat binding: cannot deliver seat-referencing capability events.
struct wl_resource *clientResource;
wl_resource_for_each(clientResource, &seatClient->resources) {
d->send_capability_unavailable(resource->handle, types.toInt(), clientResource);
Expand Down Expand Up @@ -267,6 +277,8 @@ void TreelandInputManagerInterfaceV1::onInputAdded(WInputDevice *input)
for (const auto &resource : d->resourceMap()) {
struct wlr_seat_client *seatClient =
Helper::instance()->seat()->handle()->client_for_wl_client(resource->client());
if (!seatClient)
continue; // No wl_seat binding: cannot deliver seat-referencing capability events.
struct wl_resource *clientResource;
wl_resource_for_each(clientResource, &seatClient->resources) {
d->send_capability_available(resource->handle, type.toInt(), clientResource);
Expand All @@ -292,6 +304,8 @@ void TreelandInputManagerInterfaceV1::onInputRemoved(WInputDevice *input)
for (const auto &resource : d->resourceMap()) {
struct wlr_seat_client *seatClient =
Helper::instance()->seat()->handle()->client_for_wl_client(resource->client());
if (!seatClient)
continue; // No wl_seat binding: cannot deliver seat-referencing capability events.
struct wl_resource *clientResource;
wl_resource_for_each(clientResource, &seatClient->resources) {
d->send_capability_unavailable(resource->handle, type.toInt(), clientResource);
Expand Down
Loading