sabit / tint2

Automatically exported from code.google.com/p/tint2
GNU General Public License v2.0
0 stars 0 forks source link

Legacy openbox "show desktop" action broken #461

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The openbox "show desktop" action used to hide normal windows but NOT the tint2 
panel.  With r664, openbox "show desktop" now hides the panel like other normal 
windows.

While the hiding issue can be addressed using the openbox native dock 
(panel_dock = 1), this is unacceptable as it 1) breaks compositing (compton), 
and 2) adds unwanted horizontal bars to the top and bottom of the tint2 panel. 
Furthermore, window stacking cannot be set to "normal" (despite correct rc.xml 
configuration) causing a regression to issue 455.

Recommendation: Revert to _NET_WM_WINDOW_TYPE_DOCK to restore legacy 
functionality, and add a fourth state for "panel_layer = float".  This new 
state sets both _NET_WM_STATE_ABOVE and _NET_WM_STATE_BELOW for TYPE_NORMAL 
stacking on TYPE_DOCK windows (on openbox) without affecting the "show desktop" 
action.

Original issue reported on code.google.com by goo...@craigoakes.com on 31 Jan 2015 at 4:33

GoogleCodeExporter commented 9 years ago
I think we can find a better solution. Please let me explain.

The openbox "show desktop" action keeps visible only the desktop window, the 
dock windows and splash windows (see 
http://git.icculus.org/?p=dana/openbox.git;a=blob;f=openbox/client.c;h=c97abd5ac
184d93428f69a40be7ee64b23dfe20f;hb=HEAD#l2806 ).

So to keep tint2 visible on show desktop, *we have to set the window type to 
either dock or splash*.

The layer should remain what the user specifies (bottom, normal or top). 
Setting _NET_WM_STATE_ABOVE and _NET_WM_STATE_BELOW at the same time does not 
make any sense to me. The standard does not suggest that they should be set at 
the same time:

http://standards.freedesktop.org/wm-spec/latest/ar01s05.html
http://standards.freedesktop.org/wm-spec/latest/ar01s09.html#STACKINGORDER

However there is one more thing that is affected by the panel_dock option, 
whether the window is focusable:

    // Unfocusable
    XWMHints wmhints;
    if (panel_dock) {
        wmhints.icon_window = wmhints.window_group = p->main_win;
        wmhints.flags = StateHint | IconWindowHint;
        wmhints.initial_state = WithdrawnState;
    }
    else {
        wmhints.flags = InputHint;
        wmhints.input = False;
    }
    XSetWMHints(server.dsp, p->main_win, &wmhints);

To summarize, we have to solve the following problems:
* tint2 should remain visible on "show desktop".
* tint2 should not have a border in openbox (although tint2 is always 
indicating to the window manager that it should NOT be decorated, so IMHO it is 
openbox's fault that it decides to draw a border; xfwm for instance does not).
* tint2 should be able to stack properly below/above other windows with 
"panel_layer = normal" (issue 455).

We have the following options:
* Set the window state to dock, normal or splash. Whether it is set to dock or 
not should follow the panel_dock option in the config file (as this is what the 
user expects).
* Enable/disable focusability.
* Set the layer to whatever the user indicated in the config file with 
panel_layer.

The changes in r677 break the third case (issue 455) for me in both openbox and 
xfwm. They also force the dock even if the user disables it.

Instead I propose the following:

    // Dock
    long val = panel_dock ? server.atom._NET_WM_WINDOW_TYPE_DOCK : server.atom._NET_WM_WINDOW_TYPE_SPLASH;
    XChangeProperty (server.dsp, p->main_win, server.atom._NET_WM_WINDOW_TYPE, XA_ATOM, 32, PropModeReplace, (unsigned char *) &val, 1);

    val = ALLDESKTOP;
    XChangeProperty (server.dsp, p->main_win, server.atom._NET_WM_DESKTOP, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &val, 1);

    Atom state[4];
    state[0] = server.atom._NET_WM_STATE_SKIP_PAGER;
    state[1] = server.atom._NET_WM_STATE_SKIP_TASKBAR;
    state[2] = server.atom._NET_WM_STATE_STICKY;
    state[3] = panel_layer == BOTTOM_LAYER ? server.atom._NET_WM_STATE_BELOW : server.atom._NET_WM_STATE_ABOVE;
    int nb_atoms = panel_layer == NORMAL_LAYER ? 3 : 4;
    XChangeProperty (server.dsp, p->main_win, server.atom._NET_WM_STATE, XA_ATOM, 32, PropModeReplace, (unsigned char *) state, nb_atoms);

    // Unfocusable
    XWMHints wmhints;
    wmhints.icon_window = wmhints.window_group = p->main_win;
    wmhints.flags = StateHint | IconWindowHint;
    wmhints.initial_state = WithdrawnState;
    wmhints.flags = InputHint;
    wmhints.input = False;
    XSetWMHints(server.dsp, p->main_win, &wmhints);

I tested it in both openbox and xfwm, with compton, in all the 6 possible 
configurations of panel_dock and panel_layer. All of the 3 problems above are 
solved.

What do you think?

Do you know by any chance why the XWMHints were set like that before?

Original comment by mrovi9...@gmail.com on 31 Jan 2015 at 10:40

GoogleCodeExporter commented 9 years ago
Thanks for the analysis and proposal.  Tried the code - brilliant.  I did try 
the TOOLBAR window type but didn't think to try the SPLASH window type - 
assumed it would be hardwired as ABOVE (the way DESKTOP is hardwired as BELOW).

I wholeheartedly agree it made no sense to set opposing states ABOVE and BELOW 
at the same time.  My solution was purely a workaround to do 1) what worked for 
openbox, and 2) what didn't break legacy functionality.  Using SPLASH is 
counter to the designated function, but more sensible than opposing states!

