forked from joejulian/gio
app,app/internal/wm: create contexts on the main thread
Instead of handing the internal/wm driver a method to run code on the (blocked) main thread, just run the necessary driver methods on the main thread. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -40,11 +40,7 @@ func newContext(w *window) (*context, error) {
|
||||
if ctx == 0 {
|
||||
return nil, errors.New("gl: failed to create NSOpenGLContext")
|
||||
}
|
||||
// [NSOpenGLContext setView] must run on the main thread. Fortunately,
|
||||
// newContext is only called during a [NSView draw] on the main thread.
|
||||
w.w.Run(func() {
|
||||
C.gio_setContextView(ctx, view)
|
||||
})
|
||||
C.gio_setContextView(ctx, view)
|
||||
c := &context{
|
||||
ctx: ctx,
|
||||
view: view,
|
||||
|
||||
@@ -60,10 +60,6 @@ type FrameEvent struct {
|
||||
type Callbacks interface {
|
||||
SetDriver(d Driver)
|
||||
Event(e event.Event)
|
||||
// Func runs a function during an Event. This is required for platforms
|
||||
// that require coordination between the rendering goroutine and the system
|
||||
// main thread.
|
||||
Run(f func())
|
||||
}
|
||||
|
||||
type Context interface {
|
||||
|
||||
Reference in New Issue
Block a user