From 72b2f2c1bf9e6ff7591e76ab3b1a9d62c8306870 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Tue, 4 Jan 2022 15:46:53 +0100 Subject: [PATCH] app: ensure SetDriver is called before sending events This used to not matter, but a follow-up change will require a valid driver to process events. Signed-off-by: Elias Naur --- app/os_wayland.go | 4 ++-- app/os_x11.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/os_wayland.go b/app/os_wayland.go index 435f2d7b..f952b9ae 100644 --- a/app/os_wayland.go +++ b/app/os_wayland.go @@ -243,11 +243,11 @@ func newWLWindow(callbacks *callbacks, options []Option) error { go func() { defer d.destroy() defer w.destroy() + + w.w.SetDriver(w) // Finish and commit setup from createNativeWindow. w.Configure(options) C.wl_surface_commit(w.surf) - - w.w.SetDriver(w) if err := w.loop(); err != nil { panic(err) } diff --git a/app/os_x11.go b/app/os_x11.go index 56b4822b..1c752473 100644 --- a/app/os_x11.go +++ b/app/os_x11.go @@ -777,12 +777,11 @@ func newX11Window(gioWin *callbacks, options []Option) error { C.XSetWMProtocols(dpy, win, &w.atoms.evDelWindow, 1) go func() { + w.w.SetDriver(w) w.Configure(options) // make the window visible on the screen C.XMapWindow(dpy, win) - - w.w.SetDriver(w) w.w.Event(ViewEvent{Display: unsafe.Pointer(dpy), Window: uintptr(win)}) w.setStage(system.StageRunning) w.loop()