diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xwayland/xwayland-output.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index 2690fa0e3..7c8ebd49a 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -687,6 +687,9 @@ void xwl_output_set_name(struct xwl_output *xwl_output, const char *name) { struct xwl_screen *xwl_screen = xwl_output->xwl_screen; + rrScrPrivPtr pScrPriv; + RRLeasePtr lease; + int i; if (xwl_output->randr_output == NULL) return; /* rootful */ @@ -697,6 +700,24 @@ xwl_output_set_name(struct xwl_output *xwl_output, const char *name) return; } + /* Check for duplicate names to be safe */ + pScrPriv = rrGetScrPriv(xwl_screen->screen); + for (i = 0; i < pScrPriv->numOutputs; i++) { + if (!strcmp(name, pScrPriv->outputs[i]->name)) { + ErrorF("An output named '%s' already exists", name); + return; + } + } + /* And leases' names as well */ + xorg_list_for_each_entry(lease, &pScrPriv->leases, list) { + for (i = 0; i < lease->numOutputs; i++) { + if (!strcmp(name, pScrPriv->outputs[i]->name)) { + ErrorF("A lease output named '%s' already exists", name); + return; + } + } + } + snprintf(xwl_output->randr_output->name, MAX_OUTPUT_NAME, "%s", name); xwl_output->randr_output->nameLength = strlen(xwl_output->randr_output->name); |