summaryrefslogtreecommitdiff
path: root/app/cwm
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2017-12-29 18:50:44 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2017-12-29 18:50:44 +0000
commit257c29b27424301ee78a7434391b2cfcfbab527e (patch)
tree9f850572a471f1ccfc6dbf2293a1306d1f8db6c0 /app/cwm
parent2ac6adfc517aafee63f26fd109cac34e00d092a8 (diff)
As done for buttonrelease, work specific un-cycling and un-highlighting actions
into the keyrelease event, only performing what's actually needed for each; should result in much fewer events against keyreleases. No intended behaviour change. Additionally, like we do for group membership, grab the keyboard only when required for cycling.
Diffstat (limited to 'app/cwm')
-rw-r--r--app/cwm/calmwm.h4
-rw-r--r--app/cwm/client.c24
-rw-r--r--app/cwm/kbfunc.c13
-rw-r--r--app/cwm/xevents.c15
4 files changed, 27 insertions, 29 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h
index 1fd830537..b2e405cf8 100644
--- a/app/cwm/calmwm.h
+++ b/app/cwm/calmwm.h
@@ -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.
*
- * $OpenBSD: calmwm.h,v 1.349 2017/12/29 16:55:50 okan Exp $
+ * $OpenBSD: calmwm.h,v 1.350 2017/12/29 18:50:43 okan Exp $
*/
#ifndef _CALMWM_H_
@@ -389,7 +389,6 @@ void client_applysizehints(struct client_ctx *);
void client_config(struct client_ctx *);
struct client_ctx *client_current(void);
void client_cycle(struct screen_ctx *, int);
-void client_cycle_leave(struct screen_ctx *);
void client_delete(struct client_ctx *);
void client_draw_border(struct client_ctx *);
struct client_ctx *client_find(Window);
@@ -401,6 +400,7 @@ void client_lower(struct client_ctx *);
void client_map(struct client_ctx *);
void client_msg(struct client_ctx *, Atom, Time);
void client_move(struct client_ctx *);
+void client_mtf(struct client_ctx *);
int client_inbound(struct client_ctx *, int, int);
struct client_ctx *client_init(Window, struct screen_ctx *, int);
void client_ptr_inbound(struct client_ctx *, int);
diff --git a/app/cwm/client.c b/app/cwm/client.c
index a9776b078..11eac06c4 100644
--- a/app/cwm/client.c
+++ b/app/cwm/client.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.
*
- * $OpenBSD: client.c,v 1.243 2017/12/29 12:54:54 okan Exp $
+ * $OpenBSD: client.c,v 1.244 2017/12/29 18:50:43 okan Exp $
*/
#include <sys/types.h>
@@ -33,7 +33,6 @@
static struct client_ctx *client_next(struct client_ctx *);
static struct client_ctx *client_prev(struct client_ctx *);
-static void client_mtf(struct client_ctx *);
static void client_placecalc(struct client_ctx *);
static void client_wm_protocols(struct client_ctx *);
static void client_mwm_hints(struct client_ctx *);
@@ -683,10 +682,6 @@ client_cycle(struct screen_ctx *sc, int flags)
struct client_ctx *newcc, *oldcc, *prevcc;
int again = 1;
- /* For X apps that ignore events. */
- XGrabKeyboard(X_Dpy, sc->rootwin, True,
- GrabModeAsync, GrabModeAsync, CurrentTime);
-
if (TAILQ_EMPTY(&sc->clientq))
return;
@@ -730,21 +725,6 @@ client_cycle(struct screen_ctx *sc, int flags)
client_ptrwarp(newcc);
}
-void
-client_cycle_leave(struct screen_ctx *sc)
-{
- struct client_ctx *cc;
-
- sc->cycling = 0;
-
- if ((cc = client_current()) != NULL) {
- client_mtf(cc);
- cc->flags &= ~CLIENT_HIGHLIGHT;
- client_draw_border(cc);
- XUngrabKeyboard(X_Dpy, CurrentTime);
- }
-}
-
static struct client_ctx *
client_next(struct client_ctx *cc)
{
@@ -817,7 +797,7 @@ client_placecalc(struct client_ctx *cc)
}
}
-static void
+void
client_mtf(struct client_ctx *cc)
{
struct screen_ctx *sc = cc->sc;
diff --git a/app/cwm/kbfunc.c b/app/cwm/kbfunc.c
index e2ecca18b..cbeba3614 100644
--- a/app/cwm/kbfunc.c
+++ b/app/cwm/kbfunc.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.
*
- * $OpenBSD: kbfunc.c,v 1.157 2017/12/29 16:55:50 okan Exp $
+ * $OpenBSD: kbfunc.c,v 1.158 2017/12/29 18:50:43 okan Exp $
*/
#include <sys/types.h>
@@ -398,7 +398,14 @@ kbfunc_client_vtile(void *ctx, struct cargs *cargs)
void
kbfunc_client_cycle(void *ctx, struct cargs *cargs)
{
- client_cycle(ctx, cargs->flag);
+ struct screen_ctx *sc = ctx;
+
+ /* For X apps that ignore/steal events. */
+ if (cargs->xev == CWM_XEV_KEY)
+ XGrabKeyboard(X_Dpy, sc->rootwin, True,
+ GrabModeAsync, GrabModeAsync, CurrentTime);
+
+ client_cycle(sc, cargs->flag);
}
void
@@ -406,7 +413,7 @@ kbfunc_client_toggle_group(void *ctx, struct cargs *cargs)
{
struct client_ctx *cc = ctx;
- /* For X apps that steal events. */
+ /* For X apps that ignore/steal events. */
if (cargs->xev == CWM_XEV_KEY)
XGrabKeyboard(X_Dpy, cc->win, True,
GrabModeAsync, GrabModeAsync, CurrentTime);
diff --git a/app/cwm/xevents.c b/app/cwm/xevents.c
index aa9856b56..61fe4760c 100644
--- a/app/cwm/xevents.c
+++ b/app/cwm/xevents.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.
*
- * $OpenBSD: xevents.c,v 1.131 2017/12/29 16:55:50 okan Exp $
+ * $OpenBSD: xevents.c,v 1.132 2017/12/29 18:50:43 okan Exp $
*/
/*
@@ -324,6 +324,7 @@ xev_handle_keyrelease(XEvent *ee)
{
XKeyEvent *e = &ee->xkey;
struct screen_ctx *sc;
+ struct client_ctx *cc;
KeySym keysym;
unsigned int i;
@@ -333,7 +334,17 @@ xev_handle_keyrelease(XEvent *ee)
keysym = XkbKeycodeToKeysym(X_Dpy, e->keycode, 0, 0);
for (i = 0; i < nitems(modkeys); i++) {
if (keysym == modkeys[i]) {
- client_cycle_leave(sc);
+ if ((cc = client_current()) != NULL) {
+ if (sc->cycling) {
+ sc->cycling = 0;
+ client_mtf(cc);
+ }
+ if (cc->flags & CLIENT_HIGHLIGHT) {
+ cc->flags &= ~CLIENT_HIGHLIGHT;
+ client_draw_border(cc);
+ }
+ }
+ XUngrabKeyboard(X_Dpy, CurrentTime);
break;
}
}