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