app/internal/wm: use Option method to initialize windows

Added (*w.window).Option methods to the backends and use them for setting the initial options passed into NewWindow.

Signed-off-by: pierre <pierre.curto@gmail.com>
This commit is contained in:
pierre
2021-04-02 19:23:17 +02:00
committed by Elias Naur
parent b77c1628f3
commit ce7f0da06e
10 changed files with 207 additions and 110 deletions
+7 -3
View File
@@ -82,9 +82,7 @@ func NewWindow(win Callbacks, opts *Options) error {
})
w.addEventListeners()
w.addHistory()
if o := opts.WindowMode; o != nil {
w.windowMode(*o)
}
w.Option(opts)
w.w = win
go func() {
@@ -476,6 +474,12 @@ func (w *window) WriteClipboard(s string) {
w.clipboard.Call("writeText", s)
}
func (w *window) Option(opts *Options) {
if o := opts.WindowMode; o != nil {
w.windowMode(*o)
}
}
func (w *window) SetCursor(name pointer.CursorName) {
style := w.cnv.Get("style")
style.Set("cursor", string(name))