ignore close events
try harder to not get automatically moved or resized. on wayland probably kwin shouldn't even rty to auto position frameless windows from the plasma process, but for now is a workaround
This commit is contained in:
parent
e59a86da32
commit
7438ba4164
@ -42,6 +42,16 @@ DesktopView::DesktopView(ShellCorona *corona, QScreen *screen)
|
|||||||
engine()->rootContext()->setContextProperty("desktop", this);
|
engine()->rootContext()->setContextProperty("desktop", this);
|
||||||
setSource(QUrl::fromLocalFile(corona->package().filePath("views", "Desktop.qml")));
|
setSource(QUrl::fromLocalFile(corona->package().filePath("views", "Desktop.qml")));
|
||||||
|
|
||||||
|
connect(this, &QWindow::xChanged, [=]() {
|
||||||
|
if (m_fillScreen) {
|
||||||
|
setGeometry(this->screen()->geometry());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
connect(this, &QWindow::yChanged, [=]() {
|
||||||
|
if (m_fillScreen) {
|
||||||
|
setGeometry(this->screen()->geometry());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
DesktopView::~DesktopView()
|
DesktopView::~DesktopView()
|
||||||
@ -84,6 +94,8 @@ void DesktopView::setFillScreen(bool fillScreen)
|
|||||||
|
|
||||||
if (m_fillScreen) {
|
if (m_fillScreen) {
|
||||||
setGeometry(screen()->geometry());
|
setGeometry(screen()->geometry());
|
||||||
|
setMinimumSize(screen()->geometry().size());
|
||||||
|
setMaximumSize(screen()->geometry().size());
|
||||||
connect(screen(), &QScreen::geometryChanged, this, static_cast<void (QWindow::*)(const QRect&)>(&QWindow::setGeometry));
|
connect(screen(), &QScreen::geometryChanged, this, static_cast<void (QWindow::*)(const QRect&)>(&QWindow::setGeometry));
|
||||||
} else {
|
} else {
|
||||||
disconnect(screen(), &QScreen::geometryChanged, this, static_cast<void (QWindow::*)(const QRect&)>(&QWindow::setGeometry));
|
disconnect(screen(), &QScreen::geometryChanged, this, static_cast<void (QWindow::*)(const QRect&)>(&QWindow::setGeometry));
|
||||||
@ -99,7 +111,8 @@ void DesktopView::setDashboardShown(bool shown)
|
|||||||
KWindowSystem::setType(winId(), NET::Normal);
|
KWindowSystem::setType(winId(), NET::Normal);
|
||||||
KWindowSystem::clearState(winId(), NET::SkipTaskbar|NET::KeepBelow);
|
KWindowSystem::clearState(winId(), NET::SkipTaskbar|NET::KeepBelow);
|
||||||
}
|
}
|
||||||
setFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
|
setFlags(Qt::FramelessWindowHint | Qt::CustomizeWindowHint);
|
||||||
|
|
||||||
raise();
|
raise();
|
||||||
KWindowSystem::raiseWindow(winId());
|
KWindowSystem::raiseWindow(winId());
|
||||||
KWindowSystem::forceActiveWindow(winId());
|
KWindowSystem::forceActiveWindow(winId());
|
||||||
@ -125,6 +138,17 @@ void DesktopView::setDashboardShown(bool shown)
|
|||||||
m_dashboardShown = shown;
|
m_dashboardShown = shown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DesktopView::event(QEvent *e)
|
||||||
|
{
|
||||||
|
if (e->type() == QEvent::Close) {
|
||||||
|
//prevent ALT+F4 from killing the shell
|
||||||
|
e->ignore();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PlasmaQuick::View::event(e);
|
||||||
|
}
|
||||||
|
|
||||||
bool DesktopView::isDashboardShown() const
|
bool DesktopView::isDashboardShown() const
|
||||||
{
|
{
|
||||||
return m_dashboardShown;
|
return m_dashboardShown;
|
||||||
|
@ -45,6 +45,9 @@ public:
|
|||||||
void setDashboardShown(bool shown);
|
void setDashboardShown(bool shown);
|
||||||
bool isDashboardShown() const;
|
bool isDashboardShown() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool event(QEvent *e);
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
/**
|
/**
|
||||||
* It will be called when the configuration is requested
|
* It will be called when the configuration is requested
|
||||||
|
Loading…
Reference in New Issue
Block a user