Commit 77b82c8
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.
Instead of pre-rounding in Go, we now:
- Pass the requested width directly to XSetScreenConfiguration
- Make XCreateScreenMode return the actual dimensions that libxcvt
produced (via in/out pointer parameters)
- Use the actual libxcvt output dimensions for the mode name so it
matches the real mode geometry
- Update the returned ScreenSize with the actual created dimensions
This way callers get accurate feedback about what resolution was set,
and existing modes with non-rounded widths (from xorg.conf) are found
correctly.
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 5073274 commit 77b82c8
3 files changed
Lines changed: 28 additions & 12 deletions
| 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 | | |
| |||
215 | 212 | | |
216 | 213 | | |
217 | 214 | | |
218 | | - | |
219 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
220 | 223 | | |
221 | 224 | | |
222 | 225 | | |
| |||
| 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