mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-26 06:59:52 -05:00
Update output layout when scale or transform changes
This commit is contained in:
parent
808ab5aa1b
commit
3b4b8953d9
11 changed files with 38 additions and 15 deletions
|
|
@ -195,9 +195,11 @@ void wlr_output_update_size(struct wlr_output *output, int32_t width,
|
|||
wl_resource_for_each(resource, &output->wl_resources) {
|
||||
wlr_output_send_current_mode_to_resource(resource);
|
||||
}
|
||||
|
||||
wl_signal_emit(&output->events.resolution, output);
|
||||
}
|
||||
|
||||
void wlr_output_transform(struct wlr_output *output,
|
||||
void wlr_output_set_transform(struct wlr_output *output,
|
||||
enum wl_output_transform transform) {
|
||||
output->impl->transform(output, transform);
|
||||
wlr_output_update_matrix(output);
|
||||
|
|
@ -207,6 +209,8 @@ void wlr_output_transform(struct wlr_output *output,
|
|||
wl_resource_for_each(resource, &output->wl_resources) {
|
||||
wl_output_send_to_resource(resource);
|
||||
}
|
||||
|
||||
wl_signal_emit(&output->events.transform, output);
|
||||
}
|
||||
|
||||
void wlr_output_set_position(struct wlr_output *output, int32_t lx,
|
||||
|
|
@ -237,6 +241,8 @@ void wlr_output_set_scale(struct wlr_output *output, uint32_t scale) {
|
|||
wl_resource_for_each(resource, &output->wl_resources) {
|
||||
wl_output_send_to_resource(resource);
|
||||
}
|
||||
|
||||
wl_signal_emit(&output->events.scale, output);
|
||||
}
|
||||
|
||||
void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
|
||||
|
|
@ -252,6 +258,8 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
|
|||
wl_signal_init(&output->events.frame);
|
||||
wl_signal_init(&output->events.swap_buffers);
|
||||
wl_signal_init(&output->events.resolution);
|
||||
wl_signal_init(&output->events.scale);
|
||||
wl_signal_init(&output->events.transform);
|
||||
wl_signal_init(&output->events.destroy);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ struct wlr_output_layout_output_state {
|
|||
bool auto_configured;
|
||||
|
||||
struct wl_listener resolution;
|
||||
struct wl_listener scale;
|
||||
struct wl_listener transform;
|
||||
struct wl_listener output_destroy;
|
||||
};
|
||||
|
||||
|
|
@ -46,6 +48,8 @@ static void wlr_output_layout_output_destroy(
|
|||
struct wlr_output_layout_output *l_output) {
|
||||
wl_signal_emit(&l_output->events.destroy, l_output);
|
||||
wl_list_remove(&l_output->state->resolution.link);
|
||||
wl_list_remove(&l_output->state->scale.link);
|
||||
wl_list_remove(&l_output->state->transform.link);
|
||||
wl_list_remove(&l_output->state->output_destroy.link);
|
||||
wl_list_remove(&l_output->link);
|
||||
free(l_output->state);
|
||||
|
|
@ -134,6 +138,18 @@ static void handle_output_resolution(struct wl_listener *listener, void *data) {
|
|||
wlr_output_layout_reconfigure(state->layout);
|
||||
}
|
||||
|
||||
static void handle_output_scale(struct wl_listener *listener, void *data) {
|
||||
struct wlr_output_layout_output_state *state =
|
||||
wl_container_of(listener, state, scale);
|
||||
wlr_output_layout_reconfigure(state->layout);
|
||||
}
|
||||
|
||||
static void handle_output_transform(struct wl_listener *listener, void *data) {
|
||||
struct wlr_output_layout_output_state *state =
|
||||
wl_container_of(listener, state, transform);
|
||||
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);
|
||||
|
|
@ -162,6 +178,10 @@ static struct wlr_output_layout_output *wlr_output_layout_output_create(
|
|||
|
||||
wl_signal_add(&output->events.resolution, &l_output->state->resolution);
|
||||
l_output->state->resolution.notify = handle_output_resolution;
|
||||
wl_signal_add(&output->events.scale, &l_output->state->scale);
|
||||
l_output->state->scale.notify = handle_output_scale;
|
||||
wl_signal_add(&output->events.transform, &l_output->state->transform);
|
||||
l_output->state->transform.notify = handle_output_transform;
|
||||
wl_signal_add(&output->events.destroy, &l_output->state->output_destroy);
|
||||
l_output->state->output_destroy.notify = handle_output_destroy;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue