Hi,

I think bugs #105351 ("omnipresent icons disappear when first clicked") and
#316044 ("docked apps disappear in special situation") refer to the same
problem and should be closed after applying the enclosed patch.

In function wWorkspaceRestoreState() (file src/workspace.c), after
restoring each workspace, all omnipresent appicons are made omnipresent
(with wClipMakeIconOmnipresent(): the appicons are prepended to the list of
global_icons) and then are merely mapped (with XMapWindow()), but are not
actually _moved_ from workspace[i] to workspace[0], which the proposed
patch does.

To prove this is the cause of the two bug reports, I describe in details
what is happening in each of them. The critical condition to reproduce
these bugs is to exit (or restart) WM from a workspace **different from
workspace 0** (any other workspace will do) and to have, obviously, at
least one omnipresent appicon docked in the clip.


In bug #105351, Alessandro Dalvit <[EMAIL PROTECTED]> wrote:

> I have 4 virtual desktops in WindowMaker, and the icon of rxvt in the
> clip set as Omnipresent; if I start X and click on this icon it
> disappears,

Excerpt from src/dock.c, function handleIconMove, lines 3968--3975:

            if (omnipresent) {
                int i;
                for (i=0; i<scr->workspace_count; i++) {
                    if (i == scr->current_workspace)
                        continue;
                    wDockHideIcons(scr->workspaces[i]->clip);
                }
            }

After "moving" the rxvt appicon (which is omnipresent), the code cycle
through all workspaces (except the current one) and hides their appicons
(to undo lines 3843--3850). The problem is, the omnipresent appicons still
belong to workspace[i] (for some i), and are thus unmapped at this point.

>             but it's sufficient to swap to another desktop to make it
> appear again.  The problem doesn't happen anymore, until I close X and
> run it again;

Indeed, wWorkspaceForceChange() calls wClipUpdateForWorkspaceChange(),
which moves all omnipresent appicons to the correct workspace and fixes the
issue until WM ends.

>                even restarting only wmaker doesn't seem to recreate the
> conditions for the problem to happen.

It does, if the "restart" is called from workspace i, i > 0.

>                                        I've been using wmaker for a
> couple years and the this happened in all the versions I tried.


In bug #316044, Mario Frasca <[EMAIL PROTECTED]> wrote:

> [...]
> quite intermittently, the following bug appears: after logging in,
> before moving to another workspace, I click (single click is enough) on
> a wmWeather unstarted dock and the whole set of docks disappears,
> leaving the clip in some sort of collapsed mode (by way of explaining,
> but not literally, because the clip retains its colors typical for
> uncollapsed mode).
>
> moving to an other workspace makes the docked applications show up
> again.  clicking on an unstarted dockapp does not cause the bug any
> more, it is something which happens only once per session and only if I
> do not change workspace before clicking on a non started dockapp.

Same as above.

> immediately after logging in, before moving to a workspace other than
> #1, I click and drag the clip and only those dockapps which are not
> omnipresent move following the dragged clip. [...]

moveDock(), called by handleDockMove(), only (and quite logically) moves
appicons that appear in the clip's icon_array, which doesn't include the
omnipresent appicons until the first workspace switch. So non-omnipresent
appicons are dragged but not the omnipresent ones.

The enclosed patch applies to wmaker-0.92.0-5.3. Please apply it (or
let me know why not! ;-) and forward it to upstream.

Best,
-- 
Daniel Déchelotte
                  http://yo.dan.free.fr/
diff -Naur -x 74_omnipresent_appicon_startup.diff 
wmaker-0.92.0-1-a/src/workspace.c wmaker-0.92.0-1-b/src/workspace.c
--- wmaker-0.92.0-1-a/src/workspace.c   2005-08-08 11:54:42.000000000 +0200
+++ wmaker-0.92.0-1-b/src/workspace.c   2005-08-08 11:55:02.000000000 +0200
@@ -1519,6 +1519,8 @@
         wfree(scr->workspaces[i]->name);
         scr->workspaces[i]->name = wstrdup(WMGetFromPLString(pstr));
         if (!wPreferences.flags.noclip) {
+            int omnipresent_icons_added = 0;
+
             clip_state = WMGetFromPLDictionary(wks_state, dClip);
             if (scr->workspaces[i]->clip)
                 wDockDestroy(scr->workspaces[i]->clip);
@@ -1534,13 +1536,30 @@
              */
             for (j=0; j<scr->workspaces[i]->clip->max_icons; j++) {
                 WAppIcon *aicon = scr->workspaces[i]->clip->icon_array[j];
+                int index;
+
+                if (!aicon || !aicon->omnipresent)
+                    continue;
+                aicon->omnipresent = 0;
+                if (wClipMakeIconOmnipresent(aicon, True) != WO_SUCCESS)
+                    continue;
+                if (i == 0)
+                    continue;
+
+                /* Move this appicon from workspace i to workspace 0 */
+                scr->workspaces[i]->clip->icon_array[j] = NULL;
+                scr->workspaces[i]->clip->icon_count--;
 
-                if (aicon && aicon->omnipresent) {
-                    aicon->omnipresent = 0;
-                    wClipMakeIconOmnipresent(aicon, True);
-                    XMapWindow(dpy, aicon->icon->core->window);
-                }
+                omnipresent_icons_added++;
+                assert (scr->workspaces[0]->clip->icon_count + 
omnipresent_icons_added
+                        <= scr->workspaces[0]->clip->max_icons);
+                for (index = 0; index < scr->workspaces[0]->clip->max_icons; 
index++)
+                    if (scr->workspaces[0]->clip->icon_array[index] == NULL)
+                        break;
+                scr->workspaces[0]->clip->icon_array[index] = aicon;
+                aicon->dock = scr->workspaces[0]->clip;
             }
+            scr->workspaces[0]->clip->icon_count += omnipresent_icons_added;
         }
 
         WMPostNotificationName(WMNWorkspaceNameChanged, scr, (void*)i);

Reply via email to