Skip to content

Windows graphics Windows graphics: Direct3D 11 + DWM compositor - #82

Open
Bell8571 wants to merge 60 commits into
unstablebuild:mainfrom
Bell8571:windows-graphics
Open

Bell8571 wants to merge 60 commits into
unstablebuild:mainfrom
Bell8571:windows-graphics

Conversation

@Bell8571

@Bell8571 Bell8571 commented Sep 16, 2026 •

Copy link
Copy Markdown

Draft first slice of Windows graphics support. Companion issue: #81 (comment)

This PR

  • internal/term/gui/wingfx — per-monitor DPI v2, dark title bar, rounded corners, Mica (Win11) / Acrylic (Win10)
  • internal/term/gui/gui_native.go — prepareNativeWindow + applyNativeWindowEffects (no-op off Windows)
  • internal/term/gui/font/emoji_windows.go — Segoe UI Emoji / Noto Color Emoji search paths
  • docs + Windows CI skeleton

Wire-up in gui.go (two calls only):

// Run, after defer:
prepareNativeWindow(title)

// Update, first line:
applyNativeWindowEffects(g.enableTransparent, g.bgBlurRadius)

@Bell8571 Bell8571 changed the title Windows graphics Windows graphics Windows graphics: Direct3D 11 + DWM compositor Sep 16, 2026
@ejb711

ejb711 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Thanks for pushing Windows forward, this is great to see. We cross-compiled main + this PR from WSL with mingw-w64 (GOOS=windows GOARCH=amd64 CGO_ENABLED=1), together with the ebiten InitHint fix and tcell PR 6, and ran the result on Windows 11. A few things in this PR itself stop it from compiling for Windows. File:line references are against the PR head (a4bfcc1).

1. internal/term/vte/gather.go still builds on Windows

gather_windows.go adds a Windows ptyGather, but gather.go has no build constraint, so on Windows both files are compiled:

  • gather_windows.go:14 ptyGather redeclares gather.go:83
  • gather_windows.go:19 newPtyGather redeclares gather.go:100
  • gather_windows.go:23 (*ptyGather).release redeclares gather.go:172
  • gather.go:105-300 also calls golang.org/x/sys/unix functions that don't exist on Windows (IoctlGetWinsize, Dup, Pipe, Poll, SetNonblock, ...)

Adding //go:build !windows to gather.go fixes all of these. gather_test.go, ptywriter_bench_test.go and workload_bench_test.go use the unix gather internals too, so they need the same tag before go test can run on Windows.

2. internal/ide/syntax doesn't call the new dl_* wrappers yet

dl_unix.go / dl_windows.go define sysDlopen, sysDlsym, sysDlclose, dlNow and dlGlobal, but the callers still use purego directly, and on Windows purego has no Dlopen/Dlsym/Dlclose/RTLD_*:

  • search.go:1041, 1091, 1097, 1099, 1108, 1131
  • tree.go:311, 487, 497, 499, 507, 514

Swapping those for the wrappers (purego.Dlopen(langfile, purego.RTLD_NOW|purego.RTLD_GLOBAL) becomes sysDlopen(langfile, dlNow|dlGlobal), and so on) makes the package compile. purego.RegisterFunc can stay as it is, since it works on Windows.

3. License headers on new files

These new files start with the build tag and a two-line SPDX header instead of the canonical LICENSE_HEADER text:
cmd/rune/env_windows.go, cmd/rune/preset_standard_windows.go, cmd/rune/ide/apiclient/uname_unix.go, cmd/rune/ide/apiclient/uname_windows.go, internal/debug/pprof_signal_unix.go, internal/debug/pprof_signal_windows.go, internal/ide/ideupgrade/detect_windows.go, internal/ide/ideupgrade/upgrader_windows.go, internal/ide/syntax/dl_unix.go, internal/ide/syntax/dl_windows.go, internal/term/vte/gather_windows.go.

CONTRIBUTING asks for bluectl license -f LICENSE_HEADER <files>. The repo also puts //go:build after the header (see cmd/rune/env_unix.go:17).

