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>
This commit is contained in:
Elias Naur
2019-08-09 21:34:29 +02:00
parent 87f8fd4152
commit e5738481f8
8 changed files with 22 additions and 6 deletions
+8
View File
@@ -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.
+8
View File
@@ -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
+1 -1
View File
@@ -419,7 +419,7 @@ func (w *window) showTextInput(show bool) {
})
}
func Main() {
func main() {
}
func createWindow(window *Window, opts *WindowOptions) error {
+1 -1
View File
@@ -251,5 +251,5 @@ func createWindow(win *Window, opts *WindowOptions) error {
return <-mainWindow.errs
}
func Main() {
func main() {
}
+1 -1
View File
@@ -374,7 +374,7 @@ func (w *window) config() (int, int, float32, Config) {
}
}
func Main() {
func main() {
<-mainDone
}
+1 -1
View File
@@ -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 {
+1 -1
View File
@@ -152,7 +152,7 @@ var (
_XKB_MOD_NAME_SHIFT = []byte("Shift\x00")
)
func Main() {
func main() {
<-mainDone
}
+1 -1
View File
@@ -157,7 +157,7 @@ const _WM_REDRAW = _WM_USER + 0
var onceMu sync.Mutex
var mainDone = make(chan struct{})
func Main() {
func main() {
<-mainDone
}