mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-02 11:55:59 +01:00
backend/noop: improve output number handling
This improves the way the output numbers are handled for the noop backend. Instead of using the number of active outputs plus one, the last used number is stored and new outputs will increment it. This fixes the situation where you start with one output, create a second, close the first, and create a third. Without this, both outputs will be NOOP-2, which causes an issue since the identifier will also be identical. With this, the last output is NOOP-3 and the outputs can be distinguished.
This commit is contained in:
parent
c97f0eb0f2
commit
6b7f5e4010
2 changed files with 3 additions and 2 deletions
|
@ -61,8 +61,8 @@ struct wlr_output *wlr_noop_add_output(struct wlr_backend *wlr_backend) {
|
||||||
|
|
||||||
strncpy(wlr_output->make, "noop", sizeof(wlr_output->make));
|
strncpy(wlr_output->make, "noop", sizeof(wlr_output->make));
|
||||||
strncpy(wlr_output->model, "noop", sizeof(wlr_output->model));
|
strncpy(wlr_output->model, "noop", sizeof(wlr_output->model));
|
||||||
snprintf(wlr_output->name, sizeof(wlr_output->name), "NOOP-%d",
|
snprintf(wlr_output->name, sizeof(wlr_output->name), "NOOP-%ld",
|
||||||
wl_list_length(&backend->outputs) + 1);
|
++backend->last_output_num);
|
||||||
|
|
||||||
wl_list_insert(&backend->outputs, &output->link);
|
wl_list_insert(&backend->outputs, &output->link);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ struct wlr_noop_backend {
|
||||||
struct wlr_backend backend;
|
struct wlr_backend backend;
|
||||||
struct wl_display *display;
|
struct wl_display *display;
|
||||||
struct wl_list outputs;
|
struct wl_list outputs;
|
||||||
|
size_t last_output_num;
|
||||||
bool started;
|
bool started;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue