Skip to content
Merged
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
24 changes: 18 additions & 6 deletions frame/layershell/dlayershellwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
#include "dlayershellwindow.h"
#include "qwaylandlayershellintegration_p.h"

#include <QMargins>

Check warning on line 8 in frame/layershell/dlayershellwindow.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QMargins> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QPlatformSurfaceEvent>

Check warning on line 9 in frame/layershell/dlayershellwindow.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QPlatformSurfaceEvent> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QScreen>

Check warning on line 10 in frame/layershell/dlayershellwindow.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QScreen> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QWindow>

Check warning on line 11 in frame/layershell/dlayershellwindow.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QWindow> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QLoggingCategory>

Check warning on line 12 in frame/layershell/dlayershellwindow.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QLoggingCategory> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include <QtWaylandClient/private/qwaylandwindow_p.h>

Expand Down Expand Up @@ -261,7 +262,8 @@
s_map.insert(window, this);
window->create();
if (dynamic_cast<QtWaylandClient::QWaylandWindow *>(window->handle())) {
ensureWaylandShellIntegration();
window->installEventFilter(this);
installWaylandShellIntegration();
}
#ifdef BUILD_WITH_X11
else if (dynamic_cast<QNativeInterface::Private::QXcbWindow *>(window->handle())) {
Expand All @@ -274,13 +276,23 @@
}
}

bool DLayerShellWindow::ensureWaylandShellIntegration()
bool DLayerShellWindow::eventFilter(QObject *watched, QEvent *event)
{
auto *window = d->parentWindow;
if (!window->handle())
window->create();
if (watched == d->parentWindow && event->type() == QEvent::PlatformSurface) {
auto *surfaceEvent = static_cast<QPlatformSurfaceEvent *>(event);
if (surfaceEvent->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated
&& dynamic_cast<QtWaylandClient::QWaylandWindow *>(d->parentWindow->handle())) {
// Only bind the existing platform window; never create one from this event.
if (!installWaylandShellIntegration())
qCWarning(layershellwindow) << "Failed to restore layer-shell integration for" << d->scope;
}
}
return QObject::eventFilter(watched, event);
}

auto *waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow *>(window->handle());
bool DLayerShellWindow::installWaylandShellIntegration()
{
auto *waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow *>(d->parentWindow->handle());
if (!waylandWindow)
return false;

Expand Down
4 changes: 2 additions & 2 deletions frame/layershell/dlayershellwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@
void setCloseOnDismissed(bool close);
bool closeOnDismissed() const;

bool ensureWaylandShellIntegration();
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
Resolved

/** Whether a system resize is pending or active on this layer surface. */
bool isResizing() const;

Expand Down Expand Up @@ -178,7 +176,9 @@
friend class QWaylandLayerShellSurface;
void setResizing(bool resizing);

bool eventFilter(QObject *watched, QEvent *event) override;
bool installWaylandShellIntegration();
DLayerShellWindow(QWindow* window);

Check warning on line 181 in frame/layershell/dlayershellwindow.h

View workflow job for this annotation

GitHub Actions / cppcheck

Class 'DLayerShellWindow' has a constructor with 1 argument that is not explicit. Such, so called "Converting constructors", should in general be explicit for type safety reasons as that prevents unintended implicit conversions.
QScopedPointer<DLayerShellWindowPrivate> d;
};

Expand Down
3 changes: 3 additions & 0 deletions panels/dock/dockhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,11 @@ void DockHelper::initAreas()
if (m_areas.contains(screen))
return;
m_areas.insert(screen, createArea(screen));
updateAllDockWakeArea();
});

connect(qApp, &QGuiApplication::primaryScreenChanged, this, &DockHelper::updateAllDockWakeArea);

connect(qApp, &QGuiApplication::screenRemoved, this, [this](QScreen *screen) {
if (!m_areas.contains(screen))
return;
Expand Down
4 changes: 1 addition & 3 deletions panels/dock/dockpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

#include "dockpanel.h"
#include "constants.h"
#include "dockadaptor.h"

Check warning on line 7 in panels/dock/dockpanel.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "dockadaptor.h" not found.
#include "docksettings.h"
#include "layershell/dlayershellwindow.h"
#include "panel.h"

Check warning on line 9 in panels/dock/dockpanel.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "panel.h" not found.
#include "pluginfactory.h"

Check warning on line 10 in panels/dock/dockpanel.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "pluginfactory.h" not found.
#include "waylanddockhelper.h"
#include "x11dockhelper.h"

Expand Down Expand Up @@ -512,8 +511,7 @@
auto *waylandScreen = dynamic_cast<QtWaylandClient::QWaylandScreen *>(primary->handle());
if (!waylandScreen || !waylandScreen->output())
return;
if (DS_NAMESPACE::DLayerShellWindow::get(win)->ensureWaylandShellIntegration())
win->show();
win->show();
Comment thread
gugullll marked this conversation as resolved.
Resolved
}

bool DockPanel::showInPrimary() const
Expand Down
1 change: 1 addition & 0 deletions panels/dock/waylanddockhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ WaylandDockHelper::WaylandDockHelper(DockPanel *panel)

connect(m_panel, &DockPanel::positionChanged, this, &WaylandDockHelper::updateRegionWatchPos);
connect(m_panel, &DockPanel::dockSizeChanged, this, &WaylandDockHelper::updateRegionWatchPos);
connect(m_panel, &DockPanel::dockScreenChanged, this, &WaylandDockHelper::updateRegionWatchPos);
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
Resolved
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
Resolved
connect(m_panel, &DockPanel::rootObjectChanged, this, &WaylandDockHelper::updateRegionWatchPos);

auto ensureRegionWatch = [this]() {
Expand Down
Loading