Cleaned up the classType struct and sysData.make() in sysdata_windows.go to remove unused fields and the window class registration code now that we no longer register window classes on the fly for each new Window/Area.
This commit is contained in:
parent
2e0914e575
commit
09f5c7764e
|
@ -25,10 +25,8 @@ type sysData struct {
|
||||||
|
|
||||||
type classData struct {
|
type classData struct {
|
||||||
name string
|
name string
|
||||||
register func(s *sysData) (newClassName string, err error)
|
|
||||||
style uint32
|
style uint32
|
||||||
xstyle uint32
|
xstyle uint32
|
||||||
mkid bool
|
|
||||||
altStyle uint32
|
altStyle uint32
|
||||||
storeSysData bool
|
storeSysData bool
|
||||||
doNotLoadFont bool
|
doNotLoadFont bool
|
||||||
|
@ -142,20 +140,12 @@ func (s *sysData) make(window *sysData) (err error) {
|
||||||
ret := make(chan uiret)
|
ret := make(chan uiret)
|
||||||
defer close(ret)
|
defer close(ret)
|
||||||
ct := classTypes[s.ctype]
|
ct := classTypes[s.ctype]
|
||||||
classname := ct.name
|
|
||||||
cid := _HMENU(0)
|
cid := _HMENU(0)
|
||||||
pwin := uintptr(_NULL)
|
pwin := uintptr(_NULL)
|
||||||
if window != nil { // this is a child control
|
if window != nil { // this is a child control
|
||||||
cid = window.addChild(s)
|
cid = window.addChild(s)
|
||||||
pwin = uintptr(window.hwnd)
|
pwin = uintptr(window.hwnd)
|
||||||
}
|
}
|
||||||
if classname == "" { // need a new window class
|
|
||||||
n, err := ct.register(s)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("error creating window class for new window/control (type %d): %v", s.ctype, err)
|
|
||||||
}
|
|
||||||
classname = n
|
|
||||||
}
|
|
||||||
style := uintptr(ct.style)
|
style := uintptr(ct.style)
|
||||||
if s.alternate {
|
if s.alternate {
|
||||||
style = uintptr(ct.altStyle)
|
style = uintptr(ct.altStyle)
|
||||||
|
@ -168,7 +158,7 @@ func (s *sysData) make(window *sysData) (err error) {
|
||||||
call: _createWindowEx,
|
call: _createWindowEx,
|
||||||
p: []uintptr{
|
p: []uintptr{
|
||||||
uintptr(ct.xstyle),
|
uintptr(ct.xstyle),
|
||||||
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(classname))),
|
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(ct.name))),
|
||||||
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(""))), // we set the window text later
|
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(""))), // we set the window text later
|
||||||
style,
|
style,
|
||||||
negConst(_CW_USEDEFAULT),
|
negConst(_CW_USEDEFAULT),
|
||||||
|
|
Loading…
Reference in New Issue