From 5e3b82eeabb2b06e9eaa7a57e168d69a1d7703c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Friedrich=20Gro=C3=9Fe?= <friedrich.grosse@gmail.com>
Date: Sun, 3 May 2020 19:38:20 +0200
Subject: [PATCH] Support glfw.TransparentFramebuffer window hint

---
 CHANGELOG.md      | 1 +
 pixelgl/window.go | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4ed4ade..e236bbf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 ## [Unreleased]
 - Gamepad API?
+- Add `WindowConfig.TransparentFramebuffer` option to support window transparency onto the background
 
 ## [v0.10.0-alpha] 2020-05-08
 - Upgrade to GLFW 3.3! :tada:
diff --git a/pixelgl/window.go b/pixelgl/window.go
index 9472659..80bac3c 100644
--- a/pixelgl/window.go
+++ b/pixelgl/window.go
@@ -56,6 +56,12 @@ type WindowConfig struct {
 	// implement proper full screen windows.
 	AlwaysOnTop bool
 
+	// TransparentFramebuffer specifies whether the window framebuffer will be
+	// transparent. If enabled and supported by the system, the window
+	// framebuffer alpha channel will be used to combine the framebuffer with
+	// the background. This does not affect window decorations.
+	TransparentFramebuffer bool
+
 	// VSync (vertical synchronization) synchronizes Window's framerate with the framerate of
 	// the monitor.
 	VSync bool
@@ -112,6 +118,7 @@ func NewWindow(cfg WindowConfig) (*Window, error) {
 		glfw.WindowHint(glfw.Decorated, bool2int[!cfg.Undecorated])
 		glfw.WindowHint(glfw.Floating, bool2int[cfg.AlwaysOnTop])
 		glfw.WindowHint(glfw.AutoIconify, bool2int[!cfg.NoIconify])
+		glfw.WindowHint(glfw.TransparentFramebuffer, bool2int[cfg.TransparentFramebuffer])
 
 		var share *glfw.Window
 		if currWin != nil {
-- 
GitLab