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:
Marco Martin 2014-03-31 18:31:14 +02:00
parent e59a86da32
commit 7438ba4164
2 changed files with 28 additions and 1 deletions

View File

@ -42,6 +42,16 @@ DesktopView::DesktopView(ShellCorona *corona, QScreen *screen)
engine()->rootContext()->setContextProperty("desktop", this);
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()
@ -84,6 +94,8 @@ void DesktopView::setFillScreen(bool fillScreen)
if (m_fillScreen) {
setGeometry(screen()->geometry());
setMinimumSize(screen()->geometry().size());
setMaximumSize(screen()->geometry().size());
connect(screen(), &QScreen::geometryChanged, this, static_cast<void (QWindow::*)(const QRect&)>(&QWindow::setGeometry));
} else {
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::clearState(winId(), NET::SkipTaskbar|NET::KeepBelow);
}
setFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
setFlags(Qt::FramelessWindowHint | Qt::CustomizeWindowHint);
raise();
KWindowSystem::raiseWindow(winId());
KWindowSystem::forceActiveWindow(winId());
@ -125,6 +138,17 @@ void DesktopView::setDashboardShown(bool 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
{
return m_dashboardShown;

View File

@ -45,6 +45,9 @@ public:
void setDashboardShown(bool shown);
bool isDashboardShown() const;
protected:
bool event(QEvent *e);
protected Q_SLOTS:
/**
* It will be called when the configuration is requested