Changeset View
Changeset View
Standalone View
Standalone View
placement.cpp
Show First 20 Lines • Show All 742 Lines • ▼ Show 20 Line(s) | |||||
743 | } | 743 | } | ||
744 | 744 | | |||
745 | void AbstractClient::growHorizontal() | 745 | void AbstractClient::growHorizontal() | ||
746 | { | 746 | { | ||
747 | if (!isResizable() || isShade()) | 747 | if (!isResizable() || isShade()) | ||
748 | return; | 748 | return; | ||
749 | QRect geom = frameGeometry(); | 749 | QRect geom = frameGeometry(); | ||
750 | geom.setRight(workspace()->packPositionRight(this, geom.right(), true)); | 750 | geom.setRight(workspace()->packPositionRight(this, geom.right(), true)); | ||
751 | QSize adjsize = adjustedSize(geom.size(), SizemodeFixedW); | 751 | QSize adjsize = adjustedSize(geom.size(), SizeModeFixedW); | ||
752 | if (frameGeometry().size() == adjsize && geom.size() != adjsize && resizeIncrements().width() > 1) { // take care of size increments | 752 | if (frameGeometry().size() == adjsize && geom.size() != adjsize && resizeIncrements().width() > 1) { // take care of size increments | ||
753 | int newright = workspace()->packPositionRight(this, geom.right() + resizeIncrements().width() - 1, true); | 753 | int newright = workspace()->packPositionRight(this, geom.right() + resizeIncrements().width() - 1, true); | ||
754 | // check that it hasn't grown outside of the area, due to size increments | 754 | // check that it hasn't grown outside of the area, due to size increments | ||
755 | // TODO this may be wrong? | 755 | // TODO this may be wrong? | ||
756 | if (workspace()->clientArea(MovementArea, | 756 | if (workspace()->clientArea(MovementArea, | ||
757 | QPoint((x() + newright) / 2, frameGeometry().center().y()), desktop()).right() >= newright) | 757 | QPoint((x() + newright) / 2, frameGeometry().center().y()), desktop()).right() >= newright) | ||
758 | geom.setRight(newright); | 758 | geom.setRight(newright); | ||
759 | } | 759 | } | ||
760 | geom.setSize(adjustedSize(geom.size(), SizemodeFixedW)); | 760 | geom.setSize(adjustedSize(geom.size(), SizeModeFixedW)); | ||
761 | geom.setSize(adjustedSize(geom.size(), SizemodeFixedH)); | 761 | geom.setSize(adjustedSize(geom.size(), SizeModeFixedH)); | ||
762 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; | 762 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; | ||
763 | setFrameGeometry(geom); | 763 | setFrameGeometry(geom); | ||
764 | } | 764 | } | ||
765 | 765 | | |||
766 | void Workspace::slotWindowShrinkHorizontal() | 766 | void Workspace::slotWindowShrinkHorizontal() | ||
767 | { | 767 | { | ||
768 | if (active_client) | 768 | if (active_client) | ||
769 | active_client->shrinkHorizontal(); | 769 | active_client->shrinkHorizontal(); | ||
770 | } | 770 | } | ||
771 | 771 | | |||
772 | void AbstractClient::shrinkHorizontal() | 772 | void AbstractClient::shrinkHorizontal() | ||
773 | { | 773 | { | ||
774 | if (!isResizable() || isShade()) | 774 | if (!isResizable() || isShade()) | ||
775 | return; | 775 | return; | ||
776 | QRect geom = frameGeometry(); | 776 | QRect geom = frameGeometry(); | ||
777 | geom.setRight(workspace()->packPositionLeft(this, geom.right(), false)); | 777 | geom.setRight(workspace()->packPositionLeft(this, geom.right(), false)); | ||
778 | if (geom.width() <= 1) | 778 | if (geom.width() <= 1) | ||
779 | return; | 779 | return; | ||
780 | geom.setSize(adjustedSize(geom.size(), SizemodeFixedW)); | 780 | geom.setSize(adjustedSize(geom.size(), SizeModeFixedW)); | ||
781 | if (geom.width() > 20) { | 781 | if (geom.width() > 20) { | ||
782 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; | 782 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; | ||
783 | setFrameGeometry(geom); | 783 | setFrameGeometry(geom); | ||
784 | } | 784 | } | ||
785 | } | 785 | } | ||
786 | 786 | | |||
787 | void Workspace::slotWindowGrowVertical() | 787 | void Workspace::slotWindowGrowVertical() | ||
788 | { | 788 | { | ||
789 | if (active_client) | 789 | if (active_client) | ||
790 | active_client->growVertical(); | 790 | active_client->growVertical(); | ||
791 | } | 791 | } | ||
792 | 792 | | |||
793 | void AbstractClient::growVertical() | 793 | void AbstractClient::growVertical() | ||
794 | { | 794 | { | ||
795 | if (!isResizable() || isShade()) | 795 | if (!isResizable() || isShade()) | ||
796 | return; | 796 | return; | ||
797 | QRect geom = frameGeometry(); | 797 | QRect geom = frameGeometry(); | ||
798 | geom.setBottom(workspace()->packPositionDown(this, geom.bottom(), true)); | 798 | geom.setBottom(workspace()->packPositionDown(this, geom.bottom(), true)); | ||
799 | QSize adjsize = adjustedSize(geom.size(), SizemodeFixedH); | 799 | QSize adjsize = adjustedSize(geom.size(), SizeModeFixedH); | ||
800 | if (frameGeometry().size() == adjsize && geom.size() != adjsize && resizeIncrements().height() > 1) { // take care of size increments | 800 | if (frameGeometry().size() == adjsize && geom.size() != adjsize && resizeIncrements().height() > 1) { // take care of size increments | ||
801 | int newbottom = workspace()->packPositionDown(this, geom.bottom() + resizeIncrements().height() - 1, true); | 801 | int newbottom = workspace()->packPositionDown(this, geom.bottom() + resizeIncrements().height() - 1, true); | ||
802 | // check that it hasn't grown outside of the area, due to size increments | 802 | // check that it hasn't grown outside of the area, due to size increments | ||
803 | if (workspace()->clientArea(MovementArea, | 803 | if (workspace()->clientArea(MovementArea, | ||
804 | QPoint(frameGeometry().center().x(), (y() + newbottom) / 2), desktop()).bottom() >= newbottom) | 804 | QPoint(frameGeometry().center().x(), (y() + newbottom) / 2), desktop()).bottom() >= newbottom) | ||
805 | geom.setBottom(newbottom); | 805 | geom.setBottom(newbottom); | ||
806 | } | 806 | } | ||
807 | geom.setSize(adjustedSize(geom.size(), SizemodeFixedH)); | 807 | geom.setSize(adjustedSize(geom.size(), SizeModeFixedH)); | ||
808 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; | 808 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; | ||
809 | setFrameGeometry(geom); | 809 | setFrameGeometry(geom); | ||
810 | } | 810 | } | ||
811 | 811 | | |||
812 | 812 | | |||
813 | void Workspace::slotWindowShrinkVertical() | 813 | void Workspace::slotWindowShrinkVertical() | ||
814 | { | 814 | { | ||
815 | if (active_client) | 815 | if (active_client) | ||
816 | active_client->shrinkVertical(); | 816 | active_client->shrinkVertical(); | ||
817 | } | 817 | } | ||
818 | 818 | | |||
819 | void AbstractClient::shrinkVertical() | 819 | void AbstractClient::shrinkVertical() | ||
820 | { | 820 | { | ||
821 | if (!isResizable() || isShade()) | 821 | if (!isResizable() || isShade()) | ||
822 | return; | 822 | return; | ||
823 | QRect geom = frameGeometry(); | 823 | QRect geom = frameGeometry(); | ||
824 | geom.setBottom(workspace()->packPositionUp(this, geom.bottom(), false)); | 824 | geom.setBottom(workspace()->packPositionUp(this, geom.bottom(), false)); | ||
825 | if (geom.height() <= 1) | 825 | if (geom.height() <= 1) | ||
826 | return; | 826 | return; | ||
827 | geom.setSize(adjustedSize(geom.size(), SizemodeFixedH)); | 827 | geom.setSize(adjustedSize(geom.size(), SizeModeFixedH)); | ||
828 | if (geom.height() > 20) { | 828 | if (geom.height() > 20) { | ||
829 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; | 829 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; | ||
830 | setFrameGeometry(geom); | 830 | setFrameGeometry(geom); | ||
831 | } | 831 | } | ||
832 | } | 832 | } | ||
833 | 833 | | |||
834 | void Workspace::quickTileWindow(QuickTileMode mode) | 834 | void Workspace::quickTileWindow(QuickTileMode mode) | ||
835 | { | 835 | { | ||
▲ Show 20 Lines • Show All 142 Lines • Show Last 20 Lines |