fc5689ea44f17986f429f189ce6cdda4274199a7 — Inkeliz 10 months ago 26e7101
app: [windows] recover focus on click

Previously, Gio doesn't reclaim the focus when they lose that to a
parent window. In such a case, the child window can steal
keyboard focus, and Gio will never recover it.

Now, Gio will recover the focus when clicked.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
1 files changed, 7 insertions(+), 0 deletions(-)

M app/os_windows.go
M app/os_windows.go => app/os_windows.go +7 -0
@@ 53,6 53,7 @@ type window struct {
	placement *windows.WindowPlacement

	animating bool
	focused   bool

	deltas     winDeltas
	borderSize image.Point

@@ 277,8 278,10 @@ func windowProc(hwnd syscall.Handle, msg uint32, wParam, lParam uintptr) uintptr
			Type: pointer.Cancel,
	case windows.WM_SETFOCUS:
		w.focused = true
		w.w.Event(key.FocusEvent{Focus: true})
	case windows.WM_KILLFOCUS:
		w.focused = false
		w.w.Event(key.FocusEvent{Focus: false})
	case windows.WM_NCHITTEST:
		if w.config.Decorated {

@@ 470,6 473,10 @@ func (w *window) hitTest(x, y int) uintptr {

func (w *window) pointerButton(btn pointer.Buttons, press bool, lParam uintptr, kmods key.Modifiers) {
	if !w.focused {

	var typ pointer.Type
	if press {
		typ = pointer.Press