MCPcopy Create free account
hub / github.com/KDE/kwin / keepInArea

Method keepInArea

src/window.cpp:960–991  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

958}
959
960RectF Window::keepInArea(RectF geometry, RectF area, bool partial) const
961{
962 if (partial) {
963 // increase the area so that can have only 100 pixels in the area
964 const RectF geometry = moveResizeGeometry();
965 area.setLeft(std::min(area.left() - geometry.width() + 100, area.left()));
966 area.setTop(std::min(area.top() - geometry.height() + 100, area.top()));
967 area.setRight(std::max(area.right() + geometry.width() - 100, area.right()));
968 area.setBottom(std::max(area.bottom() + geometry.height() - 100, area.bottom()));
969 }
970 if (!partial) {
971 // resize to fit into area
972 if (area.width() < geometry.width() || area.height() < geometry.height()) {
973 geometry = resizeWithChecks(geometry, geometry.size().boundedTo(area.size()));
974 }
975 }
976
977 if (geometry.right() > area.right() && geometry.width() <= area.width()) {
978 geometry.moveRight(area.right());
979 }
980 if (geometry.bottom() > area.bottom() && geometry.height() <= area.height()) {
981 geometry.moveBottom(area.bottom());
982 }
983
984 if (geometry.left() < area.left()) {
985 geometry.moveLeft(area.left());
986 }
987 if (geometry.top() < area.top()) {
988 geometry.moveTop(area.top());
989 }
990 return geometry;
991}
992
993/**
994 * Returns the maximum client size, not the maximum frame size.

Callers 3

testXdgPopupWithPanelMethod · 0.80
placeUnderMouseMethod · 0.80
placeOnMainWindowMethod · 0.80

Calls 15

setLeftMethod · 0.45
leftMethod · 0.45
widthMethod · 0.45
setTopMethod · 0.45
topMethod · 0.45
heightMethod · 0.45
setRightMethod · 0.45
rightMethod · 0.45
setBottomMethod · 0.45
bottomMethod · 0.45
sizeMethod · 0.45
moveRightMethod · 0.45

Tested by

no test coverage detected