Merge branch 'master' of git://git.ucc.asn.au/tpg/acess2
[tpg/acess2.git] / Usermode / Applications / axwin3_src / WM / wm_input.c
index f15d25a..3220f77 100644 (file)
@@ -13,6 +13,7 @@
 
 // === IMPORTS ===
 extern tWindow *gpWM_RootWindow;
+extern tWindow *gpWM_FocusedWindow;
 
 // === GLOBALS ===
 //! Window in which the mouse button was originally pressed
@@ -21,7 +22,7 @@ tWindow       *gpWM_DownStartWindow[MAX_BUTTONS];
 // === CODE ===
 tWindow *WM_int_GetWindowAtPos(int X, int Y)
 {
-       tWindow *win, *next_win, *ret;
+       tWindow *win, *next_win, *ret = NULL;
        
        next_win = gpWM_RootWindow;
 
@@ -110,3 +111,30 @@ void WM_Input_MouseButton(int X, int Y, int ButtonIndex, int Pressed)
        WM_Input_int_SendBtnMsg(win, X, Y, ButtonIndex, Pressed);
 }
 
+void WM_Input_KeyDown(uint32_t Character, uint32_t Scancode)
+{
+       struct sWndMsg_KeyAction        msg;
+       msg.KeySym = Scancode;
+       msg.UCS32 = Character;
+       WM_SendMessage(NULL, gpWM_FocusedWindow, WNDMSG_KEYDOWN, sizeof(msg), &msg);
+}
+
+void WM_Input_KeyFire(uint32_t Character, uint32_t Scancode)
+{
+       struct sWndMsg_KeyAction        msg;
+
+       // TODO: Properly translate into KeySyms and Unicode
+
+       msg.KeySym = Scancode;
+       msg.UCS32 = Character;
+       WM_SendMessage(NULL, gpWM_FocusedWindow, WNDMSG_KEYFIRE, sizeof(msg), &msg);
+}
+
+void WM_Input_KeyUp(uint32_t Character, uint32_t Scancode)
+{
+       struct sWndMsg_KeyAction        msg;
+       msg.KeySym = Scancode;
+       msg.UCS32 = Character;
+       WM_SendMessage(NULL, gpWM_FocusedWindow, WNDMSG_KEYUP, sizeof(msg), &msg);
+}
+

UCC git Repository :: git.ucc.asn.au