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
When an output is added or removed, the position of the other
outputs can also change, resulting in windows moving between them.
We need to redraw all the outputs (not just the new one) to prevent
stale/corrupted screen contents.
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
See sway@4cdc4ac6
Sometimes the preferred mode is not available due to hardware
constraints. In these cases it is better to fallback to lower modes than
to end up with a black screen.
Move font_texture_create() to font.c so it can be used for purposes other
than rendering the menu, for example server side decoration.
Refactor menu.c and menu.h to use this more generic font_texture_create()
It makes more sense to just keep one set of corner textures for server
side view decorations, rather than storing a set for each view. This also
keeps the code simpler when when changing theme parameters.
src/xdg.c:180:2: warning: implicit declaration of function 'wlr_xdg_surface_for_each_popup' is invalid in C99 [-Wimplicit-function-declaration]
wlr_xdg_surface_for_each_popup(view->xdg_surface, iterator, data);
^
ld: error: undefined symbol: wlr_xdg_surface_for_each_popup
>>> referenced by xdg.c:180 (src/xdg.c:180)
>>> labwc.p/src_xdg.c.o:(xdg_toplevel_view_for_each_popup)
Based on 5438cc158a