From: John Hodge Date: Wed, 6 Jul 2011 15:09:25 +0000 (+0800) Subject: AxWin2 - Added mouse support (well, it now reads the mouse state) X-Git-Tag: rel0.10~42 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=f8000bc4044bc761b8f3ab6cf19d40c7d1f79ba9;p=tpg%2Facess2.git AxWin2 - Added mouse support (well, it now reads the mouse state) - TODO: Implement the cursor (probably as a HW cursor in the video driver) --- diff --git a/Usermode/Applications/axwin2_src/WM/input.c b/Usermode/Applications/axwin2_src/WM/input.c index c75e0a05..0517993f 100644 --- a/Usermode/Applications/axwin2_src/WM/input.c +++ b/Usermode/Applications/axwin2_src/WM/input.c @@ -6,6 +6,24 @@ #include // === CODE === +int Input_Init(void) +{ + struct { + int Num, Value; + } num_value; + giMouseFD = open(gsMouseDevice, 3); + + num_value.Num = 0; + num_value.Value = giScreenWidth; + ioctl(giMouseFD, 6, &num_value); + + num_value.Num = 1; + num_value.Value = giScreenHeight; + ioctl(giMouseFD, 6, &num_value); + + return 0; +} + void Input_FillSelect(int *nfds, fd_set *set) { if(*nfds < giTerminalFD) *nfds = giTerminalFD; @@ -24,6 +42,7 @@ void Input_HandleSelect(fd_set *set) // oops, error } // TODO: pass on to message handler + _SysDebug("Keypress 0x%x", codepoint); } if(FD_ISSET(giMouseFD, set)) @@ -37,7 +56,10 @@ void Input_HandleSelect(fd_set *set) } Axies[2]; uint8_t Buttons[3]; } mouseinfo; - + + _SysDebug("Cursor event"); + + seek(giMouseFD, 0, SEEK_SET); if( read(giMouseFD, sizeof(mouseinfo), &mouseinfo) != sizeof(mouseinfo) ) { // Not a 3 button mouse, oops @@ -46,5 +68,6 @@ void Input_HandleSelect(fd_set *set) // Handle movement // Video_SetCursorPos( mouseinfo.Axies[0], mouseinfo.Axies[1] ); + _SysDebug("Cursor to %i,%i\n", mouseinfo.Axies[0], mouseinfo.Axies[1]); } } diff --git a/Usermode/Applications/axwin2_src/WM/main.c b/Usermode/Applications/axwin2_src/WM/main.c index 781194a8..48e47ff7 100644 --- a/Usermode/Applications/axwin2_src/WM/main.c +++ b/Usermode/Applications/axwin2_src/WM/main.c @@ -7,6 +7,7 @@ // === IMPORTS === extern void WM_Update(void); +extern int Input_Init(void); // === GLOBALS === const char *gsTerminalDevice = NULL; @@ -38,6 +39,7 @@ int main(int argc, char *argv[]) Video_Setup(); Interface_Init(); IPC_Init(); + Input_Init(); WM_Update();