~eliasnaur/gio

e5738481f8787940f9986dada64fa1646dc3b358 — Elias Naur 8 months ago 87f8fd4
ui/app: add package documentation and document Main

Split Main into the common Main function and platform specific
main functions.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
M ui/app/app.go => ui/app/app.go +8 -0
@@ 134,6 134,14 @@ func DataDir() (string, error) {
	return dataDir()
}

// Main must be called from the a program's main function.
// Calling Main is necessary because some operating systems
// require control of the main thread of the program for
// running user interfaces.
func Main() {
	main()
}

// Config implements the ui.Config interface.
type Config struct {
	// Device pixels per dp.

A ui/app/doc.go => ui/app/doc.go +8 -0
@@ 0,0 1,8 @@
// SPDX-License-Identifier: Unlicense OR MIT

/*
Package app provides a platform-independent interface to operating system
functionality for running graphical user interfaces.

*/
package app

M ui/app/os_android.go => ui/app/os_android.go +1 -1
@@ 419,7 419,7 @@ func (w *window) showTextInput(show bool) {
	})
}

func Main() {
func main() {
}

func createWindow(window *Window, opts *WindowOptions) error {

M ui/app/os_ios.go => ui/app/os_ios.go +1 -1
@@ 251,5 251,5 @@ func createWindow(win *Window, opts *WindowOptions) error {
	return <-mainWindow.errs
}

func Main() {
func main() {
}

M ui/app/os_js.go => ui/app/os_js.go +1 -1
@@ 374,7 374,7 @@ func (w *window) config() (int, int, float32, Config) {
	}
}

func Main() {
func main() {
	<-mainDone
}


M ui/app/os_macos.go => ui/app/os_macos.go +1 -1
@@ 271,7 271,7 @@ func createWindow(win *Window, opts *WindowOptions) error {
	return <-mainWindow.errs
}

func Main() {
func main() {
	wopts := <-mainWindow.out
	view := viewFactory()
	if view == 0 {

M ui/app/os_wayland.go => ui/app/os_wayland.go +1 -1
@@ 152,7 152,7 @@ var (
	_XKB_MOD_NAME_SHIFT = []byte("Shift\x00")
)

func Main() {
func main() {
	<-mainDone
}


M ui/app/os_windows.go => ui/app/os_windows.go +1 -1
@@ 157,7 157,7 @@ const _WM_REDRAW = _WM_USER + 0
var onceMu sync.Mutex
var mainDone = make(chan struct{})

func Main() {
func main() {
	<-mainDone
}