My openbox test results:
panel_dock = 0
        and panel_layer = bottom        expected behaviour (below)
        and panel_layer = normal        expected behaviour (floating)
        and panel_layer = top           expected behaviour (above)
panel_dock = 1 "native dock"
        and panel_layer = bottom        expected behaviour (below)
        and panel_layer = normal        FAIL behaves as above
        and panel_layer = top           expected behaviour (above)

My fluxbox test results:
panel_dock = 0
        and panel_layer = bottom        expected behaviour (below)
        and panel_layer = normal        expected behaviour (floating)
        and panel_layer = top           expected behaviour (above)
panel_dock = 1 "slit"
        and panel_layer = bottom        expected behaviour (below)
        and panel_layer = normal        FAIL behaves as above
        and panel_layer = top           expected behaviour (above)

Normal behaves as ABOVE for both OB and FB using a DOCK window. As far as I can 
tell, this *is* the native action for a DOCK in those WMs.  It seems acceptable 
particularly since the non-dock version follows the panel_layer accurately.  
And from my experience distro hopping, I find most openbox/tint2 distros tend 
to ignore the native dock anyway.

Thumbs up.  Make it happen.

(Mr OV, I'd like your email address - my developer email address is functional 
so please get in touch.)

Original comment by goo...@craigoakes.com on 31 Jan 2015 at 2:11

GoogleCodeExporter commented 9 years ago
Also same test results with compton + openbox.

And no, I don't know why the xwmhints were configured with the if statement...

Original comment by goo...@craigoakes.com on 31 Jan 2015 at 2:20

GoogleCodeExporter commented 9 years ago
Issue 228 has been merged into this issue.

Original comment by mrovi9...@gmail.com on 1 Feb 2015 at 10:16

GoogleCodeExporter commented 9 years ago
Committed r680.

Original comment by mrovi9...@gmail.com on 1 Feb 2015 at 12:36

GoogleCodeExporter commented 9 years ago

Original comment by mrovi9...@gmail.com on 1 Feb 2015 at 5:51

GoogleCodeExporter commented 9 years ago

Original comment by mrovi9...@gmail.com on 1 Feb 2015 at 11:48

GoogleCodeExporter commented 9 years ago
See also issue 394

Original comment by mrovi9...@gmail.com on 2 Feb 2015 at 12:48

GoogleCodeExporter commented 9 years ago

Original comment by goo...@craigoakes.com on 2 Feb 2015 at 1:44

GoogleCodeExporter commented 9 years ago
Related: issue 257.

Original comment by mrovi9...@gmail.com on 8 Feb 2015 at 10:42

GoogleCodeExporter commented 9 years ago
With panel_dock = 0 and strut_policy = follow_size, there was some strange 
behavior with XFWM, which I think I fixed (issue 472 and r731)

Original comment by mrovi9...@gmail.com on 20 Mar 2015 at 9:23