Index: calmwm.c =================================================================== RCS file: /cvs/xenocara/app/cwm/calmwm.c,v retrieving revision 1.43 diff -p -u -r1.43 calmwm.c --- calmwm.c 24 Aug 2009 21:22:48 -0000 1.43 +++ calmwm.c 5 Nov 2009 04:21:53 -0000 @@ -144,6 +144,7 @@ static void x_setupscreen(struct screen_ctx *sc, u_int which) { Window *wins, w0, w1; + struct client_ctx **clients; XWindowAttributes winattr; XSetWindowAttributes rootattr; int fake; @@ -168,13 +169,17 @@ x_setupscreen(struct screen_ctx *sc, u_i /* Deal with existing clients. */ XQueryTree(X_Dpy, sc->rootwin, &w0, &w1, &wins, &nwins); + clients = xcalloc(nwins, sizeof(struct client_ctx *)); for (i = 0; i < nwins; i++) { XGetWindowAttributes(X_Dpy, wins[i], &winattr); + if (winattr.override_redirect || - winattr.map_state != IsViewable) + winattr.map_state != IsViewable) { + clients[i] = NULL; continue; - client_new(wins[i], sc, winattr.map_state != IsUnmapped); + } + clients[i] = client_new(wins[i], sc, winattr.map_state != IsUnmapped); } XFree(wins); @@ -199,6 +204,13 @@ x_setupscreen(struct screen_ctx *sc, u_i screen_init_xinerama(sc); XSync(X_Dpy, False); + + for (i = 0; i < nwins; i++) { + if (clients[i] == NULL) + continue; + client_updatexinerama(clients[i]); + } + xfree(clients); } static int Index: calmwm.h =================================================================== RCS file: /cvs/xenocara/app/cwm/calmwm.h,v retrieving revision 1.98 diff -p -u -r1.98 calmwm.h --- calmwm.h 27 Aug 2009 01:38:08 -0000 1.98 +++ calmwm.h 5 Nov 2009 04:21:53 -0000 @@ -116,6 +116,7 @@ struct client_ctx { TAILQ_ENTRY(client_ctx) mru_entry; struct screen_ctx *sc; + XineramaScreenInfo *xinerama; Window win; XSizeHints *size; @@ -398,6 +399,7 @@ struct screen_ctx *screen_current(void); void screen_updatestackingorder(void); void screen_init_xinerama(struct screen_ctx *); XineramaScreenInfo *screen_find_xinerama(struct screen_ctx *, int, int); +XineramaScreenInfo *screen_find_ptrxinerama(); void conf_setup(struct conf *, const char *); void conf_client(struct client_ctx *); Index: client.c =================================================================== RCS file: /cvs/xenocara/app/cwm/client.c,v retrieving revision 1.65 diff -p -u -r1.65 client.c --- client.c 25 Sep 2009 15:57:49 -0000 1.65 +++ client.c 5 Nov 2009 04:21:53 -0000 @@ -459,6 +459,17 @@ client_update(struct client_ctx *cc) } void +client_updatexinerama(struct client_ctx *cc) +{ + if (!HasXinerama) + return; + + cc->xinerama = screen_find_xinerama(cc->sc, + cc->geom.x + cc->geom.width / 2, + cc->geom.y + cc->geom.height / 2); +} + +void client_send_delete(struct client_ctx *cc) { if (cc->xproto & CLIENT_PROTO_DELETE) @@ -813,3 +824,4 @@ client_inbound(struct client_ctx *cc, in return (x < cc->geom.width && x >= 0 && y < cc->geom.height && y >= 0); } + Index: group.c =================================================================== RCS file: /cvs/xenocara/app/cwm/group.c,v retrieving revision 1.32 diff -p -u -r1.32 group.c --- group.c 20 Jun 2009 00:55:42 -0000 1.32 +++ group.c 5 Nov 2009 04:21:54 -0000 @@ -77,12 +77,19 @@ static void group_hide(struct group_ctx *gc) { struct client_ctx *cc; + XineramaScreenInfo *info; screen_updatestackingorder(); + if (HasXinerama) + info = screen_find_ptrxinerama(); + gc->nhidden = 0; gc->highstack = 0; TAILQ_FOREACH(cc, &gc->clients, group_entry) { + if (HasXinerama && cc->xinerama != info) + continue; + client_hide(cc); gc->nhidden++; if (cc->stackingorder > gc->highstack) @@ -96,17 +103,28 @@ group_show(struct group_ctx *gc) { struct client_ctx *cc; Window *winlist; + XineramaScreenInfo *info; u_int i; int lastempty = -1; winlist = (Window *) xcalloc(sizeof(*winlist), (gc->highstack + 1)); + if (HasXinerama) + info = screen_find_ptrxinerama(); + /* * Invert the stacking order as XRestackWindows() expects them * top-to-bottom. */ TAILQ_FOREACH(cc, &gc->clients, group_entry) { + if (HasXinerama && cc->xinerama != info) + continue; + + if (cc->stackingorder > gc->highstack) + cc->stackingorder = 0; + winlist[gc->highstack - cc->stackingorder] = cc->win; + client_unhide(cc); } Index: kbfunc.c =================================================================== RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v retrieving revision 1.43 diff -p -u -r1.43 kbfunc.c --- kbfunc.c 5 Sep 2009 16:06:15 -0000 1.43 +++ kbfunc.c 5 Nov 2009 04:21:54 -0000 @@ -89,6 +89,7 @@ kbfunc_moveresize(struct client_ctx *cc, cc->geom.x = cc->sc->xmax - 1; client_move(cc); + client_updatexinerama(cc); xu_ptr_getpos(cc->win, &x, &y); cc->ptr.y = y + my; cc->ptr.x = x + mx; Index: mousefunc.c =================================================================== RCS file: /cvs/xenocara/app/cwm/mousefunc.c,v retrieving revision 1.15 diff -p -u -r1.15 mousefunc.c --- mousefunc.c 27 Aug 2009 01:38:08 -0000 1.15 +++ mousefunc.c 5 Nov 2009 04:21:54 -0000 @@ -162,6 +162,7 @@ mousefunc_window_move(struct client_ctx if (time) { XSync(X_Dpy, False); client_move(cc); + client_updatexinerama(cc); } xu_ptr_ungrab(); return; Index: screen.c =================================================================== RCS file: /cvs/xenocara/app/cwm/screen.c,v retrieving revision 1.17 diff -p -u -r1.17 screen.c --- screen.c 24 Aug 2009 21:22:48 -0000 1.17 +++ screen.c 5 Nov 2009 04:21:54 -0000 @@ -109,3 +109,18 @@ screen_find_xinerama(struct screen_ctx * } return (NULL); } + +/* + * Find which xinerama screen the pointer is on. + */ +XineramaScreenInfo * +screen_find_ptrxinerama() +{ + struct screen_ctx *sc; + int xmouse, ymouse; + + sc = screen_current(); + + xu_ptr_getpos(sc->rootwin, &xmouse, &ymouse); + return screen_find_xinerama(sc, xmouse, ymouse); +} Index: xevents.c =================================================================== RCS file: /cvs/xenocara/app/cwm/xevents.c,v retrieving revision 1.43 diff -p -u -r1.43 xevents.c --- xevents.c 27 Aug 2009 01:38:08 -0000 1.43 +++ xevents.c 5 Nov 2009 04:21:54 -0000 @@ -77,6 +77,7 @@ xev_handle_maprequest(XEvent *ee) } client_ptrwarp(cc); + client_updatexinerama(cc); } static void