Changeset View
Changeset View
Standalone View
Standalone View
xdgshellclient.cpp
Show First 20 Lines • Show All 183 Lines • ▼ Show 20 Line(s) | 179 | { | |||
---|---|---|---|---|---|
184 | bool needsPlacement = !isInitialPositionSet(); | 184 | bool needsPlacement = !isInitialPositionSet(); | ||
185 | 185 | | |||
186 | if (supportsWindowRules()) { | 186 | if (supportsWindowRules()) { | ||
187 | setupWindowRules(false); | 187 | setupWindowRules(false); | ||
188 | 188 | | |||
189 | const QRect originalGeometry = QRect(pos(), sizeForClientSize(clientSize())); | 189 | const QRect originalGeometry = QRect(pos(), sizeForClientSize(clientSize())); | ||
190 | const QRect ruledGeometry = rules()->checkGeometry(originalGeometry, true); | 190 | const QRect ruledGeometry = rules()->checkGeometry(originalGeometry, true); | ||
191 | if (originalGeometry != ruledGeometry) { | 191 | if (originalGeometry != ruledGeometry) { | ||
192 | setGeometry(ruledGeometry); | 192 | setFrameGeometry(ruledGeometry); | ||
193 | } | 193 | } | ||
194 | 194 | | |||
195 | maximize(rules()->checkMaximize(maximizeMode(), true)); | 195 | maximize(rules()->checkMaximize(maximizeMode(), true)); | ||
196 | 196 | | |||
197 | setDesktop(rules()->checkDesktop(desktop(), true)); | 197 | setDesktop(rules()->checkDesktop(desktop(), true)); | ||
198 | setDesktopFileName(rules()->checkDesktopFile(desktopFileName(), true).toUtf8()); | 198 | setDesktopFileName(rules()->checkDesktopFile(desktopFileName(), true).toUtf8()); | ||
199 | if (rules()->checkMinimize(isMinimized(), true)) { | 199 | if (rules()->checkMinimize(isMinimized(), true)) { | ||
200 | minimize(true); // No animation. | 200 | minimize(true); // No animation. | ||
▲ Show 20 Lines • Show All 211 Lines • ▼ Show 20 Line(s) | 411 | { | |||
412 | KDecoration2::Decoration *decoration = Decoration::DecorationBridge::self()->createDecoration(this); | 412 | KDecoration2::Decoration *decoration = Decoration::DecorationBridge::self()->createDecoration(this); | ||
413 | if (decoration) { | 413 | if (decoration) { | ||
414 | QMetaObject::invokeMethod(decoration, "update", Qt::QueuedConnection); | 414 | QMetaObject::invokeMethod(decoration, "update", Qt::QueuedConnection); | ||
415 | connect(decoration, &KDecoration2::Decoration::shadowChanged, this, &Toplevel::updateShadow); | 415 | connect(decoration, &KDecoration2::Decoration::shadowChanged, this, &Toplevel::updateShadow); | ||
416 | connect(decoration, &KDecoration2::Decoration::bordersChanged, this, | 416 | connect(decoration, &KDecoration2::Decoration::bordersChanged, this, | ||
417 | [this]() { | 417 | [this]() { | ||
418 | GeometryUpdatesBlocker blocker(this); | 418 | GeometryUpdatesBlocker blocker(this); | ||
419 | RequestGeometryBlocker requestBlocker(this); | 419 | RequestGeometryBlocker requestBlocker(this); | ||
420 | QRect oldgeom = geometry(); | 420 | const QRect oldGeometry = frameGeometry(); | ||
421 | if (!isShade()) | 421 | if (!isShade()) { | ||
422 | checkWorkspacePosition(oldgeom); | 422 | checkWorkspacePosition(oldGeometry); | ||
423 | emit geometryShapeChanged(this, oldgeom); | 423 | } | ||
424 | emit geometryShapeChanged(this, oldGeometry); | ||||
424 | } | 425 | } | ||
425 | ); | 426 | ); | ||
426 | } | 427 | } | ||
427 | setDecoration(decoration); | 428 | setDecoration(decoration); | ||
428 | // TODO: ensure the new geometry still fits into the client area (e.g. maximized windows) | 429 | // TODO: ensure the new geometry still fits into the client area (e.g. maximized windows) | ||
429 | doSetGeometry(QRect(oldGeom.topLeft(), m_clientSize + (decoration ? QSize(decoration->borderLeft() + decoration->borderRight(), | 430 | doSetGeometry(QRect(oldGeom.topLeft(), m_clientSize + (decoration ? QSize(decoration->borderLeft() + decoration->borderRight(), | ||
430 | decoration->borderBottom() + decoration->borderTop()) : QSize()))); | 431 | decoration->borderBottom() + decoration->borderTop()) : QSize()))); | ||
431 | 432 | | |||
432 | emit geometryShapeChanged(this, oldGeom); | 433 | emit geometryShapeChanged(this, oldGeom); | ||
433 | } | 434 | } | ||
434 | 435 | | |||
435 | void XdgShellClient::updateDecoration(bool check_workspace_pos, bool force) | 436 | void XdgShellClient::updateDecoration(bool check_workspace_pos, bool force) | ||
436 | { | 437 | { | ||
437 | if (!force && | 438 | if (!force && | ||
438 | ((!isDecorated() && noBorder()) || (isDecorated() && !noBorder()))) | 439 | ((!isDecorated() && noBorder()) || (isDecorated() && !noBorder()))) | ||
439 | return; | 440 | return; | ||
440 | QRect oldgeom = geometry(); | 441 | QRect oldgeom = frameGeometry(); | ||
441 | QRect oldClientGeom = oldgeom.adjusted(borderLeft(), borderTop(), -borderRight(), -borderBottom()); | 442 | QRect oldClientGeom = oldgeom.adjusted(borderLeft(), borderTop(), -borderRight(), -borderBottom()); | ||
442 | blockGeometryUpdates(true); | 443 | blockGeometryUpdates(true); | ||
443 | if (force) | 444 | if (force) | ||
444 | destroyDecoration(); | 445 | destroyDecoration(); | ||
445 | if (!noBorder()) { | 446 | if (!noBorder()) { | ||
446 | createDecoration(oldgeom); | 447 | createDecoration(oldgeom); | ||
447 | } else | 448 | } else | ||
448 | destroyDecoration(); | 449 | destroyDecoration(); | ||
449 | if (m_serverDecoration && isDecorated()) { | 450 | if (m_serverDecoration && isDecorated()) { | ||
450 | m_serverDecoration->setMode(KWayland::Server::ServerSideDecorationManagerInterface::Mode::Server); | 451 | m_serverDecoration->setMode(KWayland::Server::ServerSideDecorationManagerInterface::Mode::Server); | ||
451 | } | 452 | } | ||
452 | if (m_xdgDecoration) { | 453 | if (m_xdgDecoration) { | ||
453 | auto mode = isDecorated() || m_userNoBorder ? XdgDecorationInterface::Mode::ServerSide: XdgDecorationInterface::Mode::ClientSide; | 454 | auto mode = isDecorated() || m_userNoBorder ? XdgDecorationInterface::Mode::ServerSide: XdgDecorationInterface::Mode::ClientSide; | ||
454 | m_xdgDecoration->configure(mode); | 455 | m_xdgDecoration->configure(mode); | ||
455 | if (m_requestGeometryBlockCounter == 0) { | 456 | if (m_requestGeometryBlockCounter == 0) { | ||
456 | m_xdgShellSurface->configure(xdgSurfaceStates(), m_requestedClientSize); | 457 | m_xdgShellSurface->configure(xdgSurfaceStates(), m_requestedClientSize); | ||
457 | } | 458 | } | ||
458 | } | 459 | } | ||
459 | updateShadow(); | 460 | updateShadow(); | ||
460 | if (check_workspace_pos) | 461 | if (check_workspace_pos) | ||
461 | checkWorkspacePosition(oldgeom, -2, oldClientGeom); | 462 | checkWorkspacePosition(oldgeom, -2, oldClientGeom); | ||
462 | blockGeometryUpdates(false); | 463 | blockGeometryUpdates(false); | ||
463 | } | 464 | } | ||
464 | 465 | | |||
465 | void XdgShellClient::setGeometry(int x, int y, int w, int h, ForceGeometry_t force) | 466 | void XdgShellClient::setFrameGeometry(int x, int y, int w, int h, ForceGeometry_t force) | ||
466 | { | 467 | { | ||
467 | const QRect newGeometry = rules()->checkGeometry(QRect(x, y, w, h)); | 468 | const QRect newGeometry = rules()->checkGeometry(QRect(x, y, w, h)); | ||
468 | 469 | | |||
469 | if (areGeometryUpdatesBlocked()) { | 470 | if (areGeometryUpdatesBlocked()) { | ||
470 | // when the GeometryUpdateBlocker exits the current geom is passed to setGeometry | 471 | // when the GeometryUpdateBlocker exits the current geom is passed to setGeometry | ||
471 | // thus we need to set it here. | 472 | // thus we need to set it here. | ||
472 | geom = newGeometry; | 473 | geom = newGeometry; | ||
473 | if (pendingGeometryUpdate() == PendingGeometryForced) { | 474 | if (pendingGeometryUpdate() == PendingGeometryForced) { | ||
▲ Show 20 Lines • Show All 236 Lines • ▼ Show 20 Line(s) | 710 | if (!isResizable()) { | |||
710 | return; | 711 | return; | ||
711 | } | 712 | } | ||
712 | 713 | | |||
713 | const QRect clientArea = isElectricBorderMaximizing() ? | 714 | const QRect clientArea = isElectricBorderMaximizing() ? | ||
714 | workspace()->clientArea(MaximizeArea, Cursor::pos(), desktop()) : | 715 | workspace()->clientArea(MaximizeArea, Cursor::pos(), desktop()) : | ||
715 | workspace()->clientArea(MaximizeArea, this); | 716 | workspace()->clientArea(MaximizeArea, this); | ||
716 | 717 | | |||
717 | const MaximizeMode oldMode = m_requestedMaximizeMode; | 718 | const MaximizeMode oldMode = m_requestedMaximizeMode; | ||
718 | const QRect oldGeometry = geometry(); | 719 | const QRect oldGeometry = frameGeometry(); | ||
719 | 720 | | |||
720 | // 'adjust == true' means to update the size only, e.g. after changing workspace size | 721 | // 'adjust == true' means to update the size only, e.g. after changing workspace size | ||
721 | if (!adjust) { | 722 | if (!adjust) { | ||
722 | if (vertical) | 723 | if (vertical) | ||
723 | m_requestedMaximizeMode = MaximizeMode(m_requestedMaximizeMode ^ MaximizeVertical); | 724 | m_requestedMaximizeMode = MaximizeMode(m_requestedMaximizeMode ^ MaximizeVertical); | ||
724 | if (horizontal) | 725 | if (horizontal) | ||
725 | m_requestedMaximizeMode = MaximizeMode(m_requestedMaximizeMode ^ MaximizeHorizontal); | 726 | m_requestedMaximizeMode = MaximizeMode(m_requestedMaximizeMode ^ MaximizeHorizontal); | ||
726 | } | 727 | } | ||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 776 | if (m_requestedMaximizeMode == MaximizeFull) { | |||
778 | if (options->electricBorderMaximize()) { | 779 | if (options->electricBorderMaximize()) { | ||
779 | updateQuickTileMode(QuickTileFlag::Maximize); | 780 | updateQuickTileMode(QuickTileFlag::Maximize); | ||
780 | } else { | 781 | } else { | ||
781 | updateQuickTileMode(QuickTileFlag::None); | 782 | updateQuickTileMode(QuickTileFlag::None); | ||
782 | } | 783 | } | ||
783 | if (quickTileMode() != oldQuickTileMode) { | 784 | if (quickTileMode() != oldQuickTileMode) { | ||
784 | emit quickTileModeChanged(); | 785 | emit quickTileModeChanged(); | ||
785 | } | 786 | } | ||
786 | setGeometry(workspace()->clientArea(MaximizeArea, this)); | 787 | setFrameGeometry(workspace()->clientArea(MaximizeArea, this)); | ||
787 | workspace()->raiseClient(this); | 788 | workspace()->raiseClient(this); | ||
788 | } else { | 789 | } else { | ||
789 | if (m_requestedMaximizeMode == MaximizeRestore) { | 790 | if (m_requestedMaximizeMode == MaximizeRestore) { | ||
790 | updateQuickTileMode(QuickTileFlag::None); | 791 | updateQuickTileMode(QuickTileFlag::None); | ||
791 | } | 792 | } | ||
792 | if (quickTileMode() != oldQuickTileMode) { | 793 | if (quickTileMode() != oldQuickTileMode) { | ||
793 | emit quickTileModeChanged(); | 794 | emit quickTileModeChanged(); | ||
794 | } | 795 | } | ||
795 | 796 | | |||
796 | if (m_geomMaximizeRestore.isValid()) { | 797 | if (m_geomMaximizeRestore.isValid()) { | ||
797 | setGeometry(m_geomMaximizeRestore); | 798 | setFrameGeometry(m_geomMaximizeRestore); | ||
798 | } else { | 799 | } else { | ||
799 | setGeometry(workspace()->clientArea(PlacementArea, this)); | 800 | setFrameGeometry(workspace()->clientArea(PlacementArea, this)); | ||
800 | } | 801 | } | ||
801 | } | 802 | } | ||
802 | } | 803 | } | ||
803 | 804 | | |||
804 | void XdgShellClient::setGeometryRestore(const QRect &geo) | 805 | void XdgShellClient::setGeometryRestore(const QRect &geo) | ||
805 | { | 806 | { | ||
806 | m_geomMaximizeRestore = geo; | 807 | m_geomMaximizeRestore = geo; | ||
807 | } | 808 | } | ||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 847 | { | |||
855 | } | 856 | } | ||
856 | if (user && !userCanSetFullScreen()) { | 857 | if (user && !userCanSetFullScreen()) { | ||
857 | return; | 858 | return; | ||
858 | } | 859 | } | ||
859 | 860 | | |||
860 | if (wasFullscreen) { | 861 | if (wasFullscreen) { | ||
861 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event | 862 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event | ||
862 | } else { | 863 | } else { | ||
863 | m_geomFsRestore = geometry(); | 864 | m_geomFsRestore = frameGeometry(); | ||
864 | } | 865 | } | ||
865 | m_fullScreen = set; | 866 | m_fullScreen = set; | ||
866 | 867 | | |||
867 | if (set) { | 868 | if (set) { | ||
868 | workspace()->raiseClient(this); | 869 | workspace()->raiseClient(this); | ||
869 | } | 870 | } | ||
870 | RequestGeometryBlocker requestBlocker(this); | 871 | RequestGeometryBlocker requestBlocker(this); | ||
871 | StackingUpdatesBlocker blocker1(workspace()); | 872 | StackingUpdatesBlocker blocker1(workspace()); | ||
872 | GeometryUpdatesBlocker blocker2(this); | 873 | GeometryUpdatesBlocker blocker2(this); | ||
873 | 874 | | |||
874 | workspace()->updateClientLayer(this); // active fullscreens get different layer | 875 | workspace()->updateClientLayer(this); // active fullscreens get different layer | ||
875 | updateDecoration(false, false); | 876 | updateDecoration(false, false); | ||
876 | 877 | | |||
877 | if (set) { | 878 | if (set) { | ||
878 | setGeometry(workspace()->clientArea(FullScreenArea, this)); | 879 | setFrameGeometry(workspace()->clientArea(FullScreenArea, this)); | ||
879 | } else { | 880 | } else { | ||
880 | if (m_geomFsRestore.isValid()) { | 881 | if (m_geomFsRestore.isValid()) { | ||
881 | int currentScreen = screen(); | 882 | int currentScreen = screen(); | ||
882 | setGeometry(QRect(m_geomFsRestore.topLeft(), adjustedSize(m_geomFsRestore.size()))); | 883 | setFrameGeometry(QRect(m_geomFsRestore.topLeft(), adjustedSize(m_geomFsRestore.size()))); | ||
883 | if( currentScreen != screen()) | 884 | if( currentScreen != screen()) | ||
884 | workspace()->sendClientToScreen( this, currentScreen ); | 885 | workspace()->sendClientToScreen( this, currentScreen ); | ||
885 | } else { | 886 | } else { | ||
886 | // this can happen when the window was first shown already fullscreen, | 887 | // this can happen when the window was first shown already fullscreen, | ||
887 | // so let the client set the size by itself | 888 | // so let the client set the size by itself | ||
888 | setGeometry(QRect(workspace()->clientArea(PlacementArea, this).topLeft(), QSize(0, 0))); | 889 | setFrameGeometry(QRect(workspace()->clientArea(PlacementArea, this).topLeft(), QSize(0, 0))); | ||
889 | } | 890 | } | ||
890 | } | 891 | } | ||
891 | 892 | | |||
892 | updateWindowRules(Rules::Fullscreen|Rules::Position|Rules::Size); | 893 | updateWindowRules(Rules::Fullscreen|Rules::Position|Rules::Size); | ||
893 | emit fullScreenChanged(); | 894 | emit fullScreenChanged(); | ||
894 | } | 895 | } | ||
895 | 896 | | |||
896 | void XdgShellClient::setNoBorder(bool set) | 897 | void XdgShellClient::setNoBorder(bool set) | ||
▲ Show 20 Lines • Show All 129 Lines • ▼ Show 20 Line(s) | 1013 | { | |||
1026 | quint64 serialId = 0; | 1027 | quint64 serialId = 0; | ||
1027 | 1028 | | |||
1028 | if (m_xdgShellSurface) { | 1029 | if (m_xdgShellSurface) { | ||
1029 | serialId = m_xdgShellSurface->configure(xdgSurfaceStates(), size); | 1030 | serialId = m_xdgShellSurface->configure(xdgSurfaceStates(), size); | ||
1030 | } | 1031 | } | ||
1031 | if (m_xdgShellPopup) { | 1032 | if (m_xdgShellPopup) { | ||
1032 | auto parent = transientFor(); | 1033 | auto parent = transientFor(); | ||
1033 | if (parent) { | 1034 | if (parent) { | ||
1034 | const QPoint globalClientContentPos = parent->geometry().topLeft() + parent->clientPos(); | 1035 | const QPoint globalClientContentPos = parent->frameGeometry().topLeft() + parent->clientPos(); | ||
1035 | const QPoint relativeOffset = rect.topLeft() - globalClientContentPos; | 1036 | const QPoint relativeOffset = rect.topLeft() - globalClientContentPos; | ||
1036 | serialId = m_xdgShellPopup->configure(QRect(relativeOffset, size)); | 1037 | serialId = m_xdgShellPopup->configure(QRect(relativeOffset, size)); | ||
1037 | } | 1038 | } | ||
1038 | } | 1039 | } | ||
1039 | 1040 | | |||
1040 | if (rect.isValid()) { //if there's no requested size, then there's implicity no positional information worth using | 1041 | if (rect.isValid()) { //if there's no requested size, then there's implicity no positional information worth using | ||
1041 | PendingConfigureRequest configureRequest; | 1042 | PendingConfigureRequest configureRequest; | ||
1042 | configureRequest.serialId = serialId; | 1043 | configureRequest.serialId = serialId; | ||
Show All 11 Lines | 1053 | { | |||
1054 | MaximizeMode maximizeMode = m_maximizeMode; | 1055 | MaximizeMode maximizeMode = m_maximizeMode; | ||
1055 | for (auto it = m_pendingConfigureRequests.begin(); it != m_pendingConfigureRequests.end(); it++) { | 1056 | for (auto it = m_pendingConfigureRequests.begin(); it != m_pendingConfigureRequests.end(); it++) { | ||
1056 | if (it->serialId > m_lastAckedConfigureRequest) { | 1057 | if (it->serialId > m_lastAckedConfigureRequest) { | ||
1057 | //this serial is not acked yet, therefore we know all future serials are not | 1058 | //this serial is not acked yet, therefore we know all future serials are not | ||
1058 | break; | 1059 | break; | ||
1059 | } | 1060 | } | ||
1060 | if (it->serialId == m_lastAckedConfigureRequest) { | 1061 | if (it->serialId == m_lastAckedConfigureRequest) { | ||
1061 | if (position != it->positionAfterResize) { | 1062 | if (position != it->positionAfterResize) { | ||
1062 | addLayerRepaint(geometry()); | 1063 | addLayerRepaint(frameGeometry()); | ||
1063 | } | 1064 | } | ||
1064 | position = it->positionAfterResize; | 1065 | position = it->positionAfterResize; | ||
1065 | maximizeMode = it->maximizeMode; | 1066 | maximizeMode = it->maximizeMode; | ||
1066 | 1067 | | |||
1067 | m_pendingConfigureRequests.erase(m_pendingConfigureRequests.begin(), ++it); | 1068 | m_pendingConfigureRequests.erase(m_pendingConfigureRequests.begin(), ++it); | ||
1068 | break; | 1069 | break; | ||
1069 | } | 1070 | } | ||
1070 | //else serialId < m_lastAckedConfigureRequest and the state is now irrelevant and can be ignored | 1071 | //else serialId < m_lastAckedConfigureRequest and the state is now irrelevant and can be ignored | ||
▲ Show 20 Lines • Show All 194 Lines • ▼ Show 20 Line(s) | 1265 | { | |||
1265 | const QRect area = workspace()->clientArea(WorkArea, this); | 1266 | const QRect area = workspace()->clientArea(WorkArea, this); | ||
1266 | // don't allow growing larger than workarea | 1267 | // don't allow growing larger than workarea | ||
1267 | if (w > area.width()) { | 1268 | if (w > area.width()) { | ||
1268 | w = area.width(); | 1269 | w = area.width(); | ||
1269 | } | 1270 | } | ||
1270 | if (h > area.height()) { | 1271 | if (h > area.height()) { | ||
1271 | h = area.height(); | 1272 | h = area.height(); | ||
1272 | } | 1273 | } | ||
1273 | setGeometry(x(), y(), w, h, force); | 1274 | setFrameGeometry(x(), y(), w, h, force); | ||
1274 | } | 1275 | } | ||
1275 | 1276 | | |||
1276 | void XdgShellClient::unmap() | 1277 | void XdgShellClient::unmap() | ||
1277 | { | 1278 | { | ||
1278 | m_unmapped = true; | 1279 | m_unmapped = true; | ||
1279 | if (isMoveResize()) { | 1280 | if (isMoveResize()) { | ||
1280 | leaveMoveResize(); | 1281 | leaveMoveResize(); | ||
1281 | } | 1282 | } | ||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 1372 | { | |||
1374 | } | 1375 | } | ||
1375 | if (m_unmapped || !m_plasmaShellSurface || m_plasmaShellSurface->role() != PlasmaShellSurfaceInterface::Role::Panel) { | 1376 | if (m_unmapped || !m_plasmaShellSurface || m_plasmaShellSurface->role() != PlasmaShellSurfaceInterface::Role::Panel) { | ||
1376 | ScreenEdges::self()->reserve(this, ElectricNone); | 1377 | ScreenEdges::self()->reserve(this, ElectricNone); | ||
1377 | return; | 1378 | return; | ||
1378 | } | 1379 | } | ||
1379 | if ((m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::AutoHide && m_hidden) || | 1380 | if ((m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::AutoHide && m_hidden) || | ||
1380 | m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::WindowsCanCover) { | 1381 | m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::WindowsCanCover) { | ||
1381 | // screen edge API requires an edge, thus we need to figure out which edge the window borders | 1382 | // screen edge API requires an edge, thus we need to figure out which edge the window borders | ||
1382 | const QRect clientGeometry = geometry(); | 1383 | const QRect clientGeometry = frameGeometry(); | ||
1383 | Qt::Edges edges; | 1384 | Qt::Edges edges; | ||
1384 | for (int i = 0; i < screens()->count(); i++) { | 1385 | for (int i = 0; i < screens()->count(); i++) { | ||
1385 | const QRect screenGeometry = screens()->geometry(i); | 1386 | const QRect screenGeometry = screens()->geometry(i); | ||
1386 | if (screenGeometry.left() == clientGeometry.left()) { | 1387 | if (screenGeometry.left() == clientGeometry.left()) { | ||
1387 | edges |= Qt::LeftEdge; | 1388 | edges |= Qt::LeftEdge; | ||
1388 | } | 1389 | } | ||
1389 | if (screenGeometry.right() == clientGeometry.right()) { | 1390 | if (screenGeometry.right() == clientGeometry.right()) { | ||
1390 | edges |= Qt::RightEdge; | 1391 | edges |= Qt::RightEdge; | ||
▲ Show 20 Lines • Show All 152 Lines • ▼ Show 20 Line(s) | |||||
1543 | 1544 | | |||
1544 | QRect XdgShellClient::transientPlacement(const QRect &bounds) const | 1545 | QRect XdgShellClient::transientPlacement(const QRect &bounds) const | ||
1545 | { | 1546 | { | ||
1546 | QRect anchorRect; | 1547 | QRect anchorRect; | ||
1547 | Qt::Edges anchorEdge; | 1548 | Qt::Edges anchorEdge; | ||
1548 | Qt::Edges gravity; | 1549 | Qt::Edges gravity; | ||
1549 | QPoint offset; | 1550 | QPoint offset; | ||
1550 | PositionerConstraints constraintAdjustments; | 1551 | PositionerConstraints constraintAdjustments; | ||
1551 | QSize size = geometry().size(); | 1552 | QSize size = frameGeometry().size(); | ||
1552 | 1553 | | |||
1553 | const QPoint parentClientPos = transientFor()->pos() + transientFor()->clientPos(); | 1554 | const QPoint parentClientPos = transientFor()->pos() + transientFor()->clientPos(); | ||
1554 | QRect popupPosition; | 1555 | QRect popupPosition; | ||
1555 | 1556 | | |||
1556 | // returns if a target is within the supplied bounds, optional edges argument states which side to check | 1557 | // returns if a target is within the supplied bounds, optional edges argument states which side to check | ||
1557 | auto inBounds = [bounds](const QRect &target, Qt::Edges edges = Qt::LeftEdge | Qt::RightEdge | Qt::TopEdge | Qt::BottomEdge) -> bool { | 1558 | auto inBounds = [bounds](const QRect &target, Qt::Edges edges = Qt::LeftEdge | Qt::RightEdge | Qt::TopEdge | Qt::BottomEdge) -> bool { | ||
1558 | if (edges & Qt::LeftEdge && target.left() < bounds.left()) { | 1559 | if (edges & Qt::LeftEdge && target.left() < bounds.left()) { | ||
1559 | return false; | 1560 | return false; | ||
▲ Show 20 Lines • Show All 256 Lines • ▼ Show 20 Line(s) | 1816 | } else { | |||
1816 | emit windowShown(this); | 1817 | emit windowShown(this); | ||
1817 | } | 1818 | } | ||
1818 | workspace()->updateMinimizedOfTransients(this); | 1819 | workspace()->updateMinimizedOfTransients(this); | ||
1819 | } | 1820 | } | ||
1820 | 1821 | | |||
1821 | void XdgShellClient::placeIn(const QRect &area) | 1822 | void XdgShellClient::placeIn(const QRect &area) | ||
1822 | { | 1823 | { | ||
1823 | Placement::self()->place(this, area); | 1824 | Placement::self()->place(this, area); | ||
1824 | setGeometryRestore(geometry()); | 1825 | setGeometryRestore(frameGeometry()); | ||
1825 | } | 1826 | } | ||
1826 | 1827 | | |||
1827 | void XdgShellClient::showOnScreenEdge() | 1828 | void XdgShellClient::showOnScreenEdge() | ||
1828 | { | 1829 | { | ||
1829 | if (!m_plasmaShellSurface || m_unmapped) { | 1830 | if (!m_plasmaShellSurface || m_unmapped) { | ||
1830 | return; | 1831 | return; | ||
1831 | } | 1832 | } | ||
1832 | hideClient(false); | 1833 | hideClient(false); | ||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | |||||
1879 | } | 1880 | } | ||
1880 | 1881 | | |||
1881 | void XdgShellClient::updateClientOutputs() | 1882 | void XdgShellClient::updateClientOutputs() | ||
1882 | { | 1883 | { | ||
1883 | QVector<OutputInterface*> clientOutputs; | 1884 | QVector<OutputInterface*> clientOutputs; | ||
1884 | const auto outputs = waylandServer()->display()->outputs(); | 1885 | const auto outputs = waylandServer()->display()->outputs(); | ||
1885 | for (OutputInterface* output: qAsConst(outputs)) { | 1886 | for (OutputInterface* output: qAsConst(outputs)) { | ||
1886 | const QRect outputGeom(output->globalPosition(), output->pixelSize() / output->scale()); | 1887 | const QRect outputGeom(output->globalPosition(), output->pixelSize() / output->scale()); | ||
1887 | if (geometry().intersects(outputGeom)) { | 1888 | if (frameGeometry().intersects(outputGeom)) { | ||
1888 | clientOutputs << output; | 1889 | clientOutputs << output; | ||
1889 | } | 1890 | } | ||
1890 | } | 1891 | } | ||
1891 | surface()->setOutputs(clientOutputs); | 1892 | surface()->setOutputs(clientOutputs); | ||
1892 | } | 1893 | } | ||
1893 | 1894 | | |||
1894 | void XdgShellClient::updateWindowMargins() | 1895 | void XdgShellClient::updateWindowMargins() | ||
1895 | { | 1896 | { | ||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |