mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
cvsimport
* refs/heads/master: During init, query screen for _NET_ACTIVE_WINDOW and set that client as active; while we already look at what's under the pointer, use this information first, then look under the pointer (saving that round-trip). This restores the active state to a client after restart even if the pointer is not above it (and of course the pointer is not above another client).
This commit is contained in:
commit
fa06851b0e
3
calmwm.h
3
calmwm.h
@ -419,7 +419,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 *);
|
||||
@ -585,6 +585,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 *);
|
||||
|
10
client.c
10
client.c
@ -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);
|
||||
|
5
screen.c
5
screen.c
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
16
xutil.c
16
xutil.c
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user