diff --git a/WINGs/WINGs/WINGsP.h.in b/WINGs/WINGs/WINGsP.h.in index de19a63..51ce826 100644 --- a/WINGs/WINGs/WINGsP.h.in +++ b/WINGs/WINGs/WINGsP.h.in @@ -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 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 diff --git a/WINGs/widgets_x11.c b/WINGs/widgets_x11.c index 81e3a8f..f944714 100644 --- a/WINGs/widgets_x11.c +++ b/WINGs/widgets_x11.c @@ -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); +} diff --git a/WINGs/wtextfield.c b/WINGs/wtextfield.c index 8b947a9..59d8a99 100644 --- a/WINGs/wtextfield.c +++ b/WINGs/wtextfield.c @@ -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];