Wayland: Dont set window icons on layer shell windows as some compositors complain about them

This commit is contained in:
Kovid Goyal 2026-03-16 08:28:36 +05:30
parent 66ffb6895c
commit ddfd8d7f45
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 10 additions and 1 deletions

8
glfw/wl_window.c vendored
View file

@ -1588,6 +1588,14 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
void
_glfwPlatformSetWindowIcon(_GLFWwindow* window, int count, const GLFWimage* images) {
if (is_layer_shell(window)) {
_glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Cannot set window icon on layer shell surfaces");
return;
}
if (!window->wl.xdg.toplevel) {
_glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Ignoring attempt to set window icon on window without a toplevel");
return;
}
if (!_glfw.wl.xdg_toplevel_icon_manager_v1) {
static bool warned_once = false;
if (!warned_once) {

View file

@ -1089,6 +1089,7 @@ set_os_window_icon(PyObject UNUSED *self, PyObject *args) {
if(!PyArg_ParseTuple(args, "K|O", &id, &what)) return NULL;
OSWindow *os_window = os_window_for_id(id);
if (!os_window) { PyErr_Format(PyExc_KeyError, "No OS Window with id: %llu", id); return NULL; }
if (w->is_layer_shell && global_state.is_wayland) Py_RETURN_NONE;
if (!what || what == Py_None) {
glfwSetWindowIcon(os_window->handle, 0, NULL);
Py_RETURN_NONE;
@ -1729,7 +1730,7 @@ create_os_window(PyObject UNUSED *self, PyObject *args, PyObject *kw) {
glfwCocoaSetWindowResizeCallback(glfw_window, cocoa_os_window_resized);
#endif
send_prerendered_sprites_for_window(w);
if (logo.pixels && logo.width && logo.height) glfwSetWindowIcon(glfw_window, 1, &logo);
if (logo.pixels && logo.width && logo.height && (!lsc || !global_state.is_wayland)) glfwSetWindowIcon(glfw_window, 1, &logo);
set_glfw_mouse_pointer_shape_in_window(glfw_window, OPT(default_pointer_shape));
update_os_window_viewport(w, false);
glfwSetWindowPosCallback(glfw_window, window_pos_callback);