Sending a SIGTERM to FvwmButtons works to gracefully unswallow a
program called stalonetray which is a system tray. Setting -transient
on the FvwmButtons panel is calling XDestroyWindow and in term causes
the programs with items in the system tray to crash with a bad window
error. I'm removing the XDestroyWindow call and letting all transient
exit paths exit through the main loop.
---
What I'm really after is a way to access icons in a system tray
without it taking up screen space except when I'm wanting to use it.
A recent change in behavior leaves me with only blueman-applet able to
disable or enable bluetooth (that I know of right now), but it only
shows up in a toolbar. So I set myself up FvwmButtons
*SystemTrayButtons: (5x1+1+0 Size 0 0 Swallow \
(NoClose Hints UseOld NoTitle) "stalonetray" \
'Exec stalonetray -geometry 4x1-30000-30000')
and a menu button to start it,
+ "&SystemTray" Module FvwmButtons -g +0-0 -transient SystemTrayButtons
Which works great with the following patch. I only see it when I want
to use it, and I can close it again when I'm done. I would have
preferred to have swallowed stalonetray up in a submenu, but this
patch was much smaller I'm sure. I would have also liked to have used
the -transientpanel option to FvwmButtons, but that seems to only work
from another FvwmButton panel, Running 'Module FvwmButtons
SystemTrayButtons' in general outside of that would just create a new
FvwmButtons, but this will do.
Can anyone thing of a case that XDestroyWindow is needed here?
modules/FvwmButtons/FvwmButtons.c | 22 ++++------------------
1 files changed, 4 insertions(+), 18 deletions(-)
diff --git a/modules/FvwmButtons/FvwmButtons.c
b/modules/FvwmButtons/FvwmButtons.c
index 1938a7c..96ec634 100644
--- a/modules/FvwmButtons/FvwmButtons.c
+++ b/modules/FvwmButtons/FvwmButtons.c
@@ -943,7 +943,7 @@ void ButtonPressProcess (button_info *b, char **act)
{
/* terminate if transient and panel has been
* unmapped */
- exit(0);
+ isTerminated = 1;
}
else if (is_transient_panel)
{
@@ -996,18 +996,11 @@ void ButtonPressProcess (button_info *b, char **act)
i2++;
}
strcat(tmp.name ,&(*act)[i2]);
- if (is_transient)
- {
- /* delete the window before continuing
- */
- XDestroyWindow(Dpy, MyWindow);
- XSync(Dpy, 0);
- }
SendText(fd,tmp.name,0);
if (is_transient)
{
/* and exit */
- exit(0);
+ isTerminated = 1;
}
if (is_transient_panel)
{
@@ -1021,18 +1014,11 @@ void ButtonPressProcess (button_info *b, char **act)
SaveButtons(UberButton);
else
{
- if (is_transient)
- {
- /* delete the window before continuing
- */
- XDestroyWindow(Dpy, MyWindow);
- XSync(Dpy, 0);
- }
SendText(fd,*act,0);
if (is_transient)
{
/* and exit */
- exit(0);
+ isTerminated = 1;
}
if (is_transient_panel)
{
@@ -1495,7 +1481,7 @@ void Loop(void)
if (b->newflags.is_panel && is_transient)
{
/* terminate if transient and a panel has been killed */
- exit(0);
+ isTerminated = 1;
}
b->swallow |= 1;
if (!b->newflags.is_panel)
--
1.7.7.1