X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=Usermode%2FApplications%2Faxwin3_src%2FWM%2Fwm_input.c;fp=Usermode%2FApplications%2Faxwin3_src%2FWM%2Fwm_input.c;h=c2ebb9e61e7a3199d3e9005d42db676e6b41784f;hb=5b6ff5b0698142d4f17a693c0d340df10b375926;hp=0000000000000000000000000000000000000000;hpb=cef3ebcc25128fd5158e3c90bcedb5431b8893ae;p=tpg%2Facess2.git diff --git a/Usermode/Applications/axwin3_src/WM/wm_input.c b/Usermode/Applications/axwin3_src/WM/wm_input.c new file mode 100644 index 00000000..c2ebb9e6 --- /dev/null +++ b/Usermode/Applications/axwin3_src/WM/wm_input.c @@ -0,0 +1,49 @@ +/* + * Acess2 Window Manager v3 + * - By John Hodge (thePowersGang) + * + * wm.c + * - Window manager core + */ +#include +#include + +// === IMPORTS === +extern tWindow *gpWM_RootWindow; + +// === CODE === +tWindow *WM_int_GetWindowAtPos(int X, int Y) +{ + tWindow *win, *next_win, *ret; + + next_win = gpWM_RootWindow; + + while(next_win) + { + ret = next_win; + next_win = NULL; + 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; + next_win = win; // Overwrite as we want the final rendered window + } + } + + return ret; +} + +void WM_Input_MouseMoved(int OldX, int OldY, int NewX, int NewY) +{ + // TODO: Mouse motion events + // TODO: Send mouseup to match mousedown if the cursor moves out of a window? +} + +void WM_Input_MouseButton(int X, int Y, int ButtonIndex, int Pressed) +{ +// tWindow *win = WM_int_GetWindowAtPos(X, Y); + + // Send Press/Release message +} +