Changeset View
Changeset View
Standalone View
Standalone View
xdgshellclient.cpp
- This file was moved from shell_client.cpp.
Show All 13 Lines | |||||
14 | This program is distributed in the hope that it will be useful, | 14 | This program is distributed in the hope that it will be useful, | ||
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | GNU General Public License for more details. | 17 | GNU General Public License for more details. | ||
18 | 18 | | |||
19 | You should have received a copy of the GNU General Public License | 19 | You should have received a copy of the GNU General Public License | ||
20 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
21 | *********************************************************************/ | 21 | *********************************************************************/ | ||
22 | #include "shell_client.h" | 22 | #include "xdgshellclient.h" | ||
23 | #include "composite.h" | 23 | #include "composite.h" | ||
24 | #include "cursor.h" | 24 | #include "cursor.h" | ||
25 | #include "deleted.h" | 25 | #include "deleted.h" | ||
26 | #include "placement.h" | 26 | #include "placement.h" | ||
27 | #include "screenedge.h" | 27 | #include "screenedge.h" | ||
28 | #include "screens.h" | 28 | #include "screens.h" | ||
29 | #ifdef KWIN_BUILD_TABBOX | 29 | #ifdef KWIN_BUILD_TABBOX | ||
30 | #include "tabbox.h" | 30 | #include "tabbox.h" | ||
Show All 30 Lines | |||||
61 | 61 | | |||
62 | Q_DECLARE_METATYPE(NET::WindowType) | 62 | Q_DECLARE_METATYPE(NET::WindowType) | ||
63 | 63 | | |||
64 | using namespace KWayland::Server; | 64 | using namespace KWayland::Server; | ||
65 | 65 | | |||
66 | namespace KWin | 66 | namespace KWin | ||
67 | { | 67 | { | ||
68 | 68 | | |||
69 | ShellClient::ShellClient(XdgShellSurfaceInterface *surface) | 69 | XdgShellClient::XdgShellClient(XdgShellSurfaceInterface *surface) | ||
70 | : AbstractClient() | 70 | : AbstractClient() | ||
71 | , m_xdgShellSurface(surface) | 71 | , m_xdgShellSurface(surface) | ||
72 | , m_xdgShellPopup(nullptr) | 72 | , m_xdgShellPopup(nullptr) | ||
73 | { | 73 | { | ||
74 | setSurface(surface->surface()); | 74 | setSurface(surface->surface()); | ||
75 | m_requestGeometryBlockCounter++; | 75 | m_requestGeometryBlockCounter++; | ||
76 | init(); | 76 | init(); | ||
77 | connect(surface->surface(), &SurfaceInterface::committed, this, &ShellClient::finishInit); | 77 | connect(surface->surface(), &SurfaceInterface::committed, this, &XdgShellClient::finishInit); | ||
78 | } | 78 | } | ||
79 | 79 | | |||
80 | ShellClient::ShellClient(XdgShellPopupInterface *surface) | 80 | XdgShellClient::XdgShellClient(XdgShellPopupInterface *surface) | ||
81 | : AbstractClient() | 81 | : AbstractClient() | ||
82 | , m_xdgShellSurface(nullptr) | 82 | , m_xdgShellSurface(nullptr) | ||
83 | , m_xdgShellPopup(surface) | 83 | , m_xdgShellPopup(surface) | ||
84 | { | 84 | { | ||
85 | setSurface(surface->surface()); | 85 | setSurface(surface->surface()); | ||
86 | m_requestGeometryBlockCounter++; | 86 | m_requestGeometryBlockCounter++; | ||
87 | init(); | 87 | init(); | ||
88 | connect(surface->surface(), &SurfaceInterface::committed, this, &ShellClient::finishInit); | 88 | connect(surface->surface(), &SurfaceInterface::committed, this, &XdgShellClient::finishInit); | ||
89 | } | 89 | } | ||
90 | 90 | | |||
91 | ShellClient::~ShellClient() = default; | 91 | XdgShellClient::~XdgShellClient() = default; | ||
92 | 92 | | |||
93 | template <class T> | 93 | template <class T> | ||
94 | void ShellClient::initSurface(T *shellSurface) | 94 | void XdgShellClient::initSurface(T *shellSurface) | ||
95 | { | 95 | { | ||
96 | m_caption = shellSurface->title().simplified(); | 96 | m_caption = shellSurface->title().simplified(); | ||
97 | // delay till end of init | 97 | // delay till end of init | ||
98 | QTimer::singleShot(0, this, &ShellClient::updateCaption); | 98 | QTimer::singleShot(0, this, &XdgShellClient::updateCaption); | ||
99 | connect(shellSurface, &T::destroyed, this, &ShellClient::destroyClient); | 99 | connect(shellSurface, &T::destroyed, this, &XdgShellClient::destroyClient); | ||
100 | connect(shellSurface, &T::titleChanged, this, | 100 | connect(shellSurface, &T::titleChanged, this, | ||
101 | [this] (const QString &s) { | 101 | [this] (const QString &s) { | ||
102 | const auto oldSuffix = m_captionSuffix; | 102 | const auto oldSuffix = m_captionSuffix; | ||
103 | m_caption = s.simplified(); | 103 | m_caption = s.simplified(); | ||
104 | updateCaption(); | 104 | updateCaption(); | ||
105 | if (m_captionSuffix == oldSuffix) { | 105 | if (m_captionSuffix == oldSuffix) { | ||
106 | // don't emit caption change twice | 106 | // don't emit caption change twice | ||
107 | // it already got emitted by the changing suffix | 107 | // it already got emitted by the changing suffix | ||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 174 | [this] (bool maximized) { | |||
176 | // rule or because the requested state is the same as the current, then the | 176 | // rule or because the requested state is the same as the current, then the | ||
177 | // compositor still has to send a configure event. | 177 | // compositor still has to send a configure event. | ||
178 | RequestGeometryBlocker blocker(this); | 178 | RequestGeometryBlocker blocker(this); | ||
179 | 179 | | |||
180 | maximize(maximized ? MaximizeFull : MaximizeRestore); | 180 | maximize(maximized ? MaximizeFull : MaximizeRestore); | ||
181 | } | 181 | } | ||
182 | ); | 182 | ); | ||
183 | // TODO: consider output! | 183 | // TODO: consider output! | ||
184 | connect(shellSurface, &T::fullscreenChanged, this, &ShellClient::clientFullScreenChanged); | 184 | connect(shellSurface, &T::fullscreenChanged, this, &XdgShellClient::clientFullScreenChanged); | ||
185 | 185 | | |||
186 | connect(shellSurface, &T::transientForChanged, this, &ShellClient::setTransient); | 186 | connect(shellSurface, &T::transientForChanged, this, &XdgShellClient::setTransient); | ||
187 | 187 | | |||
188 | connect(this, &ShellClient::geometryChanged, this, &ShellClient::updateClientOutputs); | 188 | connect(this, &XdgShellClient::geometryChanged, this, &XdgShellClient::updateClientOutputs); | ||
189 | connect(screens(), &Screens::changed, this, &ShellClient::updateClientOutputs); | 189 | connect(screens(), &Screens::changed, this, &XdgShellClient::updateClientOutputs); | ||
190 | } | 190 | } | ||
191 | 191 | | |||
192 | void ShellClient::init() | 192 | void XdgShellClient::init() | ||
193 | { | 193 | { | ||
194 | connect(this, &ShellClient::desktopFileNameChanged, this, &ShellClient::updateIcon); | 194 | connect(this, &XdgShellClient::desktopFileNameChanged, this, &XdgShellClient::updateIcon); | ||
195 | createWindowId(); | 195 | createWindowId(); | ||
196 | setupCompositing(); | 196 | setupCompositing(); | ||
197 | updateIcon(); | 197 | updateIcon(); | ||
198 | SurfaceInterface *s = surface(); | 198 | SurfaceInterface *s = surface(); | ||
199 | Q_ASSERT(s); | 199 | Q_ASSERT(s); | ||
200 | ready_for_painting = false; | 200 | ready_for_painting = false; | ||
201 | doSetGeometry(QRect(QPoint(0, 0), m_clientSize)); | 201 | doSetGeometry(QRect(QPoint(0, 0), m_clientSize)); | ||
202 | if (waylandServer()->inputMethodConnection() == s->client()) { | 202 | if (waylandServer()->inputMethodConnection() == s->client()) { | ||
203 | m_windowType = NET::OnScreenDisplay; | 203 | m_windowType = NET::OnScreenDisplay; | ||
204 | } | 204 | } | ||
205 | 205 | | |||
206 | connect(s, &SurfaceInterface::sizeChanged, this, | 206 | connect(s, &SurfaceInterface::sizeChanged, this, | ||
207 | [this] { | 207 | [this] { | ||
208 | m_clientSize = surface()->size(); | 208 | m_clientSize = surface()->size(); | ||
209 | doSetGeometry(QRect(pos(), m_clientSize + QSize(borderLeft() + borderRight(), borderTop() + borderBottom()))); | 209 | doSetGeometry(QRect(pos(), m_clientSize + QSize(borderLeft() + borderRight(), borderTop() + borderBottom()))); | ||
210 | } | 210 | } | ||
211 | ); | 211 | ); | ||
212 | connect(s, &SurfaceInterface::unmapped, this, &ShellClient::unmap); | 212 | connect(s, &SurfaceInterface::unmapped, this, &XdgShellClient::unmap); | ||
213 | connect(s, &SurfaceInterface::unbound, this, &ShellClient::destroyClient); | 213 | connect(s, &SurfaceInterface::unbound, this, &XdgShellClient::destroyClient); | ||
214 | connect(s, &SurfaceInterface::destroyed, this, &ShellClient::destroyClient); | 214 | connect(s, &SurfaceInterface::destroyed, this, &XdgShellClient::destroyClient); | ||
215 | if (m_xdgShellSurface) { | 215 | if (m_xdgShellSurface) { | ||
216 | initSurface(m_xdgShellSurface); | 216 | initSurface(m_xdgShellSurface); | ||
217 | 217 | | |||
218 | auto global = static_cast<XdgShellInterface *>(m_xdgShellSurface->global()); | 218 | auto global = static_cast<XdgShellInterface *>(m_xdgShellSurface->global()); | ||
219 | connect(global, &XdgShellInterface::pingDelayed, | 219 | connect(global, &XdgShellInterface::pingDelayed, | ||
220 | this, [this](qint32 serial) { | 220 | this, [this](qint32 serial) { | ||
221 | auto it = m_pingSerials.find(serial); | 221 | auto it = m_pingSerials.find(serial); | ||
222 | if (it != m_pingSerials.end()) { | 222 | if (it != m_pingSerials.end()) { | ||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 285 | connect(m_xdgShellPopup, &XdgShellPopupInterface::grabRequested, this, [this](SeatInterface *seat, quint32 serial) { | |||
288 | //TODO - should check the parent had focus | 288 | //TODO - should check the parent had focus | ||
289 | m_hasPopupGrab = true; | 289 | m_hasPopupGrab = true; | ||
290 | }); | 290 | }); | ||
291 | 291 | | |||
292 | connect(m_xdgShellPopup, &XdgShellPopupInterface::configureAcknowledged, this, [this](int serial) { | 292 | connect(m_xdgShellPopup, &XdgShellPopupInterface::configureAcknowledged, this, [this](int serial) { | ||
293 | m_lastAckedConfigureRequest = serial; | 293 | m_lastAckedConfigureRequest = serial; | ||
294 | }); | 294 | }); | ||
295 | 295 | | |||
296 | connect(m_xdgShellPopup, &XdgShellPopupInterface::destroyed, this, &ShellClient::destroyClient); | 296 | connect(m_xdgShellPopup, &XdgShellPopupInterface::destroyed, this, &XdgShellClient::destroyClient); | ||
297 | } | 297 | } | ||
298 | 298 | | |||
299 | // set initial desktop | 299 | // set initial desktop | ||
300 | setDesktop(VirtualDesktopManager::self()->current()); | 300 | setDesktop(VirtualDesktopManager::self()->current()); | ||
301 | 301 | | |||
302 | // setup shadow integration | 302 | // setup shadow integration | ||
303 | getShadow(); | 303 | getShadow(); | ||
304 | connect(s, &SurfaceInterface::shadowChanged, this, &Toplevel::getShadow); | 304 | connect(s, &SurfaceInterface::shadowChanged, this, &Toplevel::getShadow); | ||
305 | 305 | | |||
306 | connect(waylandServer(), &WaylandServer::foreignTransientChanged, this, [this](KWayland::Server::SurfaceInterface *child) { | 306 | connect(waylandServer(), &WaylandServer::foreignTransientChanged, this, [this](KWayland::Server::SurfaceInterface *child) { | ||
307 | if (child == surface()) { | 307 | if (child == surface()) { | ||
308 | setTransient(); | 308 | setTransient(); | ||
309 | } | 309 | } | ||
310 | }); | 310 | }); | ||
311 | setTransient(); | 311 | setTransient(); | ||
312 | 312 | | |||
313 | AbstractClient::updateColorScheme(QString()); | 313 | AbstractClient::updateColorScheme(QString()); | ||
314 | } | 314 | } | ||
315 | 315 | | |||
316 | void ShellClient::finishInit() { | 316 | void XdgShellClient::finishInit() { | ||
317 | SurfaceInterface *s = surface(); | 317 | SurfaceInterface *s = surface(); | ||
318 | disconnect(s, &SurfaceInterface::committed, this, &ShellClient::finishInit); | 318 | disconnect(s, &SurfaceInterface::committed, this, &XdgShellClient::finishInit); | ||
319 | 319 | | |||
320 | bool needsPlacement = !isInitialPositionSet(); | 320 | bool needsPlacement = !isInitialPositionSet(); | ||
321 | 321 | | |||
322 | if (supportsWindowRules()) { | 322 | if (supportsWindowRules()) { | ||
323 | setupWindowRules(false); | 323 | setupWindowRules(false); | ||
324 | 324 | | |||
325 | const QRect originalGeometry = QRect(pos(), sizeForClientSize(clientSize())); | 325 | const QRect originalGeometry = QRect(pos(), sizeForClientSize(clientSize())); | ||
326 | const QRect ruledGeometry = rules()->checkGeometry(originalGeometry, true); | 326 | const QRect ruledGeometry = rules()->checkGeometry(originalGeometry, true); | ||
Show All 39 Lines | |||||
366 | m_requestGeometryBlockCounter--; | 366 | m_requestGeometryBlockCounter--; | ||
367 | if (m_requestGeometryBlockCounter == 0) { | 367 | if (m_requestGeometryBlockCounter == 0) { | ||
368 | requestGeometry(m_blockedRequestGeometry); | 368 | requestGeometry(m_blockedRequestGeometry); | ||
369 | } | 369 | } | ||
370 | 370 | | |||
371 | m_isInitialized = true; | 371 | m_isInitialized = true; | ||
372 | } | 372 | } | ||
373 | 373 | | |||
374 | void ShellClient::destroyClient() | 374 | void XdgShellClient::destroyClient() | ||
375 | { | 375 | { | ||
376 | m_closing = true; | 376 | m_closing = true; | ||
377 | #ifdef KWIN_BUILD_TABBOX | 377 | #ifdef KWIN_BUILD_TABBOX | ||
378 | TabBox::TabBox *tabBox = TabBox::TabBox::self(); | 378 | TabBox::TabBox *tabBox = TabBox::TabBox::self(); | ||
379 | if (tabBox && tabBox->isDisplayed() && tabBox->currentClient() == this) { | 379 | if (tabBox && tabBox->isDisplayed() && tabBox->currentClient() == this) { | ||
380 | tabBox->nextPrev(true); | 380 | tabBox->nextPrev(true); | ||
381 | } | 381 | } | ||
382 | #endif | 382 | #endif | ||
Show All 28 Lines | |||||
411 | 411 | | |||
412 | deleted->unrefWindow(); | 412 | deleted->unrefWindow(); | ||
413 | 413 | | |||
414 | m_xdgShellSurface = nullptr; | 414 | m_xdgShellSurface = nullptr; | ||
415 | m_xdgShellPopup = nullptr; | 415 | m_xdgShellPopup = nullptr; | ||
416 | deleteClient(this); | 416 | deleteClient(this); | ||
417 | } | 417 | } | ||
418 | 418 | | |||
419 | void ShellClient::deleteClient(ShellClient *c) | 419 | void XdgShellClient::deleteClient(XdgShellClient *c) | ||
420 | { | 420 | { | ||
421 | delete c; | 421 | delete c; | ||
422 | } | 422 | } | ||
423 | 423 | | |||
424 | QSize ShellClient::toWindowGeometry(const QSize &size) const | 424 | QSize XdgShellClient::toWindowGeometry(const QSize &size) const | ||
425 | { | 425 | { | ||
426 | QSize adjustedSize = size - QSize(borderLeft() + borderRight(), borderTop() + borderBottom()); | 426 | QSize adjustedSize = size - QSize(borderLeft() + borderRight(), borderTop() + borderBottom()); | ||
427 | // a client going fullscreen should have the window the contents size of the screen | 427 | // a client going fullscreen should have the window the contents size of the screen | ||
428 | if (!isFullScreen() && requestedMaximizeMode() != MaximizeFull) { | 428 | if (!isFullScreen() && requestedMaximizeMode() != MaximizeFull) { | ||
429 | adjustedSize -= QSize(m_windowMargins.left() + m_windowMargins.right(), m_windowMargins.top() + m_windowMargins.bottom()); | 429 | adjustedSize -= QSize(m_windowMargins.left() + m_windowMargins.right(), m_windowMargins.top() + m_windowMargins.bottom()); | ||
430 | } | 430 | } | ||
431 | return adjustedSize; | 431 | return adjustedSize; | ||
432 | } | 432 | } | ||
433 | 433 | | |||
434 | QStringList ShellClient::activities() const | 434 | QStringList XdgShellClient::activities() const | ||
435 | { | 435 | { | ||
436 | // TODO: implement | 436 | // TODO: implement | ||
437 | return QStringList(); | 437 | return QStringList(); | ||
438 | } | 438 | } | ||
439 | 439 | | |||
440 | QPoint ShellClient::clientContentPos() const | 440 | QPoint XdgShellClient::clientContentPos() const | ||
441 | { | 441 | { | ||
442 | return -1 * clientPos(); | 442 | return -1 * clientPos(); | ||
443 | } | 443 | } | ||
444 | 444 | | |||
445 | QSize ShellClient::clientSize() const | 445 | QSize XdgShellClient::clientSize() const | ||
446 | { | 446 | { | ||
447 | return m_clientSize; | 447 | return m_clientSize; | ||
448 | } | 448 | } | ||
449 | 449 | | |||
450 | void ShellClient::debug(QDebug &stream) const | 450 | void XdgShellClient::debug(QDebug &stream) const | ||
451 | { | 451 | { | ||
452 | stream.nospace(); | 452 | stream.nospace(); | ||
453 | stream << "\'ShellClient:" << surface() << ";WMCLASS:" << resourceClass() << ":" | 453 | stream << "\'XdgShellClient:" << surface() << ";WMCLASS:" << resourceClass() << ":" | ||
454 | << resourceName() << ";Caption:" << caption() << "\'"; | 454 | << resourceName() << ";Caption:" << caption() << "\'"; | ||
455 | } | 455 | } | ||
456 | 456 | | |||
457 | bool ShellClient::belongsToDesktop() const | 457 | bool XdgShellClient::belongsToDesktop() const | ||
458 | { | 458 | { | ||
459 | const auto clients = waylandServer()->clients(); | 459 | const auto clients = waylandServer()->clients(); | ||
460 | 460 | | |||
461 | return std::any_of(clients.constBegin(), clients.constEnd(), | 461 | return std::any_of(clients.constBegin(), clients.constEnd(), | ||
462 | [this](const ShellClient *client) { | 462 | [this](const XdgShellClient *client) { | ||
463 | if (belongsToSameApplication(client, SameApplicationChecks())) { | 463 | if (belongsToSameApplication(client, SameApplicationChecks())) { | ||
464 | return client->isDesktop(); | 464 | return client->isDesktop(); | ||
465 | } | 465 | } | ||
466 | return false; | 466 | return false; | ||
467 | } | 467 | } | ||
468 | ); | 468 | ); | ||
469 | } | 469 | } | ||
470 | 470 | | |||
471 | Layer ShellClient::layerForDock() const | 471 | Layer XdgShellClient::layerForDock() const | ||
472 | { | 472 | { | ||
473 | if (m_plasmaShellSurface) { | 473 | if (m_plasmaShellSurface) { | ||
474 | switch (m_plasmaShellSurface->panelBehavior()) { | 474 | switch (m_plasmaShellSurface->panelBehavior()) { | ||
475 | case PlasmaShellSurfaceInterface::PanelBehavior::WindowsCanCover: | 475 | case PlasmaShellSurfaceInterface::PanelBehavior::WindowsCanCover: | ||
476 | return NormalLayer; | 476 | return NormalLayer; | ||
477 | case PlasmaShellSurfaceInterface::PanelBehavior::AutoHide: | 477 | case PlasmaShellSurfaceInterface::PanelBehavior::AutoHide: | ||
478 | return AboveLayer; | 478 | return AboveLayer; | ||
479 | case PlasmaShellSurfaceInterface::PanelBehavior::WindowsGoBelow: | 479 | case PlasmaShellSurfaceInterface::PanelBehavior::WindowsGoBelow: | ||
480 | case PlasmaShellSurfaceInterface::PanelBehavior::AlwaysVisible: | 480 | case PlasmaShellSurfaceInterface::PanelBehavior::AlwaysVisible: | ||
481 | return DockLayer; | 481 | return DockLayer; | ||
482 | default: | 482 | default: | ||
483 | Q_UNREACHABLE(); | 483 | Q_UNREACHABLE(); | ||
484 | break; | 484 | break; | ||
485 | } | 485 | } | ||
486 | } | 486 | } | ||
487 | return AbstractClient::layerForDock(); | 487 | return AbstractClient::layerForDock(); | ||
488 | } | 488 | } | ||
489 | 489 | | |||
490 | QRect ShellClient::transparentRect() const | 490 | QRect XdgShellClient::transparentRect() const | ||
491 | { | 491 | { | ||
492 | // TODO: implement | 492 | // TODO: implement | ||
493 | return QRect(); | 493 | return QRect(); | ||
494 | } | 494 | } | ||
495 | 495 | | |||
496 | NET::WindowType ShellClient::windowType(bool direct, int supported_types) const | 496 | NET::WindowType XdgShellClient::windowType(bool direct, int supported_types) const | ||
497 | { | 497 | { | ||
498 | // TODO: implement | 498 | // TODO: implement | ||
499 | Q_UNUSED(direct) | 499 | Q_UNUSED(direct) | ||
500 | Q_UNUSED(supported_types) | 500 | Q_UNUSED(supported_types) | ||
501 | return m_windowType; | 501 | return m_windowType; | ||
502 | } | 502 | } | ||
503 | 503 | | |||
504 | double ShellClient::opacity() const | 504 | double XdgShellClient::opacity() const | ||
505 | { | 505 | { | ||
506 | return m_opacity; | 506 | return m_opacity; | ||
507 | } | 507 | } | ||
508 | 508 | | |||
509 | void ShellClient::setOpacity(double opacity) | 509 | void XdgShellClient::setOpacity(double opacity) | ||
510 | { | 510 | { | ||
511 | const qreal newOpacity = qBound(0.0, opacity, 1.0); | 511 | const qreal newOpacity = qBound(0.0, opacity, 1.0); | ||
512 | if (newOpacity == m_opacity) { | 512 | if (newOpacity == m_opacity) { | ||
513 | return; | 513 | return; | ||
514 | } | 514 | } | ||
515 | const qreal oldOpacity = m_opacity; | 515 | const qreal oldOpacity = m_opacity; | ||
516 | m_opacity = newOpacity; | 516 | m_opacity = newOpacity; | ||
517 | addRepaintFull(); | 517 | addRepaintFull(); | ||
518 | emit opacityChanged(this, oldOpacity); | 518 | emit opacityChanged(this, oldOpacity); | ||
519 | } | 519 | } | ||
520 | 520 | | |||
521 | void ShellClient::addDamage(const QRegion &damage) | 521 | void XdgShellClient::addDamage(const QRegion &damage) | ||
522 | { | 522 | { | ||
523 | auto s = surface(); | 523 | auto s = surface(); | ||
524 | if (s->size().isValid()) { | 524 | if (s->size().isValid()) { | ||
525 | m_clientSize = s->size(); | 525 | m_clientSize = s->size(); | ||
526 | updateWindowMargins(); | 526 | updateWindowMargins(); | ||
527 | updatePendingGeometry(); | 527 | updatePendingGeometry(); | ||
528 | } | 528 | } | ||
529 | markAsMapped(); | 529 | markAsMapped(); | ||
530 | setDepth((s->buffer()->hasAlphaChannel() && !isDesktop()) ? 32 : 24); | 530 | setDepth((s->buffer()->hasAlphaChannel() && !isDesktop()) ? 32 : 24); | ||
531 | repaints_region += damage.translated(clientPos()); | 531 | repaints_region += damage.translated(clientPos()); | ||
532 | Toplevel::addDamage(damage); | 532 | Toplevel::addDamage(damage); | ||
533 | } | 533 | } | ||
534 | 534 | | |||
535 | void ShellClient::markAsMapped() | 535 | void XdgShellClient::markAsMapped() | ||
536 | { | 536 | { | ||
537 | if (!m_unmapped) { | 537 | if (!m_unmapped) { | ||
538 | return; | 538 | return; | ||
539 | } | 539 | } | ||
540 | 540 | | |||
541 | m_unmapped = false; | 541 | m_unmapped = false; | ||
542 | if (!ready_for_painting) { | 542 | if (!ready_for_painting) { | ||
543 | setReadyForPainting(); | 543 | setReadyForPainting(); | ||
544 | } else { | 544 | } else { | ||
545 | addRepaintFull(); | 545 | addRepaintFull(); | ||
546 | emit windowShown(this); | 546 | emit windowShown(this); | ||
547 | } | 547 | } | ||
548 | if (shouldExposeToWindowManagement()) { | 548 | if (shouldExposeToWindowManagement()) { | ||
549 | setupWindowManagementInterface(); | 549 | setupWindowManagementInterface(); | ||
550 | } | 550 | } | ||
551 | updateShowOnScreenEdge(); | 551 | updateShowOnScreenEdge(); | ||
552 | } | 552 | } | ||
553 | 553 | | |||
554 | void ShellClient::createDecoration(const QRect &oldGeom) | 554 | void XdgShellClient::createDecoration(const QRect &oldGeom) | ||
555 | { | 555 | { | ||
556 | KDecoration2::Decoration *decoration = Decoration::DecorationBridge::self()->createDecoration(this); | 556 | KDecoration2::Decoration *decoration = Decoration::DecorationBridge::self()->createDecoration(this); | ||
557 | if (decoration) { | 557 | if (decoration) { | ||
558 | QMetaObject::invokeMethod(decoration, "update", Qt::QueuedConnection); | 558 | QMetaObject::invokeMethod(decoration, "update", Qt::QueuedConnection); | ||
559 | connect(decoration, &KDecoration2::Decoration::shadowChanged, this, &Toplevel::getShadow); | 559 | connect(decoration, &KDecoration2::Decoration::shadowChanged, this, &Toplevel::getShadow); | ||
560 | connect(decoration, &KDecoration2::Decoration::bordersChanged, this, | 560 | connect(decoration, &KDecoration2::Decoration::bordersChanged, this, | ||
561 | [this]() { | 561 | [this]() { | ||
562 | GeometryUpdatesBlocker blocker(this); | 562 | GeometryUpdatesBlocker blocker(this); | ||
563 | RequestGeometryBlocker requestBlocker(this); | 563 | RequestGeometryBlocker requestBlocker(this); | ||
564 | QRect oldgeom = geometry(); | 564 | QRect oldgeom = geometry(); | ||
565 | if (!isShade()) | 565 | if (!isShade()) | ||
566 | checkWorkspacePosition(oldgeom); | 566 | checkWorkspacePosition(oldgeom); | ||
567 | emit geometryShapeChanged(this, oldgeom); | 567 | emit geometryShapeChanged(this, oldgeom); | ||
568 | } | 568 | } | ||
569 | ); | 569 | ); | ||
570 | } | 570 | } | ||
571 | setDecoration(decoration); | 571 | setDecoration(decoration); | ||
572 | // TODO: ensure the new geometry still fits into the client area (e.g. maximized windows) | 572 | // TODO: ensure the new geometry still fits into the client area (e.g. maximized windows) | ||
573 | doSetGeometry(QRect(oldGeom.topLeft(), m_clientSize + (decoration ? QSize(decoration->borderLeft() + decoration->borderRight(), | 573 | doSetGeometry(QRect(oldGeom.topLeft(), m_clientSize + (decoration ? QSize(decoration->borderLeft() + decoration->borderRight(), | ||
574 | decoration->borderBottom() + decoration->borderTop()) : QSize()))); | 574 | decoration->borderBottom() + decoration->borderTop()) : QSize()))); | ||
575 | 575 | | |||
576 | emit geometryShapeChanged(this, oldGeom); | 576 | emit geometryShapeChanged(this, oldGeom); | ||
577 | } | 577 | } | ||
578 | 578 | | |||
579 | void ShellClient::updateDecoration(bool check_workspace_pos, bool force) | 579 | void XdgShellClient::updateDecoration(bool check_workspace_pos, bool force) | ||
580 | { | 580 | { | ||
581 | if (!force && | 581 | if (!force && | ||
582 | ((!isDecorated() && noBorder()) || (isDecorated() && !noBorder()))) | 582 | ((!isDecorated() && noBorder()) || (isDecorated() && !noBorder()))) | ||
583 | return; | 583 | return; | ||
584 | QRect oldgeom = geometry(); | 584 | QRect oldgeom = geometry(); | ||
585 | QRect oldClientGeom = oldgeom.adjusted(borderLeft(), borderTop(), -borderRight(), -borderBottom()); | 585 | QRect oldClientGeom = oldgeom.adjusted(borderLeft(), borderTop(), -borderRight(), -borderBottom()); | ||
586 | blockGeometryUpdates(true); | 586 | blockGeometryUpdates(true); | ||
587 | if (force) | 587 | if (force) | ||
Show All 13 Lines | 596 | if (m_xdgDecoration) { | |||
601 | } | 601 | } | ||
602 | } | 602 | } | ||
603 | getShadow(); | 603 | getShadow(); | ||
604 | if (check_workspace_pos) | 604 | if (check_workspace_pos) | ||
605 | checkWorkspacePosition(oldgeom, -2, oldClientGeom); | 605 | checkWorkspacePosition(oldgeom, -2, oldClientGeom); | ||
606 | blockGeometryUpdates(false); | 606 | blockGeometryUpdates(false); | ||
607 | } | 607 | } | ||
608 | 608 | | |||
609 | void ShellClient::setGeometry(int x, int y, int w, int h, ForceGeometry_t force) | 609 | void XdgShellClient::setGeometry(int x, int y, int w, int h, ForceGeometry_t force) | ||
610 | { | 610 | { | ||
611 | const QRect newGeometry = rules()->checkGeometry(QRect(x, y, w, h)); | 611 | const QRect newGeometry = rules()->checkGeometry(QRect(x, y, w, h)); | ||
612 | 612 | | |||
613 | if (areGeometryUpdatesBlocked()) { | 613 | if (areGeometryUpdatesBlocked()) { | ||
614 | // when the GeometryUpdateBlocker exits the current geom is passed to setGeometry | 614 | // when the GeometryUpdateBlocker exits the current geom is passed to setGeometry | ||
615 | // thus we need to set it here. | 615 | // thus we need to set it here. | ||
616 | geom = newGeometry; | 616 | geom = newGeometry; | ||
617 | if (pendingGeometryUpdate() == PendingGeometryForced) | 617 | if (pendingGeometryUpdate() == PendingGeometryForced) | ||
Show All 17 Lines | 632 | if (requestedClientSize == m_clientSize && | |||
635 | doSetGeometry(newGeometry); | 635 | doSetGeometry(newGeometry); | ||
636 | updateMaximizeMode(m_requestedMaximizeMode); | 636 | updateMaximizeMode(m_requestedMaximizeMode); | ||
637 | } else { | 637 | } else { | ||
638 | // size did change, Client needs to provide a new buffer | 638 | // size did change, Client needs to provide a new buffer | ||
639 | requestGeometry(newGeometry); | 639 | requestGeometry(newGeometry); | ||
640 | } | 640 | } | ||
641 | } | 641 | } | ||
642 | 642 | | |||
643 | void ShellClient::doSetGeometry(const QRect &rect) | 643 | void XdgShellClient::doSetGeometry(const QRect &rect) | ||
644 | { | 644 | { | ||
645 | if (geom == rect && pendingGeometryUpdate() == PendingGeometryNone) { | 645 | if (geom == rect && pendingGeometryUpdate() == PendingGeometryNone) { | ||
646 | return; | 646 | return; | ||
647 | } | 647 | } | ||
648 | if (!m_unmapped) { | 648 | if (!m_unmapped) { | ||
649 | addWorkspaceRepaint(visibleRect()); | 649 | addWorkspaceRepaint(visibleRect()); | ||
650 | } | 650 | } | ||
651 | 651 | | |||
Show All 15 Lines | |||||
667 | updateGeometryBeforeUpdateBlocking(); | 667 | updateGeometryBeforeUpdateBlocking(); | ||
668 | emit geometryShapeChanged(this, old); | 668 | emit geometryShapeChanged(this, old); | ||
669 | 669 | | |||
670 | if (isResize()) { | 670 | if (isResize()) { | ||
671 | performMoveResize(); | 671 | performMoveResize(); | ||
672 | } | 672 | } | ||
673 | } | 673 | } | ||
674 | 674 | | |||
675 | QByteArray ShellClient::windowRole() const | 675 | QByteArray XdgShellClient::windowRole() const | ||
676 | { | 676 | { | ||
677 | return QByteArray(); | 677 | return QByteArray(); | ||
678 | } | 678 | } | ||
679 | 679 | | |||
680 | bool ShellClient::belongsToSameApplication(const AbstractClient *other, SameApplicationChecks checks) const | 680 | bool XdgShellClient::belongsToSameApplication(const AbstractClient *other, SameApplicationChecks checks) const | ||
681 | { | 681 | { | ||
682 | if (checks.testFlag(SameApplicationCheck::AllowCrossProcesses)) { | 682 | if (checks.testFlag(SameApplicationCheck::AllowCrossProcesses)) { | ||
683 | if (other->desktopFileName() == desktopFileName()) { | 683 | if (other->desktopFileName() == desktopFileName()) { | ||
684 | return true; | 684 | return true; | ||
685 | } | 685 | } | ||
686 | } | 686 | } | ||
687 | if (auto s = other->surface()) { | 687 | if (auto s = other->surface()) { | ||
688 | return s->client() == surface()->client(); | 688 | return s->client() == surface()->client(); | ||
689 | } | 689 | } | ||
690 | return false; | 690 | return false; | ||
691 | } | 691 | } | ||
692 | 692 | | |||
693 | void ShellClient::blockActivityUpdates(bool b) | 693 | void XdgShellClient::blockActivityUpdates(bool b) | ||
694 | { | 694 | { | ||
695 | Q_UNUSED(b) | 695 | Q_UNUSED(b) | ||
696 | } | 696 | } | ||
697 | 697 | | |||
698 | void ShellClient::updateCaption() | 698 | void XdgShellClient::updateCaption() | ||
699 | { | 699 | { | ||
700 | const QString oldSuffix = m_captionSuffix; | 700 | const QString oldSuffix = m_captionSuffix; | ||
701 | const auto shortcut = shortcutCaptionSuffix(); | 701 | const auto shortcut = shortcutCaptionSuffix(); | ||
702 | m_captionSuffix = shortcut; | 702 | m_captionSuffix = shortcut; | ||
703 | if ((!isSpecialWindow() || isToolbar()) && findClientWithSameCaption()) { | 703 | if ((!isSpecialWindow() || isToolbar()) && findClientWithSameCaption()) { | ||
704 | int i = 2; | 704 | int i = 2; | ||
705 | do { | 705 | do { | ||
706 | m_captionSuffix = shortcut + QLatin1String(" <") + QString::number(i) + QLatin1Char('>'); | 706 | m_captionSuffix = shortcut + QLatin1String(" <") + QString::number(i) + QLatin1Char('>'); | ||
707 | i++; | 707 | i++; | ||
708 | } while (findClientWithSameCaption()); | 708 | } while (findClientWithSameCaption()); | ||
709 | } | 709 | } | ||
710 | if (m_captionSuffix != oldSuffix) { | 710 | if (m_captionSuffix != oldSuffix) { | ||
711 | emit captionChanged(); | 711 | emit captionChanged(); | ||
712 | } | 712 | } | ||
713 | } | 713 | } | ||
714 | 714 | | |||
715 | void ShellClient::closeWindow() | 715 | void XdgShellClient::closeWindow() | ||
716 | { | 716 | { | ||
717 | if (m_xdgShellSurface && isCloseable()) { | 717 | if (m_xdgShellSurface && isCloseable()) { | ||
718 | m_xdgShellSurface->close(); | 718 | m_xdgShellSurface->close(); | ||
719 | const qint32 pingSerial = static_cast<XdgShellInterface *>(m_xdgShellSurface->global())->ping(m_xdgShellSurface); | 719 | const qint32 pingSerial = static_cast<XdgShellInterface *>(m_xdgShellSurface->global())->ping(m_xdgShellSurface); | ||
720 | m_pingSerials.insert(pingSerial, PingReason::CloseWindow); | 720 | m_pingSerials.insert(pingSerial, PingReason::CloseWindow); | ||
721 | } | 721 | } | ||
722 | } | 722 | } | ||
723 | 723 | | |||
724 | AbstractClient *ShellClient::findModal(bool allow_itself) | 724 | AbstractClient *XdgShellClient::findModal(bool allow_itself) | ||
725 | { | 725 | { | ||
726 | Q_UNUSED(allow_itself) | 726 | Q_UNUSED(allow_itself) | ||
727 | return nullptr; | 727 | return nullptr; | ||
728 | } | 728 | } | ||
729 | 729 | | |||
730 | bool ShellClient::isCloseable() const | 730 | bool XdgShellClient::isCloseable() const | ||
731 | { | 731 | { | ||
732 | if (m_windowType == NET::Desktop || m_windowType == NET::Dock) { | 732 | if (m_windowType == NET::Desktop || m_windowType == NET::Dock) { | ||
733 | return false; | 733 | return false; | ||
734 | } | 734 | } | ||
735 | if (m_xdgShellSurface) { | 735 | if (m_xdgShellSurface) { | ||
736 | return true; | 736 | return true; | ||
737 | } | 737 | } | ||
738 | return false; | 738 | return false; | ||
739 | } | 739 | } | ||
740 | 740 | | |||
741 | bool ShellClient::isFullScreen() const | 741 | bool XdgShellClient::isFullScreen() const | ||
742 | { | 742 | { | ||
743 | return m_fullScreen; | 743 | return m_fullScreen; | ||
744 | } | 744 | } | ||
745 | 745 | | |||
746 | bool ShellClient::isMaximizable() const | 746 | bool XdgShellClient::isMaximizable() const | ||
747 | { | 747 | { | ||
748 | if (!isResizable()) { | 748 | if (!isResizable()) { | ||
749 | return false; | 749 | return false; | ||
750 | } | 750 | } | ||
751 | if (rules()->checkMaximize(MaximizeRestore) != MaximizeRestore || rules()->checkMaximize(MaximizeFull) != MaximizeFull) { | 751 | if (rules()->checkMaximize(MaximizeRestore) != MaximizeRestore || rules()->checkMaximize(MaximizeFull) != MaximizeFull) { | ||
752 | return false; | 752 | return false; | ||
753 | } | 753 | } | ||
754 | return true; | 754 | return true; | ||
755 | } | 755 | } | ||
756 | 756 | | |||
757 | bool ShellClient::isMinimizable() const | 757 | bool XdgShellClient::isMinimizable() const | ||
758 | { | 758 | { | ||
759 | if (!rules()->checkMinimize(true)) { | 759 | if (!rules()->checkMinimize(true)) { | ||
760 | return false; | 760 | return false; | ||
761 | } | 761 | } | ||
762 | return (!m_plasmaShellSurface || m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Normal); | 762 | return (!m_plasmaShellSurface || m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Normal); | ||
763 | } | 763 | } | ||
764 | 764 | | |||
765 | bool ShellClient::isMovable() const | 765 | bool XdgShellClient::isMovable() const | ||
766 | { | 766 | { | ||
767 | if (rules()->checkPosition(invalidPoint) != invalidPoint) { | 767 | if (rules()->checkPosition(invalidPoint) != invalidPoint) { | ||
768 | return false; | 768 | return false; | ||
769 | } | 769 | } | ||
770 | if (m_plasmaShellSurface) { | 770 | if (m_plasmaShellSurface) { | ||
771 | return m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Normal; | 771 | return m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Normal; | ||
772 | } | 772 | } | ||
773 | if (m_xdgShellPopup) { | 773 | if (m_xdgShellPopup) { | ||
774 | return false; | 774 | return false; | ||
775 | } | 775 | } | ||
776 | return true; | 776 | return true; | ||
777 | } | 777 | } | ||
778 | 778 | | |||
779 | bool ShellClient::isMovableAcrossScreens() const | 779 | bool XdgShellClient::isMovableAcrossScreens() const | ||
780 | { | 780 | { | ||
781 | if (rules()->checkPosition(invalidPoint) != invalidPoint) { | 781 | if (rules()->checkPosition(invalidPoint) != invalidPoint) { | ||
782 | return false; | 782 | return false; | ||
783 | } | 783 | } | ||
784 | if (m_plasmaShellSurface) { | 784 | if (m_plasmaShellSurface) { | ||
785 | return m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Normal; | 785 | return m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Normal; | ||
786 | } | 786 | } | ||
787 | if (m_xdgShellPopup) { | 787 | if (m_xdgShellPopup) { | ||
788 | return false; | 788 | return false; | ||
789 | } | 789 | } | ||
790 | return true; | 790 | return true; | ||
791 | } | 791 | } | ||
792 | 792 | | |||
793 | bool ShellClient::isResizable() const | 793 | bool XdgShellClient::isResizable() const | ||
794 | { | 794 | { | ||
795 | if (rules()->checkSize(QSize()).isValid()) { | 795 | if (rules()->checkSize(QSize()).isValid()) { | ||
796 | return false; | 796 | return false; | ||
797 | } | 797 | } | ||
798 | if (m_plasmaShellSurface) { | 798 | if (m_plasmaShellSurface) { | ||
799 | return m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Normal; | 799 | return m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Normal; | ||
800 | } | 800 | } | ||
801 | if (m_xdgShellPopup) { | 801 | if (m_xdgShellPopup) { | ||
802 | return false; | 802 | return false; | ||
803 | } | 803 | } | ||
804 | return true; | 804 | return true; | ||
805 | } | 805 | } | ||
806 | 806 | | |||
807 | bool ShellClient::isShown(bool shaded_is_shown) const | 807 | bool XdgShellClient::isShown(bool shaded_is_shown) const | ||
808 | { | 808 | { | ||
809 | Q_UNUSED(shaded_is_shown) | 809 | Q_UNUSED(shaded_is_shown) | ||
810 | return !m_closing && !m_unmapped && !isMinimized() && !m_hidden; | 810 | return !m_closing && !m_unmapped && !isMinimized() && !m_hidden; | ||
811 | } | 811 | } | ||
812 | 812 | | |||
813 | void ShellClient::hideClient(bool hide) | 813 | void XdgShellClient::hideClient(bool hide) | ||
814 | { | 814 | { | ||
815 | if (m_hidden == hide) { | 815 | if (m_hidden == hide) { | ||
816 | return; | 816 | return; | ||
817 | } | 817 | } | ||
818 | m_hidden = hide; | 818 | m_hidden = hide; | ||
819 | if (hide) { | 819 | if (hide) { | ||
820 | addWorkspaceRepaint(visibleRect()); | 820 | addWorkspaceRepaint(visibleRect()); | ||
821 | workspace()->clientHidden(this); | 821 | workspace()->clientHidden(this); | ||
822 | emit windowHidden(this); | 822 | emit windowHidden(this); | ||
823 | } else { | 823 | } else { | ||
824 | emit windowShown(this); | 824 | emit windowShown(this); | ||
825 | } | 825 | } | ||
826 | } | 826 | } | ||
827 | 827 | | |||
828 | static bool changeMaximizeRecursion = false; | 828 | static bool changeMaximizeRecursion = false; | ||
829 | void ShellClient::changeMaximize(bool horizontal, bool vertical, bool adjust) | 829 | void XdgShellClient::changeMaximize(bool horizontal, bool vertical, bool adjust) | ||
830 | { | 830 | { | ||
831 | if (changeMaximizeRecursion) { | 831 | if (changeMaximizeRecursion) { | ||
832 | return; | 832 | return; | ||
833 | } | 833 | } | ||
834 | 834 | | |||
835 | if (!isResizable()) { | 835 | if (!isResizable()) { | ||
836 | return; | 836 | return; | ||
837 | } | 837 | } | ||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Line(s) | 914 | } else { | |||
922 | if (m_geomMaximizeRestore.isValid()) { | 922 | if (m_geomMaximizeRestore.isValid()) { | ||
923 | setGeometry(m_geomMaximizeRestore); | 923 | setGeometry(m_geomMaximizeRestore); | ||
924 | } else { | 924 | } else { | ||
925 | setGeometry(workspace()->clientArea(PlacementArea, this)); | 925 | setGeometry(workspace()->clientArea(PlacementArea, this)); | ||
926 | } | 926 | } | ||
927 | } | 927 | } | ||
928 | } | 928 | } | ||
929 | 929 | | |||
930 | MaximizeMode ShellClient::maximizeMode() const | 930 | MaximizeMode XdgShellClient::maximizeMode() const | ||
931 | { | 931 | { | ||
932 | return m_maximizeMode; | 932 | return m_maximizeMode; | ||
933 | } | 933 | } | ||
934 | 934 | | |||
935 | MaximizeMode ShellClient::requestedMaximizeMode() const | 935 | MaximizeMode XdgShellClient::requestedMaximizeMode() const | ||
936 | { | 936 | { | ||
937 | return m_requestedMaximizeMode; | 937 | return m_requestedMaximizeMode; | ||
938 | } | 938 | } | ||
939 | 939 | | |||
940 | bool ShellClient::noBorder() const | 940 | bool XdgShellClient::noBorder() const | ||
941 | { | 941 | { | ||
942 | if (m_serverDecoration) { | 942 | if (m_serverDecoration) { | ||
943 | if (m_serverDecoration->mode() == ServerSideDecorationManagerInterface::Mode::Server) { | 943 | if (m_serverDecoration->mode() == ServerSideDecorationManagerInterface::Mode::Server) { | ||
944 | return m_userNoBorder || isFullScreen(); | 944 | return m_userNoBorder || isFullScreen(); | ||
945 | } | 945 | } | ||
946 | } | 946 | } | ||
947 | if (m_xdgDecoration && m_xdgDecoration->requestedMode() != XdgDecorationInterface::Mode::ClientSide) { | 947 | if (m_xdgDecoration && m_xdgDecoration->requestedMode() != XdgDecorationInterface::Mode::ClientSide) { | ||
948 | return m_userNoBorder || isFullScreen(); | 948 | return m_userNoBorder || isFullScreen(); | ||
949 | } | 949 | } | ||
950 | return true; | 950 | return true; | ||
951 | } | 951 | } | ||
952 | 952 | | |||
953 | bool ShellClient::isFullScreenable() const | 953 | bool XdgShellClient::isFullScreenable() const | ||
954 | { | 954 | { | ||
955 | if (!rules()->checkFullScreen(true)) { | 955 | if (!rules()->checkFullScreen(true)) { | ||
956 | return false; | 956 | return false; | ||
957 | } | 957 | } | ||
958 | return !isSpecialWindow(); | 958 | return !isSpecialWindow(); | ||
959 | } | 959 | } | ||
960 | 960 | | |||
961 | void ShellClient::setFullScreen(bool set, bool user) | 961 | void XdgShellClient::setFullScreen(bool set, bool user) | ||
962 | { | 962 | { | ||
963 | set = rules()->checkFullScreen(set); | 963 | set = rules()->checkFullScreen(set); | ||
964 | 964 | | |||
965 | const bool wasFullscreen = isFullScreen(); | 965 | const bool wasFullscreen = isFullScreen(); | ||
966 | if (wasFullscreen == set) { | 966 | if (wasFullscreen == set) { | ||
967 | return; | 967 | return; | ||
968 | } | 968 | } | ||
969 | if (isSpecialWindow()) { | 969 | if (isSpecialWindow()) { | ||
Show All 34 Lines | 1001 | } else { | |||
1004 | setGeometry(QRect(workspace()->clientArea(PlacementArea, this).topLeft(), QSize(0, 0))); | 1004 | setGeometry(QRect(workspace()->clientArea(PlacementArea, this).topLeft(), QSize(0, 0))); | ||
1005 | } | 1005 | } | ||
1006 | } | 1006 | } | ||
1007 | 1007 | | |||
1008 | updateWindowRules(Rules::Fullscreen|Rules::Position|Rules::Size); | 1008 | updateWindowRules(Rules::Fullscreen|Rules::Position|Rules::Size); | ||
1009 | emit fullScreenChanged(); | 1009 | emit fullScreenChanged(); | ||
1010 | } | 1010 | } | ||
1011 | 1011 | | |||
1012 | void ShellClient::setNoBorder(bool set) | 1012 | void XdgShellClient::setNoBorder(bool set) | ||
1013 | { | 1013 | { | ||
1014 | if (!userCanSetNoBorder()) { | 1014 | if (!userCanSetNoBorder()) { | ||
1015 | return; | 1015 | return; | ||
1016 | } | 1016 | } | ||
1017 | set = rules()->checkNoBorder(set); | 1017 | set = rules()->checkNoBorder(set); | ||
1018 | if (m_userNoBorder == set) { | 1018 | if (m_userNoBorder == set) { | ||
1019 | return; | 1019 | return; | ||
1020 | } | 1020 | } | ||
1021 | m_userNoBorder = set; | 1021 | m_userNoBorder = set; | ||
1022 | updateDecoration(true, false); | 1022 | updateDecoration(true, false); | ||
1023 | updateWindowRules(Rules::NoBorder); | 1023 | updateWindowRules(Rules::NoBorder); | ||
1024 | } | 1024 | } | ||
1025 | 1025 | | |||
1026 | void ShellClient::setOnAllActivities(bool set) | 1026 | void XdgShellClient::setOnAllActivities(bool set) | ||
1027 | { | 1027 | { | ||
1028 | Q_UNUSED(set) | 1028 | Q_UNUSED(set) | ||
1029 | } | 1029 | } | ||
1030 | 1030 | | |||
1031 | void ShellClient::takeFocus() | 1031 | void XdgShellClient::takeFocus() | ||
1032 | { | 1032 | { | ||
1033 | if (rules()->checkAcceptFocus(wantsInput())) { | 1033 | if (rules()->checkAcceptFocus(wantsInput())) { | ||
1034 | if (m_xdgShellSurface) { | 1034 | if (m_xdgShellSurface) { | ||
1035 | const qint32 pingSerial = static_cast<XdgShellInterface *>(m_xdgShellSurface->global())->ping(m_xdgShellSurface); | 1035 | const qint32 pingSerial = static_cast<XdgShellInterface *>(m_xdgShellSurface->global())->ping(m_xdgShellSurface); | ||
1036 | m_pingSerials.insert(pingSerial, PingReason::FocusWindow); | 1036 | m_pingSerials.insert(pingSerial, PingReason::FocusWindow); | ||
1037 | } | 1037 | } | ||
1038 | setActive(true); | 1038 | setActive(true); | ||
1039 | } | 1039 | } | ||
1040 | 1040 | | |||
1041 | if (!keepAbove() && !isOnScreenDisplay() && !belongsToDesktop()) { | 1041 | if (!keepAbove() && !isOnScreenDisplay() && !belongsToDesktop()) { | ||
1042 | workspace()->setShowingDesktop(false); | 1042 | workspace()->setShowingDesktop(false); | ||
1043 | } | 1043 | } | ||
1044 | } | 1044 | } | ||
1045 | 1045 | | |||
1046 | void ShellClient::doSetActive() | 1046 | void XdgShellClient::doSetActive() | ||
1047 | { | 1047 | { | ||
1048 | if (!isActive()) { | 1048 | if (!isActive()) { | ||
1049 | return; | 1049 | return; | ||
1050 | } | 1050 | } | ||
1051 | StackingUpdatesBlocker blocker(workspace()); | 1051 | StackingUpdatesBlocker blocker(workspace()); | ||
1052 | workspace()->focusToNull(); | 1052 | workspace()->focusToNull(); | ||
1053 | } | 1053 | } | ||
1054 | 1054 | | |||
1055 | bool ShellClient::userCanSetFullScreen() const | 1055 | bool XdgShellClient::userCanSetFullScreen() const | ||
1056 | { | 1056 | { | ||
1057 | if (m_xdgShellSurface) { | 1057 | if (m_xdgShellSurface) { | ||
1058 | return true; | 1058 | return true; | ||
1059 | } | 1059 | } | ||
1060 | return false; | 1060 | return false; | ||
1061 | } | 1061 | } | ||
1062 | 1062 | | |||
1063 | bool ShellClient::userCanSetNoBorder() const | 1063 | bool XdgShellClient::userCanSetNoBorder() const | ||
1064 | { | 1064 | { | ||
1065 | if (m_serverDecoration && m_serverDecoration->mode() == ServerSideDecorationManagerInterface::Mode::Server) { | 1065 | if (m_serverDecoration && m_serverDecoration->mode() == ServerSideDecorationManagerInterface::Mode::Server) { | ||
1066 | return !isFullScreen() && !isShade(); | 1066 | return !isFullScreen() && !isShade(); | ||
1067 | } | 1067 | } | ||
1068 | if (m_xdgDecoration && m_xdgDecoration->requestedMode() != XdgDecorationInterface::Mode::ClientSide) { | 1068 | if (m_xdgDecoration && m_xdgDecoration->requestedMode() != XdgDecorationInterface::Mode::ClientSide) { | ||
1069 | return !isFullScreen() && !isShade(); | 1069 | return !isFullScreen() && !isShade(); | ||
1070 | } | 1070 | } | ||
1071 | return false; | 1071 | return false; | ||
1072 | } | 1072 | } | ||
1073 | 1073 | | |||
1074 | bool ShellClient::wantsInput() const | 1074 | bool XdgShellClient::wantsInput() const | ||
1075 | { | 1075 | { | ||
1076 | return rules()->checkAcceptFocus(acceptsFocus()); | 1076 | return rules()->checkAcceptFocus(acceptsFocus()); | ||
1077 | } | 1077 | } | ||
1078 | 1078 | | |||
1079 | bool ShellClient::acceptsFocus() const | 1079 | bool XdgShellClient::acceptsFocus() const | ||
1080 | { | 1080 | { | ||
1081 | if (waylandServer()->inputMethodConnection() == surface()->client()) { | 1081 | if (waylandServer()->inputMethodConnection() == surface()->client()) { | ||
1082 | return false; | 1082 | return false; | ||
1083 | } | 1083 | } | ||
1084 | if (m_plasmaShellSurface) { | 1084 | if (m_plasmaShellSurface) { | ||
1085 | if (m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::OnScreenDisplay || | 1085 | if (m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::OnScreenDisplay || | ||
1086 | m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::ToolTip || | 1086 | m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::ToolTip || | ||
1087 | m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Notification || | 1087 | m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Notification || | ||
Show All 11 Lines | |||||
1099 | } | 1099 | } | ||
1100 | if (m_xdgShellSurface) { | 1100 | if (m_xdgShellSurface) { | ||
1101 | // TODO: proper | 1101 | // TODO: proper | ||
1102 | return true; | 1102 | return true; | ||
1103 | } | 1103 | } | ||
1104 | return false; | 1104 | return false; | ||
1105 | } | 1105 | } | ||
1106 | 1106 | | |||
1107 | void ShellClient::createWindowId() | 1107 | void XdgShellClient::createWindowId() | ||
1108 | { | 1108 | { | ||
1109 | m_windowId = waylandServer()->createWindowId(surface()); | 1109 | m_windowId = waylandServer()->createWindowId(surface()); | ||
1110 | } | 1110 | } | ||
1111 | 1111 | | |||
1112 | pid_t ShellClient::pid() const | 1112 | pid_t XdgShellClient::pid() const | ||
1113 | { | 1113 | { | ||
1114 | return surface()->client()->processId(); | 1114 | return surface()->client()->processId(); | ||
1115 | } | 1115 | } | ||
1116 | 1116 | | |||
1117 | bool ShellClient::isLockScreen() const | 1117 | bool XdgShellClient::isLockScreen() const | ||
1118 | { | 1118 | { | ||
1119 | return surface()->client() == waylandServer()->screenLockerClientConnection(); | 1119 | return surface()->client() == waylandServer()->screenLockerClientConnection(); | ||
1120 | } | 1120 | } | ||
1121 | 1121 | | |||
1122 | bool ShellClient::isInputMethod() const | 1122 | bool XdgShellClient::isInputMethod() const | ||
1123 | { | 1123 | { | ||
1124 | return surface()->client() == waylandServer()->inputMethodConnection(); | 1124 | return surface()->client() == waylandServer()->inputMethodConnection(); | ||
1125 | } | 1125 | } | ||
1126 | 1126 | | |||
1127 | void ShellClient::requestGeometry(const QRect &rect) | 1127 | void XdgShellClient::requestGeometry(const QRect &rect) | ||
1128 | { | 1128 | { | ||
1129 | if (m_requestGeometryBlockCounter != 0) { | 1129 | if (m_requestGeometryBlockCounter != 0) { | ||
1130 | m_blockedRequestGeometry = rect; | 1130 | m_blockedRequestGeometry = rect; | ||
1131 | return; | 1131 | return; | ||
1132 | } | 1132 | } | ||
1133 | 1133 | | |||
1134 | QSize size; | 1134 | QSize size; | ||
1135 | if (rect.isValid()) { | 1135 | if (rect.isValid()) { | ||
Show All 23 Lines | 1156 | if (rect.isValid()) { //if there's no requested size, then there's implicity no positional information worth using | |||
1159 | configureRequest.positionAfterResize = rect.topLeft(); | 1159 | configureRequest.positionAfterResize = rect.topLeft(); | ||
1160 | configureRequest.maximizeMode = m_requestedMaximizeMode; | 1160 | configureRequest.maximizeMode = m_requestedMaximizeMode; | ||
1161 | m_pendingConfigureRequests.append(configureRequest); | 1161 | m_pendingConfigureRequests.append(configureRequest); | ||
1162 | } | 1162 | } | ||
1163 | 1163 | | |||
1164 | m_blockedRequestGeometry = QRect(); | 1164 | m_blockedRequestGeometry = QRect(); | ||
1165 | } | 1165 | } | ||
1166 | 1166 | | |||
1167 | void ShellClient::updatePendingGeometry() | 1167 | void XdgShellClient::updatePendingGeometry() | ||
1168 | { | 1168 | { | ||
1169 | QPoint position = pos(); | 1169 | QPoint position = pos(); | ||
1170 | MaximizeMode maximizeMode = m_maximizeMode; | 1170 | MaximizeMode maximizeMode = m_maximizeMode; | ||
1171 | for (auto it = m_pendingConfigureRequests.begin(); it != m_pendingConfigureRequests.end(); it++) { | 1171 | for (auto it = m_pendingConfigureRequests.begin(); it != m_pendingConfigureRequests.end(); it++) { | ||
1172 | if (it->serialId > m_lastAckedConfigureRequest) { | 1172 | if (it->serialId > m_lastAckedConfigureRequest) { | ||
1173 | //this serial is not acked yet, therefore we know all future serials are not | 1173 | //this serial is not acked yet, therefore we know all future serials are not | ||
1174 | break; | 1174 | break; | ||
1175 | } | 1175 | } | ||
1176 | if (it->serialId == m_lastAckedConfigureRequest) { | 1176 | if (it->serialId == m_lastAckedConfigureRequest) { | ||
1177 | if (position != it->positionAfterResize) { | 1177 | if (position != it->positionAfterResize) { | ||
1178 | addLayerRepaint(geometry()); | 1178 | addLayerRepaint(geometry()); | ||
1179 | } | 1179 | } | ||
1180 | position = it->positionAfterResize; | 1180 | position = it->positionAfterResize; | ||
1181 | maximizeMode = it->maximizeMode; | 1181 | maximizeMode = it->maximizeMode; | ||
1182 | 1182 | | |||
1183 | m_pendingConfigureRequests.erase(m_pendingConfigureRequests.begin(), ++it); | 1183 | m_pendingConfigureRequests.erase(m_pendingConfigureRequests.begin(), ++it); | ||
1184 | break; | 1184 | break; | ||
1185 | } | 1185 | } | ||
1186 | //else serialId < m_lastAckedConfigureRequest and the state is now irrelevant and can be ignored | 1186 | //else serialId < m_lastAckedConfigureRequest and the state is now irrelevant and can be ignored | ||
1187 | } | 1187 | } | ||
1188 | doSetGeometry(QRect(position, m_clientSize + QSize(borderLeft() + borderRight(), borderTop() + borderBottom()))); | 1188 | doSetGeometry(QRect(position, m_clientSize + QSize(borderLeft() + borderRight(), borderTop() + borderBottom()))); | ||
1189 | updateMaximizeMode(maximizeMode); | 1189 | updateMaximizeMode(maximizeMode); | ||
1190 | } | 1190 | } | ||
1191 | 1191 | | |||
1192 | void ShellClient::clientFullScreenChanged(bool fullScreen) | 1192 | void XdgShellClient::clientFullScreenChanged(bool fullScreen) | ||
1193 | { | 1193 | { | ||
1194 | setFullScreen(fullScreen, false); | 1194 | setFullScreen(fullScreen, false); | ||
1195 | } | 1195 | } | ||
1196 | 1196 | | |||
1197 | void ShellClient::resizeWithChecks(int w, int h, ForceGeometry_t force) | 1197 | void XdgShellClient::resizeWithChecks(int w, int h, ForceGeometry_t force) | ||
1198 | { | 1198 | { | ||
1199 | Q_UNUSED(force) | 1199 | Q_UNUSED(force) | ||
1200 | QRect area = workspace()->clientArea(WorkArea, this); | 1200 | QRect area = workspace()->clientArea(WorkArea, this); | ||
1201 | // don't allow growing larger than workarea | 1201 | // don't allow growing larger than workarea | ||
1202 | if (w > area.width()) { | 1202 | if (w > area.width()) { | ||
1203 | w = area.width(); | 1203 | w = area.width(); | ||
1204 | } | 1204 | } | ||
1205 | if (h > area.height()) { | 1205 | if (h > area.height()) { | ||
1206 | h = area.height(); | 1206 | h = area.height(); | ||
1207 | } | 1207 | } | ||
1208 | if (m_xdgShellSurface) { | 1208 | if (m_xdgShellSurface) { | ||
1209 | m_xdgShellSurface->configure(xdgSurfaceStates(), QSize(w, h)); | 1209 | m_xdgShellSurface->configure(xdgSurfaceStates(), QSize(w, h)); | ||
1210 | } | 1210 | } | ||
1211 | } | 1211 | } | ||
1212 | 1212 | | |||
1213 | void ShellClient::unmap() | 1213 | void XdgShellClient::unmap() | ||
1214 | { | 1214 | { | ||
1215 | m_unmapped = true; | 1215 | m_unmapped = true; | ||
1216 | if (isMoveResize()) { | 1216 | if (isMoveResize()) { | ||
1217 | leaveMoveResize(); | 1217 | leaveMoveResize(); | ||
1218 | } | 1218 | } | ||
1219 | m_requestedClientSize = QSize(0, 0); | 1219 | m_requestedClientSize = QSize(0, 0); | ||
1220 | destroyWindowManagementInterface(); | 1220 | destroyWindowManagementInterface(); | ||
1221 | if (Workspace::self()) { | 1221 | if (Workspace::self()) { | ||
1222 | addWorkspaceRepaint(visibleRect()); | 1222 | addWorkspaceRepaint(visibleRect()); | ||
1223 | workspace()->clientHidden(this); | 1223 | workspace()->clientHidden(this); | ||
1224 | } | 1224 | } | ||
1225 | emit windowHidden(this); | 1225 | emit windowHidden(this); | ||
1226 | } | 1226 | } | ||
1227 | 1227 | | |||
1228 | void ShellClient::installPlasmaShellSurface(PlasmaShellSurfaceInterface *surface) | 1228 | void XdgShellClient::installPlasmaShellSurface(PlasmaShellSurfaceInterface *surface) | ||
1229 | { | 1229 | { | ||
1230 | m_plasmaShellSurface = surface; | 1230 | m_plasmaShellSurface = surface; | ||
1231 | auto updatePosition = [this, surface] { | 1231 | auto updatePosition = [this, surface] { | ||
1232 | QRect rect = QRect(surface->position(), m_clientSize + QSize(borderLeft() + borderRight(), borderTop() + borderBottom())); | 1232 | QRect rect = QRect(surface->position(), m_clientSize + QSize(borderLeft() + borderRight(), borderTop() + borderBottom())); | ||
1233 | doSetGeometry(rect); | 1233 | doSetGeometry(rect); | ||
1234 | }; | 1234 | }; | ||
1235 | auto updateRole = [this, surface] { | 1235 | auto updateRole = [this, surface] { | ||
1236 | NET::WindowType type = NET::Unknown; | 1236 | NET::WindowType type = NET::Unknown; | ||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 1285 | [this] { | |||
1286 | hideClient(false); | 1286 | hideClient(false); | ||
1287 | ScreenEdges::self()->reserve(this, ElectricNone); | 1287 | ScreenEdges::self()->reserve(this, ElectricNone); | ||
1288 | m_plasmaShellSurface->showAutoHidingPanel(); | 1288 | m_plasmaShellSurface->showAutoHidingPanel(); | ||
1289 | } | 1289 | } | ||
1290 | ); | 1290 | ); | ||
1291 | updatePosition(); | 1291 | updatePosition(); | ||
1292 | updateRole(); | 1292 | updateRole(); | ||
1293 | updateShowOnScreenEdge(); | 1293 | updateShowOnScreenEdge(); | ||
1294 | connect(this, &ShellClient::geometryChanged, this, &ShellClient::updateShowOnScreenEdge); | 1294 | connect(this, &XdgShellClient::geometryChanged, this, &XdgShellClient::updateShowOnScreenEdge); | ||
1295 | 1295 | | |||
1296 | setSkipTaskbar(surface->skipTaskbar()); | 1296 | setSkipTaskbar(surface->skipTaskbar()); | ||
1297 | connect(surface, &PlasmaShellSurfaceInterface::skipTaskbarChanged, this, [this] { | 1297 | connect(surface, &PlasmaShellSurfaceInterface::skipTaskbarChanged, this, [this] { | ||
1298 | setSkipTaskbar(m_plasmaShellSurface->skipTaskbar()); | 1298 | setSkipTaskbar(m_plasmaShellSurface->skipTaskbar()); | ||
1299 | }); | 1299 | }); | ||
1300 | 1300 | | |||
1301 | setSkipSwitcher(surface->skipSwitcher()); | 1301 | setSkipSwitcher(surface->skipSwitcher()); | ||
1302 | connect(surface, &PlasmaShellSurfaceInterface::skipSwitcherChanged, this, [this] { | 1302 | connect(surface, &PlasmaShellSurfaceInterface::skipSwitcherChanged, this, [this] { | ||
1303 | setSkipSwitcher(m_plasmaShellSurface->skipSwitcher()); | 1303 | setSkipSwitcher(m_plasmaShellSurface->skipSwitcher()); | ||
1304 | }); | 1304 | }); | ||
1305 | } | 1305 | } | ||
1306 | 1306 | | |||
1307 | void ShellClient::updateShowOnScreenEdge() | 1307 | void XdgShellClient::updateShowOnScreenEdge() | ||
1308 | { | 1308 | { | ||
1309 | if (!ScreenEdges::self()) { | 1309 | if (!ScreenEdges::self()) { | ||
1310 | return; | 1310 | return; | ||
1311 | } | 1311 | } | ||
1312 | if (m_unmapped || !m_plasmaShellSurface || m_plasmaShellSurface->role() != PlasmaShellSurfaceInterface::Role::Panel) { | 1312 | if (m_unmapped || !m_plasmaShellSurface || m_plasmaShellSurface->role() != PlasmaShellSurfaceInterface::Role::Panel) { | ||
1313 | ScreenEdges::self()->reserve(this, ElectricNone); | 1313 | ScreenEdges::self()->reserve(this, ElectricNone); | ||
1314 | return; | 1314 | return; | ||
1315 | } | 1315 | } | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 1372 | if (edges.testFlag(Qt::BottomEdge)) { | |||
1373 | border = ElectricBottom; | 1373 | border = ElectricBottom; | ||
1374 | } | 1374 | } | ||
1375 | ScreenEdges::self()->reserve(this, border); | 1375 | ScreenEdges::self()->reserve(this, border); | ||
1376 | } else { | 1376 | } else { | ||
1377 | ScreenEdges::self()->reserve(this, ElectricNone); | 1377 | ScreenEdges::self()->reserve(this, ElectricNone); | ||
1378 | } | 1378 | } | ||
1379 | } | 1379 | } | ||
1380 | 1380 | | |||
1381 | bool ShellClient::isInitialPositionSet() const | 1381 | bool XdgShellClient::isInitialPositionSet() const | ||
1382 | { | 1382 | { | ||
1383 | if (m_plasmaShellSurface) { | 1383 | if (m_plasmaShellSurface) { | ||
1384 | return m_plasmaShellSurface->isPositionSet(); | 1384 | return m_plasmaShellSurface->isPositionSet(); | ||
1385 | } | 1385 | } | ||
1386 | return false; | 1386 | return false; | ||
1387 | } | 1387 | } | ||
1388 | 1388 | | |||
1389 | void ShellClient::installAppMenu(AppMenuInterface *menu) | 1389 | void XdgShellClient::installAppMenu(AppMenuInterface *menu) | ||
1390 | { | 1390 | { | ||
1391 | m_appMenuInterface = menu; | 1391 | m_appMenuInterface = menu; | ||
1392 | 1392 | | |||
1393 | auto updateMenu = [this](AppMenuInterface::InterfaceAddress address) { | 1393 | auto updateMenu = [this](AppMenuInterface::InterfaceAddress address) { | ||
1394 | updateApplicationMenuServiceName(address.serviceName); | 1394 | updateApplicationMenuServiceName(address.serviceName); | ||
1395 | updateApplicationMenuObjectPath(address.objectPath); | 1395 | updateApplicationMenuObjectPath(address.objectPath); | ||
1396 | }; | 1396 | }; | ||
1397 | connect(m_appMenuInterface, &AppMenuInterface::addressChanged, this, [=](AppMenuInterface::InterfaceAddress address) { | 1397 | connect(m_appMenuInterface, &AppMenuInterface::addressChanged, this, [=](AppMenuInterface::InterfaceAddress address) { | ||
1398 | updateMenu(address); | 1398 | updateMenu(address); | ||
1399 | }); | 1399 | }); | ||
1400 | updateMenu(menu->address()); | 1400 | updateMenu(menu->address()); | ||
1401 | } | 1401 | } | ||
1402 | 1402 | | |||
1403 | void ShellClient::installPalette(ServerSideDecorationPaletteInterface *palette) | 1403 | void XdgShellClient::installPalette(ServerSideDecorationPaletteInterface *palette) | ||
1404 | { | 1404 | { | ||
1405 | m_paletteInterface = palette; | 1405 | m_paletteInterface = palette; | ||
1406 | 1406 | | |||
1407 | auto updatePalette = [this](const QString &palette) { | 1407 | auto updatePalette = [this](const QString &palette) { | ||
1408 | AbstractClient::updateColorScheme(rules()->checkDecoColor(palette)); | 1408 | AbstractClient::updateColorScheme(rules()->checkDecoColor(palette)); | ||
1409 | }; | 1409 | }; | ||
1410 | connect(m_paletteInterface, &ServerSideDecorationPaletteInterface::paletteChanged, this, [=](const QString &palette) { | 1410 | connect(m_paletteInterface, &ServerSideDecorationPaletteInterface::paletteChanged, this, [=](const QString &palette) { | ||
1411 | updatePalette(palette); | 1411 | updatePalette(palette); | ||
1412 | }); | 1412 | }); | ||
1413 | connect(m_paletteInterface, &QObject::destroyed, this, [=]() { | 1413 | connect(m_paletteInterface, &QObject::destroyed, this, [=]() { | ||
1414 | updatePalette(QString()); | 1414 | updatePalette(QString()); | ||
1415 | }); | 1415 | }); | ||
1416 | updatePalette(palette->palette()); | 1416 | updatePalette(palette->palette()); | ||
1417 | } | 1417 | } | ||
1418 | 1418 | | |||
1419 | void ShellClient::updateColorScheme() | 1419 | void XdgShellClient::updateColorScheme() | ||
1420 | { | 1420 | { | ||
1421 | if (m_paletteInterface) { | 1421 | if (m_paletteInterface) { | ||
1422 | AbstractClient::updateColorScheme(rules()->checkDecoColor(m_paletteInterface->palette())); | 1422 | AbstractClient::updateColorScheme(rules()->checkDecoColor(m_paletteInterface->palette())); | ||
1423 | } else { | 1423 | } else { | ||
1424 | AbstractClient::updateColorScheme(rules()->checkDecoColor(QString())); | 1424 | AbstractClient::updateColorScheme(rules()->checkDecoColor(QString())); | ||
1425 | } | 1425 | } | ||
1426 | } | 1426 | } | ||
1427 | 1427 | | |||
1428 | void ShellClient::updateMaximizeMode(MaximizeMode maximizeMode) | 1428 | void XdgShellClient::updateMaximizeMode(MaximizeMode maximizeMode) | ||
1429 | { | 1429 | { | ||
1430 | if (maximizeMode == m_maximizeMode) { | 1430 | if (maximizeMode == m_maximizeMode) { | ||
1431 | return; | 1431 | return; | ||
1432 | } | 1432 | } | ||
1433 | 1433 | | |||
1434 | m_maximizeMode = maximizeMode; | 1434 | m_maximizeMode = maximizeMode; | ||
1435 | updateWindowRules(Rules::MaximizeHoriz | Rules::MaximizeVert | Rules::Position | Rules::Size); | 1435 | updateWindowRules(Rules::MaximizeHoriz | Rules::MaximizeVert | Rules::Position | Rules::Size); | ||
1436 | 1436 | | |||
1437 | emit clientMaximizedStateChanged(this, m_maximizeMode); | 1437 | emit clientMaximizedStateChanged(this, m_maximizeMode); | ||
1438 | emit clientMaximizedStateChanged(this, m_maximizeMode & MaximizeHorizontal, m_maximizeMode & MaximizeVertical); | 1438 | emit clientMaximizedStateChanged(this, m_maximizeMode & MaximizeHorizontal, m_maximizeMode & MaximizeVertical); | ||
1439 | } | 1439 | } | ||
1440 | 1440 | | |||
1441 | bool ShellClient::hasStrut() const | 1441 | bool XdgShellClient::hasStrut() const | ||
1442 | { | 1442 | { | ||
1443 | if (!isShown(true)) { | 1443 | if (!isShown(true)) { | ||
1444 | return false; | 1444 | return false; | ||
1445 | } | 1445 | } | ||
1446 | if (!m_plasmaShellSurface) { | 1446 | if (!m_plasmaShellSurface) { | ||
1447 | return false; | 1447 | return false; | ||
1448 | } | 1448 | } | ||
1449 | if (m_plasmaShellSurface->role() != PlasmaShellSurfaceInterface::Role::Panel) { | 1449 | if (m_plasmaShellSurface->role() != PlasmaShellSurfaceInterface::Role::Panel) { | ||
1450 | return false; | 1450 | return false; | ||
1451 | } | 1451 | } | ||
1452 | return m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::AlwaysVisible; | 1452 | return m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::AlwaysVisible; | ||
1453 | } | 1453 | } | ||
1454 | 1454 | | |||
1455 | void ShellClient::updateIcon() | 1455 | void XdgShellClient::updateIcon() | ||
1456 | { | 1456 | { | ||
1457 | const QString waylandIconName = QStringLiteral("wayland"); | 1457 | const QString waylandIconName = QStringLiteral("wayland"); | ||
1458 | const QString dfIconName = iconFromDesktopFile(); | 1458 | const QString dfIconName = iconFromDesktopFile(); | ||
1459 | const QString iconName = dfIconName.isEmpty() ? waylandIconName : dfIconName; | 1459 | const QString iconName = dfIconName.isEmpty() ? waylandIconName : dfIconName; | ||
1460 | if (iconName == icon().name()) { | 1460 | if (iconName == icon().name()) { | ||
1461 | return; | 1461 | return; | ||
1462 | } | 1462 | } | ||
1463 | setIcon(QIcon::fromTheme(iconName)); | 1463 | setIcon(QIcon::fromTheme(iconName)); | ||
1464 | } | 1464 | } | ||
1465 | 1465 | | |||
1466 | bool ShellClient::isTransient() const | 1466 | bool XdgShellClient::isTransient() const | ||
1467 | { | 1467 | { | ||
1468 | return m_transient; | 1468 | return m_transient; | ||
1469 | } | 1469 | } | ||
1470 | 1470 | | |||
1471 | void ShellClient::setTransient() | 1471 | void XdgShellClient::setTransient() | ||
1472 | { | 1472 | { | ||
1473 | SurfaceInterface *s = nullptr; | 1473 | SurfaceInterface *s = nullptr; | ||
1474 | if (m_xdgShellSurface) { | 1474 | if (m_xdgShellSurface) { | ||
1475 | if (auto transient = m_xdgShellSurface->transientFor().data()) { | 1475 | if (auto transient = m_xdgShellSurface->transientFor().data()) { | ||
1476 | s = transient->surface(); | 1476 | s = transient->surface(); | ||
1477 | } | 1477 | } | ||
1478 | } | 1478 | } | ||
1479 | if (m_xdgShellPopup) { | 1479 | if (m_xdgShellPopup) { | ||
Show All 10 Lines | 1486 | if (t != transientFor()) { | |||
1490 | setTransientFor(t); | 1490 | setTransientFor(t); | ||
1491 | if (t) { | 1491 | if (t) { | ||
1492 | t->addTransient(this); | 1492 | t->addTransient(this); | ||
1493 | } | 1493 | } | ||
1494 | } | 1494 | } | ||
1495 | m_transient = (s != nullptr); | 1495 | m_transient = (s != nullptr); | ||
1496 | } | 1496 | } | ||
1497 | 1497 | | |||
1498 | bool ShellClient::hasTransientPlacementHint() const | 1498 | bool XdgShellClient::hasTransientPlacementHint() const | ||
1499 | { | 1499 | { | ||
1500 | return isTransient() && transientFor() && m_xdgShellPopup; | 1500 | return isTransient() && transientFor() && m_xdgShellPopup; | ||
1501 | } | 1501 | } | ||
1502 | 1502 | | |||
1503 | QRect ShellClient::transientPlacement(const QRect &bounds) const | 1503 | QRect XdgShellClient::transientPlacement(const QRect &bounds) const | ||
1504 | { | 1504 | { | ||
1505 | QRect anchorRect; | 1505 | QRect anchorRect; | ||
1506 | Qt::Edges anchorEdge; | 1506 | Qt::Edges anchorEdge; | ||
1507 | Qt::Edges gravity; | 1507 | Qt::Edges gravity; | ||
1508 | QPoint offset; | 1508 | QPoint offset; | ||
1509 | PositionerConstraints constraintAdjustments; | 1509 | PositionerConstraints constraintAdjustments; | ||
1510 | QSize size = geometry().size(); | 1510 | QSize size = geometry().size(); | ||
1511 | 1511 | | |||
▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Line(s) | |||||
1615 | } | 1615 | } | ||
1616 | if (constraintAdjustments & PositionerConstraint::ResizeY) { | 1616 | if (constraintAdjustments & PositionerConstraint::ResizeY) { | ||
1617 | //TODO | 1617 | //TODO | ||
1618 | } | 1618 | } | ||
1619 | 1619 | | |||
1620 | return popupPosition; | 1620 | return popupPosition; | ||
1621 | } | 1621 | } | ||
1622 | 1622 | | |||
1623 | QPoint ShellClient::popupOffset(const QRect &anchorRect, const Qt::Edges anchorEdge, const Qt::Edges gravity, const QSize popupSize) const | 1623 | QPoint XdgShellClient::popupOffset(const QRect &anchorRect, const Qt::Edges anchorEdge, const Qt::Edges gravity, const QSize popupSize) const | ||
1624 | { | 1624 | { | ||
1625 | QPoint anchorPoint; | 1625 | QPoint anchorPoint; | ||
1626 | switch (anchorEdge & (Qt::LeftEdge | Qt::RightEdge)) { | 1626 | switch (anchorEdge & (Qt::LeftEdge | Qt::RightEdge)) { | ||
1627 | case Qt::LeftEdge: | 1627 | case Qt::LeftEdge: | ||
1628 | anchorPoint.setX(anchorRect.x()); | 1628 | anchorPoint.setX(anchorRect.x()); | ||
1629 | break; | 1629 | break; | ||
1630 | case Qt::RightEdge: | 1630 | case Qt::RightEdge: | ||
1631 | anchorPoint.setX(anchorRect.x() + anchorRect.width()); | 1631 | anchorPoint.setX(anchorRect.x() + anchorRect.width()); | ||
Show All 35 Lines | 1665 | case Qt::BottomEdge: | |||
1667 | break; | 1667 | break; | ||
1668 | default: | 1668 | default: | ||
1669 | popupPosAdjust.setY(qRound(-popupSize.height() / 2.0)); | 1669 | popupPosAdjust.setY(qRound(-popupSize.height() / 2.0)); | ||
1670 | } | 1670 | } | ||
1671 | 1671 | | |||
1672 | return anchorPoint + popupPosAdjust; | 1672 | return anchorPoint + popupPosAdjust; | ||
1673 | } | 1673 | } | ||
1674 | 1674 | | |||
1675 | void ShellClient::doResizeSync() | 1675 | void XdgShellClient::doResizeSync() | ||
1676 | { | 1676 | { | ||
1677 | requestGeometry(moveResizeGeometry()); | 1677 | requestGeometry(moveResizeGeometry()); | ||
1678 | } | 1678 | } | ||
1679 | 1679 | | |||
1680 | QMatrix4x4 ShellClient::inputTransformation() const | 1680 | QMatrix4x4 XdgShellClient::inputTransformation() const | ||
1681 | { | 1681 | { | ||
1682 | QMatrix4x4 m = Toplevel::inputTransformation(); | 1682 | QMatrix4x4 m = Toplevel::inputTransformation(); | ||
1683 | m.translate(-borderLeft(), -borderTop()); | 1683 | m.translate(-borderLeft(), -borderTop()); | ||
1684 | return m; | 1684 | return m; | ||
1685 | } | 1685 | } | ||
1686 | 1686 | | |||
1687 | void ShellClient::installServerSideDecoration(KWayland::Server::ServerSideDecorationInterface *deco) | 1687 | void XdgShellClient::installServerSideDecoration(KWayland::Server::ServerSideDecorationInterface *deco) | ||
1688 | { | 1688 | { | ||
1689 | if (m_serverDecoration == deco) { | 1689 | if (m_serverDecoration == deco) { | ||
1690 | return; | 1690 | return; | ||
1691 | } | 1691 | } | ||
1692 | m_serverDecoration = deco; | 1692 | m_serverDecoration = deco; | ||
1693 | connect(m_serverDecoration, &ServerSideDecorationInterface::destroyed, this, | 1693 | connect(m_serverDecoration, &ServerSideDecorationInterface::destroyed, this, | ||
1694 | [this] { | 1694 | [this] { | ||
1695 | m_serverDecoration = nullptr; | 1695 | m_serverDecoration = nullptr; | ||
1696 | if (m_closing || !Workspace::self()) { | 1696 | if (m_closing || !Workspace::self()) { | ||
1697 | return; | 1697 | return; | ||
1698 | } | 1698 | } | ||
1699 | if (!m_unmapped) { | 1699 | if (!m_unmapped) { | ||
1700 | // maybe delay to next event cycle in case the ShellClient is getting destroyed, too | 1700 | // maybe delay to next event cycle in case the XdgShellClient is getting destroyed, too | ||
1701 | updateDecoration(true); | 1701 | updateDecoration(true); | ||
1702 | } | 1702 | } | ||
1703 | } | 1703 | } | ||
1704 | ); | 1704 | ); | ||
1705 | if (!m_unmapped) { | 1705 | if (!m_unmapped) { | ||
1706 | updateDecoration(true); | 1706 | updateDecoration(true); | ||
1707 | } | 1707 | } | ||
1708 | connect(m_serverDecoration, &ServerSideDecorationInterface::modeRequested, this, | 1708 | connect(m_serverDecoration, &ServerSideDecorationInterface::modeRequested, this, | ||
1709 | [this] (ServerSideDecorationManagerInterface::Mode mode) { | 1709 | [this] (ServerSideDecorationManagerInterface::Mode mode) { | ||
1710 | const bool changed = mode != m_serverDecoration->mode(); | 1710 | const bool changed = mode != m_serverDecoration->mode(); | ||
1711 | if (changed && !m_unmapped) { | 1711 | if (changed && !m_unmapped) { | ||
1712 | updateDecoration(false); | 1712 | updateDecoration(false); | ||
1713 | } | 1713 | } | ||
1714 | } | 1714 | } | ||
1715 | ); | 1715 | ); | ||
1716 | } | 1716 | } | ||
1717 | 1717 | | |||
1718 | void ShellClient::installXdgDecoration(XdgDecorationInterface *deco) | 1718 | void XdgShellClient::installXdgDecoration(XdgDecorationInterface *deco) | ||
1719 | { | 1719 | { | ||
1720 | Q_ASSERT(m_xdgShellSurface); | 1720 | Q_ASSERT(m_xdgShellSurface); | ||
1721 | 1721 | | |||
1722 | m_xdgDecoration = deco; | 1722 | m_xdgDecoration = deco; | ||
1723 | 1723 | | |||
1724 | connect(m_xdgDecoration, &QObject::destroyed, this, | 1724 | connect(m_xdgDecoration, &QObject::destroyed, this, | ||
1725 | [this] { | 1725 | [this] { | ||
1726 | m_xdgDecoration = nullptr; | 1726 | m_xdgDecoration = nullptr; | ||
1727 | if (m_closing || !Workspace::self()) { | 1727 | if (m_closing || !Workspace::self()) { | ||
1728 | return; | 1728 | return; | ||
1729 | } | 1729 | } | ||
1730 | updateDecoration(true); | 1730 | updateDecoration(true); | ||
1731 | } | 1731 | } | ||
1732 | ); | 1732 | ); | ||
1733 | 1733 | | |||
1734 | connect(m_xdgDecoration, &XdgDecorationInterface::modeRequested, this, | 1734 | connect(m_xdgDecoration, &XdgDecorationInterface::modeRequested, this, | ||
1735 | [this] () { | 1735 | [this] () { | ||
1736 | //force is true as we must send a new configure response | 1736 | //force is true as we must send a new configure response | ||
1737 | updateDecoration(false, true); | 1737 | updateDecoration(false, true); | ||
1738 | }); | 1738 | }); | ||
1739 | } | 1739 | } | ||
1740 | 1740 | | |||
1741 | bool ShellClient::shouldExposeToWindowManagement() | 1741 | bool XdgShellClient::shouldExposeToWindowManagement() | ||
1742 | { | 1742 | { | ||
1743 | if (isLockScreen()) { | 1743 | if (isLockScreen()) { | ||
1744 | return false; | 1744 | return false; | ||
1745 | } | 1745 | } | ||
1746 | if (m_xdgShellPopup) { | 1746 | if (m_xdgShellPopup) { | ||
1747 | return false; | 1747 | return false; | ||
1748 | } | 1748 | } | ||
1749 | return true; | 1749 | return true; | ||
1750 | } | 1750 | } | ||
1751 | 1751 | | |||
1752 | KWayland::Server::XdgShellSurfaceInterface::States ShellClient::xdgSurfaceStates() const | 1752 | KWayland::Server::XdgShellSurfaceInterface::States XdgShellClient::xdgSurfaceStates() const | ||
1753 | { | 1753 | { | ||
1754 | XdgShellSurfaceInterface::States states; | 1754 | XdgShellSurfaceInterface::States states; | ||
1755 | if (isActive()) { | 1755 | if (isActive()) { | ||
1756 | states |= XdgShellSurfaceInterface::State::Activated; | 1756 | states |= XdgShellSurfaceInterface::State::Activated; | ||
1757 | } | 1757 | } | ||
1758 | if (isFullScreen()) { | 1758 | if (isFullScreen()) { | ||
1759 | states |= XdgShellSurfaceInterface::State::Fullscreen; | 1759 | states |= XdgShellSurfaceInterface::State::Fullscreen; | ||
1760 | } | 1760 | } | ||
1761 | if (m_requestedMaximizeMode == MaximizeMode::MaximizeFull) { | 1761 | if (m_requestedMaximizeMode == MaximizeMode::MaximizeFull) { | ||
1762 | states |= XdgShellSurfaceInterface::State::Maximized; | 1762 | states |= XdgShellSurfaceInterface::State::Maximized; | ||
1763 | } | 1763 | } | ||
1764 | if (isResize()) { | 1764 | if (isResize()) { | ||
1765 | states |= XdgShellSurfaceInterface::State::Resizing; | 1765 | states |= XdgShellSurfaceInterface::State::Resizing; | ||
1766 | } | 1766 | } | ||
1767 | return states; | 1767 | return states; | ||
1768 | } | 1768 | } | ||
1769 | 1769 | | |||
1770 | void ShellClient::doMinimize() | 1770 | void XdgShellClient::doMinimize() | ||
1771 | { | 1771 | { | ||
1772 | if (isMinimized()) { | 1772 | if (isMinimized()) { | ||
1773 | workspace()->clientHidden(this); | 1773 | workspace()->clientHidden(this); | ||
1774 | } else { | 1774 | } else { | ||
1775 | emit windowShown(this); | 1775 | emit windowShown(this); | ||
1776 | } | 1776 | } | ||
1777 | workspace()->updateMinimizedOfTransients(this); | 1777 | workspace()->updateMinimizedOfTransients(this); | ||
1778 | } | 1778 | } | ||
1779 | 1779 | | |||
1780 | void ShellClient::placeIn(const QRect &area) | 1780 | void XdgShellClient::placeIn(const QRect &area) | ||
1781 | { | 1781 | { | ||
1782 | Placement::self()->place(this, area); | 1782 | Placement::self()->place(this, area); | ||
1783 | setGeometryRestore(geometry()); | 1783 | setGeometryRestore(geometry()); | ||
1784 | } | 1784 | } | ||
1785 | 1785 | | |||
1786 | void ShellClient::showOnScreenEdge() | 1786 | void XdgShellClient::showOnScreenEdge() | ||
1787 | { | 1787 | { | ||
1788 | if (!m_plasmaShellSurface || m_unmapped) { | 1788 | if (!m_plasmaShellSurface || m_unmapped) { | ||
1789 | return; | 1789 | return; | ||
1790 | } | 1790 | } | ||
1791 | hideClient(false); | 1791 | hideClient(false); | ||
1792 | workspace()->raiseClient(this); | 1792 | workspace()->raiseClient(this); | ||
1793 | if (m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::AutoHide) { | 1793 | if (m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::AutoHide) { | ||
1794 | m_plasmaShellSurface->showAutoHidingPanel(); | 1794 | m_plasmaShellSurface->showAutoHidingPanel(); | ||
1795 | } | 1795 | } | ||
1796 | } | 1796 | } | ||
1797 | 1797 | | |||
1798 | bool ShellClient::dockWantsInput() const | 1798 | bool XdgShellClient::dockWantsInput() const | ||
1799 | { | 1799 | { | ||
1800 | if (m_plasmaShellSurface) { | 1800 | if (m_plasmaShellSurface) { | ||
1801 | if (m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Panel) { | 1801 | if (m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Panel) { | ||
1802 | return m_plasmaShellSurface->panelTakesFocus(); | 1802 | return m_plasmaShellSurface->panelTakesFocus(); | ||
1803 | } | 1803 | } | ||
1804 | } | 1804 | } | ||
1805 | return false; | 1805 | return false; | ||
1806 | } | 1806 | } | ||
1807 | 1807 | | |||
1808 | void ShellClient::killWindow() | 1808 | void XdgShellClient::killWindow() | ||
1809 | { | 1809 | { | ||
1810 | if (!surface()) { | 1810 | if (!surface()) { | ||
1811 | return; | 1811 | return; | ||
1812 | } | 1812 | } | ||
1813 | auto c = surface()->client(); | 1813 | auto c = surface()->client(); | ||
1814 | if (c->processId() == getpid() || c->processId() == 0) { | 1814 | if (c->processId() == getpid() || c->processId() == 0) { | ||
1815 | c->destroy(); | 1815 | c->destroy(); | ||
1816 | return; | 1816 | return; | ||
1817 | } | 1817 | } | ||
1818 | ::kill(c->processId(), SIGTERM); | 1818 | ::kill(c->processId(), SIGTERM); | ||
1819 | // give it time to terminate and only if terminate fails, try destroy Wayland connection | 1819 | // give it time to terminate and only if terminate fails, try destroy Wayland connection | ||
1820 | QTimer::singleShot(5000, c, &ClientConnection::destroy); | 1820 | QTimer::singleShot(5000, c, &ClientConnection::destroy); | ||
1821 | } | 1821 | } | ||
1822 | 1822 | | |||
1823 | bool ShellClient::hasPopupGrab() const | 1823 | bool XdgShellClient::hasPopupGrab() const | ||
1824 | { | 1824 | { | ||
1825 | return m_hasPopupGrab; | 1825 | return m_hasPopupGrab; | ||
1826 | } | 1826 | } | ||
1827 | 1827 | | |||
1828 | void ShellClient::popupDone() | 1828 | void XdgShellClient::popupDone() | ||
1829 | { | 1829 | { | ||
1830 | if (m_xdgShellPopup) { | 1830 | if (m_xdgShellPopup) { | ||
1831 | m_xdgShellPopup->popupDone(); | 1831 | m_xdgShellPopup->popupDone(); | ||
1832 | } | 1832 | } | ||
1833 | } | 1833 | } | ||
1834 | 1834 | | |||
1835 | void ShellClient::updateClientOutputs() | 1835 | void XdgShellClient::updateClientOutputs() | ||
1836 | { | 1836 | { | ||
1837 | QVector<OutputInterface*> clientOutputs; | 1837 | QVector<OutputInterface*> clientOutputs; | ||
1838 | const auto outputs = waylandServer()->display()->outputs(); | 1838 | const auto outputs = waylandServer()->display()->outputs(); | ||
1839 | for (OutputInterface* output: qAsConst(outputs)) { | 1839 | for (OutputInterface* output: qAsConst(outputs)) { | ||
1840 | const QRect outputGeom(output->globalPosition(), output->pixelSize() / output->scale()); | 1840 | const QRect outputGeom(output->globalPosition(), output->pixelSize() / output->scale()); | ||
1841 | if (geometry().intersects(outputGeom)) { | 1841 | if (geometry().intersects(outputGeom)) { | ||
1842 | clientOutputs << output; | 1842 | clientOutputs << output; | ||
1843 | } | 1843 | } | ||
1844 | } | 1844 | } | ||
1845 | surface()->setOutputs(clientOutputs); | 1845 | surface()->setOutputs(clientOutputs); | ||
1846 | } | 1846 | } | ||
1847 | 1847 | | |||
1848 | void ShellClient::updateWindowMargins() | 1848 | void XdgShellClient::updateWindowMargins() | ||
1849 | { | 1849 | { | ||
1850 | QRect windowGeometry; | 1850 | QRect windowGeometry; | ||
1851 | QSize clientSize = m_clientSize; | 1851 | QSize clientSize = m_clientSize; | ||
1852 | 1852 | | |||
1853 | if (m_xdgShellSurface) { | 1853 | if (m_xdgShellSurface) { | ||
1854 | windowGeometry = m_xdgShellSurface->windowGeometry(); | 1854 | windowGeometry = m_xdgShellSurface->windowGeometry(); | ||
1855 | } else { | 1855 | } else { | ||
1856 | windowGeometry = m_xdgShellPopup->windowGeometry(); | 1856 | windowGeometry = m_xdgShellPopup->windowGeometry(); | ||
Show All 9 Lines | |||||
1866 | } else { | 1866 | } else { | ||
1867 | m_windowMargins = QMargins(windowGeometry.left(), | 1867 | m_windowMargins = QMargins(windowGeometry.left(), | ||
1868 | windowGeometry.top(), | 1868 | windowGeometry.top(), | ||
1869 | clientSize.width() - (windowGeometry.right() + 1), | 1869 | clientSize.width() - (windowGeometry.right() + 1), | ||
1870 | clientSize.height() - (windowGeometry.bottom() + 1)); | 1870 | clientSize.height() - (windowGeometry.bottom() + 1)); | ||
1871 | } | 1871 | } | ||
1872 | } | 1872 | } | ||
1873 | 1873 | | |||
1874 | bool ShellClient::isPopupWindow() const | 1874 | bool XdgShellClient::isPopupWindow() const | ||
1875 | { | 1875 | { | ||
1876 | if (Toplevel::isPopupWindow()) { | 1876 | if (Toplevel::isPopupWindow()) { | ||
1877 | return true; | 1877 | return true; | ||
1878 | } | 1878 | } | ||
1879 | if (m_xdgShellPopup != nullptr) { | 1879 | if (m_xdgShellPopup != nullptr) { | ||
1880 | return true; | 1880 | return true; | ||
1881 | } | 1881 | } | ||
1882 | return false; | 1882 | return false; | ||
1883 | } | 1883 | } | ||
1884 | 1884 | | |||
1885 | bool ShellClient::supportsWindowRules() const | 1885 | bool XdgShellClient::supportsWindowRules() const | ||
1886 | { | 1886 | { | ||
1887 | if (m_plasmaShellSurface) { | 1887 | if (m_plasmaShellSurface) { | ||
1888 | return false; | 1888 | return false; | ||
1889 | } | 1889 | } | ||
1890 | return m_xdgShellSurface; | 1890 | return m_xdgShellSurface; | ||
1891 | } | 1891 | } | ||
1892 | 1892 | | |||
1893 | } | 1893 | } |