Changeset View
Changeset View
Standalone View
Standalone View
shell_client.cpp
Show First 20 Lines • Show All 351 Lines • ▼ Show 20 Line(s) | |||||
352 | 352 | | |||
353 | void ShellClient::finishInit() { | 353 | void ShellClient::finishInit() { | ||
354 | SurfaceInterface *s = surface(); | 354 | SurfaceInterface *s = surface(); | ||
355 | disconnect(s, &SurfaceInterface::committed, this, &ShellClient::finishInit); | 355 | disconnect(s, &SurfaceInterface::committed, this, &ShellClient::finishInit); | ||
356 | 356 | | |||
357 | if (supportsWindowRules()) { | 357 | if (supportsWindowRules()) { | ||
358 | setupWindowRules(false); | 358 | setupWindowRules(false); | ||
359 | 359 | | |||
360 | const QRect originalGeometry = QRect(pos(), sizeForClientSize(clientSize())); | ||||
361 | const QRect ruledGeometry = rules()->checkGeometry(originalGeometry, true); | ||||
362 | if (originalGeometry != ruledGeometry) { | ||||
363 | setGeometry(ruledGeometry); | ||||
364 | } | ||||
365 | | ||||
360 | setDesktop(rules()->checkDesktop(desktop(), true)); | 366 | setDesktop(rules()->checkDesktop(desktop(), true)); | ||
361 | setDesktopFileName(rules()->checkDesktopFile(desktopFileName(), true).toUtf8()); | 367 | setDesktopFileName(rules()->checkDesktopFile(desktopFileName(), true).toUtf8()); | ||
362 | if (rules()->checkMinimize(isMinimized(), true)) { | 368 | if (rules()->checkMinimize(isMinimized(), true)) { | ||
363 | minimize(true); // No animation. | 369 | minimize(true); // No animation. | ||
364 | } | 370 | } | ||
365 | setSkipTaskbar(rules()->checkSkipTaskbar(skipTaskbar(), true)); | 371 | setSkipTaskbar(rules()->checkSkipTaskbar(skipTaskbar(), true)); | ||
366 | setSkipPager(rules()->checkSkipPager(skipPager(), true)); | 372 | setSkipPager(rules()->checkSkipPager(skipPager(), true)); | ||
367 | setSkipSwitcher(rules()->checkSkipSwitcher(skipSwitcher(), true)); | 373 | setSkipSwitcher(rules()->checkSkipSwitcher(skipSwitcher(), true)); | ||
▲ Show 20 Lines • Show All 220 Lines • ▼ Show 20 Line(s) | 573 | { | |||
588 | getShadow(); | 594 | getShadow(); | ||
589 | if (check_workspace_pos) | 595 | if (check_workspace_pos) | ||
590 | checkWorkspacePosition(oldgeom, -2, oldClientGeom); | 596 | checkWorkspacePosition(oldgeom, -2, oldClientGeom); | ||
591 | blockGeometryUpdates(false); | 597 | blockGeometryUpdates(false); | ||
592 | } | 598 | } | ||
593 | 599 | | |||
594 | void ShellClient::setGeometry(int x, int y, int w, int h, ForceGeometry_t force) | 600 | void ShellClient::setGeometry(int x, int y, int w, int h, ForceGeometry_t force) | ||
595 | { | 601 | { | ||
602 | const QRect newGeometry = rules()->checkGeometry(QRect(x, y, w, h)); | ||||
603 | | ||||
596 | if (areGeometryUpdatesBlocked()) { | 604 | if (areGeometryUpdatesBlocked()) { | ||
597 | // when the GeometryUpdateBlocker exits the current geom is passed to setGeometry | 605 | // when the GeometryUpdateBlocker exits the current geom is passed to setGeometry | ||
598 | // thus we need to set it here. | 606 | // thus we need to set it here. | ||
599 | geom = QRect(x, y, w, h); | 607 | geom = newGeometry; | ||
600 | if (pendingGeometryUpdate() == PendingGeometryForced) | 608 | if (pendingGeometryUpdate() == PendingGeometryForced) | ||
601 | {} // maximum, nothing needed | 609 | {} // maximum, nothing needed | ||
602 | else if (force == ForceGeometrySet) | 610 | else if (force == ForceGeometrySet) | ||
603 | setPendingGeometryUpdate(PendingGeometryForced); | 611 | setPendingGeometryUpdate(PendingGeometryForced); | ||
604 | else | 612 | else | ||
605 | setPendingGeometryUpdate(PendingGeometryNormal); | 613 | setPendingGeometryUpdate(PendingGeometryNormal); | ||
606 | return; | 614 | return; | ||
607 | } | 615 | } | ||
608 | if (pendingGeometryUpdate() != PendingGeometryNone) { | 616 | if (pendingGeometryUpdate() != PendingGeometryNone) { | ||
609 | // reset geometry to the one before blocking, so that we can compare properly | 617 | // reset geometry to the one before blocking, so that we can compare properly | ||
610 | geom = geometryBeforeUpdateBlocking(); | 618 | geom = geometryBeforeUpdateBlocking(); | ||
611 | } | 619 | } | ||
612 | // TODO: better merge with Client's implementation | 620 | // TODO: better merge with Client's implementation | ||
613 | const QSize requestedClientSize = QSize(w, h) - QSize(borderLeft() + borderRight(), borderTop() + borderBottom()); | 621 | const QSize requestedClientSize = newGeometry.size() - QSize(borderLeft() + borderRight(), borderTop() + borderBottom()); | ||
614 | if (requestedClientSize == m_clientSize && !isWaitingForMoveResizeSync()) { | 622 | if (requestedClientSize == m_clientSize && !isWaitingForMoveResizeSync()) { | ||
615 | // size didn't change, update directly | 623 | // size didn't change, update directly | ||
616 | doSetGeometry(QRect(x, y, w, h)); | 624 | doSetGeometry(newGeometry); | ||
617 | updateMaximizeMode(m_requestedMaximizeMode); | 625 | updateMaximizeMode(m_requestedMaximizeMode); | ||
618 | } else { | 626 | } else { | ||
619 | // size did change, Client needs to provide a new buffer | 627 | // size did change, Client needs to provide a new buffer | ||
620 | requestGeometry(QRect(x, y, w, h)); | 628 | requestGeometry(newGeometry); | ||
621 | } | 629 | } | ||
622 | } | 630 | } | ||
623 | 631 | | |||
624 | void ShellClient::doSetGeometry(const QRect &rect) | 632 | void ShellClient::doSetGeometry(const QRect &rect) | ||
625 | { | 633 | { | ||
626 | if (geom == rect && pendingGeometryUpdate() == PendingGeometryNone) { | 634 | if (geom == rect && pendingGeometryUpdate() == PendingGeometryNone) { | ||
627 | return; | 635 | return; | ||
628 | } | 636 | } | ||
629 | if (!m_unmapped) { | 637 | if (!m_unmapped) { | ||
630 | addWorkspaceRepaint(visibleRect()); | 638 | addWorkspaceRepaint(visibleRect()); | ||
631 | } | 639 | } | ||
640 | | ||||
632 | geom = rect; | 641 | geom = rect; | ||
642 | updateWindowRules(Rules::Position | Rules::Size); | ||||
633 | 643 | | |||
634 | if (m_unmapped && m_geomMaximizeRestore.isEmpty() && !geom.isEmpty()) { | 644 | if (m_unmapped && m_geomMaximizeRestore.isEmpty() && !geom.isEmpty()) { | ||
635 | // use first valid geometry as restore geometry | 645 | // use first valid geometry as restore geometry | ||
636 | m_geomMaximizeRestore = geom; | 646 | m_geomMaximizeRestore = geom; | ||
637 | } | 647 | } | ||
638 | 648 | | |||
639 | if (!m_unmapped) { | 649 | if (!m_unmapped) { | ||
640 | addWorkspaceRepaint(visibleRect()); | 650 | addWorkspaceRepaint(visibleRect()); | ||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Line(s) | |||||
719 | 729 | | |||
720 | bool ShellClient::isFullScreen() const | 730 | bool ShellClient::isFullScreen() const | ||
721 | { | 731 | { | ||
722 | return m_fullScreen; | 732 | return m_fullScreen; | ||
723 | } | 733 | } | ||
724 | 734 | | |||
725 | bool ShellClient::isMaximizable() const | 735 | bool ShellClient::isMaximizable() const | ||
726 | { | 736 | { | ||
737 | if (!isResizable()) { | ||||
738 | return false; | ||||
739 | } | ||||
727 | return true; | 740 | return true; | ||
728 | } | 741 | } | ||
729 | 742 | | |||
730 | bool ShellClient::isMinimizable() const | 743 | bool ShellClient::isMinimizable() const | ||
731 | { | 744 | { | ||
732 | if (!rules()->checkMinimize(true)) { | 745 | if (!rules()->checkMinimize(true)) { | ||
733 | return false; | 746 | return false; | ||
734 | } | 747 | } | ||
735 | return (!m_plasmaShellSurface || m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Normal); | 748 | return (!m_plasmaShellSurface || m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Normal); | ||
736 | } | 749 | } | ||
737 | 750 | | |||
738 | bool ShellClient::isMovable() const | 751 | bool ShellClient::isMovable() const | ||
739 | { | 752 | { | ||
753 | if (rules()->checkPosition(invalidPoint) != invalidPoint) { | ||||
754 | return false; | ||||
755 | } | ||||
740 | if (m_plasmaShellSurface) { | 756 | if (m_plasmaShellSurface) { | ||
741 | return m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Normal; | 757 | return m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Normal; | ||
742 | } | 758 | } | ||
743 | if (m_xdgShellPopup) { | 759 | if (m_xdgShellPopup) { | ||
744 | return false; | 760 | return false; | ||
745 | } | 761 | } | ||
746 | return true; | 762 | return true; | ||
747 | } | 763 | } | ||
748 | 764 | | |||
749 | bool ShellClient::isMovableAcrossScreens() const | 765 | bool ShellClient::isMovableAcrossScreens() const | ||
750 | { | 766 | { | ||
767 | if (rules()->checkPosition(invalidPoint) != invalidPoint) { | ||||
768 | return false; | ||||
769 | } | ||||
751 | if (m_plasmaShellSurface) { | 770 | if (m_plasmaShellSurface) { | ||
752 | return m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Normal; | 771 | return m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Normal; | ||
753 | } | 772 | } | ||
754 | if (m_xdgShellPopup) { | 773 | if (m_xdgShellPopup) { | ||
755 | return false; | 774 | return false; | ||
756 | } | 775 | } | ||
757 | return true; | 776 | return true; | ||
758 | } | 777 | } | ||
759 | 778 | | |||
760 | bool ShellClient::isResizable() const | 779 | bool ShellClient::isResizable() const | ||
761 | { | 780 | { | ||
781 | if (rules()->checkSize(QSize()).isValid()) { | ||||
782 | return false; | ||||
783 | } | ||||
762 | if (m_plasmaShellSurface) { | 784 | if (m_plasmaShellSurface) { | ||
763 | return m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Normal; | 785 | return m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Normal; | ||
764 | } | 786 | } | ||
765 | if (m_xdgShellPopup) { | 787 | if (m_xdgShellPopup) { | ||
766 | return false; | 788 | return false; | ||
767 | } | 789 | } | ||
768 | return true; | 790 | return true; | ||
769 | } | 791 | } | ||
▲ Show 20 Lines • Show All 1121 Lines • Show Last 20 Lines |