forked from joejulian/gio
app: [API] refactor app.ViewEvent to support wayland
This commit changes the definition of app.ViewEvent on Unix systems to be an interface implemented by two different concrete types: X11ViewEvent and WaylandViewEvent. Each provides the necessary fields for custom rendering on its display protocol. This is a breaking change for all users of app.ViewEvent on Linux/BSD, as it now is an interface instead of a concrete type. Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
+10
-4
@@ -248,12 +248,19 @@ func newWLWindow(callbacks *callbacks, options []Option) error {
|
||||
defer w.destroy()
|
||||
|
||||
w.w.SetDriver(w)
|
||||
|
||||
// Finish and commit setup from createNativeWindow.
|
||||
w.Configure(options)
|
||||
C.wl_surface_commit(w.surf)
|
||||
if err := w.loop(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
w.w.Event(WaylandViewEvent{
|
||||
Display: unsafe.Pointer(w.display()),
|
||||
Surface: unsafe.Pointer(w.surf),
|
||||
})
|
||||
defer w.w.Event(WaylandViewEvent{})
|
||||
|
||||
err := w.loop()
|
||||
w.w.Event(system.DestroyEvent{Err: err})
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
@@ -1308,7 +1315,6 @@ func (w *window) loop() error {
|
||||
default:
|
||||
}
|
||||
if w.dead {
|
||||
w.w.Event(system.DestroyEvent{})
|
||||
break
|
||||
}
|
||||
w.draw()
|
||||
|
||||
Reference in New Issue
Block a user