From f777b0dd05e6af4e72be202456f6c017ac0475db Mon Sep 17 00:00:00 2001 From: Patrick Stephen Date: Sat, 9 Oct 2021 11:03:24 -0500 Subject: [PATCH] event: split SetCallerMap into its own interface for backwards compatibility --- event/handler.go | 3 +++ sceneLoop.go | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/event/handler.go b/event/handler.go index 8c650edb..89624e7e 100644 --- a/event/handler.go +++ b/event/handler.go @@ -38,7 +38,10 @@ type Handler interface { UnbindAll(Event) UnbindAllAndRebind(Event, []Bindable, CID, []string) UnbindBindable(UnbindOption) +} +// A CallerMapper has an internal caller map that can be set. +type CallerMapper interface { SetCallerMap(*CallerMap) } diff --git a/sceneLoop.go b/sceneLoop.go index 15f62a34..e4a31e8c 100644 --- a/sceneLoop.go +++ b/sceneLoop.go @@ -130,7 +130,9 @@ func (w *Window) sceneLoop(first string, trackingInputs bool) { } else { w.CallerMap = event.NewCallerMap() } - w.eventHandler.SetCallerMap(w.CallerMap) + if cmr, ok := w.eventHandler.(event.CallerMapper); ok { + cmr.SetCallerMap(w.CallerMap) + } w.DrawStack.Clear() w.DrawStack.PreDraw()