comparison src/video/win32/SDL_win32mouse.c @ 3779:5f599ed92fb9 gsoc2008_manymouse

Small improvements
author Szymon Wilczek <kazeuser@gmail.com>
date Thu, 14 Aug 2008 08:28:19 +0000
parents 8b5b67000dc0
children
comparison
equal deleted inserted replaced
3778:a9370b995ded 3779:5f599ed92fb9
52 int devCount=0; 52 int devCount=0;
53 int i; 53 int i;
54 int tmp=0; 54 int tmp=0;
55 char* buffer=NULL; 55 char* buffer=NULL;
56 char* tab="wacom";/*since windows does't give us handles to tablets, we have to detect a tablet by it's name*/ 56 char* tab="wacom";/*since windows does't give us handles to tablets, we have to detect a tablet by it's name*/
57 const char *rdp = "rdp_mou";
57 58
58 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 59 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
59 60
60 /*we're checking for the number of rawinput devices*/ 61 /*we're checking for the number of rawinput devices*/
61 62
76 77
77 /*we're getting the details of the devices*/ 78 /*we're getting the details of the devices*/
78 79
79 for(i=0;i<devCount;++i) 80 for(i=0;i<devCount;++i)
80 { 81 {
82 int is_rdp=0;
81 int j; 83 int j;
82 int k; 84 int k;
83 char *default_device_name="Pointing device xx"; 85 char *default_device_name="Pointing device xx";
84 const char *reg_key_root = "System\\CurrentControlSet\\Enum\\"; 86 const char *reg_key_root = "System\\CurrentControlSet\\Enum\\";
85 char *device_name=SDL_malloc(256*sizeof(char)); 87 char *device_name=SDL_malloc(256*sizeof(char));
108 110
109 if(GetRawInputDeviceInfoA(deviceList[i].hDevice, RIDI_DEVICENAME, buffer, &tmp)<0) 111 if(GetRawInputDeviceInfoA(deviceList[i].hDevice, RIDI_DEVICENAME, buffer, &tmp)<0)
110 { 112 {
111 continue; 113 continue;
112 } 114 }
113
114 buffer+=4; 115 buffer+=4;
115 tmp-=4; 116 tmp-=4;
116 117
117 tmp_name=buffer; 118 tmp_name=buffer;
118 for(j=0;j<tmp;++j) 119 for(j=0;j<tmp;++j)
130 *tmp_name='\0'; 131 *tmp_name='\0';
131 132
132 SDL_memcpy(key_name, reg_key_root, SDL_strlen (reg_key_root)); 133 SDL_memcpy(key_name, reg_key_root, SDL_strlen (reg_key_root));
133 SDL_memcpy(key_name + (SDL_strlen (reg_key_root)), buffer, j + 1); 134 SDL_memcpy(key_name + (SDL_strlen (reg_key_root)), buffer, j + 1);
134 135
136 l=SDL_strlen(key_name);
137 is_rdp=0;
138 if(l>=7)
139 {
140 for(j=0;j<l-7;++j)
141 {
142 for(k=0;k<7;++k)
143 {
144 if(rdp[k]!=SDL_tolower((unsigned char)key_name[j+k]))
145 {
146 break;
147 }
148 }
149 if(k==7)
150 {
151 is_rdp=1;
152 break;
153 }
154 }
155 }
156 if(is_rdp==1)
157 {
158 SDL_free(buffer);
159 SDL_free(key_name);
160 SDL_free(device_name);
161 is_rdp=0;
162 continue;
163 }
164
135 /*we're opening the registry key to get the mouse name*/ 165 /*we're opening the registry key to get the mouse name*/
136 166
137 rc = RegOpenKeyExA(HKEY_LOCAL_MACHINE, key_name, 0, KEY_READ, &hkey); 167 rc = RegOpenKeyExA(HKEY_LOCAL_MACHINE, key_name, 0, KEY_READ, &hkey);
138 168
139 if (rc != ERROR_SUCCESS) 169 if (rc != ERROR_SUCCESS)
195 } 225 }
196 226
197 void 227 void
198 WIN_QuitMouse(_THIS) 228 WIN_QuitMouse(_THIS)
199 { 229 {
200 int i;
201 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 230 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
202 /*let's delete all of the mouses*/ 231 /*let's delete all of the mouses*/
203 SDL_MouseQuit(); 232 SDL_MouseQuit();
204 } 233 }
205 234