2 * Acess2 Window Manager v3
3 * - By John Hodge (thePowersGang)
6 * - Window manager core
9 #include <wm_internals.h>
10 #include <wm_messages.h>
13 extern tWindow *gpWM_RootWindow;
16 tWindow *WM_int_GetWindowAtPos(int X, int Y)
18 tWindow *win, *next_win, *ret;
20 next_win = gpWM_RootWindow;
26 for(win = ret->FirstChild; win; win = win->NextSibling)
28 if( !(win->Flags & WINFLAG_SHOW) ) continue ;
29 if( X < win->X || X >= win->X + win->W ) continue;
30 if( Y < win->Y || Y >= win->Y + win->H ) continue;
31 next_win = win; // Overwrite as we want the final rendered window
38 void WM_Input_MouseMoved(int OldX, int OldY, int NewX, int NewY)
40 // TODO: Mouse motion events
41 // TODO: Send mouseup to match mousedown if the cursor moves out of a window?
44 void WM_Input_MouseButton(int X, int Y, int ButtonIndex, int Pressed)
46 tWindow *win = WM_int_GetWindowAtPos(X, Y);
47 struct sWndMsg_MouseButton msg;
49 // Send Press/Release message
52 msg.Button = ButtonIndex;
53 msg.bPressed = !!Pressed;
55 WM_SendMessage(NULL, win, WNDMSG_MOUSEBTN, sizeof(msg), &msg);