Conversation
jserv
added a commit
that referenced
this pull request
Jun 11, 2026
PR #10's sanitize job (clang -fsanitize=address,undefined -fno-sanitize-recover=undefined) tripped on src/window-property.c:478 during test_ewmh_wm_state_clientmessage's toggle path, which clears _NET_WM_STATE and then reads it back: src/window-property.c:478:41: runtime error: applying zero offset to null pointer After XChangeProperty(... PropModeReplace, NULL, 0) the stored WindowProperty has data == NULL and dataLength == 0. XGetWindowProperty then computed `windowProperty->data + offsetItems * storageTypeSize` and called memcpy(dst, NULL, 0). Both pointer arithmetic on NULL and memcpy of zero bytes from a NULL source are undefined per the C standard, regardless of the runtime no-op. Guard the memcpy with dataReturnSize > 0 so empty properties skip the copy and only NUL-terminate the 1-byte allocation. Verified locally under the same sanitizer flag set; the rest of check-unit stays green.
This implements EWMH / ICCCM / MWM support
- New src/events-ewmh.c routes root ClientMessages (_NET_{WM_STATE,
ACTIVE_WINDOW,CLOSE_WINDOW}) into the in-process WM rather than letting
the acceptsEventMask walk drop them in XSendEvent.
- New src/window-wm.c applies _MOTIF_WM_HINTS to SDL_SetWindow{Resizable,
Bordered}, mirrors _NET_WM_STATE bits into SDL_SetWindowFullscreen /
Maximize / Minimize / AlwaysOnTop, and wires WM_TRANSIENT_FOR +
_NET_WM_STATE_MODAL / MWM_INPUT_FULL_APPLICATION_MODAL into
SDL_SetWindowModalFor with deferred re-resolve on realize.
- New src/window-property.c factors X{Change,Delete,GetWindow}Property
plus the _NET_WM_NAME / WM_NAME title detour out of window.c;
_NET_WM_STATE writes drive both the SDL flag mirror and the modal
pairing.
- New src/events-expose.c owns expose-event synthesis (clear-without-expose,
full-window expose, descendant fanout, synthetic resize).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This implements EWMH / ICCCM / MWM support
Summary by cubic
Implements an in-process window manager for EWMH/ICCCM/MWM. Routes root
ClientMessages and applies WM hints/state directly to SDL windows for correct modal, fullscreen, maximize/minimize, always-on-top, focus, close, and expose behavior.New Features
ClientMessages:_NET_WM_STATE,_NET_ACTIVE_WINDOW,_NET_CLOSE_WINDOW._MOTIF_WM_HINTSand mirror_NET_WM_STATEto SDL (resizable/borders, fullscreen/maximize/minimize/above).WM_TRANSIENT_FOR+_NET_WM_STATE_MODAL/MWM_INPUT_FULL_APPLICATION_MODAL(deferred on realize).X{Change,Delete,GetWindow}Propertyinto a new module; synthesize reads and hook writes to drive SDL flags,_NET_WM_STATE, and window title.Bug Fixes
XGetWindowPropertyreads to avoidmemcpyon empty values (e.g. cleared_NET_WM_STATE).Written for commit e155761. Summary will update on new commits.