mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-30 00:15:58 +01:00
add wlr_output destroy event
This commit is contained in:
parent
fa3d4ecc84
commit
d84deb0742
3 changed files with 21 additions and 0 deletions
|
@ -37,6 +37,7 @@ struct wlr_output {
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal frame;
|
struct wl_signal frame;
|
||||||
struct wl_signal resolution;
|
struct wl_signal resolution;
|
||||||
|
struct wl_signal destroy;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
@ -100,6 +100,7 @@ void wlr_output_init(struct wlr_output *output,
|
||||||
output->scale = 1;
|
output->scale = 1;
|
||||||
wl_signal_init(&output->events.frame);
|
wl_signal_init(&output->events.frame);
|
||||||
wl_signal_init(&output->events.resolution);
|
wl_signal_init(&output->events.resolution);
|
||||||
|
wl_signal_init(&output->events.destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_output_enable(struct wlr_output *output, bool enable) {
|
void wlr_output_enable(struct wlr_output *output, bool enable) {
|
||||||
|
@ -176,6 +177,8 @@ void wlr_output_destroy(struct wlr_output *output) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wl_signal_emit(&output->events.destroy, output);
|
||||||
|
|
||||||
wlr_texture_destroy(output->cursor.texture);
|
wlr_texture_destroy(output->cursor.texture);
|
||||||
wlr_renderer_destroy(output->cursor.renderer);
|
wlr_renderer_destroy(output->cursor.renderer);
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,13 @@ struct wlr_output_layout_state {
|
||||||
|
|
||||||
struct wlr_output_layout_output_state {
|
struct wlr_output_layout_output_state {
|
||||||
struct wlr_output_layout *layout;
|
struct wlr_output_layout *layout;
|
||||||
|
struct wlr_output_layout_output *l_output;
|
||||||
|
|
||||||
struct wlr_box *_box;
|
struct wlr_box *_box;
|
||||||
bool auto_configured;
|
bool auto_configured;
|
||||||
|
|
||||||
struct wl_listener resolution;
|
struct wl_listener resolution;
|
||||||
|
struct wl_listener output_destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_output_layout *wlr_output_layout_init() {
|
struct wlr_output_layout *wlr_output_layout_init() {
|
||||||
|
@ -30,6 +34,7 @@ struct wlr_output_layout *wlr_output_layout_init() {
|
||||||
static void wlr_output_layout_output_destroy(
|
static void wlr_output_layout_output_destroy(
|
||||||
struct wlr_output_layout_output *l_output) {
|
struct wlr_output_layout_output *l_output) {
|
||||||
wl_list_remove(&l_output->state->resolution.link);
|
wl_list_remove(&l_output->state->resolution.link);
|
||||||
|
wl_list_remove(&l_output->state->output_destroy.link);
|
||||||
wl_list_remove(&l_output->link);
|
wl_list_remove(&l_output->link);
|
||||||
free(l_output->state->_box);
|
free(l_output->state->_box);
|
||||||
free(l_output->state);
|
free(l_output->state);
|
||||||
|
@ -111,11 +116,20 @@ static void handle_output_resolution(struct wl_listener *listener, void *data) {
|
||||||
wlr_output_layout_reconfigure(state->layout);
|
wlr_output_layout_reconfigure(state->layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void handle_output_destroy(struct wl_listener *listener, void *data) {
|
||||||
|
struct wlr_output_layout_output_state *state =
|
||||||
|
wl_container_of(listener, state, output_destroy);
|
||||||
|
struct wlr_output_layout *layout = state->layout;
|
||||||
|
wlr_output_layout_output_destroy(state->l_output);
|
||||||
|
wlr_output_layout_reconfigure(layout);
|
||||||
|
}
|
||||||
|
|
||||||
static struct wlr_output_layout_output *wlr_output_layout_output_create(
|
static struct wlr_output_layout_output *wlr_output_layout_output_create(
|
||||||
struct wlr_output_layout *layout, struct wlr_output *output) {
|
struct wlr_output_layout *layout, struct wlr_output *output) {
|
||||||
struct wlr_output_layout_output *l_output;
|
struct wlr_output_layout_output *l_output;
|
||||||
l_output= calloc(1, sizeof(struct wlr_output_layout_output));
|
l_output= calloc(1, sizeof(struct wlr_output_layout_output));
|
||||||
l_output->state = calloc(1, sizeof(struct wlr_output_layout_output_state));
|
l_output->state = calloc(1, sizeof(struct wlr_output_layout_output_state));
|
||||||
|
l_output->state->l_output = l_output;
|
||||||
l_output->state->_box = calloc(1, sizeof(struct wlr_box));
|
l_output->state->_box = calloc(1, sizeof(struct wlr_box));
|
||||||
l_output->state->layout = layout;
|
l_output->state->layout = layout;
|
||||||
l_output->output = output;
|
l_output->output = output;
|
||||||
|
@ -124,6 +138,9 @@ static struct wlr_output_layout_output *wlr_output_layout_output_create(
|
||||||
wl_signal_add(&output->events.resolution, &l_output->state->resolution);
|
wl_signal_add(&output->events.resolution, &l_output->state->resolution);
|
||||||
l_output->state->resolution.notify = handle_output_resolution;
|
l_output->state->resolution.notify = handle_output_resolution;
|
||||||
|
|
||||||
|
wl_signal_add(&output->events.destroy, &l_output->state->output_destroy);
|
||||||
|
l_output->state->output_destroy.notify = handle_output_destroy;
|
||||||
|
|
||||||
return l_output;
|
return l_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue