From 620454355f63270e27792725e5e986db2402d0b5 Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Wed, 7 Aug 2024 11:02:17 -0700 Subject: [PATCH] export ProcessResized for workaround --- internal/driver/glfw/window.go | 2 +- internal/driver/glfw/window_desktop.go | 2 +- internal/driver/glfw/window_wasm.go | 4 ++-- window.go | 3 +++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/driver/glfw/window.go b/internal/driver/glfw/window.go index 582eaf1a26..92b14819e1 100644 --- a/internal/driver/glfw/window.go +++ b/internal/driver/glfw/window.go @@ -301,7 +301,7 @@ func (w *window) processMoved(x, y int) { go w.canvas.reloadScale() } -func (w *window) processResized(width, height int) { +func (w *window) ProcessResized(width, height int) { canvasSize := w.computeCanvasSize(width, height) if !w.fullScreen { w.width = scale.ToScreenCoordinate(w.canvas, canvasSize.Width) diff --git a/internal/driver/glfw/window_desktop.go b/internal/driver/glfw/window_desktop.go index b4a923e7ba..2a4d23b14e 100644 --- a/internal/driver/glfw/window_desktop.go +++ b/internal/driver/glfw/window_desktop.go @@ -329,7 +329,7 @@ func (w *window) moved(_ *glfw.Window, x, y int) { } func (w *window) resized(_ *glfw.Window, width, height int) { - w.processResized(width, height) + w.ProcessResized(width, height) } func (w *window) scaled(_ *glfw.Window, x float32, y float32) { diff --git a/internal/driver/glfw/window_wasm.go b/internal/driver/glfw/window_wasm.go index 0cb74c9990..0ac8321dd7 100644 --- a/internal/driver/glfw/window_wasm.go +++ b/internal/driver/glfw/window_wasm.go @@ -161,7 +161,7 @@ func (w *window) moved(_ *glfw.Window, x, y int) { func (w *window) resized(_ *glfw.Window, width, height int) { w.canvas.scale = w.calculatedScale() - w.processResized(width, height) + w.ProcessResized(width, height) } func (w *window) frameSized(_ *glfw.Window, width, height int) { @@ -551,7 +551,7 @@ func (w *window) create() { width, height := win.GetSize() w.processFrameSized(width, height) - w.processResized(width, height) + w.ProcessResized(width, height) }) } diff --git a/window.go b/window.go index 3e366acb96..ce6bfe26ab 100644 --- a/window.go +++ b/window.go @@ -102,4 +102,7 @@ type Window interface { // Clipboard returns the system clipboard Clipboard() Clipboard + + // Supersonic-specific for workaround window sizing issue on startup + ProcessResized(w, h int) }