X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Faxwin3_src%2FWM%2Fwm_input.c;h=5f6ef85384002a92886b69cfca6b0efa6d482572;hb=6312f7425503f27821671cb0aef9403f27ce7aca;hp=f15d25a7ec1768d29d1ae9dcd06afffd32d7a561;hpb=2f16fec349eabb42f5e23ea2b821f149fa6b767e;p=tpg%2Facess2.git diff --git a/Usermode/Applications/axwin3_src/WM/wm_input.c b/Usermode/Applications/axwin3_src/WM/wm_input.c index f15d25a7..5f6ef853 100644 --- a/Usermode/Applications/axwin3_src/WM/wm_input.c +++ b/Usermode/Applications/axwin3_src/WM/wm_input.c @@ -8,11 +8,13 @@ #include #include #include +#include #define MAX_BUTTONS 3 // === IMPORTS === extern tWindow *gpWM_RootWindow; +extern tWindow *gpWM_FocusedWindow; // === GLOBALS === //! Window in which the mouse button was originally pressed @@ -21,7 +23,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; @@ -32,8 +34,8 @@ tWindow *WM_int_GetWindowAtPos(int X, int Y) for(win = ret->FirstChild; win; win = win->NextSibling) { if( !(win->Flags & WINFLAG_SHOW) ) continue ; - if( X < win->X || X >= win->X + win->W ) continue; - if( Y < win->Y || Y >= win->Y + win->H ) continue; + if( X < win->X || X >= win->X + win->RealW ) continue; + if( Y < win->Y || Y >= win->Y + win->RealH ) continue; next_win = win; // Overwrite as we want the final rendered window } } @@ -69,7 +71,7 @@ void WM_Input_MouseMoved(int OldX, int OldY, int NewX, int NewY) WM_SendMessage(NULL, win, WNDMSG_MOUSEMOVE, sizeof(msg), &msg); } -inline void WM_Input_int_SendBtnMsg(tWindow *Win, int X, int Y, int Index, int Pressed) +void WM_Input_int_SendBtnMsg(tWindow *Win, int X, int Y, int Index, int Pressed) { struct sWndMsg_MouseButton msg; @@ -110,3 +112,36 @@ 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; + + WM_Hotkey_KeyDown(Scancode); + + 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; + + WM_Hotkey_KeyUp(Scancode); + + msg.KeySym = Scancode; + msg.UCS32 = Character; + WM_SendMessage(NULL, gpWM_FocusedWindow, WNDMSG_KEYUP, sizeof(msg), &msg); +} +