Commit abe9ac5
fix: remove unnecessary screen width rounding in ChangeScreenSize (#11)
## Summary
- Removes the Go-level `s.Width = s.Width - (s.Width % 8)` rounding in
`ChangeScreenSize` that was silently truncating requested widths (e.g.
390 → 384)
- Makes `XCreateScreenMode` return the actual dimensions that `libxcvt`
produced via in/out pointer parameters, so the Go caller uses the
correct width for `XSetScreenConfiguration`
- Fixes the mode name in `XCreateScreenModeInfo` to use `libxcvt`'s
actual output dimensions instead of the original request, preventing
name/geometry mismatches
## Context
The rounding was originally added to match `libxcvt`'s CVT convention of
producing widths as multiples of 8. However, CVT is a timing standard
for generating timing parameters for physical monitors — not a hard
requirement of X.Org or the Xorg dummy driver used for virtual displays.
The rounding made it impossible to use non-multiple-of-8 resolutions
like 390x844 for mobile viewports, even when valid modelines existed in
`xorg.conf`, because Neko would turn 390 into 384 before ever searching
for a mode.
Now the resolution flow is:
1. **Exact match** — if a pre-defined modeline exists in `xorg.conf` for
the exact requested dimensions (e.g. `390x844`),
`XSetScreenConfiguration` finds and uses it directly.
2. **Dynamic creation** — if no match, `XCreateScreenMode` dynamically
creates a new mode via `libxcvt` and reports the actual dimensions back
to the caller.
## Verified
Tested end-to-end in a headful `chromium-headful` container:
- Requested 390x844@25Hz via the kernel-images API
- xrandr confirmed display at exactly `390x844_25` (using a manually
crafted modeline in `xorg.conf` that bypasses CVT rounding)
- CDP verification confirmed `screen.width=390`, `screen.height=844`,
`innerWidth=390`, `innerHeight=807` (37px app-mode title bar)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches XRandR mode selection/creation and changes the
resolution-setting flow, which could affect display configuration
behavior across environments, but the change is localized to the Xorg
wrapper.
>
> **Overview**
> `ChangeScreenSize` no longer truncates widths to a multiple of 8
before attempting to apply a screen mode; it now tries to set the exact
requested dimensions first and only creates a new mode if no existing
mode matches.
>
> `XCreateScreenMode` is updated to take width/height as in/out pointers
so the caller receives libxcvt’s *actual* generated dimensions, and
`XCreateScreenModeInfo` now names modes using those actual dimensions to
avoid name/geometry mismatches.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
3f90ca6. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 5073274 commit abe9ac5
3 files changed
+28
-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 | + | |
217 | 216 | | |
218 | | - | |
219 | | - | |
| 217 | + | |
220 | 218 | | |
221 | 219 | | |
222 | 220 | | |
223 | 221 | | |
224 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
225 | 227 | | |
226 | 228 | | |
227 | 229 | | |
| |||
| 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