Exemplo n.º 1
0
static void DIJoystick_poll_joysticks(void)
{
	HRESULT hr;
	DWORD	i;
	
	This.m_bCoinSlot = 0;

	for (i = 0; i < This.num_joysticks; i++)
	{
		/* start by clearing the structure, then fill it in if possible */

		ClearJoyState(&This.joysticks[i].dijs);

		if (This.joysticks[i].did == NULL)
			continue;

		if (This.joysticks[i].use_joystick == FALSE)
			continue;

		hr = IDirectInputDevice2_Poll(This.joysticks[i].did);

		hr = IDirectInputDevice2_GetDeviceState(This.joysticks[i].did,sizeof(DIJOYSTATE),
												&This.joysticks[i].dijs);
		if (FAILED(hr))
		{
			if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED)
			{
				hr = IDirectInputDevice2_Acquire(This.joysticks[i].did);
			}
			continue;
		}
	}
}
Exemplo n.º 2
0
HRESULT GetDeviceState(LPDIRECTINPUTDEVICE2 dev, int size, void *ptr)
{
	HRESULT hr = IDirectInputDevice2_GetDeviceState(dev, size, ptr);
	if ( hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED ) {
		hr = IDirectInputDevice2_Acquire(dev);
		if ( hr != DI_OK )
		{
			LOG->Trace( hr_ssprintf(hr, "?") );
			return hr;
		}

		hr = IDirectInputDevice2_GetDeviceState(dev, size, ptr);
	}

	return hr;
}
int get_joystick_status(struct wwvi_js_event *wjse)
{
	HRESULT hr;
	DIJOYSTATE2 js;
	int i;

	if (!joystick || !wjse)
		return -1;

	/* poll the device to read the current state  */
	hr = IDirectInputDevice2_Poll(joystick);
	if (FAILED(hr)) {
		/* input stream has been interrupted, re-acquire and try again */
		hr = IDirectInputDevice2_Acquire(joystick);
		while(hr == DIERR_INPUTLOST)
			hr = IDirectInputDevice2_Acquire(joystick);

		/* other errors may occur when the app is minimized
		or in the process of switching, so just try again later */
		if (FAILED(hr))
			return -1;

		/* try to poll again */
		hr = IDirectInputDevice2_Poll(joystick);
		if (FAILED(hr))
			return -1;
	}

	/* get the device state */
	hr = IDirectInputDevice2_GetDeviceState(joystick, sizeof(DIJOYSTATE2), &js);
	if(FAILED(hr))
		return -1;

	/* write out state */
	wjse->stick_x = js.lX;
	wjse->stick_y = js.lY;
	for (i = 0; i < 11; ++i) {
		wjse->button[i] = (js.rgbButtons[i] & 0x80) ? 1 : 0;
	}

	return 0;
}
Exemplo n.º 4
0
static void handle_mouse(const int numevents, DIDEVICEOBJECTDATA *ptrbuf)
{
	int i;
	Sint16 xrel, yrel;
	Uint8 state;
	Uint8 button;
	DWORD timestamp = 0;

	
	if (SDL_PublicSurface == NULL) {
		return;
	}

	
	if ( !(SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) {
		mouse_lost = 1;
		ClipCursor(NULL);
	} else {
		
		if ( mouse_lost ) {
			POINT mouse_pos;
			Uint8 old_state;
			Uint8 new_state;

			
			GetCursorPos(&mouse_pos);
			ScreenToClient(SDL_Window, &mouse_pos);
			post_mouse_motion( 0, (Sint16)mouse_pos.x, (Sint16)mouse_pos.y);

			
			old_state = SDL_GetMouseState(NULL, NULL);
			new_state = 0;
			{ 
	#if DIRECTINPUT_VERSION >= 0x700
				DIMOUSESTATE2 distate;
	#else
				DIMOUSESTATE distate;
	#endif
				HRESULT result;

				result=IDirectInputDevice2_GetDeviceState(SDL_DIdev[1],
							sizeof(distate), &distate);
				if ( result != DI_OK ) {
					
					SetDIerror(
					"IDirectInputDevice2::GetDeviceState", result);
					return;
				}
				for ( i=3; i>=0; --i ) {
					if ( (distate.rgbButtons[i]&0x80) == 0x80 ) {
						new_state |= 0x01;
					}
					new_state <<= 1;
				}
			}
			for ( i=0; i<8; ++i ) {
				if ( (old_state&0x01) != (new_state&0x01) ) {
					button = (Uint8)(i+1);
					
					switch ( button ) {
						case 2: button = SDL_BUTTON_RIGHT; break;
						case 3: button = SDL_BUTTON_MIDDLE; break;
						case 4: button = SDL_BUTTON_X1; break;
						case 5: button = SDL_BUTTON_X2; break;
						default: break;
					}
					if ( new_state & 0x01 ) {
						
						if ( ++mouse_pressed > 0 ) {
							SetCapture(SDL_Window);
						}
						state = SDL_PRESSED;
					} else {
						
						if ( --mouse_pressed <= 0 ) {
							ReleaseCapture();
							mouse_pressed = 0;
						}
						state = SDL_RELEASED;
					}
					if ( mouse_buttons_swapped ) {
						if ( button == 1 ) button = 3;
						else
						if ( button == 3 ) button = 1;
					}
					posted = SDL_PrivateMouseButton(state, button,
										0, 0);
				}
				old_state >>= 1;
				new_state >>= 1;
			}
			mouse_lost = 0;
			return;
		}

		
		xrel = 0;
		yrel = 0;
		for ( i=0; i<(int)numevents; ++i ) {
			switch (ptrbuf[i].dwOfs) {
				case DIMOFS_X:
					if ( timestamp != ptrbuf[i].dwTimeStamp ) {
						if ( xrel || yrel ) {
							post_mouse_motion(1, xrel, yrel);
							xrel = 0;
							yrel = 0;
						}
						timestamp = ptrbuf[i].dwTimeStamp;
					}
					xrel += (Sint16)ptrbuf[i].dwData;
					break;
				case DIMOFS_Y:
					if ( timestamp != ptrbuf[i].dwTimeStamp ) {
						if ( xrel || yrel ) {
							post_mouse_motion(1, xrel, yrel);
							xrel = 0;
							yrel = 0;
						}
						timestamp = ptrbuf[i].dwTimeStamp;
					}
					yrel += (Sint16)ptrbuf[i].dwData;
					break;
				case DIMOFS_Z:
					if ( xrel || yrel ) {
						post_mouse_motion(1, xrel, yrel);
						xrel = 0;
						yrel = 0;
					}
					timestamp = 0;
					if((int)ptrbuf[i].dwData > 0)
						button = SDL_BUTTON_WHEELUP;
					else
						button = SDL_BUTTON_WHEELDOWN;
					posted = SDL_PrivateMouseButton(
							SDL_PRESSED, button, 0, 0);
					posted |= SDL_PrivateMouseButton(
							SDL_RELEASED, button, 0, 0);
					break;
				case DIMOFS_BUTTON0:
				case DIMOFS_BUTTON1:
				case DIMOFS_BUTTON2:
				case DIMOFS_BUTTON3:
	#if DIRECTINPUT_VERSION >= 0x700
				case DIMOFS_BUTTON4:
				case DIMOFS_BUTTON5:
				case DIMOFS_BUTTON6:
				case DIMOFS_BUTTON7:
	#endif
					if ( xrel || yrel ) {
						post_mouse_motion(1, xrel, yrel);
						xrel = 0;
						yrel = 0;
					}
					timestamp = 0;
					button = (Uint8)(ptrbuf[i].dwOfs-DIMOFS_BUTTON0)+1;
					
					switch ( button ) {
						case 2: button = SDL_BUTTON_RIGHT; break;
						case 3: button = SDL_BUTTON_MIDDLE; break;
						case 4: button = SDL_BUTTON_X1; break;
						case 5: button = SDL_BUTTON_X2; break;
						default: break;
					}
					if ( ptrbuf[i].dwData & 0x80 ) {
						
						if ( ++mouse_pressed > 0 ) {
							SetCapture(SDL_Window);
						}
						state = SDL_PRESSED;
					} else {
						
						if ( --mouse_pressed <= 0 ) {
							ReleaseCapture();
							mouse_pressed = 0;
						}
						state = SDL_RELEASED;
					}
					if ( mouse_buttons_swapped ) {
						if ( button == 1 ) button = 3;
						else
						if ( button == 3 ) button = 1;
					}
					posted = SDL_PrivateMouseButton(state, button,
										0, 0);
					break;
			}
		}
		if ( xrel || yrel ) {
			post_mouse_motion(1, xrel, yrel);
		}
	}
}
Exemplo n.º 5
0
/* Function to update the state of a joystick - called as a device poll.
 * This function shouldn't update the joystick structure directly,
 * but instead should call SDL_PrivateJoystick*() to deliver events
 * and update joystick device state.
 */
void
SDL_SYS_JoystickUpdate_Polled(SDL_Joystick * joystick)
{
    DIJOYSTATE2 state;
    HRESULT result;
    int i;

    result =
        IDirectInputDevice2_GetDeviceState(joystick->hwdata->InputDevice,
                                           sizeof(DIJOYSTATE2), &state);
    if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) {
        IDirectInputDevice2_Acquire(joystick->hwdata->InputDevice);
        result =
            IDirectInputDevice2_GetDeviceState(joystick->hwdata->InputDevice,
                                               sizeof(DIJOYSTATE2), &state);
    }

    /* Set each known axis, button and POV. */
    for (i = 0; i < joystick->hwdata->NumInputs; ++i) {
        const input_t *in = &joystick->hwdata->Inputs[i];

        switch (in->type) {
        case AXIS:
            switch (in->ofs) {
            case DIJOFS_X:
                SDL_PrivateJoystickAxis_Int(joystick, in->num,
                                            (Sint16) state.lX);
                break;
            case DIJOFS_Y:
                SDL_PrivateJoystickAxis_Int(joystick, in->num,
                                            (Sint16) state.lY);
                break;
            case DIJOFS_Z:
                SDL_PrivateJoystickAxis_Int(joystick, in->num,
                                            (Sint16) state.lZ);
                break;
            case DIJOFS_RX:
                SDL_PrivateJoystickAxis_Int(joystick, in->num,
                                            (Sint16) state.lRx);
                break;
            case DIJOFS_RY:
                SDL_PrivateJoystickAxis_Int(joystick, in->num,
                                            (Sint16) state.lRy);
                break;
            case DIJOFS_RZ:
                SDL_PrivateJoystickAxis_Int(joystick, in->num,
                                            (Sint16) state.lRz);
                break;
            case DIJOFS_SLIDER(0):
                SDL_PrivateJoystickAxis_Int(joystick, in->num,
                                            (Sint16) state.rglSlider[0]);
                break;
            case DIJOFS_SLIDER(1):
                SDL_PrivateJoystickAxis_Int(joystick, in->num,
                                            (Sint16) state.rglSlider[1]);
                break;
            }

            break;

        case BUTTON:
            SDL_PrivateJoystickButton_Int(joystick, in->num,
                                          (Uint8) (state.
                                                   rgbButtons[in->ofs -
                                                              DIJOFS_BUTTON0]
                                                   ? SDL_PRESSED :
                                                   SDL_RELEASED));
            break;
        case HAT:
            {
                Uint8 pos = TranslatePOV(state.rgdwPOV[in->ofs -
                                                       DIJOFS_POV(0)]);
                SDL_PrivateJoystickHat_Int(joystick, in->num, pos);
                break;
            }
        }
    }
}
Exemplo n.º 6
0
/* joystick_dinput_poll: [primary thread]
 *  Polls the DirectInput joystick devices.
 */
