Usermode/AxWin3 - Splitting widget types out into separate files
[tpg/acess2.git] / Usermode / Applications / axwin3_src / WM / wm_input.c
index af258ff..f15d25a 100644 (file)
@@ -15,8 +15,6 @@
 extern tWindow *gpWM_RootWindow;
 
 // === GLOBALS ===
-//! Window which will recieve the next keyboard event
-tWindow        *gpWM_FocusedWindow;
 //! Window in which the mouse button was originally pressed
 tWindow        *gpWM_DownStartWindow[MAX_BUTTONS];
 
@@ -49,8 +47,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);
@@ -64,8 +62,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);
@@ -75,8 +73,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;
        
@@ -92,8 +90,8 @@ 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);
-               WM_GiveFocus(win);
+//             _SysDebug("Gave focus to %p", win);
+               WM_FocusWindow(win);
                WM_RaiseWindow(win);
        }
 
@@ -112,19 +110,3 @@ void WM_Input_MouseButton(int X, int Y, int ButtonIndex, int Pressed)
        WM_Input_int_SendBtnMsg(win, X, Y, ButtonIndex, Pressed);
 }
 
-// --- Manipulation Functions ---
-void WM_GiveFocus(tWindow *Destination)
-{
-       struct sWndMsg_Bool     _msg;
-       
-       if( gpWM_FocusedWindow == Destination )
-               return ;
-       
-       _msg.Val = 0;
-       WM_SendMessage(NULL, gpWM_FocusedWindow, WNDMSG_FOCUS, sizeof(_msg), &_msg);
-       _msg.Val = 1;
-       WM_SendMessage(NULL, Destination, WNDMSG_FOCUS, sizeof(_msg), &_msg);
-       
-       gpWM_FocusedWindow = Destination;
-}
-

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