mirror of https://github.com/0intro/wmii
Deal with a particular Qt systray replacement bug. Cleanup a bit more politely on sigterm/sigint.
This commit is contained in:
parent
7eb2bef1bd
commit
6594959ce8
|
@ -5,7 +5,7 @@ include $(ROOT)/mk/wmii.mk
|
||||||
main.c: $(ROOT)/mk/wmii.mk
|
main.c: $(ROOT)/mk/wmii.mk
|
||||||
|
|
||||||
TARG = witray
|
TARG = witray
|
||||||
HFILES= dat.h fns.h
|
HFILES= dat.h fns.h selection.h
|
||||||
|
|
||||||
PACKAGES += $(X11PACKAGES)
|
PACKAGES += $(X11PACKAGES)
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ client_manage(XWindow w) {
|
||||||
XAddToSaveSet(display, w);
|
XAddToSaveSet(display, w);
|
||||||
c->xembed = xembed_swallow(tray.win, &c->w, client_cleanup);
|
c->xembed = xembed_swallow(tray.win, &c->w, client_cleanup);
|
||||||
if(traperrors(false)) {
|
if(traperrors(false)) {
|
||||||
fprint(1, "client_manage(0x%ulx): Caught error.\n", w);
|
fprint(2, "client_manage(0x%ulx): Caught error.\n", w);
|
||||||
if(c->xembed)
|
if(c->xembed)
|
||||||
xembed_disown(c->xembed);
|
xembed_disown(c->xembed);
|
||||||
return;
|
return;
|
||||||
|
@ -112,7 +112,7 @@ void
|
||||||
client_opcode(Client *c, long message, long l1, long l2, long l3) {
|
client_opcode(Client *c, long message, long l1, long l2, long l3) {
|
||||||
Message *m, **mp;
|
Message *m, **mp;
|
||||||
|
|
||||||
Dprint("client_opcode(%p, %s, %lx, %lx, %lx)\n",
|
Dprint("client_opcode(%p, %s, %ulx, %ulx, %ulx)\n",
|
||||||
c,
|
c,
|
||||||
message == TrayRequestDock ? "TrayRequestDock" :
|
message == TrayRequestDock ? "TrayRequestDock" :
|
||||||
message == TrayBeginMessage ? "TrayBeginMessage" :
|
message == TrayBeginMessage ? "TrayBeginMessage" :
|
||||||
|
|
|
@ -33,9 +33,11 @@ cleanup_handler(int signal) {
|
||||||
sa.sa_handler = SIG_DFL;
|
sa.sa_handler = SIG_DFL;
|
||||||
sigaction(signal, &sa, nil);
|
sigaction(signal, &sa, nil);
|
||||||
|
|
||||||
|
selection_release(tray.selection);
|
||||||
srv.running = false;
|
srv.running = false;
|
||||||
|
|
||||||
switch(signal) {
|
switch(signal) {
|
||||||
|
case SIGINT:
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
sa.sa_handler = cleanup_handler;
|
sa.sa_handler = cleanup_handler;
|
||||||
sigaction(SIGALRM, &sa, nil);
|
sigaction(SIGALRM, &sa, nil);
|
||||||
|
@ -45,8 +47,6 @@ cleanup_handler(int signal) {
|
||||||
break;
|
break;
|
||||||
case SIGALRM:
|
case SIGALRM:
|
||||||
raise(SIGTERM);
|
raise(SIGTERM);
|
||||||
case SIGINT:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ message(Selection *s, XClientMessageEvent *ev) {
|
||||||
USED(s);
|
USED(s);
|
||||||
|
|
||||||
Dprint("message(%A) 0x%lx\n", ev->message_type, ev->window);
|
Dprint("message(%A) 0x%lx\n", ev->message_type, ev->window);
|
||||||
Dprint("\t0x%lx, 0x%lx, 0x%lx, 0x%lx, 0x%lx\n",
|
Dprint("\t0x%lx, 0x%lx, 0x%ulx, 0x%ulx, 0x%ulx\n",
|
||||||
ev->data.l[0], ev->data.l[1], ev->data.l[2], ev->data.l[3], ev->data.l[4]);
|
ev->data.l[0], ev->data.l[1], ev->data.l[2], ev->data.l[3], ev->data.l[4]);
|
||||||
|
|
||||||
w = findwin(ev->window);
|
w = findwin(ev->window);
|
||||||
|
|
|
@ -104,10 +104,10 @@ selection_manage(char *selection, ulong time,
|
||||||
|
|
||||||
void
|
void
|
||||||
selection_release(Selection *s) {
|
selection_release(Selection *s) {
|
||||||
if(!s->time_end)
|
|
||||||
XSetSelectionOwner(display, xatom(s->selection), None, s->time_start);
|
|
||||||
if(s->cleanup)
|
if(s->cleanup)
|
||||||
s->cleanup(s);
|
s->cleanup(s);
|
||||||
|
if(!s->time_end)
|
||||||
|
XSetSelectionOwner(display, xatom(s->selection), None, s->time_start);
|
||||||
destroywindow(s->owner);
|
destroywindow(s->owner);
|
||||||
free(s->selection);
|
free(s->selection);
|
||||||
free(s);
|
free(s);
|
||||||
|
|
|
@ -76,8 +76,16 @@ xembed_updateinfo(XEmbed *xembed) {
|
||||||
xembed->version = res[0];
|
xembed->version = res[0];
|
||||||
xembed->flags = res[1];
|
xembed->flags = res[1];
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
/* Deal with a Qt system tray replacement bug. */
|
||||||
|
xembed->flags = XEmbedMapped;
|
||||||
|
}
|
||||||
free(res);
|
free(res);
|
||||||
|
|
||||||
|
Dprint("xembed_updateinfo(0x%ulx) XEmbedMapped=%s\n",
|
||||||
|
xembed->w,
|
||||||
|
xembed->flags & XEmbedMapped ? "true" : "false");
|
||||||
|
|
||||||
if(xembed->flags & XEmbedMapped)
|
if(xembed->flags & XEmbedMapped)
|
||||||
mapwin(xembed->w);
|
mapwin(xembed->w);
|
||||||
else
|
else
|
||||||
|
|
|
@ -39,8 +39,7 @@ to configure, and generally Just Works.
|
||||||
vertically, respectively. Also determines from which edge of
|
vertically, respectively. Also determines from which edge of
|
||||||
the screen windows are shunted to make room for the tray.
|
the screen windows are shunted to make room for the tray.
|
||||||
: -n
|
: -n
|
||||||
Only create a new tray if a previous tray manager is not
|
Do not replace an already running system tray.
|
||||||
already running.
|
|
||||||
: -p <padding>
|
: -p <padding>
|
||||||
Sets the padding between icons and around the edge of the
|
Sets the padding between icons and around the edge of the
|
||||||
tray. In pixels.
|
tray. In pixels.
|
||||||
|
|
Loading…
Reference in New Issue