Xinqi Bao's Git
projects
/
dwm.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
made bar togglalble
[dwm.git]
/
client.c
diff --git
a/client.c
b/client.c
index
64da343
..
cf3a686
100644
(file)
--- a/
client.c
+++ b/
client.c
@@
-152,6
+152,14
@@
focus(Client *c) {
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
}
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
}
+void
+focustopvisible(void) {
+ Client *c;
+
+ for(c = stack; c && !isvisible(c); c = c->snext);
+ focus(c);
+}
+
void
killclient(const char *arg) {
XEvent ev;
void
killclient(const char *arg) {
XEvent ev;
@@
-365,9
+373,8
@@
updatetitle(Client *c) {
XGetWMName(dpy, c->win, &name);
if(!name.nitems)
return;
XGetWMName(dpy, c->win, &name);
if(!name.nitems)
return;
- if(name.encoding == XA_STRING)
{
+ if(name.encoding == XA_STRING)
strncpy(c->name, (char *)name.value, sizeof c->name - 1);
strncpy(c->name, (char *)name.value, sizeof c->name - 1);
- }
else {
if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success
&& n > 0 && *list)
else {
if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success
&& n > 0 && *list)
@@
-382,7
+389,6
@@
updatetitle(Client *c) {
void
unmanage(Client *c) {
void
unmanage(Client *c) {
- Client *nc;
XWindowChanges wc;
wc.border_width = c->oldborder;
XWindowChanges wc;
wc.border_width = c->oldborder;
@@
-392,10
+398,8
@@
unmanage(Client *c) {
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
detach(c);
detachstack(c);
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
detach(c);
detachstack(c);
- if(sel == c) {
- for(nc = stack; nc && !isvisible(nc); nc = nc->snext);
- focus(nc);
- }
+ if(sel == c)
+ focustopvisible();
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
setclientstate(c, WithdrawnState);
free(c->tags);
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
setclientstate(c, WithdrawnState);
free(c->tags);