diff options
Diffstat (limited to '')
-rw-r--r-- | calmwm.h | 5 | ||||
-rw-r--r-- | client.c | 12 | ||||
-rw-r--r-- | screen.c | 7 | ||||
-rw-r--r-- | xevents.c | 4 | ||||
-rw-r--r-- | xutil.c | 18 |
5 files changed, 32 insertions, 14 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: calmwm.h,v 1.311 2015/11/12 21:28:03 okan Exp $ + * $OpenBSD: calmwm.h,v 1.312 2016/09/16 14:32:02 okan Exp $ */ #ifndef _CALMWM_H_ @@ -398,7 +398,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 *); -struct client_ctx *client_init(Window, struct screen_ctx *); +struct client_ctx *client_init(Window, struct screen_ctx *, int); void client_ptrsave(struct client_ctx *); void client_ptrwarp(struct client_ctx *); void client_raise(struct client_ctx *); @@ -564,6 +564,7 @@ void xu_ewmh_net_workarea(struct screen_ctx *); void xu_ewmh_net_client_list(struct screen_ctx *); void xu_ewmh_net_client_list_stacking(struct screen_ctx *); void xu_ewmh_net_active_window(struct screen_ctx *, Window); +Window xu_ewmh_get_net_active_window(struct screen_ctx *); void xu_ewmh_net_wm_desktop_viewport(struct screen_ctx *); void xu_ewmh_net_wm_number_of_desktops(struct screen_ctx *); void xu_ewmh_net_showing_desktop(struct screen_ctx *); @@ -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.221 2016/09/14 21:00:24 okan Exp $ + * $OpenBSD: client.c,v 1.222 2016/09/16 14:32:02 okan Exp $ */ #include <sys/types.h> @@ -43,13 +43,13 @@ static int client_inbound(struct client_ctx *, int, int); struct client_ctx *curcc = NULL; struct client_ctx * -client_init(Window win, struct screen_ctx *sc) +client_init(Window win, struct screen_ctx *sc, int active) { struct client_ctx *cc; XWindowAttributes wattr; int mapped; Window rwin, cwin; - int x, y, wx, wy, activate = 0; + int x, y, wx, wy; unsigned int mask; if (win == None) @@ -105,9 +105,9 @@ client_init(Window win, struct screen_ctx *sc) if ((cc->wmh) && (cc->wmh->flags & StateHint)) client_set_wm_state(cc, cc->wmh->initial_state); } else { - if ((XQueryPointer(X_Dpy, cc->win, &rwin, &cwin, + if ((active == 0) && (XQueryPointer(X_Dpy, cc->win, &rwin, &cwin, &x, &y, &wx, &wy, &mask)) && (cwin != None)) - activate = 1; + active = 1; } XSelectInput(X_Dpy, cc->win, ColormapChangeMask | EnterWindowMask | @@ -145,7 +145,7 @@ out: XSync(X_Dpy, False); XUngrabServer(X_Dpy); - if (activate) + if (active) client_setactive(cc); return(cc); @@ -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: screen.c,v 1.79 2015/11/11 14:22:01 okan Exp $ + * $OpenBSD: screen.c,v 1.80 2016/09/16 14:32:02 okan Exp $ */ #include <sys/types.h> @@ -35,7 +35,7 @@ void screen_init(int which) { struct screen_ctx *sc; - Window *wins, w0, w1; + Window *wins, w0, w1, active = None; XSetWindowAttributes rootattr; unsigned int nwins, i; @@ -65,6 +65,7 @@ screen_init(int which) xu_ewmh_net_wm_number_of_desktops(sc); xu_ewmh_net_showing_desktop(sc); xu_ewmh_net_virtual_roots(sc); + active = xu_ewmh_get_net_active_window(sc); rootattr.cursor = Conf.cursor[CF_NORMAL]; rootattr.event_mask = SubstructureRedirectMask | @@ -77,7 +78,7 @@ screen_init(int which) /* Deal with existing clients. */ if (XQueryTree(X_Dpy, sc->rootwin, &w0, &w1, &wins, &nwins)) { for (i = 0; i < nwins; i++) - (void)client_init(wins[i], sc); + (void)client_init(wins[i], sc, (active == wins[i])); XFree(wins); } @@ -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.121 2016/09/14 19:45:33 okan Exp $ + * $OpenBSD: xevents.c,v 1.122 2016/09/16 14:32:02 okan Exp $ */ /* @@ -81,7 +81,7 @@ xev_handle_maprequest(XEvent *ee) client_ptrsave(old_cc); if ((cc = client_find(e->window)) == NULL) - cc = client_init(e->window, NULL); + cc = client_init(e->window, NULL, 0); if ((cc != NULL) && (!(cc->flags & CLIENT_IGNORE))) client_ptrwarp(cc); @@ -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: xutil.c,v 1.103 2015/08/27 18:53:15 okan Exp $ + * $OpenBSD: xutil.c,v 1.104 2016/09/16 14:32:02 okan Exp $ */ #include <sys/types.h> @@ -256,6 +256,22 @@ xu_ewmh_net_active_window(struct screen_ctx *sc, Window w) XA_WINDOW, 32, PropModeReplace, (unsigned char *)&w, 1); } +Window +xu_ewmh_get_net_active_window(struct screen_ctx *sc) +{ + long *p; + Window win; + + if ((xu_getprop(sc->rootwin, ewmh[_NET_ACTIVE_WINDOW], + XA_WINDOW, 32, (unsigned char **)&p)) <= 0) + return(None); + + win = (Window)*p; + XFree(p); + + return(win); +} + void xu_ewmh_net_wm_desktop_viewport(struct screen_ctx *sc) { |