summaryrefslogtreecommitdiff
path: root/sysdata.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-06-30 22:48:12 -0400
committerPietro Gagliardi <[email protected]>2014-06-30 22:48:12 -0400
commitffa1bbe0b91a8c812ddcea5c5d65e55f60d07f33 (patch)
tree000fadd9af11843d92e7f0eee49fa90cca1379cd /sysdata.go
parent990d50e9a153681a091a23734f8962e728fde1b0 (diff)
Restored the previous new API. I'm going to change it so that events are callbacks rather than using a window handler, but other than that... yeah.
Diffstat (limited to 'sysdata.go')
-rw-r--r--sysdata.go26
1 files changed, 4 insertions, 22 deletions
diff --git a/sysdata.go b/sysdata.go
index 4a95591..9144517 100644
--- a/sysdata.go
+++ b/sysdata.go
@@ -2,21 +2,16 @@
package ui
-const eventbufsiz = 100 // suggested by skelterjohn
-
-// newEvent returns a new channel suitable for listening for events.
-func newEvent() chan struct{} {
- return make(chan struct{}, eventbufsiz)
-}
-
// The sysData type contains all system data. It provides the system-specific underlying implementation. It is guaranteed to have the following by embedding:
type cSysData struct {
ctype int
- event chan struct{}
allocate func(x int, y int, width int, height int, d *sysSizeData) []*allocation
spaced bool
alternate bool // editable for Combobox, multi-select for listbox, password for lineedit
- handler AreaHandler // for Areas
+ handler AreaHandler // for Areas; TODO rename to areahandler
+ winhandler WindowHandler // for Windows
+ close func(*bool) // provided by each Window
+ event func() // provided by each control
}
// this interface is used to make sure all sysDatas are synced
@@ -44,19 +39,6 @@ var _xSysData interface {
setChecked(bool)
} = &sysData{} // this line will error if there's an inconsistency
-// signal sends the event signal. This raise is done asynchronously to avoid deadlocking the UI task.
-// Thanks skelterjohn for this techinque: if we can't queue any more events, drop them
-func (s *cSysData) signal() {
- if s.event != nil {
- go func() {
- select {
- case s.event <- struct{}{}:
- default:
- }
- }()
- }
-}
-
const (
c_window = iota
c_button