101 lines
2.2 KiB
C
101 lines
2.2 KiB
C
/*
|
|
* 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;
|
|
}
|