From 3fbf746682de3c68d484eae2343dacb0857da871 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 28 Jun 2014 09:37:31 -0400 Subject: Added rewrite of most of the dialog system for the new API. The Windows API is, however, getting in the way... --- init.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'init.go') diff --git a/init.go b/init.go index 2e59301..0474612 100644 --- a/init.go +++ b/init.go @@ -17,13 +17,10 @@ func Go(main func()) error { return ui(main) } -// AppQuit is pulsed when the user decides to quit the program if their operating system provides a facility for quitting an entire application, rather than merely close all windows (for instance, Mac OS X via the Dock icon). -// You should assign one of your Windows's Closing to this variable so the user choosing to quit the application is treated the same as closing that window. -// If you do not respond to this signal, nothing will happen; regardless of whether or not you respond to this signal, the application will not quit. -// Do not merely check this channel alone; it is not guaranteed to be pulsed on all systems or in all conditions. -var AppQuit chan struct{} - -func init() { - // don't expose this in the documentation - AppQuit = newEvent() +// This function is a simple helper functionn that basically pushes the effect of a function call for later. This allows the selected safe Window methods to be safe. +// It's also currently used by the various dialog box functions on Windows to allow them to return instantly, rather than wait for the dialog box to finish (which both GTK+ and Mac OS X let you do). I consider this a race condition bug. TODO (also TODO document the /intended/ behavior) +func touitask(f func()) { + go func() { // to avoid locking uitask itself + uitask <- f + }() } -- cgit v1.2.3