summaryrefslogtreecommitdiff
path: root/openbox/action.c
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@comhem.se>2007-04-24 16:37:01 +0000
committerMikael Magnusson <mikachu@comhem.se>2007-04-24 16:37:01 +0000
commitf20182804656b9f1a705c93bc1f42f92ab3590ef (patch)
tree5af9e54677cd536ab64bb3c0c138f16f46875773 /openbox/action.c
parentac241a8235be139ddfa15d6f2cbdcb64385c25d9 (diff)
this doesn't work yet but i don't want to screw it up accidentally
Diffstat (limited to 'openbox/action.c')
-rw-r--r--openbox/action.c69
1 files changed, 21 insertions, 48 deletions
diff --git a/openbox/action.c b/openbox/action.c
index daed9768..b74dfa95 100644
--- a/openbox/action.c
+++ b/openbox/action.c
@@ -1579,54 +1579,27 @@ static guint32 pick_corner(gint x, gint y, gint cx, gint cy, gint cw, gint ch)
return prop_atoms.net_wm_moveresize_size_topleft;
}
} else {
- if (x - cx > cw * 2 / 3) {
- if (y - cy > ch * 2 / 3)
- return prop_atoms.net_wm_moveresize_size_bottomright;
- else if (y - cy < ch / 3)
- return prop_atoms.net_wm_moveresize_size_topright;
- else
- return prop_atoms.net_wm_moveresize_size_right;
- } else if (x - cx < cw / 3) {
- if (y - cy > ch * 2 / 3)
- return prop_atoms.net_wm_moveresize_size_bottomleft;
- else if (y - cy < ch / 3)
- return prop_atoms.net_wm_moveresize_size_topleft;
- else
- return prop_atoms.net_wm_moveresize_size_left;
- } else
- if (y - cy > ch * 2 / 3)
- return prop_atoms.net_wm_moveresize_size_bottom;
- else if (y - cy < ch / 3)
- return prop_atoms.net_wm_moveresize_size_top;
- else {
- /* inside the middle square... */
- cx += cw / 3;
- cy += ch / 3;
- cw /= 3;
- ch /= 3;
- if (x - cx > cw * 2 / 3) {
- if (y - cy > ch * 2 / 3)
- return prop_atoms.net_wm_moveresize_size_bottomright;
- else if (y - cy < ch / 3)
- return prop_atoms.net_wm_moveresize_size_topright;
- else
- return prop_atoms.net_wm_moveresize_size_right;
- } else if (x - cx < cw / 3) {
- if (y - cy > ch * 2 / 3)
- return prop_atoms.net_wm_moveresize_size_bottomleft;
- else if (y - cy < ch / 3)
- return prop_atoms.net_wm_moveresize_size_topleft;
- else
- return prop_atoms.net_wm_moveresize_size_left;
- } else
- if (y - cy > ch * 2 / 3)
- return prop_atoms.net_wm_moveresize_size_bottom;
- else if (y - cy < ch / 3)
- return prop_atoms.net_wm_moveresize_size_top;
- else {
- return prop_atoms.net_wm_moveresize_move;
- }
- }
+ /* let's make x and y client relative instead of screen relative */
+ x = x - cx;
+ y = y - cy;
+ if (y < -4*x*ch/cw+7*ch/3 && y > -ch*x/4/cw+2*ch/3)
+ return prop_atoms.net_wm_moveresize_size_topleft;
+ else if (y > 5*ch/9 && y > 4*x*ch/cw-15*ch/9)
+ return prop_atoms.net_wm_moveresize_size_top;
+ else if (y > ch*x/4/cw+5*ch/12)
+ return prop_atoms.net_wm_moveresize_size_topright;
+ else if (x < 4*cw/9 && y > ch*x/4/cw+ch/3)
+ return prop_atoms.net_wm_moveresize_size_left;
+ else if (x > 5*cw/9 && y > -ch*x/4/cw+7*ch/12)
+ return prop_atoms.net_wm_moveresize_size_right;
+ else if (y > 4*ch*x/cw-4*ch/3)
+ return prop_atoms.net_wm_moveresize_size_bottomleft;
+ else if (y < 4*ch/9 && y < -4*x*ch/cw+8*ch/3)
+ return prop_atoms.net_wm_moveresize_size_bottom;
+ else if (y > 5*cw/9)
+ return prop_atoms.net_wm_moveresize_size_bottomright;
+ else
+ return prop_atoms.net_wm_moveresize_move;
}
}