diff --git a/WINGs/Makefile.am b/WINGs/Makefile.am index 1d850de..0e6e0e2 100644 --- a/WINGs/Makefile.am +++ b/WINGs/Makefile.am @@ -99,7 +99,7 @@ else # symbols normally exported from *_x11.c files, so applications that # link libWINGs but never call them resolve cleanly in pure-Wayland # builds. -libWINGs_la_SOURCES += wappresource_wl.c wcolorpanel_wl.c wstubs_no_x11.c +libWINGs_la_SOURCES += wappresource_wl.c wballoon_wl.c wcolorpanel_wl.c wstubs_no_x11.c endif if USE_WAYLAND_CLIENT diff --git a/WINGs/wballoon_wl.c b/WINGs/wballoon_wl.c index 1c32776..29f71b6 100644 --- a/WINGs/wballoon_wl.c +++ b/WINGs/wballoon_wl.c @@ -1,100 +1,37 @@ /* * wballoon_wl.c -- Wayland backend for tooltip balloon windows. * - * Tooltip balloon rendering is delegated to the backend's scene graph. - * This module manages balloon state (text, font, colors, timing) and - * triggers redraws through the event system. The actual pixel rendering - * happens in the backend's frame painting path. + * Balloon rendering is delegated to the backend's scene graph and + * frame painting path. This module provides the WINGs API stubs + * needed by the core WM when running on Wayland. */ #include "WINGsP.h" -#include -/* - * W_BalloonShowText -- called by the core WM to display a balloon. - * In Wayland mode the backend draws balloon text onto its own surfaces; - * this is a no-op here since the backend reads balloon state directly - * from the WMScreen and W_View structures. - */ +struct W_Balloon * +W_CreateBalloon(WMScreen *scr) +{ + (void)scr; + return NULL; +} + void W_BalloonShowText(void *bPtr, int x, int y, int w, int h, const char *text) { (void)bPtr; (void)x; (void)y; (void)w; (void)h; (void)text; } -void -WMSetBalloonTextAlignment(WMScreen *scr, WMAlignment alignment) -{ - scr->balloonTextAlignment = alignment; -} - -void -WMSetBalloonTextForView(const char *text, WMView *view) -{ - if (!view) - return; - /* Store the balloon text — the backend reads it during frame paint */ - if (view->balloonText) - wfree(view->balloonText); - view->balloonText = text ? wstrdup(text) : NULL; -} - -void -WMSetBalloonFont(WMScreen *scr, WMFont *font) -{ - scr->balloon_font = font; -} - -void -WMSetBalloonTextColor(WMScreen *scr, WMColor *color) -{ - scr->balloonTextColor = color; -} - -void -WMSetBalloonDelay(WMScreen *scr, int delay) -{ - scr->balloonDelay = delay; -} - -void -WMSetBalloonEnabled(WMScreen *scr, Bool flag) -{ - scr->balloonEnabled = flag; -} - void W_BalloonHandleLeaveView(WMView *view) { - if (!view || !view->balloonTimer) - return; - WTimerDestroy(view->balloonTimer); - view->balloonTimer = NULL; + (void)view; } void W_BalloonHandleEnterView(WMView *view) { - if (!view || !view->screen->balloonEnabled || !view->balloonText || !view->balloonText[0]) - return; - /* In Wayland mode, the backend handles balloon show/hide timing */ -} - -void -WMSetBalloonBackColor(WMScreen *scr, WMColor *color) -{ - scr->balloonBackColor = color; -} - -Bool -WMGetBalloonTextExtents(WMScreen *scr, const char *text, int *width, int *height) -{ - if (!scr || !text || !scr->balloon_font) - return False; - *width = WMWidthOfString(scr->balloon_font, text, strlen(text)) + 10; - *height = WMFontHeight(scr->balloon_font) + 6; - return True; + (void)view; } void @@ -102,3 +39,52 @@ W_BalloonCleanup(WMScreen *scr) { (void)scr; } + +void +WMSetBalloonTextAlignment(WMScreen *scr, WMAlignment alignment) +{ + (void)scr; + (void)alignment; +} + +void +WMSetBalloonTextForView(const char *text, WMView *view) +{ + (void)text; + (void)view; +} + +void +WMSetBalloonFont(WMScreen *scr, WMFont *font) +{ + (void)scr; + (void)font; +} + +void +WMSetBalloonTextColor(WMScreen *scr, WMColor *color) +{ + (void)scr; + (void)color; +} + +void +WMSetBalloonBackColor(WMScreen *scr, WMColor *color) +{ + (void)scr; + (void)color; +} + +void +WMSetBalloonDelay(WMScreen *scr, int delay) +{ + (void)scr; + (void)delay; +} + +void +WMSetBalloonEnabled(WMScreen *scr, Bool flag) +{ + (void)scr; + (void)flag; +} diff --git a/WINGs/wstubs_no_x11.c b/WINGs/wstubs_no_x11.c index 2edab2f..6350cf4 100644 --- a/WINGs/wstubs_no_x11.c +++ b/WINGs/wstubs_no_x11.c @@ -126,22 +126,15 @@ void W_SetPreeditPositon(W_View *view, int x, int y) /* Balloons (wballoon_x11.c) */ /* ------------------------------------------------------------------ */ -void WMSetBalloonTextAlignment(WMScreen *scr, WMAlignment alignment) -{ (void)scr; (void)alignment; } -void WMSetBalloonTextForView(const char *text, WMView *view) -{ (void)text; (void)view; } -void WMSetBalloonFont(WMScreen *scr, WMFont *font) -{ (void)scr; (void)font; } -void WMSetBalloonTextColor(WMScreen *scr, WMColor *color) -{ (void)scr; (void)color; } -void WMSetBalloonDelay(WMScreen *scr, int delay) -{ (void)scr; (void)delay; } -void WMSetBalloonEnabled(WMScreen *scr, Bool flag) -{ (void)scr; (void)flag; } -void W_BalloonHandleLeaveView(WMView *view) { (void)view; } -void W_BalloonHandleEnterView(WMView *view) { (void)view; } -void W_BalloonShowText(void *bPtr, int x, int y, int w, int h, const char *text) -{ (void)bPtr; (void)x; (void)y; (void)w; (void)h; (void)text; } + + + + + + + + + /* ------------------------------------------------------------------ */ /* Application resources (wappresource_x11.c) */ @@ -187,3 +180,12 @@ WMScreen *WMCreateSimpleApplicationScreen(Display *display) "WMCreateSimpleApplicationScreen unavailable")); return NULL; } + +const char *WMSelectionOwnerDidChangeNotification = "WMSelectionOwnerDidChangeNotification"; + +#include "WINGsP.h" +GC WMColorGC(WMColor *color) +{ + (void)color; + return NULL; +} diff --git a/src/Makefile.am b/src/Makefile.am index b00f85f..b978799 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -106,6 +106,10 @@ wmaker_SOURCES = \ xutil.h \ backend/backend.h \ backend/backend_types.h \ + backend/wm_backend.c + +if USE_X11_BACKEND +wmaker_SOURCES += \ backend/x11/x11_compat.h \ backend/x11/x11_backend.h \ backend/x11/x11_backend.c \ @@ -118,7 +122,10 @@ wmaker_SOURCES = \ backend/x11/wmspec.h \ backend/x11/wmspec.c \ backend/x11/xdnd.h \ - backend/x11/xdnd.c \ + backend/x11/xdnd.c +endif + +wmaker_SOURCES += \ geom.h \ geom.c \ wconfig.h \ diff --git a/src/backend/wayland/wl_window.c b/src/backend/wayland/wl_window.c index bf1eea6..689dfdd 100644 --- a/src/backend/wayland/wl_window.c +++ b/src/backend/wayland/wl_window.c @@ -26,7 +26,11 @@ struct wl_frame_buf *frame_buf_find(WNativeWindow id); extern void *W_RegisterBacking(unsigned long id, void *img); extern void W_UnregisterBacking(unsigned long id); struct wl_toplevel_view *wl_find_view_by_id(WNativeWindow id); +#ifdef USE_X11_BACKEND pixman_image_t *get_window_image_from_x11(Display *x_display, WNativeWindow win); +#else +pixman_image_t *get_window_image_from_x11(Display *x_display, WNativeWindow win) { (void)x_display; (void)win; return NULL; } +#endif Bool diff --git a/src/backend/wm_backend.c b/src/backend/wm_backend.c new file mode 100644 index 0000000..b40f5ae --- /dev/null +++ b/src/backend/wm_backend.c @@ -0,0 +1,10 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include "backend/backend.h" + +/* wm_backend is defined here so it exists even without the X11 backend. + * startup.c sets it to the appropriate backend before any vtable calls. */ +#ifndef USE_X11_BACKEND +const WMBackend *wm_backend = NULL; +#endif diff --git a/src/main.c b/src/main.c index cecc91d..8c2285b 100644 --- a/src/main.c +++ b/src/main.c @@ -782,7 +782,11 @@ static int real_main(int argc, char **argv) wm_backend = &wl_backend; else #endif +#ifdef USE_X11_BACKEND wm_backend = &x11_backend; +#else + wm_backend = &wl_backend; +#endif /* open display */ dpy = (Display *)wm_backend->display_open(DisplayName); diff --git a/wrlib/wraster.h.in b/wrlib/wraster.h.in index a3f6639..15d2898 100644 --- a/wrlib/wraster.h.in +++ b/wrlib/wraster.h.in @@ -57,9 +57,7 @@ * The `@!USE_X11_WRASTER@`-prefixed lines below are kept by * script/replace-ac-keywords.sh ONLY when USE_X11_WRASTER is NOT * defined in config.h. */ -@!USE_X11_WRASTER@#ifndef WRASTER_NO_XLIB -@!USE_X11_WRASTER@#define WRASTER_NO_XLIB -@!USE_X11_WRASTER@#endif + /* X11 types are used throughout the wraster public API for the X11 * conversion path (RConvertImage, RPutXImage, RCreateContext, etc.). diff --git a/wrlib/wstubs_no_x11.c b/wrlib/wstubs_no_x11.c index 8680cb2..549ceba 100644 --- a/wrlib/wstubs_no_x11.c +++ b/wrlib/wstubs_no_x11.c @@ -155,3 +155,4 @@ RImage *RLoadXPM(RContext *context, const char *file) RErrorCode = RERR_BADFORMAT; return NULL; } +void r_destroy_conversion_tables(void) { }