4. go.work points at personal forks

go.work replaces ebiten and tcell with github.com/Bell8571/.... Because go.work sits at the repo root, it applies to every build, Linux and macOS included. Both fixes are now upstream:

  • ebiten: unstablebuild/ebiten#1 is merged (6f1d59169), though not tagged yet. It resolves as v2.7.6-0.20260916232601-6f1d59169775.
  • tcell: unstablebuild/tcell#6 is still open, and its head is the same commit (5f98175) that go.work pins.

It might be cleaner to bump the existing replace in go.mod once ebiten is tagged and tcell#6 lands, and drop go.work from the PR.

With 1 and 2 fixed, plus a few small unix-only splits we've opened separately (#106, #107, #108), rune.exe, rune-agent.exe, extension_go.exe and extension_python.exe all link. rune.exe runs natively and needs only KERNEL32.dll and msvcrt.dll. Happy to help with any of the above.

ernestrc pushed a commit that referenced this pull request Sep 20, 2026
Part of Windows support (#68, coordinated on #81). Second small slice
moving unix-only syscalls behind build tags; graphics stay with #82.

`lspSocketpair` calls `syscall.Socketpair`, which does not exist on
Windows, so `idelsp` fails to compile there. The unix implementation
moves into a `!windows` file unchanged.

On Windows it returns an explicit "language servers are not supported on
Windows yet" error instead of the package failing to build. The transport 
also depends on `net.FileConn` and on handing the server one bidirectional
handle as its stdin and stdout, neither of which carries over
to Windows, so a real Windows transport (loopback pair with piped stdio)
is a separate change.

Linux and macOS are unchanged; `TestLSPSocketpairIsCloseOnExec` still
pins the unix implementation. After this, the package's only remaining
Windows compile error is the `Setpgid` process-group attribute, which
the next slice handles.

Signed-off-by: Eric Brooks <[email protected]>
ernestrc pushed a commit that referenced this pull request Sep 20, 2026
…tening (#111)

Part of Windows support (#68, coordinated on #81). Found by running a
locally built `rune.exe` on Windows 11; graphics stay with #82.

`newUnixListener` created `<dataDir>/sockets` only after `bind(2)`
failed with `ENOENT`. On Windows, AF_UNIX reports a missing parent
directory as `WSAENETDOWN` instead, so the directory was never
created, every retry failed, and the home workspace's extensions
never started. The directory is now created before the first bind; the
retry loop keeps its stale-socket handling unchanged.

Linux and macOS behave the same: the `ENOENT` path only ever created
this directory, and `MkdirAll` on an existing one is a no-op. A new test starts
a listener under a data directory that does not exist yet and checks the socket
lands in `<dataDir>/sockets`.

Verified natively: with this, #110 and the other Windows slices applied
locally, a first launch on a fresh data directory logs zero errors
and the socket file is created.

Signed-off-by: Eric Brooks <[email protected]>
ernestrc pushed a commit that referenced this pull request Sep 21, 2026
…109)

Part of Windows support (#68, coordinated on #81). First runtime fix
found by running a locally built `rune.exe` on Windows 11; graphics stay
with #82.

The data directory, workspace server log and default config paths were
built with `path.Join`, which always joins with a forward slash, so on Windows
they came out as `C:\Users\me/.rune`. They now use `filepath.Join`. Linux and
macOS are unchanged: both functions join the same way there.

`extensionsCmdDir` was `"/tmp"`, which is not an absolute path on
Windows. It resolved under the home directory to `C:\Users\me\tmp`,
which does not exist, so building the home workspace's
extensions executor failed and the window stayed blank. It stays
`"/tmp"` on unix and is `os.TempDir()` on Windows.

New tests pin both on every OS: the defaults match `filepath.Join`, and
`extensionsCmdDir` is an absolute directory that exists. On Linux
`path.Join` and `filepath.Join` agree, so these cannot fail
there before the change; they fail on Windows without it, as does the
existing `TestResolveDefaultConfigPathPrefersYAMLThenStar`.

Signed-off-by: Eric Brooks <[email protected]>
ernestrc added a commit that referenced this pull request Sep 30, 2026
…106)

Part of Windows support (#68, coordinated on #81). First of 
a few small slices that move unix-only syscalls behind build 
tags so the tree compiles for `GOOS=windows`; graphics stay with #82.

`cmd/rune/main.go` referenced `syscall.SIGURG` and `unix.Dup2`, 
and the ssh workspace's signal map referenced `SIGUSR1`/`SIGUSR2`. 
None of these exist on Windows, so both packages fail to compile
there.

The unix bodies move into `!windows` files unchanged. Windows 
gets small counterparts: `SIGURG` never arrives, the launch log 
takes over the standard error handle with `SetStdHandle` (which 
the runtime also consults for fatal writes, so crash output lands 
in the log too), and `USR1`/`USR2` are simply absent from the map.

Behavior on Linux and macOS is unchanged. New tests pin the 
`SIGURG` check and the forwarded user signals.

Signed-off-by: Eric Brooks <[email protected]>
Signed-off-by: ernestrc <[email protected]>
Co-authored-by: ernestrc <[email protected]>
ernestrc added a commit that referenced this pull request Sep 30, 2026
Part of Windows support (#68, coordinated on #81). Found by running a
locally built `rune.exe` on Windows 11; graphics stay with #82.

The firstmover lock is a unix socket. When a leader dies 
without removing it, the next process gets an address-in-use 
error from `bind(2)` and falls back to following, then to a coup
once the dead leader stays unresponsive. That check used 
`syscall.EADDRINUSE`, which on Windows is an invented Go
errno rather than the Winsock `WSAEADDRINUSE` that bind 
returns, so the error was treated as unexpected and the service 
gave up. After any run that did not exit cleanly, every storage user
failed on the next launch: session history, window size and position,
installed packages.

Windows now also matches `WSAEADDRINUSE`, and the lock 
directory is created before the first bind, since Windows reports
a missing parent directory as `WSAENETDOWN` rather than 
`ENOENT` (same shape as #111).

Signed-off-by: Eric Brooks <[email protected]>
Signed-off-by: ernestrc <[email protected]>
Co-authored-by: ernestrc <[email protected]>
ernestrc added a commit that referenced this pull request Sep 30, 2026
Part of Windows support (#68, coordinated on #81). Third slice; graphics
stay with #82.

Four call sites built `syscall.SysProcAttr` literals with `Setpgid`,
`Setsid` and `Setctty`, and the file scheme killed process groups with 
`syscall.Kill`. None of these exist on Windows, so `workspace`, 
`workspacerpc`, `extensionv2`, `idedebug` and `vte` fail to compile there.

This collects them in a small `internal/procattr` package: 
`NewGroup`, `NewSession`, `LeadsGroup`, `KillGroup` and `Signal`.
The unix implementations are the old code moved unchanged, including
`killProcessGroup` from the file scheme. On Windows a new group is
`CREATE_NEW_PROCESS_GROUP`, a group is killed with 
`taskkill /T /F` (which walks the process tree, with "not found" 
mapped to `os.ErrProcessDone` like `ESRCH` on unix), sessions
and controlling terminals do not exist, and `Signal` supports `SIGKILL` only.

Linux and macOS are unchanged: the existing process-group tests in
`file_scheme_test` and
`workspace_runner_test` pass as before, and new tests pin that the
helpers build exactly the
attributes the literals built. The Windows-tagged tests cover the
`taskkill` arguments and the
group check; `GOOS=windows go vet ./internal/procattr/` passes.

`idelsp`'s single `Setpgid` literal is deliberately left alone here
because #107 touches the same file's imports; it becomes a one-line
follow-up once both land.

Signed-off-by: Eric Brooks <[email protected]>
Signed-off-by: ernestrc <[email protected]>
Co-authored-by: ernestrc <[email protected]>

@Bell8571 Bell8571 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants