summaryrefslogtreecommitdiff
path: root/randr
diff options
context:
space:
mode:
authorMichael Wyraz <mw@brick4u.de>2022-10-14 15:07:27 +0200
committerMatt Turner <mattst88@gmail.com>2023-12-17 18:55:50 +0000
commit818130bb122750dfb780a6e591c31edf6475f3a5 (patch)
tree1d6bb9cd746edd0c5ee69166e3d007aec2e1c02c /randr
parente2eeaab2a4b3d4d3c500f3480214f8c962c3213b (diff)
Removing the code that deletes an existing monitor in RRMonitorAdd
In commit 7e1f86d4 monitor support was added to randr. At this time it seemed to be reasonable not to have more than one (virtual) monitor on a particular physical display. The code was never changed since. Nowadays, extremely large displays exists (4k displays, ultra-wide displays). In some use cases it makes sense to split these large physical displays into multiple virtual monitors. An example are ultra-wide screens that can be split into 2 monitors. The change in this commit makes this work. Besides that, removing a monitor in a function that is called "RRMonitorAdd" is bad practice and causes unexpected behaviour.
Diffstat (limited to 'randr')
-rw-r--r--randr/rrmonitor.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/randr/rrmonitor.c b/randr/rrmonitor.c
index c905042bb..0ec36f677 100644
--- a/randr/rrmonitor.c
+++ b/randr/rrmonitor.c
@@ -507,7 +507,6 @@ RRMonitorAdd(ClientPtr client, ScreenPtr screen, RRMonitorPtr monitor)
for (m = 0; m < pScrPriv->numMonitors; m++) {
RRMonitorPtr existing = pScrPriv->monitors[m];
- int o, eo;
/* If 'name' matches an existing Monitor on the screen, the
* existing one will be deleted as if RRDeleteMonitor were called.
@@ -517,27 +516,6 @@ RRMonitorAdd(ClientPtr client, ScreenPtr screen, RRMonitorPtr monitor)
continue;
}
- /* For each output in 'info.outputs', each one is removed from all
- * pre-existing Monitors. If removing the output causes the list
- * of outputs for that Monitor to become empty, then that
- * Monitor will be deleted as if RRDeleteMonitor were called.
- */
-
- for (eo = 0; eo < existing->numOutputs; eo++) {
- for (o = 0; o < monitor->numOutputs; o++) {
- if (monitor->outputs[o] == existing->outputs[eo]) {
- memmove(existing->outputs + eo, existing->outputs + eo + 1,
- (existing->numOutputs - (eo + 1)) * sizeof (RROutput));
- --existing->numOutputs;
- --eo;
- break;
- }
- }
- if (existing->numOutputs == 0) {
- (void) RRMonitorDelete(client, screen, existing->name);
- break;
- }
- }
if (monitor->primary)
existing->primary = FALSE;
}