aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc52
1 files changed, 47 insertions, 5 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 269665e..d5679d4 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -2789,7 +2789,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2789 2789
2790 if (! resizing) { 2790 if (! resizing) {
2791 2791
2792 ResizeDirection resize_corner = RIGHTBOTTOM; 2792 ReferenceCorner resize_corner = RIGHTBOTTOM;
2793 if (me.window == frame().gripRight()) 2793 if (me.window == frame().gripRight())
2794 resize_corner = RIGHTBOTTOM; 2794 resize_corner = RIGHTBOTTOM;
2795 else if (me.window == frame().gripLeft()) 2795 else if (me.window == frame().gripLeft())
@@ -2834,7 +2834,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2834 if (m_resize_corner == RIGHTBOTTOM || m_resize_corner == RIGHTTOP || 2834 if (m_resize_corner == RIGHTBOTTOM || m_resize_corner == RIGHTTOP ||
2835 m_resize_corner == RIGHT) 2835 m_resize_corner == RIGHT)
2836 m_last_resize_w = frame().width() + dx; 2836 m_last_resize_w = frame().width() + dx;
2837 if (m_resize_corner == ALLCORNERS) { 2837 if (m_resize_corner == CENTER) {
2838 // dx or dy must be at least 2 2838 // dx or dy must be at least 2
2839 if (abs(dx) >= 2 || abs(dy) >= 2) { 2839 if (abs(dx) >= 2 || abs(dy) >= 2) {
2840 // take max and make it even 2840 // take max and make it even
@@ -3339,12 +3339,12 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) {
3339 3339
3340} 3340}
3341 3341
3342FluxboxWindow::ResizeDirection FluxboxWindow::getResizeDirection(int x, int y, 3342FluxboxWindow::ReferenceCorner FluxboxWindow::getResizeDirection(int x, int y,
3343 ResizeModel model) const { 3343 ResizeModel model) const {
3344 int cx = frame().width() / 2; 3344 int cx = frame().width() / 2;
3345 int cy = frame().height() / 2; 3345 int cy = frame().height() / 2;
3346 if (model == CENTERRESIZE) 3346 if (model == CENTERRESIZE)
3347 return ALLCORNERS; 3347 return CENTER;
3348 if (model == NEARESTEDGERESIZE) { 3348 if (model == NEARESTEDGERESIZE) {
3349 if (cy - abs(y - cy) < cx - abs(x - cx)) // y is nearest 3349 if (cy - abs(y - cy) < cx - abs(x - cx)) // y is nearest
3350 return (y > cy) ? BOTTOM : TOP; 3350 return (y > cy) ? BOTTOM : TOP;
@@ -3365,7 +3365,7 @@ FluxboxWindow::ResizeDirection FluxboxWindow::getResizeDirection(int x, int y,
3365 return RIGHTBOTTOM; 3365 return RIGHTBOTTOM;
3366} 3366}
3367 3367
3368void FluxboxWindow::startResizing(int x, int y, ResizeDirection dir) { 3368void FluxboxWindow::startResizing(int x, int y, ReferenceCorner dir) {
3369 3369
3370 if (s_num_grabs > 0 || isShaded() || isIconic() ) 3370 if (s_num_grabs > 0 || isShaded() || isIconic() )
3371 return; 3371 return;
@@ -4038,6 +4038,48 @@ void FluxboxWindow::associateClient(WinClient &client) {
4038 client.titleSig().attach(this); 4038 client.titleSig().attach(this);
4039} 4039}
4040 4040
4041FluxboxWindow::ReferenceCorner FluxboxWindow::getCorner(string str) {
4042 str = FbTk::StringUtil::toLower(str);
4043 if (str == "lefttop" || str == "topleft" || str == "upperleft" || str == "")
4044 return LEFTTOP;
4045 if (str == "top" || str == "upper" || str == "topcenter")
4046 return TOP;
4047 if (str == "righttop" || str == "topright" || str == "upperright")
4048 return RIGHTTOP;
4049 if (str == "left" || str == "leftcenter")
4050 return LEFT;
4051 if (str == "center" || str == "wincenter")
4052 return CENTER;
4053 if (str == "right" || str == "rightcenter")
4054 return RIGHT;
4055 if (str == "leftbottom" || str == "bottomleft" || str == "lowerleft")
4056 return LEFTBOTTOM;
4057 if (str == "bottom" || str == "bottomcenter")
4058 return BOTTOM;
4059 if (str == "rightbottom" || str == "bottomright" || str == "lowerright")
4060 return RIGHTBOTTOM;
4061 return ERROR;
4062}
4063
4064void FluxboxWindow::translateCoords(int &x, int &y, ReferenceCorner dir) const {
4065 int head = getOnHead(), bw = 2 * frame().window().borderWidth(),
4066 left = screen().maxLeft(head), right = screen().maxRight(head),
4067 top = screen().maxTop(head), bottom = screen().maxBottom(head);
4068
4069 if (dir == LEFTTOP || dir == LEFT || dir == LEFTBOTTOM)
4070 x += left;
4071 if (dir == RIGHTTOP || dir == RIGHT || dir == RIGHTBOTTOM)
4072 x = right - width() - bw - x;
4073 if (dir == TOP || dir == CENTER || dir == BOTTOM)
4074 x += (left + right - width() - bw)/2;
4075 if (dir == LEFTTOP || dir == TOP || dir == RIGHTTOP)
4076 y += top;
4077 if (dir == LEFTBOTTOM || dir == BOTTOM || dir == RIGHTBOTTOM)
4078 y = bottom - height() - bw - y;
4079 if (dir == LEFT || dir == CENTER || dir == RIGHT)
4080 y += (top + bottom - height() - bw)/2;
4081}
4082
4041int FluxboxWindow::getOnHead() const { 4083int FluxboxWindow::getOnHead() const {
4042 return screen().getHead(fbWindow()); 4084 return screen().getHead(fbWindow());
4043} 4085}