~eliasnaur/gio-patches

gio: app: prevent default Windows event handler from running for WM_SYSKEYUP/DOWN v2 PROPOSED

aarzilli
aarzilli: 1
 app: prevent default Windows event handler from running for WM_SYSKEYUP/DOWN

 1 files changed, 5 insertions(+), 0 deletions(-)
#481351 apple.yml success
#481352 freebsd.yml success
#481353 linux.yml success
#481354 openbsd.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~eliasnaur/gio-patches/patches/21915/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH gio v2] app: prevent default Windows event handler from running for WM_SYSKEYUP/DOWN Export this patch

aarzilli
F10 has a special meaning on Windows, if the default handler runs the
first key press following F10 will not generate a key.Press event and
if the first key press after F10 is space the window menu will be
opened instead.

Fixes #213

Signed-off-by: aarzilli <alessandro.arzilli@gmail.com>
---
 app/internal/wm/os_windows.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/app/internal/wm/os_windows.go b/app/internal/wm/os_windows.go
index 05d440e..fbe2596 100644
--- a/app/internal/wm/os_windows.go
+++ b/app/internal/wm/os_windows.go
@@ -249,7 +249,12 @@ func windowProc(hwnd syscall.Handle, msg uint32, wParam, lParam uintptr) uintptr
			if msg == windows.WM_KEYUP || msg == windows.WM_SYSKEYUP {
				e.State = key.Release
			}

			w.w.Event(e)

			if msg == windows.WM_SYSKEYDOWN || msg == windows.WM_SYSKEYUP {
				return 0
			}
		}
	case windows.WM_LBUTTONDOWN:
		w.pointerButton(pointer.ButtonPrimary, true, lParam, getModifiers())
-- 
2.17.1
builds.sr.ht
gio/patches: SUCCESS in 19m43s

[app: prevent default Windows event handler from running for WM_SYSKEYUP/DOWN][0] v2 from [aarzilli][1]

[0]: https://lists.sr.ht/~eliasnaur/gio-patches/patches/21915
[1]: mailto:alessandro.arzilli@gmail.com

✓ #481353 SUCCESS gio/patches/linux.yml   https://builds.sr.ht/~eliasnaur/job/481353
✓ #481351 SUCCESS gio/patches/apple.yml   https://builds.sr.ht/~eliasnaur/job/481351
✓ #481352 SUCCESS gio/patches/freebsd.yml https://builds.sr.ht/~eliasnaur/job/481352
✓ #481354 SUCCESS gio/patches/openbsd.yml https://builds.sr.ht/~eliasnaur/job/481354
I think this change is generally good:

- The user can access the system menu by pressing Alt+Space.
- cmd.exe also blocks F10 from showing the system menu, presumably
  because it doesn't have a regular menu, or maybe because F10 means
  other things in a terminal.
- You mentioned debuggers use F10 for their own purposes as well.

However, your change also blocks the Alt key for accessing the system
menu; in particular, Alt-F4 no longer exits a Gio program. I think you
need to filter F10 specifically.

On Fri Apr 9, 2021 at 10:05, aarzilli wrote: