From 7b10e2941ff7623a0c6aa755700d0a50c10b5b6b Mon Sep 17 00:00:00 2001
From: Doug Coleman <doug.coleman@gmail.com>
Date: Sun, 9 Dec 2007 17:45:49 -0600
Subject: [PATCH] Handle WM_SYSCOMMAND -- don't beep on alpha keys

---
 extra/ui/windows/windows.factor | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/extra/ui/windows/windows.factor b/extra/ui/windows/windows.factor
index 0146deed98..de9ad130fe 100755
--- a/extra/ui/windows/windows.factor
+++ b/extra/ui/windows/windows.factor
@@ -210,6 +210,9 @@ SYMBOL: hWnd
     hWnd get window-focus send-gesture
     drop ;
 
+: handle-wm-syscommand ( hWnd uMsg wParam lParam -- n )
+    dup alpha? [ 3drop drop 0 ] [ DefWindowProc ] if ;
+
 : cleanup-window ( handle -- )
     dup win-title [ free ] when*
     dup win-hRC wglDeleteContext win32-error=0/f
@@ -305,7 +308,7 @@ M: windows-ui-backend (close-window)
 : ui-wndproc ( -- object )
     "uint" { "void*" "uint" "long" "long" } "stdcall" [
         [
-        pick
+        pick ! global [ dup windows-message-name . ] bind
             {
                 { [ dup WM_CLOSE = ]    [ drop handle-wm-close 0 ] }
                 { [ dup WM_PAINT = ]
@@ -320,6 +323,7 @@ M: windows-ui-backend (close-window)
                 { [ dup WM_KEYUP = over WM_SYSKEYUP = or ]
                     [ drop 4dup handle-wm-keyup DefWindowProc ] }
 
+                { [ dup WM_SYSCOMMAND = ] [ drop handle-wm-syscommand ] }
                 { [ dup WM_SETFOCUS = ] [ drop handle-wm-set-focus 0 ] }
                 { [ dup WM_KILLFOCUS = ] [ drop handle-wm-kill-focus 0 ] }