Commit 9fc8c79
fix: remove unnecessary screen width rounding in ChangeScreenSize
The Go-level `s.Width = s.Width - (s.Width % 8)` rounding was silently
truncating requested widths (e.g. 390 → 384) before attempting to find
or create a screen mode. This made it impossible to use resolutions like
392x844 for mobile viewports even when valid modelines existed.
The rounding was originally added to match libxcvt's CVT convention of
producing widths as multiples of 8, but this is a timing standard for
physical monitors — not a constraint of the Xorg dummy driver used for
virtual displays.
Now ChangeScreenSize follows a 3-step fallback:
1. Try the exact requested dimensions (e.g. 390x844)
2. If no match, round width up to the nearest multiple of 8 and retry
(e.g. 392x844 — matches predefined modelines in xorg.conf)
3. If still no match, dynamically create a new mode via libxcvt
The C layer is also updated so XCreateScreenMode returns the actual
dimensions that libxcvt produced (via in/out pointer parameters), and
XCreateScreenModeInfo uses the actual libxcvt output dimensions for the
mode name so it matches the real mode geometry.
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 5073274 commit 9fc8c79
3 files changed
+48
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
306 | 308 | | |
307 | 309 | | |
308 | 310 | | |
309 | 311 | | |
310 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
311 | 317 | | |
312 | 318 | | |
313 | 319 | | |
| |||
325 | 331 | | |
326 | 332 | | |
327 | 333 | | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | 334 | | |
333 | 335 | | |
334 | 336 | | |
335 | 337 | | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
336 | 341 | | |
337 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
338 | 347 | | |
339 | 348 | | |
340 | 349 | | |
| |||
349 | 358 | | |
350 | 359 | | |
351 | 360 | | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
352 | 365 | | |
353 | 366 | | |
354 | 367 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | 204 | | |
208 | 205 | | |
209 | 206 | | |
| |||
212 | 209 | | |
213 | 210 | | |
214 | 211 | | |
215 | | - | |
| 212 | + | |
216 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
217 | 228 | | |
218 | | - | |
219 | | - | |
| 229 | + | |
220 | 230 | | |
221 | 231 | | |
222 | 232 | | |
223 | 233 | | |
224 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
225 | 239 | | |
226 | 240 | | |
227 | 241 | | |
| |||
237 | 251 | | |
238 | 252 | | |
239 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
240 | 262 | | |
241 | 263 | | |
242 | 264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
0 commit comments