Use view_move() and view_move_resize() correctly.
view_move_resize() should only be used when the view actually changes
width and/or height, otherwise the serials might cause a delay in moving
xdg-shell clients.
Issue #201
labwc currently doesn't handle output layout changes very well:
- Windows can end up "lost" completely offscreen
- Maximized/fullscreen windows can end up spanning multiple outputs
Currently, new_output_notify() and output_destroy_notify() contain logic
to update the cursor and force a repaint when outputs are added or
removed. This logic in fact needs to run on any output layout change,
so consolidate it into a new function, output_update_for_layout_change().
Then add a second new function, view_adjust_for_layout_change(), which
adjusts window placement to account for the new layout.
The behavior is roughly as follows:
- Normal windows that end up offscreen are centered on the closest
output (making use of the existing view_center() logic)
- Maximized windows are re-maximized on the closest output. Logic is
also added to the unmaximize step to check that the original
unmaximized position is still on-screen.
- Fullscreen windows are re-fullscreened on the same output if
possible; otherwise they are un-fullscreened.
Minimized windows don't require any special handling. Their placement
is adjusted just the same, but invisible to the user until they are
later unminimized.
There is some positioning glitch still with un-fullscreening a window
whose output has been disconnected/disabled; it can end up in an
unexpected position (but at least has the correct size and decoration).
I don't think this is due to a bug in my change per se, but perhaps the
change has exposed a bug elsewhere.
Fixes: #177
...and call it from desktop_move_to_front() in order force an enter event
on the surface below the cursor when cycling views.
Inspired by PR #164 - just restructured it a bit.
Suggested-by: @bi4k8
If we don't switch focus, we want the close button to close the window associated with it, not the current focus window.
Signed-off-by: Joshua Ashton <joshua@froggi.es>
cursor_rebase() sets the cursor icon and sends a motion-event to the
surface below the cursor. It is made public in anticipation of using it
in various view_* functions.
...and replace with a local MAX macro, because:
- They contain a ({}) construct which is a GNU extension and that's
against Drew's coding style
- min() is not used anyway
- MAX() clashes with cairo's macro, so best to not add this in labwc.h
ld: error: undefined symbol: wlr_backend_get_renderer
>>> referenced by output.c
>>> labwc.p/src_output.c.o:(render_rect)
>>> referenced by output.c
>>> labwc.p/src_output.c.o:(render_rect)
>>> referenced by output.c
>>> labwc.p/src_output.c.o:(render_texture)
>>> referenced 5 more times
Based on 5865af75cf
Based on a6538ced35