annotate src/video/win32/SDL_win32mouse.c @ 3770:81b649bad6d2 gsoc2008_manymouse

Implementation finished
author Szymon Wilczek <kazeuser@gmail.com>
date Thu, 31 Jul 2008 14:41:48 +0000
parents 1b87a8beab9d
children 8cc36a399a12
rev   line source
3768
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
1 /*
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
2 SDL - Simple DirectMedia Layer
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
4
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
5 This library is free software; you can redistribute it and/or
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
6 modify it under the terms of the GNU Lesser General Public
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
7 License as published by the Free Software Foundation; either
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
9
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
10 This library is distributed in the hope that it will be useful,
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
13 Lesser General Public License for more details.
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
14
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
15 You should have received a copy of the GNU Lesser General Public
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
16 License along with this library; if not, write to the Free Software
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
18
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
19 Sam Lantinga
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
20 slouken@libsdl.org
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
21 */
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
22
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
23 #if (_WIN32_WINNT < 0x0501)
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
24 #undef _WIN32_WINNT
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
25 #define _WIN32_WINNT 0x0501
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
26 #endif
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
27
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
28 #include "SDL_config.h"
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
29
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
30 #include "SDL_win32video.h"
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
31
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
32 #include "../../events/SDL_mouse_c.h"
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
33
3770
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
34 #include <wintab.h>
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
35 #define PACKETDATA ( PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE)
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
36 #define PACKETMODE 0
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
37 #include <pktdef.h>
3768
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
38
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
39 extern HANDLE* mice;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
40
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
41 extern int total_mice;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
42
3770
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
43 extern int tablet;
3768
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
44
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
45 void
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
46 WIN_InitMouse(_THIS)
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
47 {
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
48 int index=0;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
49 RAWINPUTDEVICELIST *deviceList=NULL;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
50 int devCount=0;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
51 int i;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
52 int tmp=0;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
53 char* buffer=NULL;
3770
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
54 char* tab="wacom";
3768
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
55
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
56 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
57
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
58 if(GetRawInputDeviceList(NULL,&devCount,sizeof(RAWINPUTDEVICELIST)))
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
59 {
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
60 return;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
61 }
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
62 else
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
63 {
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
64 deviceList = SDL_malloc(sizeof(RAWINPUTDEVICELIST)*devCount);
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
65 }
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
66
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
67 GetRawInputDeviceList(deviceList,&devCount,sizeof(RAWINPUTDEVICELIST));
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
68
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
69 mice = SDL_malloc(devCount*sizeof(HANDLE));
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
70
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
71 for(i=0;i<devCount;++i)
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
72 {
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
73 int j;
3770
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
74 int k;
3768
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
75 char *default_device_name="Pointing device xx";
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
76 const char *reg_key_root = "System\\CurrentControlSet\\Enum\\";
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
77 char *device_name=SDL_malloc(256*sizeof(char));
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
78 char *key_name=NULL;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
79 char *tmp_name=NULL;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
80 LONG rc = 0;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
81 HKEY hkey;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
82 DWORD regtype = REG_SZ;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
83 DWORD out=256*sizeof(char);
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
84 SDL_Mouse mouse;
3770
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
85 int l;
3768
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
86 if(deviceList[i].dwType!=RIM_TYPEMOUSE)
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
87 {
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
88 continue;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
89 }
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
90 if(GetRawInputDeviceInfoA(deviceList[i].hDevice, RIDI_DEVICENAME, NULL, &tmp)<0)
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
91 {
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
92 continue;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
93 }
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
94 buffer = SDL_malloc((tmp+1)*sizeof(char));
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
95 key_name = SDL_malloc(tmp + sizeof(reg_key_root)*sizeof(char));
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
96
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
97 if(GetRawInputDeviceInfoA(deviceList[i].hDevice, RIDI_DEVICENAME, buffer, &tmp)<0)
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
98 {
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
99 continue;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
100 }
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
101
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
102 buffer+=4;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
103 tmp-=4;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
104
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
105 tmp_name=buffer;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
106 for(j=0;j<tmp;++j)
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
107 {
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
108 if(*tmp_name=='#')
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
109 {
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
110 *tmp_name='\\';
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
111 }
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
112 else if(*tmp_name=='{')
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
113 {
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
114 break;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
115 }
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
116 ++tmp_name;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
117 }
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
118 *tmp_name='\0';
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
119
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
120 SDL_memcpy(key_name, reg_key_root, SDL_strlen (reg_key_root));
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
121 SDL_memcpy(key_name + (SDL_strlen (reg_key_root)), buffer, j + 1);
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
122
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
123 rc = RegOpenKeyExA(HKEY_LOCAL_MACHINE, key_name, 0, KEY_READ, &hkey);
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
124
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
125 if (rc != ERROR_SUCCESS)
3770
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
126 {
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
127 SDL_memcpy(device_name, default_device_name, SDL_strlen(default_device_name));
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
128 }
3768
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
129
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
130 rc = RegQueryValueExA(hkey, "DeviceDesc", NULL, &regtype, device_name, &out);
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
131 RegCloseKey(hkey);
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
132 if (rc != ERROR_SUCCESS)
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
133 {
3770
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
134 SDL_memcpy(device_name, default_device_name, SDL_strlen(default_device_name));
3768
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
135 }
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
136 mice[index]=deviceList[i].hDevice;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
137 SDL_zero(mouse);
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
138 SDL_SetIndexId(index,index);
3770
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
139 l=SDL_strlen(device_name);
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
140 if(tablet==-1)
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
141 {
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
142 for(j=0;j<l-5;++j)
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
143 {
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
144 for(k=0;k<5;++k)
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
145 {
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
146 if(tab[k]!=SDL_tolower((unsigned char)device_name[j+k]))
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
147 {
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
148 break;
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
149 }
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
150 }
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
151 if(k==5)
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
152 {
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
153 tablet=index;
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
154 break;
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
155 }
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
156 }
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
157 }
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
158 if(tablet==index)
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
159 {
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
160 AXIS pressure;
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
161 WTInfo(WTI_DEVICES,DVC_NPRESSURE, &pressure);
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
162 data->mouse = SDL_AddMouse(&mouse, index,device_name,pressure.axMax,pressure.axMin);
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
163 }
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
164 else
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
165 {
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
166 data->mouse = SDL_AddMouse(&mouse, index,device_name,0,0);
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
167 }
3768
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
168 ++index;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
169
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
170 SDL_free(buffer);
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
171 SDL_free(key_name);
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
172 }
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
173 total_mice=index;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
174 SDL_free(deviceList);
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
175 }
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
176
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
177 void
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
178 WIN_QuitMouse(_THIS)
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
179 {
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
180 int i;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
181 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
182 for(i=0;i<total_mice;++i)
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
183 {
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
184 SDL_DelMouse(i);
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
185 }
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
186 }
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
187
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 1895
diff changeset
188 /* vi: set ts=4 sw=4 expandtab: */
3770
81b649bad6d2 Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents: 3768
diff changeset
189