summaryrefslogtreecommitdiffstats
path: root/source/kde/kde/patch/kscreen/57.patch
blob: bb8befc91fa2977b862521e4ff135eee46c06e8b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
From 4d025b68022405ce889b563ed67646ccbfe4a658 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=C3=A9ven=20Car?= <meven.car@enioka.com>
Date: Mon, 29 Nov 2021 17:15:26 +0100
Subject: [PATCH 1/4] Compute logicalSize taking into account current config

BUG: 441417
---
 kcm/output_identifier.cpp |  2 +-
 kcm/output_model.cpp      | 23 +++++++++++++++--------
 kded/output.cpp           |  4 ++--
 3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/kcm/output_identifier.cpp b/kcm/output_identifier.cpp
index a672995..ba51470 100644
--- a/kcm/output_identifier.cpp
+++ b/kcm/output_identifier.cpp
@@ -56,7 +56,7 @@ OutputIdentifier::OutputIdentifier(KScreen::ConfigPtr config, QObject *parent)
         }
         if (config->supportedFeatures() & KScreen::Config::Feature::PerOutputScaling) {
             // Scale adjustment is not needed on Wayland, we use logical size.
-            logicalSize = output->logicalSize().toSize();
+            logicalSize = output->explicitLogicalSize().toSize();
         } else {
             logicalSize = deviceSize / view->effectiveDevicePixelRatio();
         }
diff --git a/kcm/output_model.cpp b/kcm/output_model.cpp
index a497c90..020b96f 100644
--- a/kcm/output_model.cpp
+++ b/kcm/output_model.cpp
@@ -161,10 +161,13 @@ bool OutputModel::setData(const QModelIndex &index, const QVariant &value, int r
         bool ok;
         const qreal scale = value.toReal(&ok);
         if (ok && !qFuzzyCompare(output.ptr->scale(), scale)) {
-            const auto oldSize = output.ptr->logicalSize().toSize();
+            const auto oldSize = output.ptr->explicitLogicalSize().toSize();
+
             output.ptr->setScale(scale);
             m_config->setScale(output.ptr, scale);
-            const auto newSize = output.ptr->logicalSize().toSize();
+
+            const auto newSize = m_config->config()->logicalSizeForOutput(*output.ptr).toSize();
+            output.ptr->setExplicitLogicalSize(newSize);
 
             maintainSnapping(output, oldSize, newSize);
 
@@ -385,9 +388,11 @@ bool OutputModel::setResolution(int outputIndex, int resIndex)
     if (output.ptr->currentModeId() == id) {
         return false;
     }
-    const auto oldSize = output.ptr->logicalSize().toSize();
+    const auto oldSize = output.ptr->explicitLogicalSize().toSize();
     output.ptr->setCurrentModeId(id);
-    const auto newSize = output.ptr->logicalSize().toSize();
+
+    const auto newSize = m_config->config()->logicalSizeForOutput(*output.ptr).toSize();
+    output.ptr->setExplicitLogicalSize(newSize);
 
     maintainSnapping(output, oldSize, newSize);
 
@@ -466,9 +471,11 @@ bool OutputModel::setRotation(int outputIndex, KScreen::Output::Rotation rotatio
     if (output.ptr->rotation() == rotation) {
         return false;
     }
-    const auto oldSize = output.ptr->logicalSize().toSize();
+    const auto oldSize = output.ptr->explicitLogicalSize().toSize();
     output.ptr->setRotation(rotation);
-    const auto newSize = output.ptr->logicalSize().toSize();
+
+    const auto newSize = m_config->config()->logicalSizeForOutput(*output.ptr).toSize();
+    output.ptr->setExplicitLogicalSize(newSize);
 
     maintainSnapping(output, oldSize, newSize);
 
@@ -653,7 +660,7 @@ bool OutputModel::setReplicationSourceIndex(int outputIndex, int sourceIndex)
             return false;
         }
         m_config->setReplicationSource(output.ptr, nullptr);
-        output.ptr->setLogicalSize(QSizeF());
+        output.ptr->setExplicitLogicalSize(QSizeF());
         resetPosition(output);
     } else {
         const auto source = m_outputs[sourceIndex].ptr;
@@ -664,7 +671,7 @@ bool OutputModel::setReplicationSourceIndex(int outputIndex, int sourceIndex)
         m_config->setReplicationSource(output.ptr, source);
         output.posReset = output.ptr->pos();
         output.ptr->setPos(source->pos());
-        output.ptr->setLogicalSize(source->logicalSize());
+        output.ptr->setExplicitLogicalSize(m_config->config()->logicalSizeForOutput(*source));
     }
 
     reposition();
diff --git a/kded/output.cpp b/kded/output.cpp
index 7463b8a..44251e5 100644
--- a/kded/output.cpp
+++ b/kded/output.cpp
@@ -404,9 +404,9 @@ void Output::readInOutputs(KScreen::ConfigPtr config, const QVariantList &output
         auto replicationSource = control.getReplicationSource(output);
         if (replicationSource) {
             output->setPos(replicationSource->pos());
-            output->setLogicalSize(replicationSource->logicalSize());
+            output->setExplicitLogicalSize(config->logicalSizeForOutput(*replicationSource));
         } else {
-            output->setLogicalSize(QSizeF());
+            output->setExplicitLogicalSize(QSizeF());
         }
     }
 
-- 
GitLab


From 3b90217f21e62285e78fff86ae562c692799e28f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=C3=A9ven=20Car?= <meven.car@enioka.com>
Date: Tue, 30 Nov 2021 14:58:40 +0100
Subject: [PATCH 2/4] Update screen size when mode changes

---
 kcm/output_model.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kcm/output_model.cpp b/kcm/output_model.cpp
index 020b96f..ae01307 100644
--- a/kcm/output_model.cpp
+++ b/kcm/output_model.cpp
@@ -390,6 +390,7 @@ bool OutputModel::setResolution(int outputIndex, int resIndex)
     }
     const auto oldSize = output.ptr->explicitLogicalSize().toSize();
     output.ptr->setCurrentModeId(id);
