src/video/windx5/SDL_dx5events.c
changeset 491 da6a7e859616
parent 460 a888b3ae31ff
child 523 c210010f50f4
equal deleted inserted replaced
490:7e53d17ec798 491:da6a7e859616
    56 static HANDLE               SDL_DIevt[MAX_INPUTS];
    56 static HANDLE               SDL_DIevt[MAX_INPUTS];
    57 static void (*SDL_DIfun[MAX_INPUTS])(const int, DIDEVICEOBJECTDATA *);
    57 static void (*SDL_DIfun[MAX_INPUTS])(const int, DIDEVICEOBJECTDATA *);
    58 static int SDL_DIndev = 0;
    58 static int SDL_DIndev = 0;
    59 static int mouse_lost;
    59 static int mouse_lost;
    60 static int mouse_pressed;
    60 static int mouse_pressed;
       
    61 static int mouse_buttons_swapped = 0;
    61 
    62 
    62 /* The translation table from a DirectInput scancode to an SDL keysym */
    63 /* The translation table from a DirectInput scancode to an SDL keysym */
    63 static SDLKey DIK_keymap[256];
    64 static SDLKey DIK_keymap[256];
    64 static SDL_keysym *TranslateKey(UINT scancode, SDL_keysym *keysym, int pressed);
    65 static SDL_keysym *TranslateKey(UINT scancode, SDL_keysym *keysym, int pressed);
    65 
    66 
   214 
   215 
   215 		/* Increment the number of devices we have */
   216 		/* Increment the number of devices we have */
   216 		++SDL_DIndev;
   217 		++SDL_DIndev;
   217 	}
   218 	}
   218 	mouse_pressed = 0;
   219 	mouse_pressed = 0;
       
   220 	mouse_buttons_swapped = GetSystemMetrics(SM_SWAPBUTTON);
   219 
   221 
   220 	/* DirectInput is ready! */
   222 	/* DirectInput is ready! */
   221 	return(0);
   223 	return(0);
   222 }
   224 }
   223 
   225 
   337 					if ( --mouse_pressed <= 0 ) {
   339 					if ( --mouse_pressed <= 0 ) {
   338 						ReleaseCapture();
   340 						ReleaseCapture();
   339 						mouse_pressed = 0;
   341 						mouse_pressed = 0;
   340 					}
   342 					}
   341 					state = SDL_RELEASED;
   343 					state = SDL_RELEASED;
       
   344 				}
       
   345 				if ( mouse_buttons_swapped ) {
       
   346 					if ( button == 1 ) button = 3;
       
   347 					else
       
   348 					if ( button == 3 ) button = 1;
   342 				}
   349 				}
   343 				posted = SDL_PrivateMouseButton(state, button,
   350 				posted = SDL_PrivateMouseButton(state, button,
   344 									0, 0);
   351 									0, 0);
   345 			}
   352 			}
   346 			old_state >>= 1;
   353 			old_state >>= 1;
   408 					if ( --mouse_pressed <= 0 ) {
   415 					if ( --mouse_pressed <= 0 ) {
   409 						ReleaseCapture();
   416 						ReleaseCapture();
   410 						mouse_pressed = 0;
   417 						mouse_pressed = 0;
   411 					}
   418 					}
   412 					state = SDL_RELEASED;
   419 					state = SDL_RELEASED;
       
   420 				}
       
   421 				if ( mouse_buttons_swapped ) {
       
   422 					if ( button == 1 ) button = 3;
       
   423 					else
       
   424 					if ( button == 3 ) button = 1;
   413 				}
   425 				}
   414 				posted = SDL_PrivateMouseButton(state, button,
   426 				posted = SDL_PrivateMouseButton(state, button,
   415 									0, 0);
   427 									0, 0);
   416 				break;
   428 				break;
   417 		}
   429 		}