fns.h, menu.c, client.c, event.c: more reliably ensure active window on delete and virtswitch
This commit is contained in:
parent
ae87896421
commit
836136e153
4 changed files with 12 additions and 10 deletions
5
client.c
5
client.c
|
@ -336,3 +336,8 @@ int isautostick(Client* c) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void ensureactive() {
|
||||||
|
if (!current)
|
||||||
|
shuffle(0);
|
||||||
|
}
|
||||||
|
|
4
event.c
4
event.c
|
@ -306,9 +306,7 @@ void destroy(Window w) {
|
||||||
currents[i] = 0;
|
currents[i] = 0;
|
||||||
|
|
||||||
rmclient(c);
|
rmclient(c);
|
||||||
//if (v == virt) {
|
ensureactive();
|
||||||
// shuffle(0);
|
|
||||||
//}
|
|
||||||
|
|
||||||
/* flush any errors generated by the window's sudden demise */
|
/* flush any errors generated by the window's sudden demise */
|
||||||
ignore_badwindow = 1;
|
ignore_badwindow = 1;
|
||||||
|
|
1
fns.h
1
fns.h
|
@ -97,6 +97,7 @@ void dump_revert();
|
||||||
void dump_clients();
|
void dump_clients();
|
||||||
void shuffle(int);
|
void shuffle(int);
|
||||||
int isautostick(Client* c);
|
int isautostick(Client* c);
|
||||||
|
void ensureactive();
|
||||||
|
|
||||||
/* grab.c */
|
/* grab.c */
|
||||||
int menuhit();
|
int menuhit();
|
||||||
|
|
12
menu.c
12
menu.c
|
@ -298,14 +298,11 @@ void delete (Client* c, int shift) {
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
return;
|
return;
|
||||||
//v = c->virt;
|
//v = c->virt;
|
||||||
if ((c->proto & Pdelete) && !shift) {
|
if ((c->proto & Pdelete) && !shift)
|
||||||
sendcmessage(c->window, wm_protocols, wm_delete, 0, 0);
|
sendcmessage(c->window, wm_protocols, wm_delete, 0, 0);
|
||||||
if (!current) {
|
|
||||||
shuffle(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
XKillClient(dpy, c->window); /* let event clean up */
|
XKillClient(dpy, c->window); /* let event clean up */
|
||||||
|
ensureactive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void hide(Client* c) {
|
void hide(Client* c) {
|
||||||
|
@ -469,7 +466,9 @@ void switch_to(int n) {
|
||||||
|
|
||||||
switch_to_c(n, clients);
|
switch_to_c(n, clients);
|
||||||
current = currents[virt];
|
current = currents[virt];
|
||||||
|
ensureactive();
|
||||||
top(current);
|
top(current);
|
||||||
|
#ifdef VIRTNOTIFY
|
||||||
if (fork() == 0) {
|
if (fork() == 0) {
|
||||||
close(ConnectionNumber(dpy));
|
close(ConnectionNumber(dpy));
|
||||||
if (dpy != '\0')
|
if (dpy != '\0')
|
||||||
|
@ -477,7 +476,6 @@ void switch_to(int n) {
|
||||||
signal(SIGINT, SIG_DFL);
|
signal(SIGINT, SIG_DFL);
|
||||||
signal(SIGTERM, SIG_DFL);
|
signal(SIGTERM, SIG_DFL);
|
||||||
signal(SIGHUP, SIG_DFL);
|
signal(SIGHUP, SIG_DFL);
|
||||||
#ifdef VIRTNOTIFY
|
|
||||||
sprintf(virtmsg, VIRTMSG, b2items[virt]);
|
sprintf(virtmsg, VIRTMSG, b2items[virt]);
|
||||||
execlp(
|
execlp(
|
||||||
"notify-send",
|
"notify-send",
|
||||||
|
@ -487,8 +485,8 @@ void switch_to(int n) {
|
||||||
VIRTHEADER,
|
VIRTHEADER,
|
||||||
virtmsg,
|
virtmsg,
|
||||||
(char*)0);
|
(char*)0);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void initb2menu(int n) { b2items[n] = 0; }
|
void initb2menu(int n) { b2items[n] = 0; }
|
||||||
|
|
Loading…
Reference in a new issue