static int joystick_dinput_poll(void)
{
   int n_joy, n_axis, n_but;
   DIJOYSTATE js;
   HRESULT hr;

   for (n_joy = 0; n_joy < dinput_joy_num; n_joy++) {
      /* poll the device */
      IDirectInputDevice2_Poll(dinput_joystick[n_joy].device);

      hr = IDirectInputDevice2_GetDeviceState(dinput_joystick[n_joy].device, sizeof(DIJOYSTATE), &js);

      if (hr == DI_OK) {
	 /* axes */
	 dinput_joystick[n_joy].axis[0] = js.lX;
	 dinput_joystick[n_joy].axis[1] = js.lY;
	 n_axis = 2;

	 if (dinput_joystick[n_joy].caps & JOYCAPS_HASZ) {
            dinput_joystick[n_joy].axis[n_axis] = js.lZ;
            n_axis++;
         }

	 if (dinput_joystick[n_joy].caps & JOYCAPS_HASR) {
            dinput_joystick[n_joy].axis[n_axis] = js.lRz;
            n_axis++;
         }

         /* In versions of the DirectInput joystick API earlier than 8.00, slider
          * data is to be found in the Z axis data member, although the object was
          * reported as a slider during enumeration. 
          *
          * Very few locations seem to describe this "feature". Here is one:
          * http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dx81_vb/directx_vb/Input/VB_Ref/Types/dijoystate2.asp
          *
          * The interesting part is the note at the bottom of the page:
          * " Note: Under Microsoft DirectX 7, sliders on some joysticks could be assigned
          *   to the Z axis, with subsequent code retrieving data from that member. 
          *   Using DirectX 8, those same sliders will be assigned to the slider array. 
          *   This should be taken into account when porting applications to DirectX 8. 
          *   Make any necessary alterations to ensure that slider data is retrieved from 
          *   the slider array. "
          */

         /* For U axis (slider 0), get data from Z axis member if API < 0x0800
          * and if a real Z axis is not present. Otherwise get it from slider 0 member.
          */
	 if (dinput_joystick[n_joy].caps & JOYCAPS_HASU) {
#if DIRECTINPUT_VERSION < 0x0800
	    if (dinput_joystick[n_joy].caps & JOYCAPS_HASZ)
               dinput_joystick[n_joy].axis[n_axis] = js.rglSlider[0];
            else
               dinput_joystick[n_joy].axis[n_axis] = js.lZ;
#else
            dinput_joystick[n_joy].axis[n_axis] = js.rglSlider[0];
#endif
            n_axis++;
         }

         /* For V axis (slider 1), get data from slider 0 member if API < 0x0800
          * and if a real Z axis is not present. Otherwise get it from slider 1 member.
          */
         if (dinput_joystick[n_joy].caps & JOYCAPS_HASV) {
#if DIRECTINPUT_VERSION < 0x0800
	    if (dinput_joystick[n_joy].caps & JOYCAPS_HASZ)
               dinput_joystick[n_joy].axis[n_axis] = js.rglSlider[1];
            else
               dinput_joystick[n_joy].axis[n_axis] = js.rglSlider[0];
#else
            dinput_joystick[n_joy].axis[n_axis] = js.rglSlider[1];
#endif
            n_axis++;
         }

	 /* hat */
         if (dinput_joystick[n_joy].caps & JOYCAPS_HASPOV)
            dinput_joystick[n_joy].hat = js.rgdwPOV[0];

	 /* buttons */
	 for (n_but = 0; n_but < dinput_joystick[n_joy].num_buttons; n_but++)
	    dinput_joystick[n_joy].button[n_but] = ((js.rgbButtons[n_but] & 0x80) != 0);

	 win_update_joystick_status(n_joy, (WINDOWS_JOYSTICK_INFO *)&dinput_joystick[n_joy]);
      }
      else {
         if ((hr == DIERR_NOTACQUIRED) || (hr == DIERR_INPUTLOST)) {
	    /* reacquire device */
	    _TRACE(PREFIX_W "joystick device not acquired or lost\n");
	    wnd_schedule_proc(joystick_dinput_acquire);
         }
         else {
            _TRACE(PREFIX_E "unexpected error while polling the joystick\n");
         }
      }
   }

   return 0;
}
Exemplo n.º 7
0
static void handle_mouse(const int numevents, DIDEVICEOBJECTDATA *ptrbuf)
{
	int i;
	Sint16 xrel, yrel;
	Uint8 state;
	Uint8 button;
	DWORD timestamp = 0;

	/* Sanity check. Mailing list reports this being NULL unexpectedly. */
	if (SDL_PublicSurface == NULL) {
		return;
	}

	/* If we are in windowed mode, Windows is taking care of the mouse */
	if (  (SDL_PublicSurface->flags & SDL_OPENGL) ||
	     !(SDL_PublicSurface->flags & SDL_FULLSCREEN) ) {
		return;
	}

	/* If the mouse was lost, regain some sense of mouse state */
	if ( mouse_lost ) {
		POINT mouse_pos;
		Uint8 old_state;
		Uint8 new_state;

		/* Set ourselves up with the current cursor position */
		GetCursorPos(&mouse_pos);
		ScreenToClient(SDL_Window, &mouse_pos);
		posted = SDL_PrivateMouseMotion(0, 0,
				(Sint16)mouse_pos.x, (Sint16)mouse_pos.y);

		/* Check for mouse button changes */
		old_state = SDL_GetMouseState(NULL, NULL);
		new_state = 0;
		{ /* Get the new DirectInput button state for the mouse */
			DIMOUSESTATE distate;
			HRESULT result;

			result=IDirectInputDevice2_GetDeviceState(SDL_DIdev[1],
						sizeof(distate), &distate);
			if ( result != DI_OK ) {
				/* Try again next time */
				SetDIerror(
				"IDirectInputDevice2::GetDeviceState", result);
				return;
			}
			for ( i=3; i>=0; --i ) {
				if ( (distate.rgbButtons[i]&0x80) == 0x80 ) {
					new_state |= 0x01;
				}
				new_state <<= 1;
			}
		}
		for ( i=0; i<8; ++i ) {
			if ( (old_state&0x01) != (new_state&0x01) ) {
				button = (Uint8)(i+1);
				/* Button #2 on two button mice is button 3
				   (the middle button is button 2)
				 */
				if ( button == 2 ) {
					button = 3;
				} else
				if ( button == 3 ) {
					button = 2;
				}
				if ( new_state & 0x01 ) {
					/* Grab mouse so we get mouse-up */
					if ( ++mouse_pressed > 0 ) {
						SetCapture(SDL_Window);
					}
					state = SDL_PRESSED;
				} else {
					/* Release mouse after all mouse-ups */
					if ( --mouse_pressed <= 0 ) {
						ReleaseCapture();
						mouse_pressed = 0;
					}
					state = SDL_RELEASED;
				}
				if ( mouse_buttons_swapped ) {
					if ( button == 1 ) button = 3;
					else
					if ( button == 3 ) button = 1;
				}
				posted = SDL_PrivateMouseButton(state, button,
									0, 0);
			}
			old_state >>= 1;
			new_state >>= 1;
		}
		mouse_lost = 0;
		return;
	}

	/* Translate mouse messages */
	xrel = 0;
	yrel = 0;
	for ( i=0; i<(int)numevents; ++i ) {
		switch (ptrbuf[i].dwOfs) {
			case DIMOFS_X:
				if ( timestamp != ptrbuf[i].dwTimeStamp ) {
					if ( xrel || yrel ) {
						posted = SDL_PrivateMouseMotion(
								0, 1, xrel, yrel);
						xrel = 0;
						yrel = 0;
					}
					timestamp = ptrbuf[i].dwTimeStamp;
				}
				xrel += (Sint16)ptrbuf[i].dwData;
				break;
			case DIMOFS_Y:
				if ( timestamp != ptrbuf[i].dwTimeStamp ) {
					if ( xrel || yrel ) {
						posted = SDL_PrivateMouseMotion(
								0, 1, xrel, yrel);
						xrel = 0;
						yrel = 0;
					}
					timestamp = ptrbuf[i].dwTimeStamp;
				}
				yrel += (Sint16)ptrbuf[i].dwData;
				break;
			case DIMOFS_Z:
				if ( xrel || yrel ) {
					posted = SDL_PrivateMouseMotion(
							0, 1, xrel, yrel);
					xrel = 0;
					yrel = 0;
				}
				timestamp = 0;
				if((int)ptrbuf[i].dwData > 0)
					button = SDL_BUTTON_WHEELUP;
				else
					button = SDL_BUTTON_WHEELDOWN;
				posted = SDL_PrivateMouseButton(
						SDL_PRESSED, button, 0, 0);
				posted |= SDL_PrivateMouseButton(
						SDL_RELEASED, button, 0, 0);
				break;
			case DIMOFS_BUTTON0:
			case DIMOFS_BUTTON1:
			case DIMOFS_BUTTON2:
			case DIMOFS_BUTTON3:
				if ( xrel || yrel ) {
					posted = SDL_PrivateMouseMotion(
							0, 1, xrel, yrel);
					xrel = 0;
					yrel = 0;
				}
				timestamp = 0;
				button = (Uint8)(ptrbuf[i].dwOfs-DIMOFS_BUTTON0)+1;
				/* Button #2 on two button mice is button 3
				   (the middle button is button 2)
				 */
				if ( button == 2 ) {
					button = 3;
				} else
				if ( button == 3 ) {
					button = 2;
				}
				if ( ptrbuf[i].dwData & 0x80 ) {
					/* Grab mouse so we get mouse-up */
					if ( ++mouse_pressed > 0 ) {
						SetCapture(SDL_Window);
					}
					state = SDL_PRESSED;
				} else {
					/* Release mouse after all mouse-ups */
					if ( --mouse_pressed <= 0 ) {
						ReleaseCapture();
						mouse_pressed = 0;
					}
					state = SDL_RELEASED;
				}
				if ( mouse_buttons_swapped ) {
					if ( button == 1 ) button = 3;
					else
					if ( button == 3 ) button = 1;
				}
				posted = SDL_PrivateMouseButton(state, button,
									0, 0);
				break;
		}
	}
	if ( xrel || yrel ) {
		posted = SDL_PrivateMouseMotion( 0, 1, xrel, yrel);
	}
}
Exemplo n.º 8
0
static void handle_mouse(const int numevents, DIDEVICEOBJECTDATA *ptrbuf)
{
	int i;
	Sint16 xrel, yrel;
	Uint8 state;
	Uint8 button;
	DWORD timestamp = 0;

	/* Sanity check. Mailing list reports this being NULL unexpectedly. */
	if (SDL_PublicSurface == NULL) {
		return;
	}

	/* If the mouse was lost, regain some sense of mouse state */
	if ( mouse_lost && (SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) {
		POINT mouse_pos;
		Uint8 old_state;
		Uint8 new_state;

		/* Set ourselves up with the current cursor position */
		GetCursorPos(&mouse_pos);
		ScreenToClient(SDL_Window, &mouse_pos);
		post_mouse_motion( 0, (Sint16)mouse_pos.x, (Sint16)mouse_pos.y);

		/* Check for mouse button changes */
		old_state = SDL_GetMouseState(NULL, NULL);
		new_state = 0;
		{ /* Get the new DirectInput button state for the mouse */
#if DIRECTINPUT_VERSION >= 0x700
			DIMOUSESTATE2 distate;
#else
			DIMOUSESTATE distate;
#endif
			HRESULT result;

			result=IDirectInputDevice2_GetDeviceState(SDL_DIdev[1],
						sizeof(distate), &distate);
			if ( result != DI_OK ) {
				/* Try again next time */
				SetDIerror(
				"IDirectInputDevice2::GetDeviceState", result);
				return;
			}
			for ( i=3; i>=0; --i ) {
				if ( (distate.rgbButtons[i]&0x80) == 0x80 ) {
					new_state |= 0x01;
				}
				new_state <<= 1;
			}
		}
		for ( i=0; i<8; ++i ) {
			if ( (old_state&0x01) != (new_state&0x01) ) {
				button = (Uint8)(i+1);
				/* Map DI button numbers to SDL */
				switch ( button ) {
					case 2: button = SDL_BUTTON_RIGHT; break;
					case 3: button = SDL_BUTTON_MIDDLE; break;
					case 4: button = SDL_BUTTON_X1; break;
					case 5: button = SDL_BUTTON_X2; break;
					default: break;
				}
				if ( new_state & 0x01 ) {
					/* Grab mouse so we get mouse-up */
					if ( ++mouse_pressed > 0 ) {
						SetCapture(SDL_Window);
					}
					state = SDL_PRESSED;
				} else {
					/* Release mouse after all mouse-ups */
					if ( --mouse_pressed <= 0 ) {
						ReleaseCapture();
						mouse_pressed = 0;
					}
					state = SDL_RELEASED;
				}
				if ( mouse_buttons_swapped ) {
					if ( button == 1 ) button = 3;
					else
					if ( button == 3 ) button = 1;
				}
				posted = SDL_PrivateMouseButton(state, button,
									0, 0);
			}
			old_state >>= 1;
			new_state >>= 1;
		}
		mouse_lost = 0;
		return;
	}