Comment 6 for bug 1827302

Revision history for this message
Matias N. Goldberg (dark-sylinc) wrote :

This bug started in Slack 3.4.0 and affects Xubuntu 18.04.2 LTS too.

The problem happens because xfwm4 looks for any of the following:
"_NET_WM_WINDOW_TYPE_DESKTOP",
"_NET_WM_WINDOW_TYPE_DIALOG",
"_NET_WM_WINDOW_TYPE_DOCK",
"_NET_WM_WINDOW_TYPE_MENU",
"_NET_WM_WINDOW_TYPE_NORMAL",
"_NET_WM_WINDOW_TYPE_SPLASH",
"_NET_WM_WINDOW_TYPE_TOOLBAR",
"_NET_WM_WINDOW_TYPE_UTILITY",

But Slack doesn't set them.

I compiled xfwm4 from source, debugged remotely (it is nearly impossible to halt the window manager in the host machine...) and the problem boils down to:

1. clientCycleCreateList in cycle.c calls:

    if (!clientSelectMask (c2, NULL, search_range, WINDOW_REGULAR_FOCUSABLE))
    {
        TRACE ("%s not in select mask", c2->name);
        continue;
    }

2. Inside clientSelectMask in focus.c, c2->type = 0; thus "return c2->type & mask" returns 0 regardless of the mask and thinks the window should not be alt-tabbed

3. I believe (not 100% sure) this happens because in clientWindowType in netwm.c, c->type_atom == None. I don't know whether this should be treated as a client bug or a window manager bug. I'm not an X11 expert so I don't know if it is possible to know if a window is the root one, but root windows should definitely be alt-tabbeable.

If I change the line to:

    if (!clientSelectMask (c2, NULL, search_range, WINDOW_REGULAR_FOCUSABLE) && c2->type != UNSET)

Then Slack works with alt+tab and my computer hasn't blown up yet. I don't know if it's the proper fix though, but it may be

I fixed this problem by rebuilding xfwm4 with the attached patch:

    mkdir tmp
    cd tmp
    sudo apt install devscripts build-essential fakeroot dpkg-dev
    sudo apt-get build-dep xfwm4
    apt-get source xfwm4
    cd xfwm4-4.12.5
    patch -i xfwm4_slack_fix.diff #Point it where the patch is located!!!
    debuild -b -uc -us
    sudo dpkg -i ../xfwm4_4.12.5-1ubuntu0.18.04.1_amd64.deb