Skip to content

Maximizing a window horizontally or vertically prevents maximizing on the other axis (via netwm message)

Submitted by OmegaPhil

Assigned to Olivier Fourdan @olivier

Link to original bug (#12538)

Description

Start with a normalized window, then maximize horizontally, e.g.:

================================================

wmctrl -i -r '<window ID>' -b add,maximized_horz

================================================

This works. Then issue the maximized_vert command:

================================================

wmctrl -i -r '<window ID>' -b add,maximized_vert

================================================

Nothing happens. If you start off with a successful vertical maximization command, then the horizontal one fails (but of course doesn't tell wmctrl...).

It looks like the code is hardcoded to treat either MAXIMIZED_HORZ or MAXIMIZED_VERT as 'maximized' (client.h:157):

=========================================================================

#define CLIENT_FLAG_MAXIMIZED (CLIENT_FLAG_MAXIMIZED_VERT |
CLIENT_FLAG_MAXIMIZED_HORIZ)

=========================================================================

so when the command to add the maximized state is processed in netwm.c:clientUpdateNetState, line 381, the code ignores valid maximization commands in the axis that hasn't been maximized:

=========================================================================

        if ((action == NET_WM_STATE_ADD) && !FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED))
        {
            mode = 0L;
            if ((first  == display_info->atoms[NET_WM_STATE_MAXIMIZED_HORZ]) ||
                (second == display_info->atoms[NET_WM_STATE_MAXIMIZED_HORZ]))
            {
                mode |= !FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ) ? CLIENT_FLAG_MAXIMIZED_HORIZ : 0;
            }

            `<etc>`

=========================================================================

is there a reason maximization in one axis only isn't being considered? Feels deliberate.

Thanks

Version: 4.12.0