Permalink
Browse files

Deal with a particular Qt systray replacement bug. Cleanup a bit more…

… politely on sigterm/sigint.
  • Loading branch information...
1 parent 143ae44 commit e97f1337d5bed2d45ddbe4e044d6668ee1783ae7 Kris Maglione committed Sep 20, 2011
Showing with 17 additions and 10 deletions.
  1. +1 −1 cmd/tray/Makefile
  2. +2 −2 cmd/tray/client.c
  3. +3 −3 cmd/tray/main.c
  4. +2 −2 cmd/tray/selection.c
  5. +8 −0 cmd/tray/xembed.c
  6. +1 −2 man/witray.man1
View
@@ -5,7 +5,7 @@ include $(ROOT)/mk/wmii.mk
main.c: $(ROOT)/mk/wmii.mk
TARG = witray
-HFILES= dat.h fns.h
+HFILES= dat.h fns.h selection.h
PACKAGES += $(X11PACKAGES)
View
@@ -27,7 +27,7 @@ client_manage(XWindow w) {
XAddToSaveSet(display, w);
c->xembed = xembed_swallow(tray.win, &c->w, client_cleanup);
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)
xembed_disown(c->xembed);
return;
@@ -112,7 +112,7 @@ void
client_opcode(Client *c, long message, long l1, long l2, long l3) {
Message *m, **mp;
- Dprint("client_opcode(%p, %s, %lx, %lx, %lx)\n",
+ Dprint("client_opcode(%p, %s, %ulx, %ulx, %ulx)\n",
c,
message == TrayRequestDock ? "TrayRequestDock" :
message == TrayBeginMessage ? "TrayBeginMessage" :
View
@@ -33,9 +33,11 @@ cleanup_handler(int signal) {
sa.sa_handler = SIG_DFL;
sigaction(signal, &sa, nil);
+ selection_release(tray.selection);
srv.running = false;
switch(signal) {
+ case SIGINT:
case SIGTERM:
sa.sa_handler = cleanup_handler;
sigaction(SIGALRM, &sa, nil);
@@ -45,8 +47,6 @@ cleanup_handler(int signal) {
break;
case SIGALRM:
raise(SIGTERM);
- case SIGINT:
- break;
}
}
@@ -81,7 +81,7 @@ message(Selection *s, XClientMessageEvent *ev) {
USED(s);
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]);
w = findwin(ev->window);
View
@@ -104,10 +104,10 @@ selection_manage(char *selection, ulong time,
void
selection_release(Selection *s) {
- if(!s->time_end)
- XSetSelectionOwner(display, xatom(s->selection), None, s->time_start);
if(s->cleanup)
s->cleanup(s);
+ if(!s->time_end)
+ XSetSelectionOwner(display, xatom(s->selection), None, s->time_start);
destroywindow(s->owner);
free(s->selection);
free(s);
View
@@ -76,8 +76,16 @@ xembed_updateinfo(XEmbed *xembed) {
xembed->version = res[0];
xembed->flags = res[1];
}
+ else {
+ /* Deal with a Qt system tray replacement bug. */
+ xembed->flags = XEmbedMapped;
+ }
free(res);
+ Dprint("xembed_updateinfo(0x%ulx) XEmbedMapped=%s\n",
+ xembed->w,
+ xembed->flags & XEmbedMapped ? "true" : "false");
+
if(xembed->flags & XEmbedMapped)
mapwin(xembed->w);
else
View
@@ -39,8 +39,7 @@ to configure, and generally Just Works.
vertically, respectively. Also determines from which edge of
the screen windows are shunted to make room for the tray.
: -n
- Only create a new tray if a previous tray manager is not
- already running.
+ Do not replace an already running system tray.
: -p <padding>
Sets the padding between icons and around the edge of the
tray. In pixels.

0 comments on commit e97f133

Please sign in to comment.