X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Faxwin3_src%2FWM%2Fwm_input.c;h=dc8d8acbe3c056937ad74c8ac3612c8cac9092a7;hb=94478ae8163d1ce92ed54550f03e76bb9f2e1802;hp=66088f926e0a74d6b5598faa8a52cc3e8d179c50;hpb=e20b7220513e6010d883ae76ca1cf2c8f0ec26af;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 66088f92..dc8d8acb 100644 --- a/Usermode/Applications/axwin3_src/WM/wm_input.c +++ b/Usermode/Applications/axwin3_src/WM/wm_input.c @@ -13,6 +13,7 @@ // === IMPORTS === extern tWindow *gpWM_RootWindow; +extern tWindow *gpWM_FocusedWindow; // === GLOBALS === //! Window in which the mouse button was originally pressed @@ -47,8 +48,8 @@ void WM_Input_MouseMoved(int OldX, int OldY, int NewX, int NewY) struct sWndMsg_MouseMove msg; win = WM_int_GetWindowAtPos(OldX, OldY); - msg.X = NewX - win->X; - msg.Y = NewY - win->Y; + msg.X = NewX - win->X - win->BorderL; + msg.Y = NewY - win->Y - win->BorderT; msg.dX = NewX - OldX; msg.dY = NewY - OldY; WM_SendMessage(NULL, win, WNDMSG_MOUSEMOVE, sizeof(msg), &msg); @@ -62,8 +63,8 @@ void WM_Input_MouseMoved(int OldX, int OldY, int NewX, int NewY) // TODO: Send mouseup to match mousedown if the cursor moves out of a window? win = newWin; - msg.X = NewX - win->X; - msg.Y = NewY - win->Y; + msg.X = NewX - win->X - win->BorderL; + msg.Y = NewY - win->Y - win->BorderT; msg.dX = NewX - OldX; msg.dY = NewY - OldY; WM_SendMessage(NULL, win, WNDMSG_MOUSEMOVE, sizeof(msg), &msg); @@ -73,8 +74,8 @@ inline void WM_Input_int_SendBtnMsg(tWindow *Win, int X, int Y, int Index, int P { struct sWndMsg_MouseButton msg; - msg.X = X - Win->X; - msg.Y = Y - Win->Y; + msg.X = X - Win->X - Win->BorderL; + msg.Y = Y - Win->Y - Win->BorderT; msg.Button = Index; msg.bPressed = !!Pressed; @@ -90,7 +91,7 @@ void WM_Input_MouseButton(int X, int Y, int ButtonIndex, int Pressed) // Handle press of primary button to change focus if( ButtonIndex == 0 && Pressed == 1 ) { - _SysDebug("Gave focus to %p", win); +// _SysDebug("Gave focus to %p", win); WM_FocusWindow(win); WM_RaiseWindow(win); } @@ -110,3 +111,27 @@ 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; + 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); +} +