mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-12-28 08:56:32 -05:00
output: add description
wlr_output.description is a string containing a human-readable string identifying the output. Compositors can customise it via wlr_output_set_description, for instance to make the name more user-friendly. References: https://github.com/swaywm/wlroots/issues/1623
This commit is contained in:
parent
a420d2c41e
commit
4da4a15d6b
7 changed files with 48 additions and 0 deletions
|
|
@ -270,6 +270,22 @@ void wlr_output_set_subpixel(struct wlr_output *output,
|
|||
wlr_output_schedule_done(output);
|
||||
}
|
||||
|
||||
void wlr_output_set_description(struct wlr_output *output, const char *desc) {
|
||||
if (output->description != NULL && desc != NULL &&
|
||||
strcmp(output->description, desc) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
free(output->description);
|
||||
if (desc != NULL) {
|
||||
output->description = strdup(desc);
|
||||
} else {
|
||||
output->description = NULL;
|
||||
}
|
||||
|
||||
wlr_signal_emit_safe(&output->events.description, output);
|
||||
}
|
||||
|
||||
static void schedule_done_handle_idle_timer(void *data) {
|
||||
struct wlr_output *output = data;
|
||||
output->idle_done = NULL;
|
||||
|
|
@ -323,6 +339,7 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
|
|||
wl_signal_init(&output->events.mode);
|
||||
wl_signal_init(&output->events.scale);
|
||||
wl_signal_init(&output->events.transform);
|
||||
wl_signal_init(&output->events.description);
|
||||
wl_signal_init(&output->events.destroy);
|
||||
pixman_region32_init(&output->damage);
|
||||
pixman_region32_init(&output->pending.damage);
|
||||
|
|
@ -365,6 +382,8 @@ void wlr_output_destroy(struct wlr_output *output) {
|
|||
wl_event_source_remove(output->idle_done);
|
||||
}
|
||||
|
||||
free(output->description);
|
||||
|
||||
pixman_region32_fini(&output->pending.damage);
|
||||
pixman_region32_fini(&output->damage);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue