Changes on viewport related files to deal with touchscreen options.
This commit is contained in:
@@ -2437,7 +2437,9 @@ static EventState HandleViewportScroll()
|
||||
* outside of the window and should not left-mouse scroll anymore. */
|
||||
if (_last_scroll_window == NULL) _last_scroll_window = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y);
|
||||
|
||||
if (_last_scroll_window == NULL || !(_right_button_down || scrollwheel_scrolling || (_settings_client.gui.left_mouse_btn_scrolling && _left_button_down))) {
|
||||
|
||||
if (_last_scroll_window == NULL || !(_right_button_down || scrollwheel_scrolling ||
|
||||
(_left_button_down && (_move_pressed || _settings_client.gui.left_mouse_btn_scrolling)))) {
|
||||
_cursor.fix_at = false;
|
||||
_scrolling_viewport = false;
|
||||
_last_scroll_window = NULL;
|
||||
@@ -2827,6 +2829,12 @@ static void MouseLoop(MouseClick click, int mousewheel)
|
||||
* But there is no company related window open anyway, so _current_company is not used. */
|
||||
assert(HasModalProgress() || IsLocalCompany());
|
||||
|
||||
int x = _cursor.pos.x;
|
||||
int y = _cursor.pos.y;
|
||||
Window *w = FindWindowFromPt(x, y);
|
||||
if (w == NULL) return;
|
||||
ViewPort *vp = IsPtInWindowViewport(w, x, y);
|
||||
|
||||
HandlePlacePresize();
|
||||
UpdateTileSelection();
|
||||
|
||||
@@ -2841,13 +2849,9 @@ static void MouseLoop(MouseClick click, int mousewheel)
|
||||
bool scrollwheel_scrolling = _settings_client.gui.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0);
|
||||
if (click == MC_NONE && mousewheel == 0 && !scrollwheel_scrolling) return;
|
||||
|
||||
int x = _cursor.pos.x;
|
||||
int y = _cursor.pos.y;
|
||||
Window *w = FindWindowFromPt(x, y);
|
||||
if (w == NULL) return;
|
||||
|
||||
if (click != MC_HOVER && !MaybeBringWindowToFront(w)) return;
|
||||
ViewPort *vp = IsPtInWindowViewport(w, x, y);
|
||||
if (click != MC_NONE && click != MC_HOVER && !MaybeBringWindowToFront(w)) return;
|
||||
|
||||
/* Don't allow any action in a viewport if either in menu or when having a modal progress window */
|
||||
if (vp != NULL && (_game_mode == GM_MENU || HasModalProgress())) return;
|
||||
@@ -2868,7 +2872,7 @@ static void MouseLoop(MouseClick click, int mousewheel)
|
||||
DEBUG(misc, 2, "Cursor: 0x%X (%d)", _cursor.sprite, _cursor.sprite);
|
||||
if (!HandleViewportClicked(vp, x, y) &&
|
||||
!(w->flags & WF_DISABLE_VP_SCROLL) &&
|
||||
_settings_client.gui.left_mouse_btn_scrolling) {
|
||||
(_settings_client.gui.left_mouse_btn_scrolling || _move_pressed)) {
|
||||
_scrolling_viewport = true;
|
||||
_cursor.fix_at = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user