mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 15:45:38 +00:00
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:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
@@ -419,7 +419,7 @@ func (w *window) showTextInput(show bool) {
|
||||
})
|
||||
}
|
||||
|
||||
func Main() {
|
||||
func main() {
|
||||
}
|
||||
|
||||
func createWindow(window *Window, opts *WindowOptions) error {
|
||||
|
||||
+1
-1
@@ -251,5 +251,5 @@ func createWindow(win *Window, opts *WindowOptions) error {
|
||||
return <-mainWindow.errs
|
||||
}
|
||||
|
||||
func Main() {
|
||||
func main() {
|
||||
}
|
||||
|
||||
+1
-1
@@ -374,7 +374,7 @@ func (w *window) config() (int, int, float32, Config) {
|
||||
}
|
||||
}
|
||||
|
||||
func Main() {
|
||||
func main() {
|
||||
<-mainDone
|
||||
}
|
||||
|
||||
|
||||
+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 {
|
||||
|
||||
@@ -152,7 +152,7 @@ var (
|
||||
_XKB_MOD_NAME_SHIFT = []byte("Shift\x00")
|
||||
)
|
||||
|
||||
func Main() {
|
||||
func main() {
|
||||
<-mainDone
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ const _WM_REDRAW = _WM_USER + 0
|
||||
var onceMu sync.Mutex
|
||||
var mainDone = make(chan struct{})
|
||||
|
||||
func Main() {
|
||||
func main() {
|
||||
<-mainDone
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user