diff options
Diffstat (limited to 'platform/windows')
| -rw-r--r-- | platform/windows/detect.py | 5 | ||||
| -rw-r--r-- | platform/windows/os_windows.cpp | 102 | ||||
| -rw-r--r-- | platform/windows/os_windows.h | 4 |
3 files changed, 94 insertions, 17 deletions
diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 0e21540e13..3277884165 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -51,8 +51,8 @@ def get_flags(): return [
('freetype','builtin'), #use builtin freetype
- ('openssl','builtin'), #use builtin openssl
- ]
+ ('openssl','builtin'), #use builtin openssl
+ ]
@@ -166,6 +166,7 @@ def configure(env): env.Append(CCFLAGS=['-O3','-ffast-math','-fomit-frame-pointer','-msse2'])
env['OBJSUFFIX'] = "_opt"+env['OBJSUFFIX']
env['LIBSUFFIX'] = "_opt"+env['LIBSUFFIX']
+ env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])
elif (env["target"]=="release_debug"):
env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 778609950e..5e57827c68 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -206,6 +206,54 @@ bool OS_Windows::can_draw() const { return !minimized; }; +#define MI_WP_SIGNATURE 0xFF515700 +#define SIGNATURE_MASK 0xFFFFFF00 +#define IsPenEvent(dw) (((dw) & SIGNATURE_MASK) == MI_WP_SIGNATURE) + + +void OS_Windows::_touch_event(int idx, UINT uMsg, WPARAM wParam, LPARAM lParam) { + + InputEvent event; + event.type = InputEvent::SCREEN_TOUCH; + event.ID=++last_id; + event.screen_touch.index = idx; + + switch (uMsg) { + case WM_LBUTTONDOWN: + case WM_MBUTTONDOWN: + case WM_RBUTTONDOWN: { + + event.screen_touch.pressed = true; + } break; + + case WM_LBUTTONUP: + case WM_MBUTTONUP: + case WM_RBUTTONUP: { + event.screen_touch.pressed = false; + } break; + }; + + event.screen_touch.x=GET_X_LPARAM(lParam); + event.screen_touch.y=GET_Y_LPARAM(lParam); + + if (main_loop) { + input->parse_input_event(event); + } +}; + +void OS_Windows::_drag_event(int idx,UINT uMsg, WPARAM wParam, LPARAM lParam) { + + InputEvent event; + event.type = InputEvent::SCREEN_DRAG; + event.ID=++last_id; + event.screen_drag.index = idx; + + event.screen_drag.x=GET_X_LPARAM(lParam); + event.screen_drag.y=GET_Y_LPARAM(lParam); + + if (main_loop) + input->parse_input_event(event); +}; LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -270,28 +318,41 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) { } case WM_MOUSELEAVE: { - old_invalid=true; - outside=true; + old_invalid=true; + outside=true; } break; case WM_MOUSEMOVE: { - if (outside) { + if (outside) { + + CursorShape c=cursor_shape; + cursor_shape=CURSOR_MAX; + set_cursor_shape(c); + outside=false; - CursorShape c=cursor_shape; - cursor_shape=CURSOR_MAX; - set_cursor_shape(c); - outside=false; + //Once-Off notification, must call again.... + TRACKMOUSEEVENT tme; + tme.cbSize=sizeof(TRACKMOUSEEVENT); + tme.dwFlags=TME_LEAVE; + tme.hwndTrack=hWnd; + tme.dwHoverTime=HOVER_DEFAULT; + TrackMouseEvent(&tme); + + } + + LPARAM extra = GetMessageExtraInfo(); + if (IsPenEvent(extra)) { + + int idx = extra & 0x7f; + _drag_event(idx, uMsg, wParam, lParam); + if (idx != 0) { + return 0; + }; + // fallthrough for mouse event + }; - //Once-Off notification, must call again.... - TRACKMOUSEEVENT tme; - tme.cbSize=sizeof(TRACKMOUSEEVENT); - tme.dwFlags=TME_LEAVE; - tme.hwndTrack=hWnd; - tme.dwHoverTime=HOVER_DEFAULT; - TrackMouseEvent(&tme); - } InputEvent event; event.type=InputEvent::MOUSE_MOTION; event.ID=++last_id; @@ -360,6 +421,17 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) { /*case WM_XBUTTONDOWN: case WM_XBUTTONUP: */{ + LPARAM extra = GetMessageExtraInfo(); + if (IsPenEvent(extra)) { + + int idx = extra & 0x7f; + _touch_event(idx, uMsg, wParam, lParam); + if (idx != 0) { + return 0; + }; + // fallthrough for mouse event + }; + InputEvent event; event.type=InputEvent::MOUSE_BUTTON; event.ID=++last_id; diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index c9eb475e1a..1a41b9d77d 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -160,6 +160,10 @@ class OS_Windows : public OS { void _post_dpad(DWORD p_dpad, int p_device, bool p_pressed); + void _drag_event(int idx,UINT uMsg, WPARAM wParam, LPARAM lParam); + void _touch_event(int idx, UINT uMsg, WPARAM wParam, LPARAM lParam); + + // functions used by main to initialize/deintialize the OS protected: virtual int get_video_driver_count() const; |