Skip to content

Commit

Permalink
disable unsupported setting of window icon on wayland
Browse files Browse the repository at this point in the history
  • Loading branch information
Geo25rey committed May 4, 2024
1 parent a7c03f1 commit 3ff1abd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions v3.4/glfw/native_linbsd_wayland.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 6 additions & 0 deletions v3.4/glfw/not_wayland.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//go:build !((linux && wayland) || (freebsd && wayland) || (netbsd && wayland) || (openbsd && wayland))
// -build linux,wayland freebsd,wayland netbsd,wayland openbsd,wayland

This comment has been minimized.

Copy link
@dmitshur

dmitshur May 6, 2024

Member

This line seems to be malformed. Maybe it was intended to be // +build. In any case, I think it should be removed. All current versions of Go can handle build constraints specified via just the //go:build lines.


package glfw

const WAYLAND = false
4 changes: 4 additions & 0 deletions v3.4/glfw/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3ff1abd

Please sign in to comment.