Changeset View
Changeset View
Standalone View
Standalone View
krunner/view.cpp
Show First 20 Lines • Show All 230 Lines • ▼ Show 20 Line(s) | 217 | { | |||
---|---|---|---|---|---|
231 | 231 | | |||
232 | // in wayland, QScreen::availableGeometry() returns QScreen::geometry() | 232 | // in wayland, QScreen::availableGeometry() returns QScreen::geometry() | ||
233 | // we could get a better value from plasmashell | 233 | // we could get a better value from plasmashell | ||
234 | // BUG: 386114 | 234 | // BUG: 386114 | ||
235 | QDBusInterface strutManager("org.kde.plasmashell", "/StrutManager", "org.kde.PlasmaShell.StrutManager"); | 235 | QDBusInterface strutManager("org.kde.plasmashell", "/StrutManager", "org.kde.PlasmaShell.StrutManager"); | ||
236 | QDBusPendingCall async = strutManager.asyncCall("availableScreenRect", shownOnScreen->name()); | 236 | QDBusPendingCall async = strutManager.asyncCall("availableScreenRect", shownOnScreen->name()); | ||
237 | QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(async, this); | 237 | QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(async, this); | ||
238 | 238 | | |||
239 | QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [=]() { | 239 | QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, watcher, shownOnScreen]() { | ||
240 | watcher->deleteLater(); | ||||
240 | QDBusPendingReply<QRect> reply = *watcher; | 241 | QDBusPendingReply<QRect> reply = *watcher; | ||
241 | 242 | | |||
242 | setScreen(shownOnScreen); | | |||
243 | const QRect r = reply.isValid() ? reply.value() : shownOnScreen->availableGeometry(); | 243 | const QRect r = reply.isValid() ? reply.value() : shownOnScreen->availableGeometry(); | ||
244 | 244 | | |||
245 | if (m_floating && !m_customPos.isNull()) { | 245 | if (m_floating && !m_customPos.isNull()) { | ||
246 | int x = qBound(r.left(), m_customPos.x(), r.right() - width()); | 246 | int x = qBound(r.left(), m_customPos.x(), r.right() - width()); | ||
247 | int y = qBound(r.top(), m_customPos.y(), r.bottom() - height()); | 247 | int y = qBound(r.top(), m_customPos.y(), r.bottom() - height()); | ||
248 | setPosition(x, y); | 248 | setPosition(x, y); | ||
249 | PlasmaQuick::Dialog::setVisible(true); | 249 | PlasmaQuick::Dialog::setVisible(true); | ||
250 | return; | 250 | return; | ||
Show All 12 Lines | |||||
263 | 263 | | |||
264 | setPosition(x, y); | 264 | setPosition(x, y); | ||
265 | PlasmaQuick::Dialog::setVisible(true); | 265 | PlasmaQuick::Dialog::setVisible(true); | ||
266 | 266 | | |||
267 | if (m_floating) { | 267 | if (m_floating) { | ||
268 | KWindowSystem::setOnDesktop(winId(), KWindowSystem::currentDesktop()); | 268 | KWindowSystem::setOnDesktop(winId(), KWindowSystem::currentDesktop()); | ||
269 | KWindowSystem::setType(winId(), NET::Normal); | 269 | KWindowSystem::setType(winId(), NET::Normal); | ||
270 | //Turn the sliding effect off | 270 | //Turn the sliding effect off | ||
271 | KWindowEffects::slideWindow(winId(), KWindowEffects::NoEdge, 0); | 271 | setLocation(Plasma::Types::Floating); | ||
272 | } else { | 272 | } else { | ||
273 | KWindowSystem::setOnAllDesktops(winId(), true); | 273 | KWindowSystem::setOnAllDesktops(winId(), true); | ||
274 | KWindowEffects::slideWindow(winId(), KWindowEffects::TopEdge, 0); | 274 | setLocation(Plasma::Types::TopEdge); | ||
275 | } | 275 | } | ||
276 | 276 | | |||
277 | KWindowSystem::forceActiveWindow(winId()); | 277 | KWindowSystem::forceActiveWindow(winId()); | ||
278 | watcher->deleteLater(); | | |||
279 | 278 | | |||
280 | }); | 279 | }); | ||
281 | } | 280 | } | ||
282 | 281 | | |||
283 | void View::displayOrHide() | 282 | void View::displayOrHide() | ||
284 | { | 283 | { | ||
285 | if (isVisible() && !QGuiApplication::focusWindow()) { | 284 | if (isVisible() && !QGuiApplication::focusWindow()) { | ||
286 | KWindowSystem::forceActiveWindow(winId()); | 285 | KWindowSystem::forceActiveWindow(winId()); | ||
▲ Show 20 Lines • Show All 130 Lines • Show Last 20 Lines |