From c2a1fe7de80e206a4e5b96af3f60106163768ad4 Mon Sep 17 00:00:00 2001
From: faiface <faiface@ksp.sk>
Date: Fri, 10 Mar 2017 00:01:58 +0100
Subject: [PATCH] only register mouse inside window

---
 pixelgl/input.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pixelgl/input.go b/pixelgl/input.go
index 2367628..157b5c0 100644
--- a/pixelgl/input.go
+++ b/pixelgl/input.go
@@ -361,10 +361,14 @@ func (w *Window) updateInput() {
 		wi, hi := w.window.GetSize()
 		width, height := float64(wi), float64(hi)
 
-		w.currInp.mouse = pixel.V(
+		mouse := pixel.V(
 			x/width*w.bounds.W()+w.bounds.X(),
 			(height-y)/height*w.bounds.H()+w.bounds.Y(),
 		)
+
+		if w.bounds.Contains(mouse) {
+			w.currInp.mouse = mouse
+		}
 	})
 
 	// cache current state to temp (so that if there are callbacks outside this function,
-- 
GitLab