summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-10-13 09:16:20 +0000
committerfrosch <frosch@openttd.org>2012-10-13 09:16:20 +0000
commit72fc7710392ada9a19b705fda3c710c1da74c599 (patch)
treebf5a9e5de0a00190ecd79f59de58f417d49c0d28 /src/window.cpp
parent2abe4ac280dd0495bceee34cf94bab2c6d3d3230 (diff)
downloadopenttd-72fc7710392ada9a19b705fda3c710c1da74c599.tar.xz
(svn r24590) -Feature: More options for the auto-scroll setting. (adf88)
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 1abf143f2..072d4b5a4 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -34,6 +34,13 @@
#include "error.h"
#include "game/game.hpp"
+/** Values for _settings_client.gui.auto_scrolling */
+enum ViewportAutoscrolling {
+ VA_DISABLED, //!< Do not autoscroll when mouse is at edge of viewport.
+ VA_MAIN_VIEWPORT_FULLSCREEN, //!< Scroll main viewport at edge when using fullscreen.
+ VA_MAIN_VIEWPORT, //!< Scroll main viewport at edge.
+ VA_EVERY_VIEWPORT, //!< Scroll all viewports at their edges.
+};
static Point _drag_delta; ///< delta between mouse cursor and upper left corner of dragged window
static Window *_mouseover_last_w = NULL; ///< Window of the last #MOUSEOVER event.
@@ -2291,12 +2298,14 @@ static int _input_events_this_tick = 0;
static void HandleAutoscroll()
{
if (_game_mode == GM_MENU || HasModalProgress()) return;
- if (!_settings_client.gui.autoscroll) return;
+ if (_settings_client.gui.auto_scrolling == VA_DISABLED) return;
+ if (_settings_client.gui.auto_scrolling == VA_MAIN_VIEWPORT_FULLSCREEN && !_fullscreen) return;
int x = _cursor.pos.x;
int y = _cursor.pos.y;
Window *w = FindWindowFromPt(x, y);
if (w == NULL || w->flags & WF_DISABLE_VP_SCROLL) return;
+ if (_settings_client.gui.auto_scrolling != VA_EVERY_VIEWPORT && w->window_class != WC_MAIN_WINDOW) return;
ViewPort *vp = IsPtInWindowViewport(w, x, y);
if (vp == NULL) return;