From 3ff1abd63dd68554fe150150fde619fb86110396 Mon Sep 17 00:00:00 2001 From: Geoffrey Casper Date: Sat, 4 May 2024 10:47:39 -0400 Subject: [PATCH] disable unsupported setting of window icon on wayland --- v3.4/glfw/native_linbsd_wayland.go | 2 ++ v3.4/glfw/not_wayland.go | 6 ++++++ v3.4/glfw/window.go | 4 ++++ 3 files changed, 12 insertions(+) create mode 100644 v3.4/glfw/not_wayland.go diff --git a/v3.4/glfw/native_linbsd_wayland.go b/v3.4/glfw/native_linbsd_wayland.go index d4118c15..1057406f 100644 --- a/v3.4/glfw/native_linbsd_wayland.go +++ b/v3.4/glfw/native_linbsd_wayland.go @@ -11,6 +11,8 @@ package glfw //#include "glfw/include/GLFW/glfw3native.h" import "C" +const WAYLAND = true + func GetWaylandDisplay() *C.struct_wl_display { ret := C.glfwGetWaylandDisplay() panicError() diff --git a/v3.4/glfw/not_wayland.go b/v3.4/glfw/not_wayland.go new file mode 100644 index 00000000..b6b5de50 --- /dev/null +++ b/v3.4/glfw/not_wayland.go @@ -0,0 +1,6 @@ +//go:build !((linux && wayland) || (freebsd && wayland) || (netbsd && wayland) || (openbsd && wayland)) +// -build linux,wayland freebsd,wayland netbsd,wayland openbsd,wayland + +package glfw + +const WAYLAND = false \ No newline at end of file diff --git a/v3.4/glfw/window.go b/v3.4/glfw/window.go index cdbf2c34..5c01082f 100644 --- a/v3.4/glfw/window.go +++ b/v3.4/glfw/window.go @@ -406,6 +406,10 @@ func (w *Window) SetTitle(title string) { // 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. func (w *Window) SetIcon(images []image.Image) { + if (WAYLAND) { + println("warning: Wayland: The platform does not support setting the window icon") + return + } count := len(images) cimages := make([]C.GLFWimage, count) freePixels := make([]func(), count)