162 lines
7.0 KiB
Plaintext
162 lines
7.0 KiB
Plaintext
user: You are executing a mechanical Wayland porting task for WindowMaker.
|
|
|
|
# Task: F.5 (Guard X11 block (if scr->display))
|
|
|
|
## Task Description (from ACTION_PLAN.md)
|
|
|
|
### F.5 Provide Wayland-safe XPM loading path
|
|
- **File**: `wrlib/load_xpm.c` (180 lines) — uses `XParseColor` for color name→RGB
|
|
- **Operation**: `load_xpm_normalized.c` (459 lines) already exists as a pure-C XPM parser that doesn't need X11. Verify that `RLoadImage()` in `wrlib/load.c` dispatches to `load_xpm_normalized.c` when `ctx->dpy == NULL`. If not, add a check:
|
|
```c
|
|
if (ctx->dpy == NULL)
|
|
return RLoadXPMNormalized(ctx, file);
|
|
else
|
|
return RLoadXPM(ctx, file);
|
|
```
|
|
- **Xlib calls eliminated**: 2 (in the Wayland path)
|
|
- **Blocked by**: F.2
|
|
|
|
## Procedure (Template 4)
|
|
|
|
|
|
**Use for**: D.1, D.2, D.11, and WINGs files where X11 code must be skipped on Wayland
|
|
|
|
```
|
|
TASK: Guard the X11-only code block at {{FILE}}:{{START_LINE}}-{{END_LINE}} so it
|
|
only executes when running on the X11 backend.
|
|
|
|
GOVERNING PRINCIPLE: WINGs code uses `scr->display != NULL` to detect the X11
|
|
backend. When `scr->display` is NULL, the Wayland backend is active and X11
|
|
calls must be skipped.
|
|
|
|
STEPS:
|
|
|
|
1. Read {{FILE}} from line {{START_LINE}} to {{END_LINE}}.
|
|
|
|
2. Confirm every line in this range calls Xlib functions or uses X11 types that
|
|
have no meaning on Wayland (GC, XCreateGC, XInternAtom, etc.).
|
|
|
|
3. Wrap the block:
|
|
```c
|
|
if (scr->display) {
|
|
// ... existing X11 code unchanged ...
|
|
}
|
|
```
|
|
Where `scr` is the `W_Screen*` in scope. Find it via:
|
|
- Direct variable `scr` or `scrPtr`
|
|
- `view->screen`
|
|
- `WMWidgetScreen(widget)`
|
|
|
|
4. If the Wayland backend needs equivalent behavior (e.g., the code creates
|
|
cursors or interns atoms), add an `else` block that calls the appropriate
|
|
backend vtable:
|
|
```c
|
|
if (scr->display) {
|
|
// X11 path
|
|
} else {
|
|
// Wayland path — use scr->viewBackend->*() or scr->renderBackend->*()
|
|
}
|
|
```
|
|
If no Wayland equivalent is needed (e.g., GC creation), the `else` is omitted.
|
|
|
|
VERIFICATION:
|
|
- The code compiles.
|
|
- Running with `WMAKER_USE_WAYLAND=1` does not crash in this code path (the
|
|
X11 block is skipped).
|
|
|
|
CONSTRAINTS:
|
|
- Do NOT move the code to a separate file. This template is for cases where
|
|
the X11 code is small (< 50 lines) and inline guarding is cleaner than a split.
|
|
- Do NOT delete the X11 code. It must continue to work for the X11 backend.
|
|
- The guard condition is always `if (scr->display)`, never `#ifdef WAYLAND`.
|
|
```
|
|
|
|
## Reference Tables (embed in every prompt)
|
|
|
|
### X11 Event Type → WMEvent Type
|
|
|
|
```
|
|
KeyPress/KeyRelease → WME_KEY_PRESS/WME_KEY_RELEASE → event->u.key.*
|
|
ButtonPress/ButtonRelease → WME_BUTTON_PRESS/WME_BUTTON_RELEASE → event->u.button.*
|
|
MotionNotify → WME_MOTION → event->u.motion.*
|
|
EnterNotify/LeaveNotify → WME_ENTER/WME_LEAVE → event->u.crossing.*
|
|
Expose → WME_EXPOSE → event->u.expose.*
|
|
ConfigureNotify → WME_CONFIGURE → event->u.configure.*
|
|
ConfigureRequest → WME_CONFIGURE_REQUEST → event->u.configureRequest.*
|
|
MapNotify → WME_MAP → event->u.lifecycle.*
|
|
MapRequest → WME_MAP_REQUEST → event->u.mapRequest.*
|
|
UnmapNotify → WME_UNMAP → event->u.lifecycle.*
|
|
DestroyNotify → WME_DESTROY → event->u.lifecycle.*
|
|
FocusIn/FocusOut → WME_FOCUS_IN/WME_FOCUS_OUT → event->u.focus.*
|
|
PropertyNotify → WME_PROPERTY → event->u.property.*
|
|
ClientMessage → WME_CLIENT_MESSAGE → event->u.clientMessage.*
|
|
SelectionNotify → WME_SELECTION → event->u.selection.*
|
|
SelectionRequest → WME_SELECTION_REQUEST → event->u.selection.* (check)
|
|
SelectionClear → WME_SELECTION_CLEAR → event->u.selection.* (check)
|
|
VisibilityNotify → WME_VISIBILITY → event->u.visibility.*
|
|
ColormapNotify → WME_COLORMAP → event->u.colormap.*
|
|
MappingNotify → WME_MAPPING → event->u.mapping.*
|
|
ReparentNotify → WME_REPARENT → event->u.reparent.*
|
|
```
|
|
|
|
### X11 Event Field → WMEvent Field
|
|
|
|
```
|
|
event->xkey.keycode → event->u.key.keycode
|
|
event->xkey.state → event->u.key.state
|
|
event->xkey.time → event->u.key.time
|
|
event->xkey.window → event->u.key.window
|
|
event->xkey.x, y → event->u.key.x, y
|
|
event->xkey.x_root → event->u.key.x_root
|
|
|
|
event->xbutton.button → event->u.button.button
|
|
event->xbutton.state → event->u.button.state
|
|
event->xbutton.time → event->u.button.time
|
|
event->xbutton.window → event->u.button.window
|
|
event->xbutton.x, y → event->u.button.x, y
|
|
event->xbutton.x_root → event->u.button.x_root
|
|
|
|
event->xmotion.state → event->u.motion.state
|
|
event->xmotion.time → event->u.motion.time
|
|
event->xmotion.window → event->u.motion.window
|
|
event->xmotion.x, y → event->u.motion.x, y
|
|
event->xmotion.x_root → event->u.motion.x_root
|
|
|
|
event->xcrossing.window → event->u.crossing.window
|
|
event->xcrossing.state → event->u.crossing.state
|
|
event->xcrossing.time → event->u.crossing.time
|
|
event->xcrossing.mode → event->u.crossing.mode
|
|
event->xcrossing.detail → event->u.crossing.detail
|
|
|
|
event->xconfigure.window → event->u.configure.window
|
|
event->xconfigure.x, y → event->u.configure.x, y
|
|
event->xconfigure.width → event->u.configure.width
|
|
event->xconfigure.height → event->u.configure.height
|
|
|
|
event->xclient.data.l[N] → event->u.clientMessage.data.l[N]
|
|
event->xclient.message_type → event->u.clientMessage.atom
|
|
event->xclient.window → event->u.clientMessage.window
|
|
|
|
event->xproperty.atom → event->u.property.atom
|
|
event->xproperty.time → event->u.property.time
|
|
event->xproperty.window → event->u.property.window
|
|
```
|
|
|
|
---
|
|
|
|
## Important Rules
|
|
|
|
1. Work in the git repository at /home/lkn/src/WindowMaker-0.96.0. Create a git branch named "port/F.5" before making changes.
|
|
2. Make exactly the changes described. No more, no less.
|
|
3. After making changes, verify with the grep commands in the template.
|
|
4. Attempt to compile with: cd /home/lkn/src/WindowMaker-0.96.0 && make -j$(nproc) 2>&1 | tail -30
|
|
5. If compilation fails, fix the errors. If you cannot fix them, revert and report.
|
|
6. If you hit a STOP condition (missing vtable slot, missing API), revert changes and report exactly what is missing.
|
|
7. When done, run: git add -A && git diff --cached --stat
|
|
8. Report the final status as one of:
|
|
- DONE: task completed, compiles clean
|
|
- STOP: blocked on <reason>
|
|
- FAIL: could not complete because <reason>
|
|
|
|
Line numbers in ACTION_PLAN.md may have drifted. Use grep to find current line numbers before editing.
|