mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 13:46:37 +00:00
Implement glfwSetWindowIcons on Linux
This commit is contained in:
parent
cca7589486
commit
c0974ca09c
@ -443,6 +443,8 @@ static void detectEWMH(void)
|
|||||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_FULLSCREEN_MONITORS");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_FULLSCREEN_MONITORS");
|
||||||
_glfw.x11.NET_WM_NAME =
|
_glfw.x11.NET_WM_NAME =
|
||||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_NAME");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_NAME");
|
||||||
|
_glfw.x11.NET_WM_ICON =
|
||||||
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_ICON");
|
||||||
_glfw.x11.NET_WM_ICON_NAME =
|
_glfw.x11.NET_WM_ICON_NAME =
|
||||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_ICON_NAME");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_ICON_NAME");
|
||||||
_glfw.x11.NET_WM_PID =
|
_glfw.x11.NET_WM_PID =
|
||||||
|
@ -129,6 +129,7 @@ typedef struct _GLFWlibraryX11
|
|||||||
Atom WM_STATE;
|
Atom WM_STATE;
|
||||||
Atom WM_DELETE_WINDOW;
|
Atom WM_DELETE_WINDOW;
|
||||||
Atom NET_WM_NAME;
|
Atom NET_WM_NAME;
|
||||||
|
Atom NET_WM_ICON;
|
||||||
Atom NET_WM_ICON_NAME;
|
Atom NET_WM_ICON_NAME;
|
||||||
Atom NET_WM_PID;
|
Atom NET_WM_PID;
|
||||||
Atom NET_WM_PING;
|
Atom NET_WM_PING;
|
||||||
|
@ -1647,7 +1647,39 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
|
|||||||
|
|
||||||
void _glfwPlatformSetWindowIcons(_GLFWwindow* window, GLFWimage* icons, int count)
|
void _glfwPlatformSetWindowIcons(_GLFWwindow* window, GLFWimage* icons, int count)
|
||||||
{
|
{
|
||||||
// TODO: Implement this
|
int i, d, p;
|
||||||
|
long* data;
|
||||||
|
|
||||||
|
// calculate number of elements
|
||||||
|
int nelements = count * 2; // width & height per icon
|
||||||
|
for (i = 0, nelements = 0; i < count; i++)
|
||||||
|
nelements += icons[i].width * icons[i].height; // pixel data
|
||||||
|
|
||||||
|
data = (long*)malloc(sizeof(long), nelements);
|
||||||
|
|
||||||
|
// build property data
|
||||||
|
for (i = 0, d = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
data[d++] = icons[i].width;
|
||||||
|
data[d++] = icons[i].height;
|
||||||
|
|
||||||
|
for (p = 0; p < icons[i].width * icons[i].height; p++)
|
||||||
|
{
|
||||||
|
unsigned char* pixel = icons[i].pixels + p * 4;
|
||||||
|
data[d++] = // pack to ARGB integer
|
||||||
|
(pixel[3] << 24) |
|
||||||
|
(pixel[0] << 16) |
|
||||||
|
(pixel[1] << 8) |
|
||||||
|
(pixel[2] << 0) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||||
|
_glfw.x11.NET_WM_ICON,
|
||||||
|
XA_CARDINAL,
|
||||||
|
32, PropModeReplace, (unsigned char*)data, nelements);
|
||||||
|
|
||||||
|
free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
||||||
|
Loading…
Reference in New Issue
Block a user