Commit Graph

9 Commits

Author SHA1 Message Date
Window Maker 3761bef513 WPrefs: make crash handler async-signal-safe with write/fsync
Previous version used fprintf which buffers and may not flush before
_exit if the crash happened mid-libc. Use write() + fsync() so the
backtrace appears in the log even if the crash is deep in a library.
2026-05-24 18:01:43 +02:00
Window Maker b2f878314c WPrefs: replace X11 WidthOfScreen/HeightOfScreen with WMScreenWidth/Height
WindowHandling.c and Icons.c called WidthOfScreen(DefaultScreenOfDisplay(
WMScreenDisplay(scr))) which dereferences NULL on Wayland (no X Display).
Use WMScreenWidth/WMScreenHeight instead — these work on both backends.

Also added temporary SIGSEGV backtrace handler to main.c for debugging.
2026-05-24 16:54:34 +02:00
Window Maker 8119bfe098 WPrefs.app: zero X11 deps, zero #ifdef USE_X11_BACKEND
Complete architectural separation: all WPrefs.app panel code is now
backend-neutral. No X11 calls, no X11 types, no X11 includes, no
backend-specific #ifdef guards in shared sources.

New W_EventBackend vtable methods (implemented in X11, stubbed in WL):
  - grab_keyboard / ungrab_keyboard / allow_events
  - grab_pointer / ungrab_pointer / query_pointer
  - get_window_geometry / move_window / translate_coordinates
  - get_root_window / query_tree
  - get_pointer_control / set_pointer_control
  - modifier_from_key / get_modifier_keysyms
  - keysym_to_string / keysym_to_keycode / keycode_to_keysym
  - keysym_convert_case
  - send_wm_command
  - set_window_hints / set_window_property_string / set_window_property_data
  - recolor_cursor
  - set_error_handler / restore_error_handler

Panel changes:
  - xmodifier.c: thin wrapper calling eventBackend->modifier_from_key()
  - main.c: X11 locale init removed (belongs in backend screen_init)
  - WPrefs.c: eventBackend->send_wm_command("Reconfigure")
  - MouseSettings.c: vtable for pointer control + modifier keysyms
  - KeyboardShortcuts.c: vtable for grab/keysym/modifier ops
  - Menu.c: RImage crosshair icon, vtable keyboard grab
  - editmenu.c: vtable for all window/pointer/property ops

Verified: nm audit shows zero X11 symbol refs in WPrefs .o files.
grep shows zero #ifdef USE_X11_BACKEND in WPrefs.app/.
2026-05-24 14:04:14 +02:00
Window Maker f0d7879b23 WPrefs.app: begin X11/Wayland separation
- WPrefs.h: drop #include <X11/Xlib.h>; ModifierFromKey takes WMScreen*
- main.c: X11 locale calls guarded with #ifdef USE_X11_BACKEND
- xmodifier.c: X11-specific modifier mapping code guarded with
  #ifdef USE_X11_BACKEND; Wayland mode uses sensible defaults
  (Mod1=Alt=Meta, Mod4=Super)
- Appearance.c: all 65 Xlib calls replaced with RImage-based rendering
  (RCreateImage, RDrawLine, RCopyArea, RFillImage, etc.) and
  WMCreatePixmapFromRImage for display. previewNoText/previewBack
  fields changed from WMNativePixmap to RImage*.

Remaining panels still have X11 calls (editmenu, Menu, TexturePanel,
KeyboardShortcuts, HotCornerShortcuts, WPrefs, MouseSettings,
double, Paths) — will be addressed in follow-up commits.
2026-05-24 13:23:47 +02:00
Window Maker fb817a7b27 wings: revert accidental WNativeWindow rename in strings/comments
The phase-β sed pass renamed every C 'Window' identifier to
WNativeWindow.  That correctly updated typedef uses but also rewrote
the string 'Window Maker', UI labels like 'Window Manager', 'Window
Placement', 'Window Title', 'Window List', 'Window System session',
etc., plus a number of comments referring to 'Window' as English.

Fixed all of those.  The C type uses (WNativeWindow rootWin, etc.)
remain unchanged — only English-language occurrences are reverted.
Verified that wmaker now reports 'Window Maker 0.96.0' again and
build is clean across WINGs/, src/, WPrefs.app/.
2026-05-24 11:42:37 +02:00
Window Maker 5417d3cbbd wprefs: route through WMOpenScreen for Wayland-client autodetect
WPrefs.app/main.c was opening the display directly via XOpenDisplay /
WMCreateScreen.  Replaced with WMOpenScreen, which autodetects
Wayland mode from WAYLAND_DISPLAY / DISPLAY env and dispatches to
W_WLClientInit in WINGs (Wayland) or W_X11OpenDisplay
(widgets_x11.c) accordingly.

The XSupportsLocale / XSetLocaleModifiers calls are now skipped in
Wayland mode (they're X11-only).  This is just startup plumbing; WPrefs's
many tab modules still have direct Xlib calls that won't work as a
pure Wayland client until each is ported through WINGs vtables.  This
commit gets us a minimal Wayland-aware launch path; further work
required to actually run native.
2026-05-24 11:38:55 +02:00
Window Maker 0f839a9c6d wings: phase β — rename X11 typedefs in shared/Wayland code
Sed pass restricted to files outside src/backend/x11 and outside
*_x11.c — i.e. all code that should not depend on X11 typedefs.

  Window     → WNativeWindow      (existing typedef in WMEvent.h)
  Atom       → WMNativeAtom
  Pixmap     → WMNativePixmap
  Cursor     → WMNativeCursor
  Drawable   → WMDrawable          (existing typedef)
  KeySym     → WMNativeKeysym
  Colormap   → WMNativeColormap

X11 backend files keep using the original Xlib type names because
they make Xlib API calls that take those types.  All typedefs are
ultimately 'unsigned long' so values pass through opaquely between
shared code and the backend.

Public WINGs API affected: WMSelectionCallback, WMSelectionProcs,
and a handful of widget signatures that took Atom/Window arguments
now take WMNativeAtom/WNativeWindow.  Source-compatible at the
binary level; consumers must rebuild.

Time and XID typedefs left for a follow-up — both are heavily used
in field/variable names that need careful auditing.  Display* and
GC stay in W_Screen for now; phase δ moves them into an X11-only
sub-struct.
2026-05-24 10:49:47 +02:00
Levi Neely 9b2448dd7f WIP: Wayland backend - fix atoms, OR surface compositing, frame/window ops
Key changes in wl_backend.c:
- wl_atom_intern: call XInternAtom on XWayland display (was returning 0)
- Add wl_or_view struct to track override_redirect XWayland surfaces
- handle_xwayland_new_surface: composite OR surfaces via scene graph
- frame_create_toplevel/child: create real X11 windows on XWayland
- frame_destroy/configure: delegate to Xlib
- window_map/unmap/move/resize: fall through to Xlib for frame windows
- stacking_raise/lower: update scene graph + Xlib fallback
- event_flush/sync: call XFlush/XSync on XWayland display
- window_set_border/border_width/clear: delegate to Xlib
- window_get_rect: query XWayland geometry for non-toplevel windows

Note: frame creation via XWayland is a temporary bridge. The correct
architectural approach is native scene-buffer rendering with pixman.
2026-05-13 07:05:22 +02:00
Levi Neely fcee811b99 WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00