summaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorpasky <pasky@openttd.org>2005-03-26 04:16:39 +0000
committerpasky <pasky@openttd.org>2005-03-26 04:16:39 +0000
commitf89984642e98786bfb7daf6e7b787ec55251579a (patch)
tree67eb1caa2844dcdf5266ba40482051839518a165 /window.c
parentd4b3469e2f828043deab48b47d32691c3f2f283f (diff)
downloadopenttd-f89984642e98786bfb7daf6e7b787ec55251579a.tar.xz
(svn r2074) MouseLoop -> InputLoop(), factor out a real mouse-specific MouseLoop from the new InitLoop() (more in the spirit of HandleKeypress()).
Diffstat (limited to 'window.c')
-rw-r--r--window.c61
1 files changed, 34 insertions, 27 deletions
diff --git a/window.c b/window.c
index a1e4edcef..58bbf368d 100644
--- a/window.c
+++ b/window.c
@@ -1284,37 +1284,11 @@ static void HandleKeypress(uint32 key)
extern void UpdateTileSelection(void);
extern bool VpHandlePlaceSizingDrag(void);
-void MouseLoop(void)
+static void MouseLoop(int click, int mousewheel)
{
int x,y;
Window *w;
ViewPort *vp;
- int click;
- int mousewheel;
-
- _current_player = _local_player;
-
- // Handle pressed keys
- if (_pressed_key) {
- uint32 key = _pressed_key; _pressed_key = 0;
- HandleKeypress(key);
- }
-
- // Mouse event?
- click = 0;
- if (_left_button_down && !_left_button_clicked) {
- _left_button_clicked = true;
- click = 1;
- } else if (_right_button_clicked) {
- _right_button_clicked = false;
- click = 2;
- }
-
- mousewheel = 0;
- if (_cursor.wheel) {
- mousewheel = _cursor.wheel;
- _cursor.wheel = 0;
- }
DecreaseWindowCounters();
HandlePlacePresize();
@@ -1410,6 +1384,39 @@ void MouseLoop(void)
}
}
+void InputLoop(void)
+{
+ int click;
+ int mousewheel;
+
+ _current_player = _local_player;
+
+ // Handle pressed keys
+ if (_pressed_key) {
+ uint32 key = _pressed_key; _pressed_key = 0;
+ HandleKeypress(key);
+ }
+
+ // Mouse event?
+ click = 0;
+ if (_left_button_down && !_left_button_clicked) {
+ _left_button_clicked = true;
+ click = 1;
+ } else if (_right_button_clicked) {
+ _right_button_clicked = false;
+ click = 2;
+ }
+
+ mousewheel = 0;
+ if (_cursor.wheel) {
+ mousewheel = _cursor.wheel;
+ _cursor.wheel = 0;
+ }
+
+ MouseLoop(click, mousewheel);
+}
+
+
static int _we4_timer;
extern uint32 _pixels_redrawn;