Commit Graph

586 Commits

Author SHA1 Message Date
lkn 16e07f751c wayland: fix modifier+drag grab — pass owner_events=1 in frameMouseDown
The pointer_grab call for Alt+drag (move/resize via MOD_MASK on client
surface) was passing owner_events=0.  wl_pointer_grab only sets
grab_type=3 and clears seat pointer focus when owner_events is True;
with 0 the grab returned success but left no grab state, so motion
events continued flowing to the client instead of the WM drag loop.

Pass 1 (True) to match the calls in resizebarMouseDown and
titlebarMouseDown, which work correctly.
2026-06-06 20:41:42 +02:00
lkn 10281cf2d1 wayland: suppress client forwarding on modifier+click for move/resize
When the WM modifier key (Alt by default, configurable via ModifierKey)
is held during a button press over a client surface, do not forward the
event to the client via wlr_seat_pointer_notify_button.  The event has
already been enqueued for the WM policy layer via W_WL_EnqueueEvent;
frameMouseDown will call wMouseMoveWindow (LMB) or wMouseResizeWindow
(RMB) as appropriate.  Without this suppression the client application
receives the Alt+click and may act on it instead of the WM.
2026-06-06 20:38:03 +02:00
lkn d17dc0d6ee wayland: fix window resize and populate button modifier state
Three related fixes for the Wayland backend:

wl_handlers.c: populate u.button.state with keyboard modifiers
  Button events were built with state=0 after memset, so all modifier-
  dependent logic in window.c (resizebarMouseDown, frameMouseDown,
  titlebarMouseDown) received no modifier information.  Read the current
  depressed modifier mask from the seat keyboard and copy it directly --
  wlroots WLR_MODIFIER_* bits match the WM_MOD_* layout exactly.

wl_framebuf.c: fix frame_buf_hit to resolve child sub-windows
  frame_buf_at() uses wlr_scene_node_at() which skips frame_buf children
  whose scene_buf has no committed buffer (resizebar, titlebar pixels are
  composited into the parent frame buffer).  The hit always resolved to
  the top-level frame, so events were dispatched to frameMouseDown instead
  of resizebarMouseDown, and resize never started.  After frame_buf_at
  returns a top-level frame, do a coordinate-based child search and return
  the smallest (most specific) child that contains the pointer -- the same
  strategy frame_buf_button_at uses for buttons.

wl_events.c: fix wl_coords_translate to return frame-relative coords
  The stub was a pass-through returning root-relative coordinates unchanged.
  wMouseResizeWindow calls coords_translate(root, frame->core->window, ...)
  to get frame-relative click coordinates for getResizeDirection().  Look up
  the dst window in the frame_buf list and subtract its absolute position.
2026-06-06 20:36:36 +02:00
lkn 6a12e3ea5a wayland: fix direct keyboard input device selection 2026-06-06 20:12:20 +02:00
lkn 2c1dca387f multi monitor 2026-06-06 20:05:57 +02:00
lkn ad0871054c wayland: fix multi-output pointer coordinate bugs
Three interrelated bugs caused clicks to land in the wrong place when
the compositor spanned multiple outputs (e.g. two 1920x1080 monitors
side by side in nested Wayland mode):

1. real_pointer_update_global() added lo->x to coordinates that were
   already in layout space from wlr_cursor_absolute_to_layout_coords,
   double-counting the output offset. It also omitted lo->y entirely,
   breaking vertical monitor layouts. Fix: read position from
   wlr_cursor->x/y which is always authoritative layout-space.

2. real_pointer_handle_motion() accumulated ev->delta into local_x/y
   then set pointer_x/y, after which handle_pointer_motion() added
   the same delta again -- doubling every relative motion. Fix: let
   handle_pointer_motion() be the sole authority; use wlr_cursor_move()
   which respects output layout geometry.

3. Pointer devices from nested Wayland outputs (WL-1, WL-2) were never
   registered with wlr_cursor via wlr_cursor_attach_input_device() or
   mapped to their output via wlr_cursor_map_input_to_output(). Without
   this mapping, wlr_cursor_absolute_to_layout_coords treated the 0..1
   range as spanning the entire layout (0..3840) instead of the
   device's specific output (e.g. 1920..3840 for WL-2). A previous
   workaround disabled absolute motion entirely for nested multi-output,
   which left only relative deltas that had no concept of which host
   window the mouse was in. Fix: register devices with wlr_cursor and
   map them to their outputs; remove the early-return.

