recapture on uncapture key
This commit is contained in:
@@ -809,7 +809,7 @@ screen_handle_event(struct screen *screen, SDL_Event *event) {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
if (screen->im.mp->relative_mode && screen->mouse_captured) {
|
if (screen->im.mp->relative_mode) {
|
||||||
SDL_Keycode key = event->key.keysym.sym;
|
SDL_Keycode key = event->key.keysym.sym;
|
||||||
if (screen_is_uncapture_key(key)) {
|
if (screen_is_uncapture_key(key)) {
|
||||||
if (!screen->uncapture_key_pressed) {
|
if (!screen->uncapture_key_pressed) {
|
||||||
@@ -826,15 +826,15 @@ screen_handle_event(struct screen *screen, SDL_Event *event) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_KEYUP:
|
case SDL_KEYUP:
|
||||||
if (screen->im.mp->relative_mode && screen->mouse_captured) {
|
if (screen->im.mp->relative_mode) {
|
||||||
SDL_Keycode key = event->key.keysym.sym;
|
SDL_Keycode key = event->key.keysym.sym;
|
||||||
SDL_Keycode uncapture_key_pressed =
|
SDL_Keycode uncapture_key_pressed =
|
||||||
screen->uncapture_key_pressed;
|
screen->uncapture_key_pressed;
|
||||||
screen->uncapture_key_pressed = 0;
|
screen->uncapture_key_pressed = 0;
|
||||||
if (key == uncapture_key_pressed) {
|
if (key == uncapture_key_pressed) {
|
||||||
// An uncapture key has been pressed then released:
|
// An uncapture key has been pressed then released:
|
||||||
// uncapture the mouse
|
// toggle the capture mouse mode
|
||||||
screen_capture_mouse(screen, false);
|
screen_capture_mouse(screen, !screen->mouse_captured);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Do not return, the event must be forwarded to the input
|
// Do not return, the event must be forwarded to the input
|
||||||
|
|||||||
Reference in New Issue
Block a user