diff options
| author | Adam Malczewski <[email protected]> | 2026-04-11 19:06:35 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-04-11 19:06:35 +0900 |
| commit | 93f50d20a021150a0b95242be0d5dd5cae9d0185 (patch) | |
| tree | 48054581d580974651260900d1ef79d370872952 /.rules/plan/phase-04-input.md | |
| download | winman-raylib-main.tar.gz winman-raylib-main.zip | |
plan and researchmain
Diffstat (limited to '.rules/plan/phase-04-input.md')
| -rw-r--r-- | .rules/plan/phase-04-input.md | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/.rules/plan/phase-04-input.md b/.rules/plan/phase-04-input.md new file mode 100644 index 0000000..439d215 --- /dev/null +++ b/.rules/plan/phase-04-input.md @@ -0,0 +1,50 @@ +# Phase 4 — Input & Focus + +--- + +## Step 4.1 — Click-to-focus and raise + +On `ButtonPress` events on managed windows, set focus with +`XSetInputFocus(dpy, win->xwin, RevertToParent, CurrentTime)` and raise +the window with `XRaiseWindow()`. + +Register for `ButtonPressMask` on all managed windows using a passive +grab: + +```c +XGrabButton(dpy, AnyButton, AnyModifier, win->xwin, True, + ButtonPressMask, GrabModeSync, GrabModeAsync, None, None); +``` + +On `ButtonPress`, set focus, raise, then `XAllowEvents(dpy, ReplayPointer, +CurrentTime)` to pass the click through to the client. + +**Verify:** Click on `xterm` — it receives focus and comes to front. +Type in it. Click `xeyes` — it comes to front. Focus switching works. + +--- + +## Step 4.2 — Window dragging with Mod+Click + +Grab `Mod4 + Button1` (Super+Click) on the root window. On press, start +tracking a drag. On motion, `XMoveWindow()` the client and update the +stored position. On release, stop. + +```c +XGrabButton(dpy, Button1, Mod4Mask, root, True, + ButtonPressMask | ButtonReleaseMask | PointerMotionMask, + GrabModeAsync, GrabModeAsync, None, None); +``` + +**Verify:** Super+Click and drag moves windows around inside Xephyr. +Release drops them. The composited view updates in real-time. + +--- + +## Step 4.3 — Window resizing with Mod+RightClick + +Same pattern as dragging but with `Mod4 + Button3`. On motion, call +`XResizeWindow()`. Re-obtain the pixmap and texture after resize. + +**Verify:** Super+RightClick and drag resizes windows. The texture +updates to show the new content. |