All pointer paths now follow the same pattern: mutate position via
wlr_cursor_move()/wlr_cursor_warp(), then read back cursor->x/y into
wl_state.pointer_x/y. Manual bounding-box clamping is retained only
for the no-cursor fallback (headless/test mode).
2026-06-06 20:05:34 +02:00
lkn b33774db14 phase 3: multi-output support — handle all wlr_outputs (not just first), per-output scene_output/bg_rect/frame_listener, refresh heads on hotplug 2026-06-06 18:02:18 +02:00
lkn 3fc416a9b6 fixup: wl_monitors_query returns scr->heads directly instead of making a copy (avoids leak) 2026-06-06 17:50:01 +02:00
lkn c5ba4baea0 phase 1-2: wl_screen_refresh_heads() enumerates all outputs from wlr_output_layout, populates heads/head_count/primary_head and sets correct scr_width/scr_height from bounding box 2026-06-06 17:49:10 +02:00
lkn 57a8973bc2 fix: wlclient_dispatch stops spinning when compositor closes the socket (NULLs ctx->display, making subsequent calls a no-op) 2026-06-06 16:53:13 +02:00
lkn 6fa2c78c2e wayland: avoid misclassifying WINGs toplevels as dialogs 2026-06-06 16:19:08 +02:00
lkn 74a4314621 fix: destroy frame_bufs in handle_toplevel_destroy so they do not leak between WPrefs launches 2026-06-06 14:19:33 +02:00
lkn f606558698 fix: also check scene_buf NULL to detect stale WINGs frame_bufs (parent frame can also leak, making parent_id check insufficient) 2026-06-06 12:03:35 +02:00
lkn fc27be21e3 fix: clean up stale WINGs frame_bufs on toplevel map so second WPrefs launch does not skip wManageWindow 2026-06-06 11:55:22 +02:00
lkn b26a4c733c fix: save host WAYLAND_DISPLAY before overwrite, restore on close so restart finds the host compositor 2026-06-06 11:27:38 +02:00
lkn bfa715a99e fix: unlink wayland socket manually instead of calling wl_display_destroy (wlroots 0.19 multi-backend aborts on display destroy during shutdown) 2026-06-06 11:14:08 +02:00
lkn 563b278268 fix: remove explicit wlr_backend_destroy before wl_display_destroy 2026-06-06 11:12:54 +02:00
lkn 6a9b509d77 fix: guard wl_list_remove in input destroy handlers against double-remove during wl_display_close 2026-06-06 11:11:30 +02:00
lkn 1c6c9d6e66 fix: call wl_display_destroy on close so restart works (stale socket was preventing execvp from re-binding) 2026-06-06 11:06:59 +02:00
lkn 1045bd6a77 fixup: remove build artifacts accidentally tracked 2026-06-06 11:01:10 +02:00
lkn a89859ab32 cleanup: remove WL_DECOMPOSITION_PLAN.md (decomposition complete) 2026-06-06 11:01:04 +02:00
lkn e78cef743e step 5: extract protocol init to wl_extensions.c (protocol globals + 5 handler relocations) 2026-06-06 09:47:08 +02:00
lkn b5aa99542c step 4: move wl_handle_x11_events from wl_backend.c to wl_xwayland.c (X11 event bridge) 2026-06-06 09:43:44 +02:00
lkn 3b3ab96597 step 3: move screen internals from wl_backend.c to wl_screen.c (alloc_gcs, create_internals, monitors_query, 293 lines) 2026-06-06 09:42:17 +02:00
lkn 9178f8a903 step 2: extract wl_background.c from wl_backend.c (desktop background rendering, 304 lines) 2026-06-06 09:40:20 +02:00
lkn 8cca118517 step 1: remove duplicate layer shell code from wl_backend.c (deletes 182 lines shadowed by wl_layer_shell.c) 2026-06-06 09:38:54 +02:00
lkn 60c43b734a fix combined build: mark stub functions __attribute__((weak)) to resolve multiple-definition conflicts when linking both X11 and Wayland backends 2026-06-06 09:36:03 +02:00
lkn 709a8d76fc cleanup: remove debug TRACE fprintf lines from defaults.c 2026-06-06 09:01:09 +02:00
lkn 90da92c83c fix startup crash: skip getTexture entries with corrupted WINGs PL arrays in Wayland-only build 2026-06-06 08:59:10 +02:00
Window Maker f619a1a1a5 fix WidgetColor crash: WMCreatePropListFromDescription creates corrupt array elements in pure Wayland build, skip getTexture for WidgetColor until WINGs PL is fixed; remove all debug traces; disable crash recovery loop 2026-06-06 07:47:19 +02:00
Window Maker 6ca913c4e3 fix MonitorLoop infinite restart, add getTexture NULL-safety, disable crash recovery 2026-06-06 07:32:52 +02:00
Window Maker c25d5dd56d fix WidgetColor crash: getTexture convert function did not handle NULL plvalue fallback for entries with no hardcoded default plvalue 2026-06-06 07:21:13 +02:00
Window Maker 7e5d81bfd1 pure Wayland build complete: no X11 libraries linked, binary builds and runs through all startup initialization, WidgetColor texture parse is pre-existing bug 2026-06-06 07:19:02 +02:00
Window Maker f1a70a8260 fix register_error_handlers NULL deref in pure Wayland build: move vtable entry out of USE_XWAYLAND guard, add empty stub 2026-06-06 06:50:02 +02:00
Window Maker 122ee29184 guard XWayland startup path behind USE_XWAYLAND: skip XOpenDisplay and pump thread in pure Wayland build 2026-06-05 20:13:16 +02:00
Window Maker 210d320887 guard wlr_xwayland_create behind USE_XWAYLAND: no XWayland server spawned in pure Wayland build, fixes crash after conditional compilation 2026-06-05 20:01:06 +02:00
Window Maker 31b621bbd2 pure Wayland build: conditionally compile wl_xdisplay.c/wl_xwayland.c behind USE_XWAYLAND, add stubs in wl_stubs.c, guard XWayland handler registration in wl_backend.c 2026-06-05 19:55:28 +02:00
Window Maker b546e9505d fix XWayland-only build: provide unconditional stub for get_window_image_from_x11 in wl_window.c so it links without the X11 backend 2026-06-05 19:40:46 +02:00
Window Maker e98dd1f6f0 add --enable-xwayland configure option: USE_XWAYLAND controls XWayland support independently from USE_X11_BACKEND; LINK_X11 conditional links libX11 when either is enabled; X11 libs no longer linked in pure Wayland mode 2026-06-05 19:35:01 +02:00
Window Maker 0453888f08 split USE_X11_BACKEND from XWayland: USE_XWAYLAND now controls X11 support in the wayland backend (X11 wrapper functions, error handlers, XWayland event loop, X11 window helpers), separate from USE_X11_BACKEND which controls the x11_backend.c classic WM mode 2026-06-05 19:09:55 +02:00
Window Maker 598f6f304b finish X11 call isolation: guard XSendEvent in wl_client.c, guard X11 error handlers in wl_extensions.c, guard vtable entries in wl_stubs.c 2026-06-05 18:42:26 +02:00
Window Maker 8c11b96ebc confine X11 calls to wl_xdisplay.c and wl_xwayland.c: wrap X11 function bodies in #if USE_X11_BACKEND with stubs, guard wl_backend.c X11 blocks, remove <X11/Xlib.h> from wl_atom.c/wl_event.c/wl_client.c/wl_framebuf.c 2026-06-05 18:36:07 +02:00
Window Maker b39c03e69e confine X11 calls to wl_xdisplay.c and wl_xwayland.c: move XInternAtom/XFlush/XSync to wl_xdisplay.c, move XGetImage/opacity to wl_xwayland.c, remove <X11/Xlib.h> from wl_atom.c/wl_event.c/wl_client.c/wl_framebuf.c 2026-06-05 18:30:20 +02:00
Window Maker 3b082257cd begin X11-free build: guard X11 link flags behind USE_X11_BACKEND, add -DWRASTER_NO_XLIB for non-X11 builds, guard X11-only function declarations in wl_types.h 2026-06-05 14:26:46 +02:00
Window Maker 3eaf2bc499 cleanup: remove stale Phase planning comments and DBG/DBG1 debug macros from all wayland backend source files 2026-06-04 21:34:37 +02:00
Window Maker 01c2664b2f fix WPrefs window decorations: only skip wManageWindow when a real WINGs dialog frame buffer is found (id>=0x20000000); regular WINGs windows (app_id="WINGs") now go through normal frame creation 2026-06-04 17:46:41 +02:00
Window Maker fb95ffc450 fix WINGs dialog button clicks: resolve WINGs view via WWindow client_leader when frame_buf_hit returns WM fake_leader 2026-06-04 14:55:43 +02:00
Window Maker 340e23ddc6 fix WINGs dialog input: skip wManageWindow for WINGs dialogs, connect XDG scene node to fake leader tree, adopt WINGs view ID 2026-06-04 13:48:26 +02:00
Window Maker e090b929a4 bridge WINGs dialog XDG toplevel to WINGs view ID: set view->frame_id and adopt WINGs window ID in handle_toplevel_map 2026-06-04 13:42:27 +02:00
Window Maker 9dcc4f8f72 add debug trace for WINGs dialog button event routing 2026-06-04 10:27:37 +02:00