mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-03-22 05:34:24 -04:00
output: introduce request_state event
This allows backends to request the compositor to change the state of an output. References: https://github.com/swaywm/wlroots/issues/2300#issuecomment-761819673
This commit is contained in:
parent
92ac84a192
commit
666e92f15e
3 changed files with 21 additions and 0 deletions
|
|
@ -138,5 +138,10 @@ void wlr_output_send_frame(struct wlr_output *output);
|
||||||
*/
|
*/
|
||||||
void wlr_output_send_present(struct wlr_output *output,
|
void wlr_output_send_present(struct wlr_output *output,
|
||||||
struct wlr_output_event_present *event);
|
struct wlr_output_event_present *event);
|
||||||
|
/**
|
||||||
|
* Request the compositor to apply new state.
|
||||||
|
*/
|
||||||
|
void wlr_output_send_request_state(struct wlr_output *output,
|
||||||
|
const struct wlr_output_state *state);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,7 @@ struct wlr_output {
|
||||||
struct wl_signal enable;
|
struct wl_signal enable;
|
||||||
struct wl_signal mode;
|
struct wl_signal mode;
|
||||||
struct wl_signal description;
|
struct wl_signal description;
|
||||||
|
struct wl_signal request_state;
|
||||||
struct wl_signal destroy;
|
struct wl_signal destroy;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
|
|
@ -238,6 +239,11 @@ struct wlr_output_event_bind {
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct wlr_output_event_request_state {
|
||||||
|
struct wlr_output *output;
|
||||||
|
struct wlr_output_state state;
|
||||||
|
};
|
||||||
|
|
||||||
struct wlr_surface;
|
struct wlr_surface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -344,6 +344,7 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
|
||||||
wl_signal_init(&output->events.enable);
|
wl_signal_init(&output->events.enable);
|
||||||
wl_signal_init(&output->events.mode);
|
wl_signal_init(&output->events.mode);
|
||||||
wl_signal_init(&output->events.description);
|
wl_signal_init(&output->events.description);
|
||||||
|
wl_signal_init(&output->events.request_state);
|
||||||
wl_signal_init(&output->events.destroy);
|
wl_signal_init(&output->events.destroy);
|
||||||
pixman_region32_init(&output->pending.damage);
|
pixman_region32_init(&output->pending.damage);
|
||||||
|
|
||||||
|
|
@ -728,6 +729,15 @@ void wlr_output_send_present(struct wlr_output *output,
|
||||||
wlr_signal_emit_safe(&output->events.present, event);
|
wlr_signal_emit_safe(&output->events.present, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wlr_output_send_request_state(struct wlr_output *output,
|
||||||
|
const struct wlr_output_state *state) {
|
||||||
|
struct wlr_output_event_request_state event = {
|
||||||
|
.output = output,
|
||||||
|
.state = *state,
|
||||||
|
};
|
||||||
|
wlr_signal_emit_safe(&output->events.request_state, &event);
|
||||||
|
}
|
||||||
|
|
||||||
void wlr_output_queue_state(struct wlr_output *output,
|
void wlr_output_queue_state(struct wlr_output *output,
|
||||||
const struct wlr_output_state *state) {
|
const struct wlr_output_state *state) {
|
||||||
assert(state != &output->pending);
|
assert(state != &output->pending);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue