mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 22:25:58 +01: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
024627e872
commit
ff55663906
3 changed files with 27 additions and 0 deletions
|
@ -146,5 +146,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
|
||||||
|
|
|
@ -178,6 +178,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;
|
||||||
|
|
||||||
|
@ -258,6 +259,11 @@ struct wlr_output_event_bind {
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct wlr_output_event_request_state {
|
||||||
|
struct wlr_output *output;
|
||||||
|
const struct wlr_output_state *state;
|
||||||
|
};
|
||||||
|
|
||||||
struct wlr_surface;
|
struct wlr_surface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -935,6 +935,22 @@ void wlr_output_send_present(struct wlr_output *output,
|
||||||
wl_signal_emit_mutable(&output->events.present, event);
|
wl_signal_emit_mutable(&output->events.present, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wlr_output_send_request_state(struct wlr_output *output,
|
||||||
|
const struct wlr_output_state *state) {
|
||||||
|
uint32_t unchanged = output_compare_state(output, state);
|
||||||
|
struct wlr_output_state copy = *state;
|
||||||
|
copy.committed &= ~unchanged;
|
||||||
|
if (copy.committed == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct wlr_output_event_request_state event = {
|
||||||
|
.output = output,
|
||||||
|
.state = ©,
|
||||||
|
};
|
||||||
|
wl_signal_emit_mutable(&output->events.request_state, &event);
|
||||||
|
}
|
||||||
|
|
||||||
void wlr_output_set_gamma(struct wlr_output *output, size_t size,
|
void wlr_output_set_gamma(struct wlr_output *output, size_t size,
|
||||||
const uint16_t *r, const uint16_t *g, const uint16_t *b) {
|
const uint16_t *r, const uint16_t *g, const uint16_t *b) {
|
||||||
uint16_t *gamma_lut = NULL;
|
uint16_t *gamma_lut = NULL;
|
||||||
|
|
Loading…
Reference in a new issue