wings: route wtextfield XInternAtom through W_NativeInternAtom
Last X11 symbol leak in shared WINGs code: wtextfield.c's selection
request handler called XInternAtom directly to look up TEXT,
COMPOUND_TEXT, and TARGETS atoms.
Replaced with W_NativeInternAtom(scr, name) — implemented in
widgets_x11.c as a thin XInternAtom wrapper. The Wayland-only
build (future) will provide a stub that returns WM_NATIVE_NONE,
making the requestHandler's downstream comparisons all fall through
to 'no match' cleanly.
Architectural verification: every WINGs shared object file (i.e.
not *_x11.o, not *_wl.o) now has ZERO undefined X11 symbols:
$ for f in WINGs/.libs/*.o; do
case $f in *_x11.o|*_wl.o) continue;; esac
nm $f | awk '$1=="U" {print $2}' | grep -c '^X[A-Z][a-z]'
done | sort -u
0
Combined with the *_wl.c files already verified to have zero X11
deps, the WINGs library now cleanly partitions: shared code is
backend-neutral, X11 backend code lives in *_x11.c, Wayland backend
code lives in *_wl.c. A --disable-x11-backend configure option can
now be added that drops *_x11.c from the build for pure-Wayland
WINGs apps.
This commit is contained in:
parent
f7a7142889
commit
70d8a068e6
|
|
@ -748,6 +748,15 @@ void W_InitIM(WMScreen *scr);
|
|||
WMScreen *W_X11OpenDisplay(const char *display);
|
||||
void W_X11PlatformInit(W_Screen *scrPtr);
|
||||
|
||||
/*
|
||||
* W_NativeInternAtom — wraps XInternAtom for the X11 backend so that
|
||||
* shared code (e.g. wtextfield.c selection request handler) can intern
|
||||
* an atom by name without including <X11/Xlib.h> or directly calling
|
||||
* XInternAtom. Returns WM_NATIVE_NONE in pure-Wayland builds (handled
|
||||
* by a future widgets_wl.c stub).
|
||||
*/
|
||||
WMNativeAtom W_NativeInternAtom(W_Screen *scr, const char *name);
|
||||
|
||||
/*
|
||||
* XLFD → FcPattern parser, defined in wfont.c. Replaces XftXlfdParse
|
||||
* so the shared font code doesn't pull libXft / libX11. Used by
|
||||
|
|
|
|||
|
|
@ -229,3 +229,16 @@ WMScreen *W_X11OpenDisplay(const char *display)
|
|||
}
|
||||
return WMCreateSimpleApplicationScreen(dpy);
|
||||
}
|
||||
|
||||
/*
|
||||
* W_NativeInternAtom — atom-intern wrapper used by shared code that
|
||||
* needs an Atom value at run-time (e.g. wtextfield.c's selection
|
||||
* request handler). In X11 mode delegates to XInternAtom. In Wayland
|
||||
* mode the stub in widgets_wl.c returns WM_NATIVE_NONE so the calling
|
||||
* code falls into a "no match" branch and selection no-ops. Either
|
||||
* way the shared file does not directly link against XInternAtom.
|
||||
*/
|
||||
WMNativeAtom W_NativeInternAtom(W_Screen *scr, const char *name)
|
||||
{
|
||||
return XInternAtom(scr->display, name, False);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,10 +238,10 @@ static WMData *requestHandler(WMView * view, WMNativeAtom selection, WMNativeAto
|
|||
{
|
||||
TextField *tPtr = view->self;
|
||||
int count;
|
||||
Display *dpy = tPtr->view->screen->display;
|
||||
WMScreen *scr = tPtr->view->screen;
|
||||
WMNativeAtom _TARGETS;
|
||||
WMNativeAtom TEXT = XInternAtom(dpy, "TEXT", False);
|
||||
WMNativeAtom COMPOUND_TEXT = XInternAtom(dpy, "COMPOUND_TEXT", False);
|
||||
WMNativeAtom TEXT = W_NativeInternAtom(scr, "TEXT");
|
||||
WMNativeAtom COMPOUND_TEXT = W_NativeInternAtom(scr, "COMPOUND_TEXT");
|
||||
WMData *data;
|
||||
|
||||
/* Parameter not used, but tell the compiler that it is ok */
|
||||
|
|
@ -260,7 +260,7 @@ static WMData *requestHandler(WMView * view, WMNativeAtom selection, WMNativeAto
|
|||
return data;
|
||||
}
|
||||
|
||||
_TARGETS = XInternAtom(dpy, "TARGETS", False);
|
||||
_TARGETS = W_NativeInternAtom(scr, "TARGETS");
|
||||
if (target == _TARGETS) {
|
||||
WMNativeAtom supported_type[4];
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue