cvsimport
This commit is contained in:
54
client.c
54
client.c
@@ -36,7 +36,7 @@ static struct client_ctx *client_mruprev(struct client_ctx *);
|
||||
static void client_mtf(struct client_ctx *);
|
||||
static void client_none(struct screen_ctx *);
|
||||
static void client_placecalc(struct client_ctx *);
|
||||
static void client_update(struct client_ctx *);
|
||||
static void client_wm_protocols(struct client_ctx *);
|
||||
static void client_getmwmhints(struct client_ctx *);
|
||||
static int client_inbound(struct client_ctx *, int, int);
|
||||
|
||||
@@ -55,7 +55,7 @@ client_find(Window win)
|
||||
}
|
||||
|
||||
struct client_ctx *
|
||||
client_new(Window win, struct screen_ctx *sc, int mapped)
|
||||
client_init(Window win, struct screen_ctx *sc, int mapped)
|
||||
{
|
||||
struct client_ctx *cc;
|
||||
XClassHint xch;
|
||||
@@ -132,7 +132,8 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
||||
|
||||
xu_ewmh_net_client_list(sc);
|
||||
|
||||
client_update(cc);
|
||||
client_wm_protocols(cc);
|
||||
xu_ewmh_restore_net_wm_state(cc);
|
||||
|
||||
if (mapped)
|
||||
group_autogroup(cc);
|
||||
@@ -149,13 +150,10 @@ client_delete(struct client_ctx *cc)
|
||||
struct screen_ctx *sc = cc->sc;
|
||||
struct winname *wn;
|
||||
|
||||
group_client_delete(cc);
|
||||
|
||||
XGrabServer(X_Dpy);
|
||||
cc->state = WithdrawnState;
|
||||
xu_set_wm_state(cc->win, cc->state);
|
||||
XRemoveFromSaveSet(X_Dpy, cc->win);
|
||||
|
||||
XSync(X_Dpy, False);
|
||||
XUngrabServer(X_Dpy);
|
||||
|
||||
@@ -164,6 +162,9 @@ client_delete(struct client_ctx *cc)
|
||||
|
||||
xu_ewmh_net_client_list(sc);
|
||||
|
||||
if (cc->group != NULL)
|
||||
TAILQ_REMOVE(&cc->group->clients, cc, group_entry);
|
||||
|
||||
if (cc == client_current())
|
||||
client_none(sc);
|
||||
|
||||
@@ -212,7 +213,7 @@ client_setactive(struct client_ctx *cc, int fg)
|
||||
XInstallColormap(X_Dpy, cc->colormap);
|
||||
XSetInputFocus(X_Dpy, cc->win,
|
||||
RevertToPointerRoot, CurrentTime);
|
||||
conf_grab_mouse(cc);
|
||||
conf_grab_mouse(cc->win);
|
||||
/*
|
||||
* If we're in the middle of alt-tabbing, don't change
|
||||
* the order please.
|
||||
@@ -301,6 +302,7 @@ client_maximize(struct client_ctx *cc)
|
||||
|
||||
resize:
|
||||
client_resize(cc, 0);
|
||||
xu_ewmh_set_net_wm_state(cc);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -341,6 +343,7 @@ client_vmaximize(struct client_ctx *cc)
|
||||
|
||||
resize:
|
||||
client_resize(cc, 0);
|
||||
xu_ewmh_set_net_wm_state(cc);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -381,6 +384,7 @@ client_hmaximize(struct client_ctx *cc)
|
||||
|
||||
resize:
|
||||
client_resize(cc, 0);
|
||||
xu_ewmh_set_net_wm_state(cc);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -389,6 +393,7 @@ client_resize(struct client_ctx *cc, int reset)
|
||||
if (reset) {
|
||||
cc->flags &= ~CLIENT_MAXIMIZED;
|
||||
cc->bwidth = Conf.bwidth;
|
||||
xu_ewmh_set_net_wm_state(cc);
|
||||
}
|
||||
|
||||
client_draw_border(cc);
|
||||
@@ -480,46 +485,43 @@ client_draw_border(struct client_ctx *cc)
|
||||
if (cc->active)
|
||||
switch (cc->flags & CLIENT_HIGHLIGHT) {
|
||||
case CLIENT_GROUP:
|
||||
pixel = sc->color[CWM_COLOR_BORDER_GROUP];
|
||||
pixel = sc->xftcolor[CWM_COLOR_BORDER_GROUP].pixel;
|
||||
break;
|
||||
case CLIENT_UNGROUP:
|
||||
pixel = sc->color[CWM_COLOR_BORDER_UNGROUP];
|
||||
pixel = sc->xftcolor[CWM_COLOR_BORDER_UNGROUP].pixel;
|
||||
break;
|
||||
default:
|
||||
pixel = sc->color[CWM_COLOR_BORDER_ACTIVE];
|
||||
pixel = sc->xftcolor[CWM_COLOR_BORDER_ACTIVE].pixel;
|
||||
break;
|
||||
}
|
||||
else
|
||||
pixel = sc->color[CWM_COLOR_BORDER_INACTIVE];
|
||||
pixel = sc->xftcolor[CWM_COLOR_BORDER_INACTIVE].pixel;
|
||||
|
||||
XSetWindowBorderWidth(X_Dpy, cc->win, cc->bwidth);
|
||||
XSetWindowBorder(X_Dpy, cc->win, pixel);
|
||||
}
|
||||
|
||||
static void
|
||||
client_update(struct client_ctx *cc)
|
||||
client_wm_protocols(struct client_ctx *cc)
|
||||
{
|
||||
Atom *p;
|
||||
int i;
|
||||
long n;
|
||||
int i, j;
|
||||
|
||||
if ((n = xu_getprop(cc->win, cwmh[WM_PROTOCOLS].atom,
|
||||
XA_ATOM, 20L, (u_char **)&p)) <= 0)
|
||||
return;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
if (p[i] == cwmh[WM_DELETE_WINDOW].atom)
|
||||
cc->xproto |= CLIENT_PROTO_DELETE;
|
||||
else if (p[i] == cwmh[WM_TAKE_FOCUS].atom)
|
||||
cc->xproto |= CLIENT_PROTO_TAKEFOCUS;
|
||||
|
||||
XFree(p);
|
||||
if (XGetWMProtocols(X_Dpy, cc->win, &p, &j)) {
|
||||
for (i = 0; i < j; i++) {
|
||||
if (p[i] == cwmh[WM_DELETE_WINDOW].atom)
|
||||
cc->xproto |= _WM_DELETE_WINDOW;
|
||||
else if (p[i] == cwmh[WM_TAKE_FOCUS].atom)
|
||||
cc->xproto |= _WM_TAKE_FOCUS;
|
||||
}
|
||||
XFree(p);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
client_send_delete(struct client_ctx *cc)
|
||||
{
|
||||
if (cc->xproto & CLIENT_PROTO_DELETE)
|
||||
if (cc->xproto & _WM_DELETE_WINDOW)
|
||||
xu_sendmsg(cc->win,
|
||||
cwmh[WM_PROTOCOLS].atom, cwmh[WM_DELETE_WINDOW].atom);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user