diff options
author | okan <okan> | 2014-09-18 13:56:58 +0000 |
---|---|---|
committer | okan <okan> | 2014-09-18 13:56:58 +0000 |
commit | 2540b3f4fe34c6bc6ed0593e9c6d713d84b2c301 (patch) | |
tree | 640369d4716c7067b56d78f937397887a07260c8 /mousefunc.c | |
parent | 973592780997d20ff46e8df168df5246ddb1df82 (diff) | |
parent | cbc7f760748f0519c70fa6c6d3c40a05810b7f9c (diff) | |
download | cwm-2540b3f4fe34c6bc6ed0593e9c6d713d84b2c301.tar.gz cwm-2540b3f4fe34c6bc6ed0593e9c6d713d84b2c301.tar.xz cwm-2540b3f4fe34c6bc6ed0593e9c6d713d84b2c301.zip |
cvsimport
Diffstat (limited to 'mousefunc.c')
-rw-r--r-- | mousefunc.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/mousefunc.c b/mousefunc.c index 3442f67..a3d9c6a 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -73,7 +73,7 @@ mousefunc_client_resize(struct client_ctx *cc, union arg *arg) struct screen_ctx *sc = cc->sc; int x = cc->geom.x, y = cc->geom.y; - if (cc->flags & CLIENT_FREEZE) + if (cc->flags & (CLIENT_FREEZE|CLIENT_STICKY)) return; client_raise(cc); @@ -90,19 +90,18 @@ mousefunc_client_resize(struct client_ctx *cc, union arg *arg) switch (ev.type) { case MotionNotify: + /* not more than 60 times / second */ + if ((ev.xmotion.time - ltime) <= (1000 / 60)) + continue; + ltime = ev.xmotion.time; + mousefunc_sweep_calc(cc, x, y, ev.xmotion.x_root, ev.xmotion.y_root); - - /* don't resize more than 60 times / second */ - if ((ev.xmotion.time - ltime) > (1000 / 60)) { - ltime = ev.xmotion.time; - client_resize(cc, 1); - mousefunc_sweep_draw(cc); - } + client_resize(cc, 1); + mousefunc_sweep_draw(cc); break; case ButtonRelease: - if (ltime) - client_resize(cc, 1); + client_resize(cc, 1); XUnmapWindow(X_Dpy, sc->menuwin); XReparentWindow(X_Dpy, sc->menuwin, sc->rootwin, 0, 0); xu_ptr_ungrab(); @@ -130,7 +129,7 @@ mousefunc_client_move(struct client_ctx *cc, union arg *arg) client_raise(cc); - if (cc->flags & CLIENT_FREEZE) + if (cc->flags & (CLIENT_FREEZE|CLIENT_STICKY)) return; if (xu_ptr_grab(cc->win, MOUSEMASK, Conf.cursor[CF_MOVE]) < 0) @@ -143,6 +142,11 @@ mousefunc_client_move(struct client_ctx *cc, union arg *arg) switch (ev.type) { case MotionNotify: + /* not more than 60 times / second */ + if ((ev.xmotion.time - ltime) <= (1000 / 60)) + continue; + ltime = ev.xmotion.time; + cc->geom.x = ev.xmotion.x_root - px - cc->bwidth; cc->geom.y = ev.xmotion.y_root - py - cc->bwidth; @@ -156,15 +160,10 @@ mousefunc_client_move(struct client_ctx *cc, union arg *arg) cc->geom.y + cc->geom.h + (cc->bwidth * 2), xine.y, xine.y + xine.h, sc->snapdist); - /* don't move more than 60 times / second */ - if ((ev.xmotion.time - ltime) > (1000 / 60)) { - ltime = ev.xmotion.time; - client_move(cc); - } + client_move(cc); break; case ButtonRelease: - if (ltime) - client_move(cc); + client_move(cc); xu_ptr_ungrab(); return; } @@ -188,10 +187,10 @@ mousefunc_menu_group(struct client_ctx *cc, union arg *arg) TAILQ_INIT(&menuq); TAILQ_FOREACH(gc, &sc->groupq, entry) { - if (TAILQ_EMPTY(&gc->clients)) + if (group_holds_only_sticky(gc)) continue; menuq_add(&menuq, gc, - group_hidden_state(gc) ? "%d: [%s]" : "%d: %s", + group_holds_only_hidden(gc) ? "%d: [%s]" : "%d: %s", gc->num, gc->name); } if (TAILQ_EMPTY(&menuq)) @@ -200,8 +199,8 @@ mousefunc_menu_group(struct client_ctx *cc, union arg *arg) if ((mi = menu_filter(sc, &menuq, NULL, NULL, 0, NULL, NULL)) != NULL) { gc = (struct group_ctx *)mi->ctx; - (group_hidden_state(gc)) ? - group_show(sc, gc) : group_hide(sc, gc); + (group_holds_only_hidden(gc)) ? + group_show(gc) : group_hide(gc); } menuq_clear(&menuq); @@ -219,7 +218,7 @@ mousefunc_menu_unhide(struct client_ctx *cc, union arg *arg) old_cc = client_current(); TAILQ_INIT(&menuq); - TAILQ_FOREACH(cc, &Clientq, entry) { + TAILQ_FOREACH(cc, &sc->clientq, entry) { if (cc->flags & CLIENT_HIDDEN) { wname = (cc->label) ? cc->label : cc->name; if (wname == NULL) |