Changeset View
Changeset View
Standalone View
Standalone View
placement.cpp
Show First 20 Lines • Show All 105 Lines • ▼ Show 20 Line(s) | 105 | else | |||
---|---|---|---|---|---|
106 | placeSmart(c, area, nextPlacement); | 106 | placeSmart(c, area, nextPlacement); | ||
107 | 107 | | |||
108 | if (options->borderSnapZone()) { | 108 | if (options->borderSnapZone()) { | ||
109 | // snap to titlebar / snap to window borders on inner screen edges | 109 | // snap to titlebar / snap to window borders on inner screen edges | ||
110 | const QRect geo(c->geometry()); | 110 | const QRect geo(c->geometry()); | ||
111 | QPoint corner = geo.topLeft(); | 111 | QPoint corner = geo.topLeft(); | ||
112 | const QPoint cp = c->clientPos(); | 112 | const QPoint cp = c->clientPos(); | ||
113 | const QSize cs = geo.size() - c->clientSize(); | 113 | const QSize cs = geo.size() - c->clientSize(); | ||
114 | Client::Position titlePos = c->titlebarPosition(); | 114 | AbstractClient::Position titlePos = c->titlebarPosition(); | ||
115 | 115 | | |||
116 | const QRect fullRect = workspace()->clientArea(FullArea, c); | 116 | const QRect fullRect = workspace()->clientArea(FullArea, c); | ||
117 | if (!(c->maximizeMode() & MaximizeHorizontal)) { | 117 | if (!(c->maximizeMode() & MaximizeHorizontal)) { | ||
118 | if (titlePos != Client::PositionRight && geo.right() == fullRect.right()) | 118 | if (titlePos != AbstractClient::PositionRight && geo.right() == fullRect.right()) | ||
119 | corner.rx() += cs.width() - cp.x(); | 119 | corner.rx() += cs.width() - cp.x(); | ||
120 | if (titlePos != Client::PositionLeft && geo.x() == fullRect.x()) | 120 | if (titlePos != AbstractClient::PositionLeft && geo.x() == fullRect.x()) | ||
121 | corner.rx() -= cp.x(); | 121 | corner.rx() -= cp.x(); | ||
122 | } | 122 | } | ||
123 | if (!(c->maximizeMode() & MaximizeVertical)) { | 123 | if (!(c->maximizeMode() & MaximizeVertical)) { | ||
124 | if (titlePos != Client::PositionBottom && geo.bottom() == fullRect.bottom()) | 124 | if (titlePos != AbstractClient::PositionBottom && geo.bottom() == fullRect.bottom()) | ||
125 | corner.ry() += cs.height() - cp.y(); | 125 | corner.ry() += cs.height() - cp.y(); | ||
126 | if (titlePos != Client::PositionTop && geo.y() == fullRect.y()) | 126 | if (titlePos != AbstractClient::PositionTop && geo.y() == fullRect.y()) | ||
127 | corner.ry() -= cp.y(); | 127 | corner.ry() -= cp.y(); | ||
128 | } | 128 | } | ||
129 | c->move(corner); | 129 | c->move(corner); | ||
130 | } | 130 | } | ||
131 | } | 131 | } | ||
132 | 132 | | |||
133 | /** | 133 | /** | ||
134 | * Place the client \a c according to a simply "random" placement algorithm. | 134 | * Place the client \a c according to a simply "random" placement algorithm. | ||
▲ Show 20 Lines • Show All 702 Lines • ▼ Show 20 Line(s) | |||||
837 | } | 837 | } | ||
838 | 838 | | |||
839 | int Workspace::packPositionLeft(const AbstractClient* cl, int oldx, bool left_edge) const | 839 | int Workspace::packPositionLeft(const AbstractClient* cl, int oldx, bool left_edge) const | ||
840 | { | 840 | { | ||
841 | int newx = clientArea(MaximizeArea, cl).left(); | 841 | int newx = clientArea(MaximizeArea, cl).left(); | ||
842 | if (oldx <= newx) // try another Xinerama screen | 842 | if (oldx <= newx) // try another Xinerama screen | ||
843 | newx = clientArea(MaximizeArea, | 843 | newx = clientArea(MaximizeArea, | ||
844 | QPoint(cl->geometry().left() - 1, cl->geometry().center().y()), cl->desktop()).left(); | 844 | QPoint(cl->geometry().left() - 1, cl->geometry().center().y()), cl->desktop()).left(); | ||
845 | if (cl->titlebarPosition() != Client::PositionLeft) { | 845 | if (cl->titlebarPosition() != AbstractClient::PositionLeft) { | ||
846 | QRect geo = cl->geometry(); | 846 | QRect geo = cl->geometry(); | ||
847 | int rgt = newx - cl->clientPos().x(); | 847 | int rgt = newx - cl->clientPos().x(); | ||
848 | geo.moveRight(rgt); | 848 | geo.moveRight(rgt); | ||
849 | if (screens()->intersecting(geo) < 2) | 849 | if (screens()->intersecting(geo) < 2) | ||
850 | newx = rgt; | 850 | newx = rgt; | ||
851 | } | 851 | } | ||
852 | if (oldx <= newx) | 852 | if (oldx <= newx) | ||
853 | return oldx; | 853 | return oldx; | ||
Show All 11 Lines | |||||
865 | } | 865 | } | ||
866 | 866 | | |||
867 | int Workspace::packPositionRight(const AbstractClient* cl, int oldx, bool right_edge) const | 867 | int Workspace::packPositionRight(const AbstractClient* cl, int oldx, bool right_edge) const | ||
868 | { | 868 | { | ||
869 | int newx = clientArea(MaximizeArea, cl).right(); | 869 | int newx = clientArea(MaximizeArea, cl).right(); | ||
870 | if (oldx >= newx) // try another Xinerama screen | 870 | if (oldx >= newx) // try another Xinerama screen | ||
871 | newx = clientArea(MaximizeArea, | 871 | newx = clientArea(MaximizeArea, | ||
872 | QPoint(cl->geometry().right() + 1, cl->geometry().center().y()), cl->desktop()).right(); | 872 | QPoint(cl->geometry().right() + 1, cl->geometry().center().y()), cl->desktop()).right(); | ||
873 | if (cl->titlebarPosition() != Client::PositionRight) { | 873 | if (cl->titlebarPosition() != AbstractClient::PositionRight) { | ||
874 | QRect geo = cl->geometry(); | 874 | QRect geo = cl->geometry(); | ||
875 | int rgt = newx + cl->width() - (cl->clientSize().width() + cl->clientPos().x()); | 875 | int rgt = newx + cl->width() - (cl->clientSize().width() + cl->clientPos().x()); | ||
876 | geo.moveRight(rgt); | 876 | geo.moveRight(rgt); | ||
877 | if (screens()->intersecting(geo) < 2) | 877 | if (screens()->intersecting(geo) < 2) | ||
878 | newx = rgt; | 878 | newx = rgt; | ||
879 | } | 879 | } | ||
880 | if (oldx >= newx) | 880 | if (oldx >= newx) | ||
881 | return oldx; | 881 | return oldx; | ||
Show All 11 Lines | |||||
893 | } | 893 | } | ||
894 | 894 | | |||
895 | int Workspace::packPositionUp(const AbstractClient* cl, int oldy, bool top_edge) const | 895 | int Workspace::packPositionUp(const AbstractClient* cl, int oldy, bool top_edge) const | ||
896 | { | 896 | { | ||
897 | int newy = clientArea(MaximizeArea, cl).top(); | 897 | int newy = clientArea(MaximizeArea, cl).top(); | ||
898 | if (oldy <= newy) // try another Xinerama screen | 898 | if (oldy <= newy) // try another Xinerama screen | ||
899 | newy = clientArea(MaximizeArea, | 899 | newy = clientArea(MaximizeArea, | ||
900 | QPoint(cl->geometry().center().x(), cl->geometry().top() - 1), cl->desktop()).top(); | 900 | QPoint(cl->geometry().center().x(), cl->geometry().top() - 1), cl->desktop()).top(); | ||
901 | if (cl->titlebarPosition() != Client::PositionTop) { | 901 | if (cl->titlebarPosition() != AbstractClient::PositionTop) { | ||
902 | QRect geo = cl->geometry(); | 902 | QRect geo = cl->geometry(); | ||
903 | int top = newy - cl->clientPos().y(); | 903 | int top = newy - cl->clientPos().y(); | ||
904 | geo.moveTop(top); | 904 | geo.moveTop(top); | ||
905 | if (screens()->intersecting(geo) < 2) | 905 | if (screens()->intersecting(geo) < 2) | ||
906 | newy = top; | 906 | newy = top; | ||
907 | } | 907 | } | ||
908 | if (oldy <= newy) | 908 | if (oldy <= newy) | ||
909 | return oldy; | 909 | return oldy; | ||
Show All 11 Lines | |||||
921 | } | 921 | } | ||
922 | 922 | | |||
923 | int Workspace::packPositionDown(const AbstractClient* cl, int oldy, bool bottom_edge) const | 923 | int Workspace::packPositionDown(const AbstractClient* cl, int oldy, bool bottom_edge) const | ||
924 | { | 924 | { | ||
925 | int newy = clientArea(MaximizeArea, cl).bottom(); | 925 | int newy = clientArea(MaximizeArea, cl).bottom(); | ||
926 | if (oldy >= newy) // try another Xinerama screen | 926 | if (oldy >= newy) // try another Xinerama screen | ||
927 | newy = clientArea(MaximizeArea, | 927 | newy = clientArea(MaximizeArea, | ||
928 | QPoint(cl->geometry().center().x(), cl->geometry().bottom() + 1), cl->desktop()).bottom(); | 928 | QPoint(cl->geometry().center().x(), cl->geometry().bottom() + 1), cl->desktop()).bottom(); | ||
929 | if (cl->titlebarPosition() != Client::PositionBottom) { | 929 | if (cl->titlebarPosition() != AbstractClient::PositionBottom) { | ||
930 | QRect geo = cl->geometry(); | 930 | QRect geo = cl->geometry(); | ||
931 | int btm = newy + cl->height() - (cl->clientSize().height() + cl->clientPos().y()); | 931 | int btm = newy + cl->height() - (cl->clientSize().height() + cl->clientPos().y()); | ||
932 | geo.moveBottom(btm); | 932 | geo.moveBottom(btm); | ||
933 | if (screens()->intersecting(geo) < 2) | 933 | if (screens()->intersecting(geo) < 2) | ||
934 | newy = btm; | 934 | newy = btm; | ||
935 | } | 935 | } | ||
936 | if (oldy >= newy) | 936 | if (oldy >= newy) | ||
937 | return oldy; | 937 | return oldy; | ||
Show All 16 Lines |