Skip to content

gtk: route pointer and key input to the Surface - #95

Merged
tannevaled merged 1 commit into
mainfrom
feat/gtk-input
Aug 31, 2026
Merged

gtk: route pointer and key input to the Surface#95
tannevaled merged 1 commit into
mainfrom
feat/gtk-input

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

The GTK backend could open a window and host native controls, but its drawn regions — the whole self-rendering Surface outside the overlaid controls — were dead: no click, scroll or keystroke reached them, so on Linux the reader couldn't even be navigated to a view. Attaches go-gtk v0.3.0's event controllers to the window and translates each into a toolkit.Event delivered to the root, then marks dirty so the frame clock presents the result — the same event shapes and DOM-style key names Cocoa/X11 emit (Click/MouseUp/Move/Drag, SecondaryClick for the right button, Scroll in ±1 rows with no inversion, KeyDown/Up/Char). Native controls still receive their own input from GTK and consume it first.

Proven end-to-end: newsreader -window under Xvfb, a synthetic click on the Settings item navigates from the feed to the Settings view. Display-free tests cover the key-name/scroll/modifier/button mapping. Bumps go-gtk v0.2.4 → v0.3.0.

The GTK back-end could open a window and host native controls, but its DRAWN
regions — the whole self-rendering Surface outside the overlaid controls — were
dead: no click, scroll or keystroke reached them, so on Linux the reader could not
even be navigated to a view. Attach go-gtk v0.3.0's event controllers to the window
and translate each into a toolkit.Event delivered to the root, then mark dirty so
the frame clock presents the result — the same event shapes and DOM-style key names
the Cocoa/X11 backends emit (EventClick/MouseUp/Move/Drag, EventSecondaryClick for
the right button, EventScroll in ±1 rows with no inversion, EventKeyDown/Up/Char).
The native controls still receive their own input from GTK and consume it first.

Proven end to end: newsreader -window under Xvfb, a synthetic click on the Settings
item navigates from the feed to the Settings view (its native text fields render).
Display-free tests cover the key-name/scroll/modifier/button mapping; bumps go-gtk
v0.2.4 → v0.3.0.
@tannevaled
tannevaled merged commit ce053e1 into main Aug 31, 2026
28 checks passed
@tannevaled
tannevaled deleted the feat/gtk-input branch August 31, 2026 20:40
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.

1 participant