From ae3103e180777518c875bb76fd1176714825dd2c Mon Sep 17 00:00:00 2001 From: Chris Waldon Date: Thu, 19 Aug 2021 14:10:21 -0400 Subject: [PATCH] app/internal/wm: implement ViewEvent for X11 Signed-off-by: Chris Waldon --- app/internal/wm/os_unix.go | 8 +++++++- app/internal/wm/os_x11.go | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/internal/wm/os_unix.go b/app/internal/wm/os_unix.go index c41dc9a5..7f92d026 100644 --- a/app/internal/wm/os_unix.go +++ b/app/internal/wm/os_unix.go @@ -7,9 +7,15 @@ package wm import ( "errors" + "unsafe" ) -type ViewEvent struct{} +type ViewEvent struct { + // Display is a pointer to the X11 Display created by XOpenDisplay. + Display unsafe.Pointer + // Window is the X11 window ID as returned by XCreateWindow. + Window uintptr +} func Main() { select {} diff --git a/app/internal/wm/os_x11.go b/app/internal/wm/os_x11.go index b5d0ebd7..f521d6ba 100644 --- a/app/internal/wm/os_x11.go +++ b/app/internal/wm/os_x11.go @@ -690,8 +690,10 @@ func newX11Window(gioWin Callbacks, opts *Options) error { go func() { w.w.SetDriver(w) + w.w.Event(ViewEvent{Display: unsafe.Pointer(dpy), Window: uintptr(win)}) w.setStage(system.StageRunning) w.loop() + w.w.Event(ViewEvent{}) w.destroy() }() return nil