aboutsummaryrefslogtreecommitdiffstats
path: root/grab.c
diff options
context:
space:
mode:
authorokan2008-07-11 14:21:28 +0000
committerokan2008-07-11 14:21:28 +0000
commita3e52a291110ce7b866a0d11eeda1619d25f952b (patch)
tree781c99337b95a8386d0e787a95a49bf97148621c /grab.c
parentdc3045573c35f2ee31dc1c012da1ff4408b6f264 (diff)
downloadcwm-a3e52a291110ce7b866a0d11eeda1619d25f952b.tar.gz
spacing, declaration lineup to be consistent throughout cwm,
readability, and a bit of knf. ok oga@
Diffstat (limited to '')
-rw-r--r--grab.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/grab.c b/grab.c
index 1c5ef2d..12f55c9 100644
--- a/grab.c
+++ b/grab.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: grab.c,v 1.19 2008/06/15 02:47:46 oga Exp $
+ * $Id: grab.c,v 1.20 2008/07/11 14:21:28 okan Exp $
*/
#include "headers.h"
@@ -29,10 +29,10 @@ static int _sweepcalc(struct client_ctx *, int, int, int, int);
void
grab_sweep_draw(struct client_ctx *cc, int dx, int dy)
{
- struct screen_ctx *sc = CCTOSC(cc);
- int x0 = cc->geom.x, y0 = cc->geom.y;
- char asize[10]; /* fits "nnnnxnnnn\0" */
- int wide, height, wide_size, wide_name;
+ struct screen_ctx *sc = CCTOSC(cc);
+ char asize[10]; /* fits "nnnnxnnnn\0" */
+ int wide, height, wide_size, wide_name;
+ int x = cc->geom.x, y = cc->geom.y;
snprintf(asize, sizeof(asize), "%dx%d",
ADJUST_WIDTH(cc, dx), ADJUST_HEIGHT(cc, dy));
@@ -41,23 +41,22 @@ grab_sweep_draw(struct client_ctx *cc, int dx, int dy)
wide = MAX(wide_size, wide_name);
height = font_ascent() + font_descent() + 1;
- XMoveResizeWindow(X_Dpy, sc->menuwin, x0, y0, wide, height * 2);
+ XMoveResizeWindow(X_Dpy, sc->menuwin, x, y, wide, height * 2);
XMapWindow(X_Dpy, sc->menuwin);
XReparentWindow(X_Dpy, sc->menuwin, cc->win, 0, 0);
XClearWindow(X_Dpy, sc->menuwin);
font_draw(sc, cc->name, strlen(cc->name), sc->menuwin,
2, font_ascent() + 1);
font_draw(sc, asize, strlen(asize), sc->menuwin,
- wide/2 - wide_size/2, height + font_ascent() + 1);
+ wide / 2 - wide_size / 2, height + font_ascent() + 1);
}
void
grab_sweep(struct client_ctx *cc)
{
- XEvent ev;
- struct screen_ctx *sc = CCTOSC(cc);
- int x0 = cc->geom.x, y0 = cc->geom.y;
- int dx, dy;
+ XEvent ev;
+ struct screen_ctx *sc = CCTOSC(cc);
+ int x = cc->geom.x, y = cc->geom.y, dx, dy;
dx = MAX(1, cc->size->width_inc);
dy = MAX(1, cc->size->height_inc);
@@ -80,7 +79,7 @@ grab_sweep(struct client_ctx *cc)
client_draw_border(cc);
break;
case MotionNotify:
- if (_sweepcalc(cc, x0, y0, ev.xmotion.x, ev.xmotion.y))
+ if (_sweepcalc(cc, x, y, ev.xmotion.x, ev.xmotion.y))
/* Recompute window output */
grab_sweep_draw(cc, dx, dy);
@@ -116,9 +115,9 @@ grab_sweep(struct client_ctx *cc)
void
grab_drag(struct client_ctx *cc)
{
- int x0 = cc->geom.x, y0 = cc->geom.y, xm, ym;
- struct screen_ctx *sc = CCTOSC(cc);
- XEvent ev;
+ XEvent ev;
+ struct screen_ctx *sc = CCTOSC(cc);
+ int x = cc->geom.x, y = cc->geom.y, xm, ym;
client_raise(cc);
@@ -135,8 +134,8 @@ grab_drag(struct client_ctx *cc)
client_draw_border(cc);
break;
case MotionNotify:
- cc->geom.x = x0 + (ev.xmotion.x - xm);
- cc->geom.y = y0 + (ev.xmotion.y - ym);
+ cc->geom.x = x + (ev.xmotion.x - xm);
+ cc->geom.y = y + (ev.xmotion.y - ym);
XMoveWindow(X_Dpy, cc->pwin,
cc->geom.x - cc->bwidth, cc->geom.y - cc->bwidth);
@@ -151,15 +150,15 @@ grab_drag(struct client_ctx *cc)
}
static int
-_sweepcalc(struct client_ctx *cc, int x0, int y0, int motionx, int motiony)
+_sweepcalc(struct client_ctx *cc, int x, int y, int motionx, int motiony)
{
- int width, height;
+ int width, height;
width = cc->geom.width;
height = cc->geom.height;
- cc->geom.width = abs(x0 - motionx);
- cc->geom.height = abs(y0 - motiony);
+ cc->geom.width = abs(x - motionx);
+ cc->geom.height = abs(y - motiony);
if (cc->size->flags & PResizeInc) {
cc->geom.width -=
@@ -178,8 +177,8 @@ _sweepcalc(struct client_ctx *cc, int x0, int y0, int motionx, int motiony)
cc->geom.height = MIN(cc->geom.height, cc->size->max_height);
}
- cc->geom.x = x0 <= motionx ? x0 : x0 - cc->geom.width;
- cc->geom.y = y0 <= motiony ? y0 : y0 - cc->geom.height;
+ cc->geom.x = x <= motionx ? x : x - cc->geom.width;
+ cc->geom.y = y <= motiony ? y : y - cc->geom.height;
return (width != cc->geom.width || height != cc->geom.height);
}