diff options
author | okan | 2013-11-27 00:01:23 +0000 |
---|---|---|
committer | okan | 2013-11-27 00:01:23 +0000 |
commit | 68b96b00340cd695b13813afd2e72425b831174c (patch) | |
tree | 5c88f7db848abab70b68d37602fbeba85597563f /xevents.c | |
parent | 603548105b9bf9ffd11eb053e62db99f9433e821 (diff) | |
download | cwm-68b96b00340cd695b13813afd2e72425b831174c.tar.gz |
Rewrite active/inactive client handling in client_setactive();
client_leave() served no real purpose, likewise no reason to handle
LeaveNotify events since an EnterNotify will process the next active
client (and we don't have anything important to process anyway), so
xev_handle_leavenotify() goes as well. Allows a simplification of
client_mtf() and client_cycle_leave() for clarity. While here, unify a
few client_current() checks.
No intended behaviour change.
Diffstat (limited to 'xevents.c')
-rw-r--r-- | xevents.c | 23 |
1 files changed, 6 insertions, 17 deletions
@@ -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.92 2013/11/12 21:25:00 okan Exp $ + * $OpenBSD: xevents.c,v 1.93 2013/11/27 00:01:23 okan Exp $ */ /* @@ -43,7 +43,6 @@ static void xev_handle_destroynotify(XEvent *); static void xev_handle_configurerequest(XEvent *); static void xev_handle_propertynotify(XEvent *); static void xev_handle_enternotify(XEvent *); -static void xev_handle_leavenotify(XEvent *); static void xev_handle_buttonpress(XEvent *); static void xev_handle_buttonrelease(XEvent *); static void xev_handle_keypress(XEvent *); @@ -60,7 +59,6 @@ void (*xev_handlers[LASTEvent])(XEvent *) = { [ConfigureRequest] = xev_handle_configurerequest, [PropertyNotify] = xev_handle_propertynotify, [EnterNotify] = xev_handle_enternotify, - [LeaveNotify] = xev_handle_leavenotify, [ButtonPress] = xev_handle_buttonpress, [ButtonRelease] = xev_handle_buttonrelease, [KeyPress] = xev_handle_keypress, @@ -81,7 +79,7 @@ xev_handle_maprequest(XEvent *ee) struct client_ctx *cc = NULL, *old_cc; XWindowAttributes xattr; - if ((old_cc = client_current()) != NULL) + if ((old_cc = client_current())) client_ptrsave(old_cc); if ((cc = client_find(e->window)) == NULL) { @@ -211,13 +209,7 @@ xev_handle_enternotify(XEvent *ee) struct client_ctx *cc; if ((cc = client_find(e->window)) != NULL) - client_setactive(cc, 1); -} - -static void -xev_handle_leavenotify(XEvent *ee) -{ - client_leave(NULL); + client_setactive(cc); } /* We can split this into two event handlers. */ @@ -256,7 +248,7 @@ xev_handle_buttonrelease(XEvent *ee) { struct client_ctx *cc; - if ((cc = client_current()) != NULL) + if ((cc = client_current())) group_sticky_toggle_exit(cc); } @@ -311,17 +303,15 @@ xev_handle_keyrelease(XEvent *ee) { XKeyEvent *e = &ee->xkey; struct screen_ctx *sc; - struct client_ctx *cc; KeySym keysym; u_int i; sc = screen_fromroot(e->root); - cc = client_current(); keysym = XkbKeycodeToKeysym(X_Dpy, e->keycode, 0, 0); for (i = 0; i < nitems(modkeys); i++) { if (keysym == modkeys[i]) { - client_cycle_leave(sc, cc); + client_cycle_leave(sc); break; } } @@ -344,8 +334,7 @@ xev_handle_clientmessage(XEvent *ee) client_send_delete(cc); if (e->message_type == ewmh[_NET_ACTIVE_WINDOW] && e->format == 32) { - old_cc = client_current(); - if (old_cc) + if ((old_cc = client_current())) client_ptrsave(old_cc); client_ptrwarp(cc); } |