AxWin2 - Debugging and misc
[tpg/acess2.git] / Usermode / Applications / axwin2_src / WM / input.c
1 /*
2  * Acess GUI (AxWin) Version 2
3  * By John Hodge (thePowersGang)
4  */
5 #include "common.h"
6 #include <acess/sys.h>
7
8 // === CODE ===
9 void Input_FillSelect(int *nfds, fd_set *set)
10 {
11         if(*nfds < giTerminalFD)        *nfds = giTerminalFD;
12         if(*nfds < giMouseFD)   *nfds = giMouseFD;
13         FD_SET(giTerminalFD, set);
14         FD_SET(giMouseFD, set);
15 }
16
17 void Input_HandleSelect(fd_set *set)
18 {
19         if(FD_ISSET(giTerminalFD, set))
20         {
21                 uint32_t        codepoint;
22                 if( read(giTerminalFD, sizeof(codepoint), &codepoint) != sizeof(codepoint) )
23                 {
24                         // oops, error
25                 }
26                 // TODO: pass on to message handler
27         }
28
29         if(FD_ISSET(giMouseFD, set))
30         {
31                 struct sMouseInfo {
32                         uint16_t        NAxies, NButtons;
33                         struct sMouseAxis {
34                                  int16_t        MinValue, MaxValue;
35                                  int16_t        CurValue;
36                                 uint16_t        CursorPos;
37                         }       Axies[2];
38                         uint8_t Buttons[3];
39                 }       mouseinfo;
40                 
41                 if( read(giMouseFD, sizeof(mouseinfo), &mouseinfo) != sizeof(mouseinfo) )
42                 {
43                         // Not a 3 button mouse, oops
44                         return ;
45                 }
46                 
47                 // Handle movement
48 //              Video_SetCursorPos( mouseinfo.Axies[0], mouseinfo.Axies[1] );
49         }
50 }

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