forked from fyne-io/fyne
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move to NativeWindow interface, implement for other platforms
- Loading branch information
Showing
10 changed files
with
137 additions
and
37 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//go:build darwin | ||
|
||
package glfw | ||
|
||
import ( | ||
"fyne.io/fyne/v2" | ||
"fyne.io/fyne/v2/driver" | ||
) | ||
|
||
// assert we are implementing fyne.NativeWindow | ||
var _ fyne.NativeWindow = (*window)(nil) | ||
|
||
func (w *window) RunNative(f func(any) error) error { | ||
var err error | ||
done := make(chan struct{}) | ||
runOnMain(func() { | ||
err = f(driver.MacWindowContext{ | ||
NSWindow: uintptr(w.view().GetCocoaWindow()), | ||
}) | ||
close(done) | ||
}) | ||
<-done | ||
return err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//go:build android | ||
|
||
package mobile | ||
|
||
import ( | ||
"fyne.io/fyne/v2" | ||
"fyne.io/fyne/v2/driver" | ||
"fyne.io/fyne/v2/internal/driver/mobile/app" | ||
) | ||
|
||
// Assert we are satisfying the NativeWindow interface | ||
var _ fyne.NativeWindow = (*window)(nil) | ||
|
||
func (w *window) RunNative(f func(context any) error) error { | ||
return app.RunOnJVM(func(vm, env, ctx uintptr) error { | ||
// TODO: define driver.AndroidWindowContext that also includes the View | ||
data := &driver.AndroidContext{VM: vm, Env: env, Ctx: ctx} | ||
return f(data) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//go:build ios | ||
|
||
package mobile | ||
|
||
import ( | ||
"fyne.io/fyne/v2" | ||
"fyne.io/fyne/v2/driver" | ||
) | ||
|
||
// Assert we are satisfying the NativeWindow interface | ||
var _ fyne.NativeWindow = (*window)(nil) | ||
|
||
func (w *window) RunNative(fn func(context any) error) error { | ||
return fn(&driver.UnknownContext{}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters