summaryrefslogtreecommitdiff
path: root/openbox/moveresize.c
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2009-11-05 22:29:38 +0100
committerDana Jansens <danakj@orodu.net>2009-11-07 17:07:05 -0500
commitfa0ae17adbc8f73b707c33836d37841e81b9303a (patch)
treedc6aaf1f7cd386f3d0c0862bd9985486c9b58aca /openbox/moveresize.c
parenta170ad7c85b5f23fafe64d28a3f183a7ce42ce53 (diff)
Make clang happier
Add asserts to default: in switch statements Store pointed to variables locally so it knows they don't change Remove some dead assignments Mark ob_exit_with_error as noreturn Use "%s", msg instead of just msg to printf style functions Use the c_pfocus variable
Diffstat (limited to 'openbox/moveresize.c')
-rw-r--r--openbox/moveresize.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/openbox/moveresize.c b/openbox/moveresize.c
index e748cd3d..d89c31ca 100644
--- a/openbox/moveresize.c
+++ b/openbox/moveresize.c
@@ -662,7 +662,7 @@ static void move_with_keys(gint keycode, gint state)
static void resize_with_keys(gint keycode, gint state)
{
gint dw = 0, dh = 0, pdx = 0, pdy = 0, opx, opy, px, py;
- gint dist = 0, resist = 0;
+ gint resist = 0;
ObDirection dir;
/* pick the edge if it needs to move */
@@ -674,8 +674,7 @@ static void resize_with_keys(gint keycode, gint state)
key_resize_edge = OB_DIRECTION_EAST;
return;
}
- }
- if (keycode == ob_keycode(OB_KEY_LEFT)) {
+ } else if (keycode == ob_keycode(OB_KEY_LEFT)) {
dir = OB_DIRECTION_WEST;
if (key_resize_edge != OB_DIRECTION_WEST &&
key_resize_edge != OB_DIRECTION_EAST)
@@ -683,8 +682,7 @@ static void resize_with_keys(gint keycode, gint state)
key_resize_edge = OB_DIRECTION_WEST;
return;
}
- }
- if (keycode == ob_keycode(OB_KEY_UP)) {
+ } else if (keycode == ob_keycode(OB_KEY_UP)) {
dir = OB_DIRECTION_NORTH;
if (key_resize_edge != OB_DIRECTION_NORTH &&
key_resize_edge != OB_DIRECTION_SOUTH)
@@ -692,8 +690,7 @@ static void resize_with_keys(gint keycode, gint state)
key_resize_edge = OB_DIRECTION_NORTH;
return;
}
- }
- if (keycode == ob_keycode(OB_KEY_DOWN)) {
+ } else /* if (keycode == ob_keycode(OB_KEY_DOWN)) */ {
dir = OB_DIRECTION_SOUTH;
if (key_resize_edge != OB_DIRECTION_NORTH &&
key_resize_edge != OB_DIRECTION_SOUTH)
@@ -756,27 +753,27 @@ static void resize_with_keys(gint keycode, gint state)
if (key_resize_edge == OB_DIRECTION_WEST) {
if (dir == OB_DIRECTION_WEST)
- dw = (dist = distw);
+ dw = distw;
else
- dw = -(dist = distw);
+ dw = -distw;
}
else if (key_resize_edge == OB_DIRECTION_EAST) {
if (dir == OB_DIRECTION_EAST)
- dw = (dist = distw);
+ dw = distw;
else
- dw = -(dist = distw);
+ dw = -distw;
}
else if (key_resize_edge == OB_DIRECTION_NORTH) {
if (dir == OB_DIRECTION_NORTH)
- dh = (dist = disth);
+ dh = disth;
else
- dh = -(dist = disth);
+ dh = -disth;
}
else /*if (key_resize_edge == OB_DIRECTION_SOUTH)*/ {
if (dir == OB_DIRECTION_SOUTH)
- dh = (dist = disth);
+ dh = disth;
else
- dh = -(dist = disth);
+ dh = -disth;
}
}