glfwSetWindowIcon

Sets the icon for the specified window.

This function sets the icon of the specified window. If passed an array of candidate images, those of or closest to the sizes desired by the system are selected. If no images are specified, the window reverts to its default icon.

The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel with the red channel first. They are arranged canonically as packed sequential rows, starting from the top-left corner.

The desired image sizes varies depending on platform and system settings. The selected images will be rescaled as needed. Good sizes include 16x16, 32x32 and 48x48.

extern (C) @nogc nothrow __gshared
void
glfwSetWindowIcon

Parameters

window GLFWwindow*

The window whose icon to set.

count int

The number of images in the specified array, or zero to revert to the default window icon.

images const(GLFWimage)*

The images to create the icon from. This is ignored if count is zero.

Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref GLFW_PLATFORM_ERROR.

Pointer lifetime

The specified image data is copied before this function returns.

@remark @macos The GLFW window has no icon, as it is not a document window, so this function does nothing. The dock icon will be the same as the application bundle's icon. For more information on bundles, see the Bundle Programming Guide

in the Mac Developer Library.

@remark @wayland There is no existing protocol to change an icon, the window will thus inherit the one defined in the application's desktop file. This function always emits @ref GLFW_PLATFORM_ERROR.

Thread Safety

This function must only be called from the main thread.

@sa @ref window_icon

Meta

Since

Added in version 3.2.

Ingroup: window