+    output.ptr->setSize(output.ptr->currentMode()->size());
 
     const auto newSize = m_config->config()->logicalSizeForOutput(*output.ptr).toSize();
     output.ptr->setExplicitLogicalSize(newSize);
-- 
GitLab


From ad8d66c2c39c15a9fd668a0a292f4cd970731123 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=C3=A9ven=20Car?= <meven.car@enioka.com>
Date: Wed, 1 Dec 2021 13:39:21 +0100
Subject: [PATCH 3/4] Ensure to set outputs explicitLogicalSize upon loading
 config

---
 kcm/config_handler.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kcm/config_handler.cpp b/kcm/config_handler.cpp
index d7e7c7c..dabbcb2 100644
--- a/kcm/config_handler.cpp
+++ b/kcm/config_handler.cpp
@@ -78,6 +78,8 @@ void ConfigHandler::resetScale(const KScreen::OutputPtr &output)
 
 void ConfigHandler::initOutput(const KScreen::OutputPtr &output)
 {
+    output->setExplicitLogicalSize(config()->logicalSizeForOutput(*output));
+
     if (output->isConnected()) {
         resetScale(output);
         m_outputs->add(output);
-- 
GitLab


From ad7dda0b64c6f76066cdd199b0aa6ed2e2982f88 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=C3=A9ven=20Car?= <meven.car@enioka.com>
Date: Wed, 1 Dec 2021 14:40:32 +0100
Subject: [PATCH 4/4] Fix output identifier window positioning in wayland with
 some scale

---
 kcm/output_identifier.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kcm/output_identifier.cpp b/kcm/output_identifier.cpp
index ba51470..d21d36f 100644
--- a/kcm/output_identifier.cpp
+++ b/kcm/output_identifier.cpp
@@ -56,7 +56,7 @@ OutputIdentifier::OutputIdentifier(KScreen::ConfigPtr config, QObject *parent)
         }
         if (config->supportedFeatures() & KScreen::Config::Feature::PerOutputScaling) {
             // Scale adjustment is not needed on Wayland, we use logical size.
-            logicalSize = output->explicitLogicalSize().toSize();
+            logicalSize = config->logicalSizeForOutput(*output.data()).toSize();
         } else {
             logicalSize = deviceSize / view->effectiveDevicePixelRatio();
         }
-- 
GitLab