x11: Fix "Move window to next screen" shortcut for maximized windows

With the recent AbstractOutput changes, Workspace::clientArea() overload
that takes only the window and no additional output was changed to

    return clientArea(opt, window, window->output());

prior to that, it had been looking up the output at the center of the
frame geometry.

As it turns out, AbstractOutput::sendToOutput() blocks geometry updates,
which in its turn means that Toplevel::output() will be updated only
after geometry updates are unblocked. For the most part, it's not a big
deal until you need to use Workspace::clientArea(opt, const Toplevel*)

Since the output won't be updated until geometry updates are unblocked,
clientArea(opt, const Toplevel *) may return outdated info.

One could argue that we just simply need to update m_output similar to
m_frameGeometry when geometry updates are blocked, but... it's not going
to work on wayland! On Wayland, GeometryUpdatesBlocker is totally
unnecessary. Even if a window is resized, m_frameGeometry will be left
unchanged until the client repaints the window.

Instead, one need to pass the AbstractOutput to clientArea() if it's
important.

This change makes X11Client::changeMaximize() query the MaximizeArea of
the output containing the center of the move resize geometry, similar to
what the XdgToplevelClient does.

BUG: 442534
This commit is contained in:
Vlad Zahorodnii 2021-09-17 12:04:44 +03:00
parent ca869e2bc5
commit afcb9fd037

View file

@ -4154,7 +4154,7 @@ void X11Client::changeMaximize(bool horizontal, bool vertical, bool adjust)
if (isElectricBorderMaximizing()) if (isElectricBorderMaximizing())
clientArea = workspace()->clientArea(MaximizeArea, this, Cursors::self()->mouse()->pos()); clientArea = workspace()->clientArea(MaximizeArea, this, Cursors::self()->mouse()->pos());
else else
clientArea = workspace()->clientArea(MaximizeArea, this); clientArea = workspace()->clientArea(MaximizeArea, this, moveResizeGeometry().center());
MaximizeMode old_mode = max_mode; MaximizeMode old_mode = max_mode;
// 'adjust == true' means to update the size only, e.g. after changing workspace size // 'adjust == true' means to update the size only, e.g. after changing workspace size