RandR: Allow duplicate monitor name when adding it

When calling RRSetMonitor, an existing monitor name is allowed.
"If 'name' matches an existing Monitor on the screen, the existing one
will be deleted as if RRDeleteMonitor were called."
https://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt

It looks like the check was added by mistake, because in the next 'for'
the monitor is deleted if it is in this list.

Steps to reproduce:
Try RRSetMonitor with existing monitor name and other valid params
OBSERVED RESULT:
RRSetMonitors returns BadValue
EXPECTED RESULT:
RRSetMonitors returns OK

Amend: 7e1f86d42b
Signed-off-by: Ilya Pominov <ipominov@astralinux.ru>
This commit is contained in:
Ilya Pominov 2023-04-10 18:52:25 +03:00 committed by Matt Turner
parent cd617f2d0f
commit 146bb9b2c1

View File

@ -489,17 +489,6 @@ RRMonitorAdd(ClientPtr client, ScreenPtr screen, RRMonitorPtr monitor)
}
}
/* 'name' must not match the name of any Monitor on the screen, or
* a Value error results.
*/
for (m = 0; m < pScrPriv->numMonitors; m++) {
if (pScrPriv->monitors[m]->name == monitor->name) {
client->errorValue = monitor->name;
return BadValue;
}
}
/* Allocate space for the new pointer. This is done before
* removing matching monitors as it may fail, and the request
* needs to not have any side-effects on failure