diff --git a/WINGs/Makefile.am b/WINGs/Makefile.am index 88cc227..1d850de 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 += wcolorpanel_wl.c wstubs_no_x11.c +libWINGs_la_SOURCES += wappresource_wl.c wcolorpanel_wl.c wstubs_no_x11.c endif if USE_WAYLAND_CLIENT diff --git a/WINGs/wappresource_wl.c b/WINGs/wappresource_wl.c new file mode 100644 index 0000000..7895967 --- /dev/null +++ b/WINGs/wappresource_wl.c @@ -0,0 +1,100 @@ +/* + * wappresource_wl.c -- Wayland backend for application icon resources. + * + * Stores application icon data (RImage, WMPixmap) without X11 WM hints. + * The backend handles its own icon surface rendering through wlroots; + * this module provides the WINGs API entry points for the core WM. + */ + +#include "WINGsP.h" +#include "GNUstep.h" + + +void +WMSetApplicationIconWindow(WMScreen *scr, WNativeWindow window) +{ + scr->applicationIconWindow = window; +} + +void +WMSetApplicationIconImage(WMScreen *scr, RImage *image) +{ + WMPixmap *icon; + + if (scr->applicationIconImage == image) + return; + + if (scr->applicationIconImage) + RReleaseImage(scr->applicationIconImage); + + scr->applicationIconImage = RRetainImage(image); + + if (image != NULL && (icon = WMCreatePixmapFromRImage(scr, image, 128)) != NULL) { + WMSetApplicationIconPixmap(scr, icon); + WMReleasePixmap(icon); + } +} + +RImage * +WMGetApplicationIconImage(WMScreen *scr) +{ + return scr->applicationIconImage; +} + +void +WMSetApplicationIconPixmap(WMScreen *scr, WMPixmap *icon) +{ + if (scr->applicationIconPixmap == icon) + return; + + if (scr->applicationIconPixmap) + WMReleasePixmap(scr->applicationIconPixmap); + + scr->applicationIconPixmap = WMRetainPixmap(icon); + /* Wayland backend reads scr->applicationIconPixmap directly */ +} + +WMPixmap * +WMGetApplicationIconPixmap(WMScreen *scr) +{ + return scr->applicationIconPixmap; +} + +WMPixmap * +WMCreateApplicationIconBlendedPixmap(WMScreen *scr, const RColor *color) +{ + WMPixmap *pix; + + if (scr->applicationIconImage) { + static const RColor gray = { + .red = 0xAE, + .green = 0xAA, + .blue = 0xAE, + .alpha = 0xFF + }; + + if (!color) + color = &gray; + + pix = WMCreateBlendedPixmapFromRImage(scr, scr->applicationIconImage, color); + } else { + pix = NULL; + } + + return pix; +} + +void +WMSetApplicationHasAppIcon(WMScreen *scr, Bool flag) +{ + scr->aflags.hasAppIcon = (flag != 0) ? 1 : 0; +} + +void +W_InitApplication(WMScreen *scr) +{ + /* No X11 group leader window needed in Wayland mode. + * The backend manages application identity through + * wlr_foreign_toplevel_handle_v1_set_app_id. */ + scr->groupLeader = WNATIVE_NONE; +} diff --git a/WINGs/wballoon_wl.c b/WINGs/wballoon_wl.c new file mode 100644 index 0000000..1c32776 --- /dev/null +++ b/WINGs/wballoon_wl.c @@ -0,0 +1,104 @@ +/* + * 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. + */ + +#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. + */ +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 +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 +W_BalloonCleanup(WMScreen *scr) +{ + (void)scr; +} diff --git a/WINGs/wcolorpanel_wl.c b/WINGs/wcolorpanel_wl.c index f960327..d6f6c8e 100644 --- a/WINGs/wcolorpanel_wl.c +++ b/WINGs/wcolorpanel_wl.c @@ -9,7 +9,7 @@ #include "WINGsP.h" #include "wcolorpanelP.h" -void W_ColorPanelMagnify(struct WMWidget *w, void *data) +void W_ColorPanelMagnify(WMWidget *w, void *data) { struct W_ColorPanel *panel = (struct W_ColorPanel *)data; (void)w; diff --git a/WINGs/wstubs_no_x11.c b/WINGs/wstubs_no_x11.c index 6358e7a..2edab2f 100644 --- a/WINGs/wstubs_no_x11.c +++ b/WINGs/wstubs_no_x11.c @@ -147,31 +147,10 @@ void W_BalloonShowText(void *bPtr, int x, int y, int w, int h, const char *text) /* Application resources (wappresource_x11.c) */ /* ------------------------------------------------------------------ */ -void WMSetApplicationIconWindow(WMScreen *scr, WNativeWindow window) -{ (void)scr; (void)window; } -void WMSetApplicationIconImage(WMScreen *scr, RImage *image) -{ (void)scr; (void)image; } -void WMSetApplicationIconPixmap(WMScreen *scr, WMPixmap *icon) -{ (void)scr; (void)icon; } -void WMSetApplicationHasAppIcon(WMScreen *scr, Bool flag) -{ (void)scr; (void)flag; } -void W_InitApplication(WMScreen *scr) { (void)scr; } - /* ------------------------------------------------------------------ */ /* Color panel (wcolorpanel_x11.c) */ /* ------------------------------------------------------------------ */ -void WMSetColorPanelAction(WMColorPanel *panel, WMAction2 *action, void *data) -{ (void)panel; (void)action; (void)data; } -void WMFreeColorPanel(WMColorPanel *panel) { (void)panel; } -void WMCloseColorPanel(WMColorPanel *panel) { (void)panel; } -void WMShowColorPanel(WMColorPanel *panel) { (void)panel; } -void WMSetColorPanelPickerMode(WMColorPanel *panel, WMColorPanelMode mode) -{ (void)panel; (void)mode; } -void WMSetColorPanelColor(WMColorPanel *panel, WMColor *color) -{ (void)panel; (void)color; } -void W_ColorPanelMagnify(WMWidget *w, void *data) { (void)w; (void)data; } - /* ------------------------------------------------------------------ */ /* Color helpers (wcolor_x11.c) */ /* ------------------------------------------------------------------ */