c2ebb9e61e7a3199d3e9005d42db676e6b41784f
[tpg/acess2.git] / Usermode / Applications / axwin3_src / WM / wm_input.c
1 /*
2  * Acess2 Window Manager v3
3  * - By John Hodge (thePowersGang)
4  *
5  * wm.c
6  * - Window manager core
7  */
8 #include <common.h>
9 #include <wm_internals.h>
10
11 // === IMPORTS ===
12 extern tWindow  *gpWM_RootWindow;
13
14 // === CODE ===
15 tWindow *WM_int_GetWindowAtPos(int X, int Y)
16 {
17         tWindow *win, *next_win, *ret;
18         
19         next_win = gpWM_RootWindow;
20
21         while(next_win)
22         {
23                 ret = next_win;
24                 next_win = NULL;
25                 for(win = ret->FirstChild; win; win = win->NextSibling)
26                 {
27                         if( !(win->Flags & WINFLAG_SHOW) )      continue ;
28                         if( X < win->X || X >= win->X + win->W )        continue;
29                         if( Y < win->Y || Y >= win->Y + win->H )        continue;
30                         next_win = win; // Overwrite as we want the final rendered window
31                 }
32         }
33         
34         return ret;
35 }
36
37 void WM_Input_MouseMoved(int OldX, int OldY, int NewX, int NewY)
38 {
39         // TODO: Mouse motion events
40         // TODO: Send mouseup to match mousedown if the cursor moves out of a window?
41 }
42
43 void WM_Input_MouseButton(int X, int Y, int ButtonIndex, int Pressed)
44 {
45 //      tWindow *win = WM_int_GetWindowAtPos(X, Y);
46         
47         // Send Press/Release message
48 }
49

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