summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorhondres <liu.gam3@gmail.com>2016-02-04 17:16:22 +0100
committerhondres <liu.gam3@gmail.com>2016-02-04 17:16:22 +0100
commitdf4faf8f334c5b1c71bfcec25fb64caf933b294b (patch)
treeb1444e53001ee0b7783525dc700d3466aa9b79e9 /platform
parentcefca4429c165134e1acc00bbd58bdcbc3f4f955 (diff)
support horizontal mouse wheel, use in text editor
Diffstat (limited to 'platform')
-rw-r--r--platform/osx/os_osx.mm15
-rw-r--r--platform/windows/os_windows.cpp21
-rw-r--r--platform/windows/os_windows.h2
3 files changed, 35 insertions, 3 deletions
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 2bb35fdc60..d808fb67a2 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -809,6 +809,21 @@ static int translateKey(unsigned int key)
OS_OSX::singleton->push_input(ev);
}
+ if (fabs(deltaX)) {
+
+ InputEvent ev;
+ ev.type=InputEvent::MOUSE_BUTTON;
+ ev.mouse_button.button_index=deltaX >0 ? BUTTON_WHEEL_RIGHT : BUTTON_WHEEL_LEFT;
+ ev.mouse_button.pressed=true;
+ ev.mouse_button.x=mouse_x;
+ ev.mouse_button.y=mouse_y;
+ ev.mouse_button.global_x=mouse_x;
+ ev.mouse_button.global_y=mouse_y;
+ ev.mouse_button.button_mask=button_mask;
+ OS_OSX::singleton->push_input(ev);
+ ev.mouse_button.pressed=false;
+ OS_OSX::singleton->push_input(ev);
+ }
}
@end
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 20f417ccc6..8a291a298b 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -66,6 +66,10 @@ extern "C" {
#endif
}
+#ifndef WM_MOUSEHWHEEL
+#define WM_MOUSEHWHEEL 0x020e
+#endif
+
//#define STDOUT_FILE
extern HINSTANCE godot_hinstance;
@@ -432,6 +436,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
case WM_MOUSEWHEEL:
+ case WM_MOUSEHWHEEL:
case WM_LBUTTONDBLCLK:
case WM_RBUTTONDBLCLK:
/*case WM_XBUTTONDOWN:
@@ -502,12 +507,24 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
if (motion>0)
- mb.button_index=4;
+ mb.button_index= BUTTON_WHEEL_UP;
else
- mb.button_index=5;
+ mb.button_index= BUTTON_WHEEL_DOWN;
} break;
+ case WM_MOUSEHWHEEL: {
+
+ mb.pressed = true;
+ int motion = (short)HIWORD(wParam);
+ if (!motion)
+ return 0;
+
+ if (motion<0)
+ mb.button_index = BUTTON_WHEEL_LEFT;
+ else
+ mb.button_index = BUTTON_WHEEL_RIGHT;
+ } break;
/*
case WM_XBUTTONDOWN: {
mb.pressed=true;
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index e433d5cc11..ab4acf312c 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -29,7 +29,7 @@
#ifndef OS_WINDOWS_H
#define OS_WINDOWS_H
-#define WINVER 0x0500
+#define WINVER 0x0600
#include "os/input.h"
#include "os/os.h"