freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2-demos] master e73aa60: [windows] Fix some GUI keys not workin


From: Werner Lemberg
Subject: [freetype2-demos] master e73aa60: [windows] Fix some GUI keys not working
Date: Sat, 9 Apr 2022 08:40:01 -0400 (EDT)

branch: master
commit e73aa600290280467baa0113fbda4862451967a1
Author: Charlie Jiang <w@chariri.moe>
Commit: Charlie Jiang <w@chariri.moe>

    [windows] Fix some GUI keys not working
    
    * graph/win32/grwin32.c (gr_win32_surface_listen_event, Message_Process): 
Switch to custom Windows messaage ID.
---
 graph/win32/grwin32.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/graph/win32/grwin32.c b/graph/win32/grwin32.c
index 0763d83..29a8626 100644
--- a/graph/win32/grwin32.c
+++ b/graph/win32/grwin32.c
@@ -59,6 +59,7 @@
 /*  Custom messages. */
 #define WM_STATUS  WM_USER+512
 #define WM_RESIZE  WM_USER+517
+#define WM_GR_KEY  WM_USER+519
 
 
   typedef struct  Translator_
@@ -395,10 +396,12 @@ gr_win32_surface_listen_event( grWin32Surface*  surface,
       break;
 
     case WM_CHAR:
+    case WM_GR_KEY:
       {
         grevent->type = gr_event_key;
         grevent->key  = msg.wParam;
-        LOG(( isprint( msg.wParam ) ? "KeyPress: Char = '%c'\n"
+        LOG(( (msg.wParam <= 256 && isprint( msg.wParam ))
+                                    ? "KeyPress: Char = '%c'\n"
                                     : "KeyPress: Char = <%02x>\n",
               msg.wParam ));
         return;
@@ -616,7 +619,7 @@ LRESULT CALLBACK Message_Process( HWND handle, UINT mess,
     {
     case WM_CLOSE:
       /* warn the main thread to quit if it didn't know */
-      PostThreadMessage( surface->host, WM_CHAR, (WPARAM)grKeyEsc, 0 );
+      PostThreadMessage( surface->host, WM_GR_KEY, (WPARAM)grKeyEsc, 0 );
       break;
 
     case WM_SIZE:
@@ -668,7 +671,7 @@ LRESULT CALLBACK Message_Process( HWND handle, UINT mess,
           if ( wParam == trans->winkey )
           {
             /* repost to the main thread */
-            PostThreadMessage( surface->host, WM_CHAR, trans->grkey, 0 );
+            PostThreadMessage( surface->host, WM_GR_KEY, trans->grkey, 0 );
             LOG(( "KeyPress: VK = 0x%02x\n", wParam ));
             break;
           }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]