Changeset View
Changeset View
Standalone View
Standalone View
shell/desktopview.cpp
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Line(s) | |||||
80 | } | 80 | } | ||
81 | 81 | | |||
82 | void DesktopView::setScreenToFollow(QScreen *screen) | 82 | void DesktopView::setScreenToFollow(QScreen *screen) | ||
83 | { | 83 | { | ||
84 | if (screen == m_screenToFollow) { | 84 | if (screen == m_screenToFollow) { | ||
85 | return; | 85 | return; | ||
86 | } | 86 | } | ||
87 | 87 | | |||
88 | m_screenName = screen->name(); | | |||
89 | m_screenToFollow = screen; | 88 | m_screenToFollow = screen; | ||
90 | setScreen(screen); | 89 | setScreen(screen); | ||
91 | adaptToScreen(); | 90 | adaptToScreen(); | ||
92 | } | 91 | } | ||
93 | 92 | | |||
94 | QScreen *DesktopView::screenToFollow() const | 93 | QScreen *DesktopView::screenToFollow() const | ||
95 | { | 94 | { | ||
96 | return m_screenToFollow; | 95 | return m_screenToFollow; | ||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Line(s) | 192 | if (qobject_cast<ShellCorona *>(corona())) { | |||
194 | return ShellSession; | 193 | return ShellSession; | ||
195 | } else { | 194 | } else { | ||
196 | return ApplicationSession; | 195 | return ApplicationSession; | ||
197 | } | 196 | } | ||
198 | } | 197 | } | ||
199 | 198 | | |||
200 | bool DesktopView::event(QEvent *e) | 199 | bool DesktopView::event(QEvent *e) | ||
201 | { | 200 | { | ||
202 | //NOTE: we need this heuristic for the case when there is an | 201 | if (e->type() == QEvent::KeyRelease) { | ||
203 | //internal laptop screen that gets disabled upon connection of an external one. the only QCreen * pointer gets recycled and there is no dedicated signal to discover this at all | | |||
204 | //after being moved, the view will get an expose event, so we can check there if the screen has been renamed | | |||
205 | //see https://bugs.kde.org/show_bug.cgi?id=373880 | | |||
206 | //https://bugreports.qt.io/browse/QTBUG-57785 | | |||
207 | if (e->type() == QEvent::Expose) { | | |||
208 | if (m_screenToFollow && m_screenToFollow->name() != m_screenName) { | | |||
209 | m_screenName = m_screenToFollow->name(); | | |||
210 | emit screenRenamed(); | | |||
211 | } | | |||
212 | } else if (e->type() == QEvent::KeyRelease) { | | |||
213 | QKeyEvent *ke = static_cast<QKeyEvent *>(e); | 202 | QKeyEvent *ke = static_cast<QKeyEvent *>(e); | ||
214 | if (KWindowSystem::showingDesktop() && ke->key() == Qt::Key_Escape) { | 203 | if (KWindowSystem::showingDesktop() && ke->key() == Qt::Key_Escape) { | ||
215 | ShellCorona *c = qobject_cast<ShellCorona *>(corona()); | 204 | ShellCorona *c = qobject_cast<ShellCorona *>(corona()); | ||
216 | if (c) { | 205 | if (c) { | ||
217 | KWindowSystem::setShowingDesktop(false); | 206 | KWindowSystem::setShowingDesktop(false); | ||
218 | } | 207 | } | ||
219 | } | 208 | } | ||
220 | } else if (e->type() == QEvent::PlatformSurface) { | 209 | } else if (e->type() == QEvent::PlatformSurface) { | ||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |