Display and control your Android device
Fix "resize to fit" when all clicks are forwarded
Romain Vimont40493dff608c
diff --git a/app/src/input_manager.c b/app/src/input_manager.cindex 1e46b30e..f5f7992a 100644--- a/app/src/input_manager.c+++ b/app/src/input_manager.c@@ -720,49 +720,48 @@ sc_input_manager_process_mouse_button(struct sc_input_manager *im,bool control = im->controller;bool paused = im->screen->paused;bool down = event->type == SDL_MOUSEBUTTONDOWN;- if (!im->forward_all_clicks) {- if (control && !paused) {- enum sc_action action = down ? SC_ACTION_DOWN : SC_ACTION_UP;+ if (control && !paused && !im->forward_all_clicks) {+ enum sc_action action = down ? SC_ACTION_DOWN : SC_ACTION_UP;- if (im->kp && event->button == SDL_BUTTON_X1) {- action_app_switch(im, action);- return;- }- if (event->button == SDL_BUTTON_X2 && down) {- if (event->clicks < 2) {- expand_notification_panel(im);- } else {- expand_settings_panel(im);- }- return;- }- if (im->kp && event->button == SDL_BUTTON_RIGHT) {- press_back_or_turn_screen_on(im, action);- return;- }- if (im->kp && event->button == SDL_BUTTON_MIDDLE) {- action_home(im, action);- return;+ if (im->kp && event->button == SDL_BUTTON_X1) {+ action_app_switch(im, action);+ return;+ }+ if (event->button == SDL_BUTTON_X2 && down) {+ if (event->clicks < 2) {+ expand_notification_panel(im);+ } else {+ expand_settings_panel(im);}+ return;+ }+ if (im->kp && event->button == SDL_BUTTON_RIGHT) {+ press_back_or_turn_screen_on(im, action);+ return;}+ if (im->kp && event->button == SDL_BUTTON_MIDDLE) {+ action_home(im, action);+ return;+ }+ }- // double-click on black borders resize to fit the device screen- bool video = im->screen->video;- if (video && event->button == SDL_BUTTON_LEFT && event->clicks == 2) {- int32_t x = event->x;- int32_t y = event->y;- sc_screen_hidpi_scale_coords(im->screen, &x, &y);- SDL_Rect *r = &im->screen->rect;- bool outside = x < r->x || x >= r->x + r->w- || y < r->y || y >= r->y + r->h;- if (outside) {- if (down) {- sc_screen_resize_to_fit(im->screen);- }- return;+ // double-click on black borders resizes to fit the device screen+ bool video = im->screen->video;+ bool mouse_relative_mode = im->mp && im->mp->relative_mode;+ if (video && !mouse_relative_mode && event->button == SDL_BUTTON_LEFT+ && event->clicks == 2) {+ int32_t x = event->x;+ int32_t y = event->y;+ sc_screen_hidpi_scale_coords(im->screen, &x, &y);+ SDL_Rect *r = &im->screen->rect;+ bool outside = x < r->x || x >= r->x + r->w+ || y < r->y || y >= r->y + r->h;+ if (outside) {+ if (down) {+ sc_screen_resize_to_fit(im->screen);}+ return;}- // otherwise, send the click event to the device}if (!im->mp || paused) {