From 2a2d730d12086097a977370e9f3a87c3053ac7ae Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 13 Aug 2014 14:09:53 -0400 Subject: [PATCH] Decided to remove AreaHandler.Defocuses() as that mucks up with the Mac OS X keyboard trap. --- redo/area.go | 4 ---- redo/area_darwin.go | 6 ------ redo/area_unix.go | 4 ---- redo/area_windows.c | 2 -- redo/area_windows.go | 9 --------- redo/future | 1 + redo/uitask_windows.c | 2 +- redo/winapi_windows.h | 1 - redo/zz_test.go | 8 ++------ 9 files changed, 4 insertions(+), 33 deletions(-) diff --git a/redo/area.go b/redo/area.go index 190fa10..2ce7d5c 100644 --- a/redo/area.go +++ b/redo/area.go @@ -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. diff --git a/redo/area_darwin.go b/redo/area_darwin.go index ff277e8..c4c3d26 100644 --- a/redo/area_darwin.go +++ b/redo/area_darwin.go @@ -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 } diff --git a/redo/area_unix.go b/redo/area_unix.go index e664724..3c2a62e 100644 --- a/redo/area_unix.go +++ b/redo/area_unix.go @@ -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 } diff --git a/redo/area_windows.c b/redo/area_windows.c index bb988b3..9bb6085 100644 --- a/redo/area_windows.c +++ b/redo/area_windows.c @@ -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); } diff --git a/redo/area_windows.go b/redo/area_windows.go index de03d10..05f0274 100644 --- a/redo/area_windows.go +++ b/redo/area_windows.go @@ -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 } diff --git a/redo/future b/redo/future index 052e807..f864a18 100644 --- a/redo/future +++ b/redo/future @@ -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 diff --git a/redo/uitask_windows.c b/redo/uitask_windows.c index 5a64096..eec2b73 100644 --- a/redo/uitask_windows.c +++ b/redo/uitask_windows.c @@ -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; diff --git a/redo/winapi_windows.h b/redo/winapi_windows.h index f9e9a9b..2d42427 100644 --- a/redo/winapi_windows.h +++ b/redo/winapi_windows.h @@ -29,7 +29,6 @@ enum { msgNOTIFY, /* WM_NOTIFY proxy */ msgAreaSizeChanged, msgAreaRepaintAll, - msgAreaDefocuses, }; /* uitask_windows.c */ diff --git a/redo/zz_test.go b/redo/zz_test.go index 3ca54e2..99dec68 100644 --- a/redo/zz_test.go +++ b/redo/zz_test.go @@ -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() } }