[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [plasma-workspace/plasmashell+libkscreen] shell: Make it possible to move a DesktopView from a scree
From: Aleix Pol <aleixpol () kde ! org>
Date: 2014-05-01 1:42:57
Message-ID: E1Wfg1Z-00067T-Es () scm ! kde ! org
[Download RAW message or body]
Git commit 2c7c0899766df7ee694dc665df76986454ca37ea by Aleix Pol.
Committed on 01/05/2014 at 01:42.
Pushed by apol into branch 'plasmashell+libkscreen'.
Make it possible to move a DesktopView from a screen to another
This way we can move the DesktopViews around without re-creating them for
no reason.
M +16 -13 shell/desktopview.cpp
M +4 -0 shell/desktopview.h
http://commits.kde.org/plasma-workspace/2c7c0899766df7ee694dc665df76986454ca37ea
diff --git a/shell/desktopview.cpp b/shell/desktopview.cpp
index d0e4273..f652771 100644
--- a/shell/desktopview.cpp
+++ b/shell/desktopview.cpp
@@ -42,16 +42,8 @@ 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());
- }
- });
+ //For some reason, if I connect the method directly it doesn't get called, I \
think it's for the lack of argument + connect(this, &QWindow::screenChanged, this, \
[=](QScreen*) { adaptToScreen(); }); }
DesktopView::~DesktopView()
@@ -91,17 +83,28 @@ void DesktopView::setFillScreen(bool fillScreen)
}
m_fillScreen = fillScreen;
+ adaptToScreen();
+ emit fillScreenChanged();
+}
+
+void DesktopView::moveEvent(QMoveEvent* ev)
+{
+ adaptToScreen();
+ QWindow::moveEvent(ev);
+}
+void DesktopView::adaptToScreen()
+{
+ qDebug() << "adapting to screen" << screen()->name() << this;
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)); + connect(screen(), \
&QScreen::geometryChanged, this, static_cast<void (QWindow::*)(const \
QRect&)>(&QWindow::setGeometry), Qt::UniqueConnection); } else {
disconnect(screen(), &QScreen::geometryChanged, this, static_cast<void \
(QWindow::*)(const QRect&)>(&QWindow::setGeometry)); }
-
- emit fillScreenChanged();
+ qDebug() << "adapted" << geometry() << (containment () ? \
containment()->wallpaper() : "xx"); }
void DesktopView::setDashboardShown(bool shown)
diff --git a/shell/desktopview.h b/shell/desktopview.h
index 7b5e342..182a367 100644
--- a/shell/desktopview.h
+++ b/shell/desktopview.h
@@ -45,6 +45,8 @@ public:
void setDashboardShown(bool shown);
bool isDashboardShown() const;
+ void adaptToScreen();
+
protected:
bool event(QEvent *e);
@@ -59,6 +61,8 @@ Q_SIGNALS:
void fillScreenChanged();
private:
+ virtual void moveEvent(QMoveEvent* ev);
+
QPointer<PlasmaQuick::ConfigView> m_configView;
bool m_stayBehind : 1;
bool m_fillScreen : 1;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic