mirror of
https://codeberg.org/dwl/dwl.git
synced 2024-12-26 19:26:32 +00:00
fix multi monitors even more
When a monitor is created or removed, the geometries of the old ones must be updated. This is also more efficient than before since we calculate the monitor geometries only when creating and destroying monitors. arrangelayers() is needed to recalculate m->w. arrange() is so clients don't move to the left monitor when plugging or unplugging monitors (clients keep the same coordinates but the field below them changes).
This commit is contained in:
parent
8f0ce672d3
commit
fbd905155a
1 changed files with 15 additions and 6 deletions
21
dwl.c
21
dwl.c
|
@ -472,7 +472,7 @@ void
|
||||||
arrangelayer(Monitor *m, struct wl_list *list, struct wlr_box *usable_area, bool exclusive)
|
arrangelayer(Monitor *m, struct wl_list *list, struct wlr_box *usable_area, bool exclusive)
|
||||||
{
|
{
|
||||||
LayerSurface *layersurface;
|
LayerSurface *layersurface;
|
||||||
struct wlr_box full_area = *wlr_output_layout_get_box(output_layout, m->wlr_output);
|
struct wlr_box full_area = m->m;
|
||||||
|
|
||||||
wl_list_for_each(layersurface, list, link) {
|
wl_list_for_each(layersurface, list, link) {
|
||||||
struct wlr_layer_surface_v1 *wlr_layer_surface = layersurface->layer_surface;
|
struct wlr_layer_surface_v1 *wlr_layer_surface = layersurface->layer_surface;
|
||||||
|
@ -547,7 +547,7 @@ arrangelayer(Monitor *m, struct wl_list *list, struct wlr_box *usable_area, bool
|
||||||
void
|
void
|
||||||
arrangelayers(Monitor *m)
|
arrangelayers(Monitor *m)
|
||||||
{
|
{
|
||||||
struct wlr_box usable_area = *wlr_output_layout_get_box(output_layout, m->wlr_output);
|
struct wlr_box usable_area = m->m;
|
||||||
uint32_t layers_above_shell[] = {
|
uint32_t layers_above_shell[] = {
|
||||||
ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY,
|
ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY,
|
||||||
ZWLR_LAYER_SHELL_V1_LAYER_TOP,
|
ZWLR_LAYER_SHELL_V1_LAYER_TOP,
|
||||||
|
@ -690,6 +690,12 @@ cleanupmon(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
wl_list_remove(&m->destroy.link);
|
wl_list_remove(&m->destroy.link);
|
||||||
free(m);
|
free(m);
|
||||||
|
|
||||||
|
wl_list_for_each(m, &mons, link) {
|
||||||
|
m->m = m->w = *wlr_output_layout_get_box(output_layout, m->wlr_output);
|
||||||
|
arrangelayers(m);
|
||||||
|
arrange(m);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -813,13 +819,16 @@ createmon(struct wl_listener *listener, void *data)
|
||||||
wlr_output_layout_add_auto(output_layout, wlr_output);
|
wlr_output_layout_add_auto(output_layout, wlr_output);
|
||||||
sgeom = *wlr_output_layout_get_box(output_layout, NULL);
|
sgeom = *wlr_output_layout_get_box(output_layout, NULL);
|
||||||
|
|
||||||
/* Get effective monitor geometry to use for window area */
|
|
||||||
m->m = *wlr_output_layout_get_box(output_layout, m->wlr_output);
|
|
||||||
m->w = m->m;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < nlayers; ++i) {
|
for (size_t i = 0; i < nlayers; ++i) {
|
||||||
wl_list_init(&m->layers[i]);
|
wl_list_init(&m->layers[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get effective monitor geometry to use for window area */
|
||||||
|
wl_list_for_each(m, &mons, link) {
|
||||||
|
m->m = m->w = *wlr_output_layout_get_box(output_layout, m->wlr_output);
|
||||||
|
arrangelayers(m);
|
||||||
|
arrange(m);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue