mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-09 15:05:58 +01:00
Fix maximized windows interaction with layer shell
If there were no layer surfaces the usable area of the output would be an empty box.
This commit is contained in:
parent
a316396eab
commit
b887af9a60
4 changed files with 28 additions and 29 deletions
|
@ -1,7 +1,6 @@
|
||||||
#ifndef ROOTSTON_LAYERS_H
|
#ifndef ROOTSTON_LAYERS_H
|
||||||
#define ROOTSTON_LAYERS_H
|
#define ROOTSTON_LAYERS_H
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <wlr/config.h>
|
|
||||||
#include <wlr/types/wlr_box.h>
|
#include <wlr/types/wlr_box.h>
|
||||||
#include <wlr/types/wlr_surface.h>
|
#include <wlr/types/wlr_surface.h>
|
||||||
#include <wlr/types/wlr_layer_shell.h>
|
#include <wlr/types/wlr_layer_shell.h>
|
||||||
|
@ -15,11 +14,12 @@ struct roots_layer_surface {
|
||||||
struct wl_listener unmap;
|
struct wl_listener unmap;
|
||||||
struct wl_listener surface_commit;
|
struct wl_listener surface_commit;
|
||||||
struct wl_listener output_destroy;
|
struct wl_listener output_destroy;
|
||||||
struct wl_listener output_mode;
|
|
||||||
struct wl_listener output_transform;
|
|
||||||
|
|
||||||
bool configured;
|
bool configured;
|
||||||
struct wlr_box geo;
|
struct wlr_box geo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct roots_output;
|
||||||
|
void arrange_layers(struct roots_output *output);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,6 +23,8 @@ struct roots_output {
|
||||||
struct wlr_box usable_area;
|
struct wlr_box usable_area;
|
||||||
|
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
|
struct wl_listener mode;
|
||||||
|
struct wl_listener transform;
|
||||||
struct wl_listener damage_frame;
|
struct wl_listener damage_frame;
|
||||||
struct wl_listener damage_destroy;
|
struct wl_listener damage_destroy;
|
||||||
};
|
};
|
||||||
|
|
|
@ -82,7 +82,7 @@ static void arrange_layer(struct wlr_output *output, struct wl_list *list,
|
||||||
wl_list_for_each(roots_surface, list, link) {
|
wl_list_for_each(roots_surface, list, link) {
|
||||||
struct wlr_layer_surface *layer = roots_surface->layer_surface;
|
struct wlr_layer_surface *layer = roots_surface->layer_surface;
|
||||||
struct wlr_layer_surface_state *state = &layer->current;
|
struct wlr_layer_surface_state *state = &layer->current;
|
||||||
if (exclusive != (state->exclusive_zone >0)) {
|
if (exclusive != (state->exclusive_zone > 0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
struct wlr_box bounds;
|
struct wlr_box bounds;
|
||||||
|
@ -152,9 +152,7 @@ static void arrange_layer(struct wlr_output *output, struct wl_list *list,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void arrange_layers(struct wlr_output *_output) {
|
void arrange_layers(struct roots_output *output) {
|
||||||
struct roots_output *output = _output->data;
|
|
||||||
|
|
||||||
struct wlr_box usable_area = { 0 };
|
struct wlr_box usable_area = { 0 };
|
||||||
wlr_output_effective_resolution(output->wlr_output,
|
wlr_output_effective_resolution(output->wlr_output,
|
||||||
&usable_area.width, &usable_area.height);
|
&usable_area.width, &usable_area.height);
|
||||||
|
@ -204,18 +202,9 @@ static void handle_output_destroy(struct wl_listener *listener, void *data) {
|
||||||
wl_container_of(listener, layer, output_destroy);
|
wl_container_of(listener, layer, output_destroy);
|
||||||
layer->layer_surface->output = NULL;
|
layer->layer_surface->output = NULL;
|
||||||
wl_list_remove(&layer->output_destroy.link);
|
wl_list_remove(&layer->output_destroy.link);
|
||||||
wl_list_remove(&layer->output_mode.link);
|
|
||||||
wlr_layer_surface_close(layer->layer_surface);
|
wlr_layer_surface_close(layer->layer_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_output_mode(struct wl_listener *listener, void *data) {
|
|
||||||
arrange_layers((struct wlr_output *)data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handle_output_transform(struct wl_listener *listener, void *data) {
|
|
||||||
arrange_layers((struct wlr_output *)data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handle_surface_commit(struct wl_listener *listener, void *data) {
|
static void handle_surface_commit(struct wl_listener *listener, void *data) {
|
||||||
struct roots_layer_surface *layer =
|
struct roots_layer_surface *layer =
|
||||||
wl_container_of(listener, layer, surface_commit);
|
wl_container_of(listener, layer, surface_commit);
|
||||||
|
@ -224,7 +213,7 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
|
||||||
if (wlr_output != NULL) {
|
if (wlr_output != NULL) {
|
||||||
struct roots_output *output = wlr_output->data;
|
struct roots_output *output = wlr_output->data;
|
||||||
struct wlr_box old_geo = layer->geo;
|
struct wlr_box old_geo = layer->geo;
|
||||||
arrange_layers(wlr_output);
|
arrange_layers(output);
|
||||||
if (memcmp(&old_geo, &layer->geo, sizeof(struct wlr_box)) != 0) {
|
if (memcmp(&old_geo, &layer->geo, sizeof(struct wlr_box)) != 0) {
|
||||||
output_damage_whole_local_surface(output, layer_surface->surface,
|
output_damage_whole_local_surface(output, layer_surface->surface,
|
||||||
old_geo.x, old_geo.y, 0);
|
old_geo.x, old_geo.y, 0);
|
||||||
|
@ -258,9 +247,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||||
wl_list_remove(&layer->unmap.link);
|
wl_list_remove(&layer->unmap.link);
|
||||||
wl_list_remove(&layer->surface_commit.link);
|
wl_list_remove(&layer->surface_commit.link);
|
||||||
wl_list_remove(&layer->output_destroy.link);
|
wl_list_remove(&layer->output_destroy.link);
|
||||||
wl_list_remove(&layer->output_mode.link);
|
arrange_layers((struct roots_output *)layer->layer_surface->output->data);
|
||||||
wl_list_remove(&layer->output_transform.link);
|
|
||||||
arrange_layers(layer->layer_surface->output);
|
|
||||||
free(layer);
|
free(layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,14 +293,6 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
|
||||||
wl_signal_add(&layer_surface->output->events.destroy,
|
wl_signal_add(&layer_surface->output->events.destroy,
|
||||||
&roots_surface->output_destroy);
|
&roots_surface->output_destroy);
|
||||||
|
|
||||||
roots_surface->output_mode.notify = handle_output_mode;
|
|
||||||
wl_signal_add(&layer_surface->output->events.mode,
|
|
||||||
&roots_surface->output_mode);
|
|
||||||
|
|
||||||
roots_surface->output_transform.notify = handle_output_transform;
|
|
||||||
wl_signal_add(&layer_surface->output->events.transform,
|
|
||||||
&roots_surface->output_transform);
|
|
||||||
|
|
||||||
roots_surface->destroy.notify = handle_destroy;
|
roots_surface->destroy.notify = handle_destroy;
|
||||||
wl_signal_add(&layer_surface->events.destroy, &roots_surface->destroy);
|
wl_signal_add(&layer_surface->events.destroy, &roots_surface->destroy);
|
||||||
roots_surface->map.notify = handle_map;
|
roots_surface->map.notify = handle_map;
|
||||||
|
@ -333,7 +312,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_layer_surface_state old_state = layer_surface->current;
|
struct wlr_layer_surface_state old_state = layer_surface->current;
|
||||||
layer_surface->current = layer_surface->client_pending;
|
layer_surface->current = layer_surface->client_pending;
|
||||||
|
|
||||||
arrange_layers(output->wlr_output);
|
arrange_layers(output);
|
||||||
|
|
||||||
layer_surface->current = old_state;
|
layer_surface->current = old_state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -816,6 +816,18 @@ static void output_damage_handle_destroy(struct wl_listener *listener,
|
||||||
output_destroy(output);
|
output_destroy(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void output_handle_mode(struct wl_listener *listener, void *data) {
|
||||||
|
struct roots_output *output =
|
||||||
|
wl_container_of(listener, output, mode);
|
||||||
|
arrange_layers(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void output_handle_transform(struct wl_listener *listener, void *data) {
|
||||||
|
struct roots_output *output =
|
||||||
|
wl_container_of(listener, output, transform);
|
||||||
|
arrange_layers(output);
|
||||||
|
}
|
||||||
|
|
||||||
void handle_new_output(struct wl_listener *listener, void *data) {
|
void handle_new_output(struct wl_listener *listener, void *data) {
|
||||||
struct roots_desktop *desktop = wl_container_of(listener, desktop,
|
struct roots_desktop *desktop = wl_container_of(listener, desktop,
|
||||||
new_output);
|
new_output);
|
||||||
|
@ -845,6 +857,11 @@ void handle_new_output(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
output->destroy.notify = output_handle_destroy;
|
output->destroy.notify = output_handle_destroy;
|
||||||
wl_signal_add(&wlr_output->events.destroy, &output->destroy);
|
wl_signal_add(&wlr_output->events.destroy, &output->destroy);
|
||||||
|
output->mode.notify = output_handle_mode;
|
||||||
|
wl_signal_add(&wlr_output->events.mode, &output->mode);
|
||||||
|
output->transform.notify = output_handle_transform;
|
||||||
|
wl_signal_add(&wlr_output->events.transform, &output->transform);
|
||||||
|
|
||||||
output->damage_frame.notify = output_damage_handle_frame;
|
output->damage_frame.notify = output_damage_handle_frame;
|
||||||
wl_signal_add(&output->damage->events.frame, &output->damage_frame);
|
wl_signal_add(&output->damage->events.frame, &output->damage_frame);
|
||||||
output->damage_destroy.notify = output_damage_handle_destroy;
|
output->damage_destroy.notify = output_damage_handle_destroy;
|
||||||
|
@ -879,5 +896,6 @@ void handle_new_output(struct wl_listener *listener, void *data) {
|
||||||
roots_seat_configure_xcursor(seat);
|
roots_seat_configure_xcursor(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
arrange_layers(output);
|
||||||
output_damage_whole(output);
|
output_damage_whole(output);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue