Skip to content

examples: select events after synchronous requests - #65

Closed
marler8997 wants to merge 1 commit into
masterfrom
fix-configure-notify
Closed

marler8997 wants to merge 1 commit into
masterfrom
fix-configure-notify

Conversation

@marler8997

Copy link
Copy Markdown
Owner

Some servers (e.g. MobaXterm's Moba/X) send a ConfigureNotify as soon as a window is created. dbe, present, draw and testexample selected StructureNotify in CreateWindow and then did synchronous requests (QueryExtension, QueryTextExtents, ...), so the event arrived while waiting for a reply:

error(x11): expected Reply but got ConfigureNotify(22)...
error: UnexpectedMessage

These examples now select their events with ChangeWindowAttributes just before MapWindow, after all synchronous requests. The other examples only select events that can't arrive before the window is mapped (Exposure, KeyPress, PointerMotion).

Verified with a proxy in front of Xvfb that injects a ConfigureNotify after any CreateWindow that selects StructureNotify (mimicking Moba/X): all four examples failed with the error above before this change and run normally after it. zig build test-non-interactive passes.

https://ampcode.com/threads/T-01a14b88-aff8-717e-bb9f-364137832240

Some servers (e.g. MobaXterm's Moba/X) send ConfigureNotify as soon as a
window is created. The dbe, present, draw and testexample examples selected
StructureNotify in CreateWindow and then did synchronous requests, so the
ConfigureNotify arrived while waiting for a reply and failed with
"expected Reply but got ConfigureNotify". Select events with
ChangeWindowAttributes just before MapWindow instead.

Amp-Thread-ID: https://ampcode.com/threads/T-01a14b88-aff8-717e-bb9f-364137832240
Co-authored-by: Amp <amp@ampcode.com>
@marler8997

Copy link
Copy Markdown
Owner Author

Superseded by #68.

@marler8997 marler8997 closed this Oct 18, 2026
@marler8997
marler8997 deleted the fix-configure-notify branch October 18, 2026 15:29
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