*/}}
Browse Source

Fix windows special key press event

YimingWu 3 months ago
parent
commit
d83300778b
2 changed files with 14 additions and 3 deletions
  1. 13 2
      la_kernel.c
  2. 1 1
      lagui-config.cmake

+ 13 - 2
la_kernel.c

@@ -1601,6 +1601,13 @@ int la_TranslateSpecialKey(int keysym){
     case VK_CONTROL:   return LA_KEY_CTRL;
     case VK_SHIFT:     return LA_KEY_SHIFT;
     case VK_MENU:      return LA_KEY_ALT;
+    case VK_OEM_1:     return ';';
+    case VK_OEM_2:     return '/';
+    case VK_OEM_3:     return '`';
+    case VK_OEM_4:     return '[';
+    case VK_OEM_5:     return '\\';
+    case VK_OEM_6:     return ']';
+    case VK_OEM_7:      return '\'';
     default:           return keysym;
     }
 #endif
@@ -7100,7 +7107,7 @@ LRESULT CALLBACK LA_WindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
     POINT point;
     PACKET pkt;
     static POINT ptOld, ptNew;
-    static UINT prsOld, prsNew;
+    static UINT prsOld, prsNew, vkey;
     if (!hwnd) return DefWindowProc(hwnd, message, wparam, lparam);
     switch (message) {
     case WM_PAINT:
@@ -7204,7 +7211,8 @@ LRESULT CALLBACK LA_WindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
         break;
     case WM_KEYDOWN:
         if (lparam & 0x40000000) break;
-        la_SendKeyboardEvent(hwnd, LA_KEY_DOWN, la_TranslateSpecialKey(wparam));
+        vkey = wparam;
+        la_SendKeyboardEvent(hwnd, LA_KEY_DOWN, la_TranslateSpecialKey(vkey));
         break;
     case WM_KEYUP:
         la_SendKeyboardEvent(hwnd, LA_KEY_UP, la_TranslateSpecialKey(wparam));
@@ -7520,6 +7528,9 @@ int la_ProcessSysMessage(){
     if (PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE) != 0) Processed = 1;
 
     while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
+        if (msg.wParam == VK_PROCESSKEY) {
+            msg.wParam = ImmGetVirtualKey(msg.hwnd);
+        }
         TranslateMessage(&msg); DispatchMessage(&msg);
         SendIdle = 0; MAIN.IdleStart = MAIN.TimeAccum; MAIN.IdleTriggered = 0;
     };

+ 1 - 1
lagui-config.cmake

@@ -80,7 +80,7 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
         ${FREETYPE_LIBRARIES}
         ${CMAKE_DL_LIBS}
         Threads::Threads
-        lagui shlwapi Shcore
+        lagui shlwapi Shcore Imm32
         CACHE INTERNAL "LaGUI shared libs"
     )
     set(LAGUI_INCLUDE_DIRS_ALL