Decided to remove AreaHandler.Defocuses() as that mucks up with the Mac OS X keyboard trap.

This commit is contained in:
Pietro Gagliardi 2014-08-13 14:09:53 -04:00
parent 35228385c1
commit 2a2d730d12
9 changed files with 4 additions and 33 deletions

View File

@ -76,10 +76,6 @@ type AreaHandler interface {
// See KeyEvent for details.
// After handling the key event, package ui will decide whether to perform platform-dependent event chain continuation based on that platform's designated action (so it is not possible to override global key events, such as Alt-Tab, this way).
Key(e KeyEvent)
// Defocuses is called when package ui needs to tell the OS if the Area should stop accepting focus.
// When and how often Defocuses is called is implementation-defined.
Defocuses() bool
}
// MouseEvent contains all the information for a mous event sent by Area.Mouse.

View File

@ -189,12 +189,6 @@ func areaView_flagsChanged(self C.id, e C.id, data unsafe.Pointer) {
sendKeyEvent(self, ke, data)
}
//export areaView_defocuses
func areaView_defocuses(data unsafe.Pointer) C.BOOL {
a := (*area)(data)
return toBOOL(a.handler.Defocuses())
}
func (a *area) id() C.id {
return a._id
}

View File

@ -388,10 +388,6 @@ func our_area_focus_callback(widget *C.GtkWidget, direction C.GtkDirectionType,
// this event indicates entering focus; always allow it
return continueEventChain
}
a := (*area)(unsafe.Pointer(data))
if a.handler.Defocuses() {
return continueEventChain
}
return stopEventChain
}

View File

@ -410,8 +410,6 @@ static LRESULT CALLBACK areaWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
case msgAreaRepaintAll:
repaintArea(hwnd);
return 0;
case msgAreaDefocuses:
return (LRESULT) areaDefocuses(data);
default:
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}

View File

@ -280,15 +280,6 @@ func areaResetClickCounter(data unsafe.Pointer) {
a.clickCounter.reset()
}
//export areaDefocuses
func areaDefocuses(data unsafe.Pointer) C.BOOL {
a := (*area)(data)
if a.handler.Defocuses() {
return C.TRUE
}
return C.FALSE
}
func (a *area) hwnd() C.HWND {
return a._hwnd
}

View File

@ -45,5 +45,6 @@ in general
so I don't forget, some TODOs:
windows
- backgrounds are not transparent
- tab order is backwards
mac os x
- applicationShouldTerminate: not handled

View File

@ -35,7 +35,7 @@ void uimsgloop(void)
if (GetClassNameW(focus, classchk, NAREACLASS) == 0)
xpanic("error getting name of focused window class for Area check", GetLastError());
if (wcscmp(classchk, areaWindowClass) == 0)
dodlgmessage = (BOOL) SendMessageW(focus, msgAreaDefocuses, 0, 0);
dodlgmessage = FALSE;
}
if (dodlgmessage && IsDialogMessageW(active, &msg) != 0)
continue;

View File

@ -29,7 +29,6 @@ enum {
msgNOTIFY, /* WM_NOTIFY proxy */
msgAreaSizeChanged,
msgAreaRepaintAll,
msgAreaDefocuses,
};
/* uitask_windows.c */

View File

@ -16,7 +16,6 @@ import (
var closeOnClick = flag.Bool("close", false, "close on click")
var smallWindow = flag.Bool("small", false, "open a small window (test Mac OS X initial control sizing)")
var defocuses = flag.Bool("defocuses", false, "if the Area in the small window (see -small) should defocus")
type dtype struct {
Name string
@ -48,7 +47,7 @@ type testwin struct {
wsmall Window
}
type areaHandler struct{defocuses bool}
type areaHandler struct{}
func (a *areaHandler) Paint(r image.Rectangle) *image.RGBA {
i := image.NewRGBA(r)
draw.Draw(i, r, &image.Uniform{color.RGBA{128,0,128,255}}, image.ZP, draw.Src)
@ -56,7 +55,6 @@ func (a *areaHandler) Paint(r image.Rectangle) *image.RGBA {
}
func (a *areaHandler) Mouse(me MouseEvent) { fmt.Printf("%#v\n", me) }
func (a *areaHandler) Key(ke KeyEvent) { fmt.Printf("%#v %q\n", ke, ke.Key) }
func (a *areaHandler) Defocuses() bool { return a.defocuses }
func (tw *testwin) make(done chan struct{}) {
tw.t = NewTab()
@ -137,13 +135,11 @@ func (tw *testwin) make(done chan struct{}) {
tw.t.Append("Password Field", tw.e2)
tw.w.Show()
if *smallWindow {
// TODO windows - tab order wrong in wine?
tw.wsmall = NewWindow("Small", 80, 80,
NewVerticalStack(
NewButton("Small"),
NewButton("Small"),
NewTextField(),
NewArea(200, 200, &areaHandler{*defocuses})))
NewArea(200, 200, &areaHandler{})))
tw.wsmall.Show()
}
}