summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/global_constants.cpp5
-rw-r--r--core/os/input_event.h2
-rw-r--r--platform/osx/os_osx.mm15
-rw-r--r--platform/windows/os_windows.cpp21
-rw-r--r--platform/windows/os_windows.h2
-rw-r--r--scene/gui/text_edit.cpp6
6 files changed, 47 insertions, 4 deletions
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
index 89d918fed9..c306744d35 100644
--- a/core/global_constants.cpp
+++ b/core/global_constants.cpp
@@ -317,16 +317,19 @@ static _GlobalConstant _global_constants[]={
BIND_GLOBAL_CONSTANT( KEY_MASK_KPAD ),
BIND_GLOBAL_CONSTANT( KEY_MASK_GROUP_SWITCH ),
- // joysticks
+ // mouse
BIND_GLOBAL_CONSTANT( BUTTON_LEFT ),
BIND_GLOBAL_CONSTANT( BUTTON_RIGHT ),
BIND_GLOBAL_CONSTANT( BUTTON_MIDDLE ),
BIND_GLOBAL_CONSTANT( BUTTON_WHEEL_UP ),
BIND_GLOBAL_CONSTANT( BUTTON_WHEEL_DOWN ),
+ BIND_GLOBAL_CONSTANT( BUTTON_WHEEL_LEFT ),
+ BIND_GLOBAL_CONSTANT( BUTTON_WHEEL_RIGHT ),
BIND_GLOBAL_CONSTANT( BUTTON_MASK_LEFT ),
BIND_GLOBAL_CONSTANT( BUTTON_MASK_RIGHT ),
BIND_GLOBAL_CONSTANT( BUTTON_MASK_MIDDLE ),
+ //joysticks
BIND_GLOBAL_CONSTANT( JOY_BUTTON_0 ),
BIND_GLOBAL_CONSTANT( JOY_BUTTON_1 ),
BIND_GLOBAL_CONSTANT( JOY_BUTTON_2 ),
diff --git a/core/os/input_event.h b/core/os/input_event.h
index b601adc875..36c1556524 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -51,6 +51,8 @@ enum {
BUTTON_MIDDLE=3,
BUTTON_WHEEL_UP=4,
BUTTON_WHEEL_DOWN=5,
+ BUTTON_WHEEL_LEFT=6,
+ BUTTON_WHEEL_RIGHT=7,
BUTTON_MASK_LEFT=(1<<(BUTTON_LEFT-1)),
BUTTON_MASK_RIGHT=(1<<(BUTTON_RIGHT-1)),
BUTTON_MASK_MIDDLE=(1<<(BUTTON_MIDDLE-1)),
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"
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 7f7c8c023c..bf012b7a03 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1197,6 +1197,12 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
if (mb.button_index==BUTTON_WHEEL_DOWN) {
v_scroll->set_val( v_scroll->get_val() +3 );
}
+ if (mb.button_index==BUTTON_WHEEL_LEFT) {
+ h_scroll->set_val( h_scroll->get_val() -3 );
+ }
+ if (mb.button_index==BUTTON_WHEEL_RIGHT) {
+ h_scroll->set_val( h_scroll->get_val() +3 );
+ }
if (mb.button_index==BUTTON_LEFT) {
int row,col;