Mercurial > sdl-ios-xcode
annotate src/video/win32/SDL_win32events.c @ 3774:8b5b67000dc0 gsoc2008_manymouse
Cursor support added
author | Szymon Wilczek <kazeuser@gmail.com> |
---|---|
date | Tue, 05 Aug 2008 14:10:11 +0000 |
parents | 8cc36a399a12 |
children |
rev | line source |
---|---|
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
1 /* |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
4 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
7 License as published by the Free Software Foundation; either |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
9 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
13 Lesser General Public License for more details. |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
14 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
18 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
19 Sam Lantinga |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
20 slouken@libsdl.org |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
21 */ |
3768 | 22 |
23 #if (_WIN32_WINNT < 0x0501) | |
24 #undef _WIN32_WINNT | |
25 #define _WIN32_WINNT 0x0501 | |
26 #endif | |
27 | |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
28 #include "SDL_config.h" |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
29 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
30 #include "SDL_win32video.h" |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
31 #include "SDL_syswm.h" |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
32 #include "SDL_vkeys.h" |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
33 #include "../../events/SDL_events_c.h" |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
34 #include <wintab.h> |
3774 | 35 #define PACKETDATA ( PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE | PK_CURSOR) |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
36 #define PACKETMODE 0 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
37 #include <pktdef.h> |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
38 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
39 /*#define WMMSG_DEBUG*/ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
40 #ifdef WMMSG_DEBUG |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
41 #include <stdio.h> |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
42 #include "wmmsg.h" |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
43 #endif |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
44 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
45 /* Masks for processing the windows KEYDOWN and KEYUP messages */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
46 #define REPEATED_KEYMASK (1<<30) |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
47 #define EXTENDED_KEYMASK (1<<24) |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
48 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
49 #define VK_ENTER 10 /* Keypad Enter ... no VKEY defined? */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
50 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
51 /* Make sure XBUTTON stuff is defined that isn't in older Platform SDKs... */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
52 #ifndef WM_XBUTTONDOWN |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
53 #define WM_XBUTTONDOWN 0x020B |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
54 #endif |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
55 #ifndef WM_XBUTTONUP |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
56 #define WM_XBUTTONUP 0x020C |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
57 #endif |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
58 #ifndef GET_XBUTTON_WPARAM |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
59 #define GET_XBUTTON_WPARAM(w) (HIWORD(w)) |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
60 #endif |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
61 |
3768 | 62 extern HCTX* g_hCtx; |
63 extern HANDLE* mice; | |
64 extern int total_mice; | |
3770
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
65 extern int tablet; |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
66 |
3771
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
67 int pressure=0;/*the pressure reported by the tablet*/ |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
68 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
69 static WPARAM |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
70 RemapVKEY(WPARAM wParam, LPARAM lParam) |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
71 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
72 int i; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
73 BYTE scancode = (BYTE) ((lParam >> 16) & 0xFF); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
74 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
75 /* Windows remaps alphabetic keys based on current layout. |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
76 We try to provide USB scancodes, so undo this mapping. |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
77 */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
78 if (wParam >= 'A' && wParam <= 'Z') { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
79 if (scancode != alpha_scancodes[wParam - 'A']) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
80 for (i = 0; i < SDL_arraysize(alpha_scancodes); ++i) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
81 if (scancode == alpha_scancodes[i]) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
82 wParam = 'A' + i; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
83 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
84 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
85 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
86 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
87 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
88 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
89 /* Keypad keys are a little trickier, we always scan for them. */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
90 for (i = 0; i < SDL_arraysize(keypad_scancodes); ++i) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
91 if (scancode == keypad_scancodes[i]) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
92 wParam = VK_NUMPAD0 + i; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
93 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
94 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
95 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
96 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
97 return wParam; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
98 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
99 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
100 LRESULT CALLBACK |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
101 WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
102 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
103 SDL_WindowData *data; |
3768 | 104 RAWINPUT* raw; |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
105 PACKET packet; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
106 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
107 /* Send a SDL_SYSWMEVENT if the application wants them */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
108 if (SDL_ProcessEvents[SDL_SYSWMEVENT] == SDL_ENABLE) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
109 SDL_SysWMmsg wmmsg; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
110 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
111 SDL_VERSION(&wmmsg.version); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
112 wmmsg.hwnd = hwnd; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
113 wmmsg.msg = msg; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
114 wmmsg.wParam = wParam; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
115 wmmsg.lParam = lParam; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
116 SDL_SendSysWMEvent(&wmmsg); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
117 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
118 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
119 /* Get the window data for the window */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
120 data = (SDL_WindowData *) GetProp(hwnd, TEXT("SDL_WindowData")); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
121 if (!data) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
122 return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
123 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
124 #ifdef WMMSG_DEBUG |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
125 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
126 FILE *log = fopen("wmmsg.txt", "a"); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
127 fprintf(log, "Received windows message: %p ", hwnd); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
128 if (msg > MAX_WMMSG) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
129 fprintf(log, "%d", msg); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
130 } else { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
131 fprintf(log, "%s", wmtab[msg]); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
132 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
133 fprintf(log, " -- 0x%X, 0x%X\n", wParam, lParam); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
134 fclose(log); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
135 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
136 #endif |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
137 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
138 switch (msg) { |
3768 | 139 case WT_PACKET: |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
140 { |
3771
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
141 /*if we receive such data we need to update the pressure*/ |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
142 if (WTPacket((HCTX)lParam, wParam, &packet)) |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
143 { |
3774 | 144 SDL_ChangeEnd(tablet, (int)packet.pkCursor); |
3768 | 145 pressure=(int)packet.pkNormalPressure; |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
146 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
147 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
148 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
149 case WT_PROXIMITY: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
150 { |
3771
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
151 /*checking where the proximity message showed up*/ |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
152 int h_context=LOWORD(lParam); |
3770
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
153 LPPOINT point; |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
154 GetCursorPos(&point); |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
155 ScreenToClient(hwnd, &point); |
3771
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
156 /*are we in proximity or out of proximity*/ |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
157 if(h_context==0) |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
158 { |
3770
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
159 SDL_SendProximity(tablet, (int)(&point->x),(int)(&point->y), SDL_PROXIMITYOUT); |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
160 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
161 else |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
162 { |
3770
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
163 SDL_SendProximity(tablet, (int)(&point->x),(int)(&point->y), SDL_PROXIMITYIN); |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
164 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
165 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
166 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
167 case WM_SHOWWINDOW: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
168 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
169 if (wParam) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
170 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_SHOWN, 0, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
171 0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
172 } else { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
173 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_HIDDEN, 0, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
174 0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
175 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
176 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
177 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
178 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
179 case WM_ACTIVATE: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
180 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
181 int index; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
182 SDL_Keyboard *keyboard; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
183 BOOL minimized; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
184 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
185 minimized = HIWORD(wParam); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
186 index = data->videodata->keyboard; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
187 keyboard = SDL_GetKeyboard(index); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
188 if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
189 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_SHOWN, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
190 0, 0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
191 SDL_SendWindowEvent(data->windowID, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
192 SDL_WINDOWEVENT_RESTORED, 0, 0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
193 if (IsZoomed(hwnd)) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
194 SDL_SendWindowEvent(data->windowID, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
195 SDL_WINDOWEVENT_MAXIMIZED, 0, 0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
196 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
197 if (keyboard && keyboard->focus != data->windowID) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
198 SDL_SetKeyboardFocus(index, data->windowID); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
199 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
200 /* FIXME: Update keyboard state */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
201 } else { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
202 if (keyboard && keyboard->focus == data->windowID) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
203 SDL_SetKeyboardFocus(index, 0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
204 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
205 if (minimized) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
206 SDL_SendWindowEvent(data->windowID, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
207 SDL_WINDOWEVENT_MINIMIZED, 0, 0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
208 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
209 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
210 return (0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
211 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
212 break; |
3771
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
213 case WM_INPUT:/*mouse events*/ |
3768 | 214 { |
215 LPBYTE lpb; | |
216 int w, h; | |
217 const RAWINPUTHEADER *header; | |
218 int index; | |
219 int i; | |
220 int size=0; | |
221 const RAWMOUSE *raw_mouse=NULL; | |
222 LPPOINT point; | |
223 USHORT flags; | |
3771
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
224 |
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
225 /*we're collecting data from the mouse*/ |
3768 | 226 GetRawInputData((HRAWINPUT) lParam, RID_INPUT, NULL, &size, sizeof (RAWINPUTHEADER)); |
227 lpb = SDL_malloc(size*sizeof(LPBYTE)); | |
228 GetRawInputData((HRAWINPUT) lParam, RID_INPUT, lpb, &size, sizeof (RAWINPUTHEADER)); | |
229 raw = (RAWINPUT *) lpb; | |
230 header = &raw->header; | |
231 flags=raw->data.mouse.usButtonFlags; | |
3771
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
232 |
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
233 /*we're checking which mouse generated the event*/ |
3768 | 234 for(i=0;i<total_mice;++i) |
235 { | |
236 if(mice[i]==header->hDevice) | |
237 { | |
238 index=i; | |
239 break; | |
240 } | |
241 } | |
3771
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
242 |
3768 | 243 GetCursorPos(&point); |
244 ScreenToClient(hwnd, &point); | |
245 SDL_GetWindowSize(data->windowID, &w, &h); | |
3771
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
246 SDL_UpdateCoordinates(w,h);/*we're updating the current window size*/ |
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
247 |
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
248 /*if the message was sent by a tablet we have to send also pressure*/ |
3770
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
249 if(i==tablet) |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
250 { |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
251 SDL_SendMouseMotion(index,0,(int)(&point->x),(int)(&point->y),pressure); |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
252 } |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
253 else |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
254 { |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
255 SDL_SendMouseMotion(index,0,(int)(&point->x),(int)(&point->y),0); |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
256 } |
3771
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
257 /*we're sending mouse buttons messages to check up if sth changed*/ |
3768 | 258 if(flags & RI_MOUSE_BUTTON_1_DOWN) |
259 { | |
260 SDL_SendMouseButton(index,SDL_PRESSED,SDL_BUTTON_LEFT); | |
261 } | |
262 else if(flags & RI_MOUSE_BUTTON_1_UP) | |
263 { | |
264 SDL_SendMouseButton(index,SDL_RELEASED,SDL_BUTTON_LEFT); | |
265 } | |
266 if(flags & RI_MOUSE_BUTTON_2_DOWN) | |
267 { | |
268 SDL_SendMouseButton(index,SDL_PRESSED,SDL_BUTTON_MIDDLE); | |
269 } | |
270 else if(flags & RI_MOUSE_BUTTON_2_UP) | |
271 { | |
272 SDL_SendMouseButton(index,SDL_RELEASED,SDL_BUTTON_MIDDLE); | |
273 } | |
274 if(flags & RI_MOUSE_BUTTON_3_DOWN) | |
275 { | |
276 SDL_SendMouseButton(index,SDL_PRESSED,SDL_BUTTON_RIGHT); | |
277 } | |
278 else if(flags & RI_MOUSE_BUTTON_3_UP) | |
279 { | |
280 SDL_SendMouseButton(index,SDL_RELEASED,SDL_BUTTON_RIGHT); | |
281 } | |
3770
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
282 if(flags & RI_MOUSE_WHEEL) |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
283 { |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
284 if(raw->data.mouse.usButtonData!=0) |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
285 { |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
286 SDL_SendMouseWheel(index, 0, raw->data.mouse.usButtonData); |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
287 } |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
288 } |
3768 | 289 } |
290 return(0); | |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
291 case WM_MOUSELEAVE: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
292 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
293 int index; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
294 SDL_Mouse *mouse; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
295 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
296 index = data->videodata->mouse; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
297 mouse = SDL_GetMouse(index); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
298 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
299 if (mouse->focus == data->windowID) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
300 SDL_SetMouseFocus(index, 0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
301 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
302 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
303 return (0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
304 case WM_SYSKEYDOWN: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
305 case WM_KEYDOWN: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
306 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
307 int index; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
308 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
309 /* Ignore repeated keys */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
310 if (lParam & REPEATED_KEYMASK) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
311 return (0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
312 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
313 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
314 index = data->videodata->keyboard; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
315 wParam = RemapVKEY(wParam, lParam); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
316 switch (wParam) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
317 case VK_CONTROL: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
318 if (lParam & EXTENDED_KEYMASK) |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
319 wParam = VK_RCONTROL; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
320 else |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
321 wParam = VK_LCONTROL; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
322 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
323 case VK_SHIFT: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
324 /* EXTENDED trick doesn't work here */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
325 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
326 Uint8 *state = SDL_GetKeyboardState(NULL); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
327 if (state[SDL_SCANCODE_LSHIFT] == SDL_RELEASED |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
328 && (GetKeyState(VK_LSHIFT) & 0x8000)) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
329 wParam = VK_LSHIFT; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
330 } else if (state[SDL_SCANCODE_RSHIFT] == SDL_RELEASED |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
331 && (GetKeyState(VK_RSHIFT) & 0x8000)) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
332 wParam = VK_RSHIFT; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
333 } else { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
334 /* Probably a key repeat */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
335 return (0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
336 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
337 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
338 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
339 case VK_MENU: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
340 if (lParam & EXTENDED_KEYMASK) |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
341 wParam = VK_RMENU; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
342 else |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
343 wParam = VK_LMENU; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
344 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
345 case VK_RETURN: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
346 if (lParam & EXTENDED_KEYMASK) |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
347 wParam = VK_ENTER; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
348 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
349 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
350 if (wParam < 256) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
351 SDL_SendKeyboardKey(index, SDL_PRESSED, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
352 data->videodata->key_layout[wParam]); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
353 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
354 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
355 return (0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
356 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
357 case WM_SYSKEYUP: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
358 case WM_KEYUP: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
359 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
360 int index; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
361 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
362 index = data->videodata->keyboard; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
363 wParam = RemapVKEY(wParam, lParam); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
364 switch (wParam) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
365 case VK_CONTROL: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
366 if (lParam & EXTENDED_KEYMASK) |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
367 wParam = VK_RCONTROL; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
368 else |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
369 wParam = VK_LCONTROL; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
370 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
371 case VK_SHIFT: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
372 /* EXTENDED trick doesn't work here */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
373 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
374 Uint8 *state = SDL_GetKeyboardState(NULL); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
375 if (state[SDL_SCANCODE_LSHIFT] == SDL_PRESSED |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
376 && !(GetKeyState(VK_LSHIFT) & 0x8000)) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
377 wParam = VK_LSHIFT; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
378 } else if (state[SDL_SCANCODE_RSHIFT] == SDL_PRESSED |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
379 && !(GetKeyState(VK_RSHIFT) & 0x8000)) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
380 wParam = VK_RSHIFT; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
381 } else { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
382 /* Probably a key repeat */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
383 return (0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
384 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
385 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
386 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
387 case VK_MENU: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
388 if (lParam & EXTENDED_KEYMASK) |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
389 wParam = VK_RMENU; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
390 else |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
391 wParam = VK_LMENU; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
392 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
393 case VK_RETURN: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
394 if (lParam & EXTENDED_KEYMASK) |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
395 wParam = VK_ENTER; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
396 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
397 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
398 /* Windows only reports keyup for print screen */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
399 if (wParam == VK_SNAPSHOT |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
400 && SDL_GetKeyboardState(NULL)[SDL_SCANCODE_PRINTSCREEN] == |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
401 SDL_RELEASED) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
402 SDL_SendKeyboardKey(index, SDL_PRESSED, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
403 data->videodata->key_layout[wParam]); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
404 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
405 if (wParam < 256) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
406 SDL_SendKeyboardKey(index, SDL_RELEASED, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
407 data->videodata->key_layout[wParam]); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
408 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
409 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
410 return (0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
411 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
412 case WM_CHAR: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
413 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
414 char text[4]; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
415 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
416 /* Convert to UTF-8 and send it on... */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
417 if (wParam <= 0x7F) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
418 text[0] = (char) wParam; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
419 text[1] = '\0'; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
420 } else if (wParam <= 0x7FF) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
421 text[0] = 0xC0 | (char) ((wParam >> 6) & 0x1F); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
422 text[1] = 0x80 | (char) (wParam & 0x3F); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
423 text[2] = '\0'; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
424 } else { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
425 text[0] = 0xE0 | (char) ((wParam >> 12) & 0x0F); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
426 text[1] = 0x80 | (char) ((wParam >> 6) & 0x3F); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
427 text[2] = 0x80 | (char) (wParam & 0x3F); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
428 text[3] = '\0'; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
429 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
430 SDL_SendKeyboardText(data->videodata->keyboard, text); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
431 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
432 return (0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
433 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
434 case WM_INPUTLANGCHANGE: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
435 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
436 WIN_UpdateKeymap(data->videodata->keyboard); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
437 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
438 return (1); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
439 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
440 case WM_GETMINMAXINFO: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
441 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
442 MINMAXINFO *info; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
443 RECT size; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
444 int x, y; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
445 int w, h; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
446 int style; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
447 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
448 /* If we allow resizing, let the resize happen naturally */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
449 if (SDL_GetWindowFlags(data->windowID) & SDL_WINDOW_RESIZABLE) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
450 return (0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
451 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
452 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
453 /* Get the current position of our window */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
454 GetWindowRect(hwnd, &size); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
455 x = size.left; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
456 y = size.top; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
457 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
458 /* Calculate current size of our window */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
459 SDL_GetWindowSize(data->windowID, &w, &h); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
460 size.top = 0; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
461 size.left = 0; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
462 size.bottom = h; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
463 size.right = w; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
464 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
465 /* DJM - according to the docs for GetMenu(), the |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
466 return value is undefined if hwnd is a child window. |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
467 Aparently it's too difficult for MS to check |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
468 inside their function, so I have to do it here. |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
469 */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
470 style = GetWindowLong(hwnd, GWL_STYLE); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
471 AdjustWindowRect(&size, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
472 style, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
473 style & WS_CHILDWINDOW ? FALSE : GetMenu(hwnd) != |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
474 NULL); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
475 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
476 w = size.right - size.left; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
477 h = size.bottom - size.top; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
478 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
479 /* Fix our size to the current size */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
480 info = (MINMAXINFO *) lParam; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
481 info->ptMaxSize.x = w; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
482 info->ptMaxSize.y = h; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
483 info->ptMaxPosition.x = x; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
484 info->ptMaxPosition.y = y; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
485 info->ptMinTrackSize.x = w; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
486 info->ptMinTrackSize.y = h; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
487 info->ptMaxTrackSize.x = w; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
488 info->ptMaxTrackSize.y = h; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
489 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
490 return (0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
491 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
492 case WM_WINDOWPOSCHANGED: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
493 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
494 RECT rect; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
495 int x, y; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
496 int w, h; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
497 Uint32 window_flags; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
498 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
499 GetClientRect(hwnd, &rect); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
500 ClientToScreen(hwnd, (LPPOINT) & rect); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
501 ClientToScreen(hwnd, (LPPOINT) & rect + 1); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
502 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
503 window_flags = SDL_GetWindowFlags(data->windowID); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
504 if ((window_flags & SDL_WINDOW_INPUT_GRABBED) && |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
505 (window_flags & SDL_WINDOW_INPUT_FOCUS)) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
506 ClipCursor(&rect); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
507 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
508 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
509 x = rect.left; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
510 y = rect.top; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
511 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_MOVED, x, y); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
512 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
513 w = rect.right - rect.left; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
514 h = rect.bottom - rect.top; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
515 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_RESIZED, w, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
516 h); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
517 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
518 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
519 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
520 case WM_SETCURSOR: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
521 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
522 /* |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
523 Uint16 hittest; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
524 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
525 hittest = LOWORD(lParam); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
526 if (hittest == HTCLIENT) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
527 SetCursor(SDL_hcursor); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
528 return (TRUE); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
529 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
530 */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
531 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
532 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
533 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
534 /* We are about to get palette focus! */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
535 case WM_QUERYNEWPALETTE: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
536 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
537 /* |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
538 WIN_RealizePalette(current_video); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
539 return (TRUE); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
540 */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
541 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
542 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
543 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
544 /* Another application changed the palette */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
545 case WM_PALETTECHANGED: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
546 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
547 /* |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
548 WIN_PaletteChanged(current_video, (HWND) wParam); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
549 */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
550 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
551 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
552 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
553 /* We were occluded, refresh our display */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
554 case WM_PAINT: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
555 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
556 RECT rect; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
557 if (GetUpdateRect(hwnd, &rect, FALSE)) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
558 ValidateRect(hwnd, &rect); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
559 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_EXPOSED, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
560 0, 0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
561 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
562 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
563 return (0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
564 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
565 /* We'll do our own drawing, prevent flicker */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
566 case WM_ERASEBKGND: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
567 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
568 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
569 return (1); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
570 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
571 case WM_SYSCOMMAND: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
572 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
573 /* Don't start the screensaver or blank the monitor in fullscreen apps */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
574 if ((wParam & 0xFFF0) == SC_SCREENSAVE || |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
575 (wParam & 0xFFF0) == SC_MONITORPOWER) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
576 if (SDL_GetWindowFlags(data->windowID) & |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
577 SDL_WINDOW_FULLSCREEN) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
578 return (0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
579 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
580 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
581 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
582 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
583 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
584 case WM_CLOSE: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
585 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
586 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_CLOSE, 0, 0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
587 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
588 return (0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
589 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
590 return CallWindowProc(data->wndproc, hwnd, msg, wParam, lParam); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
591 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
592 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
593 void |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
594 WIN_PumpEvents(_THIS) |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
595 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
596 MSG msg; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
597 |
3768 | 598 while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) { |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
599 TranslateMessage(&msg); |
3768 | 600 DispatchMessageA(&msg); |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
601 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
602 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
603 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
604 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
605 static int app_registered = 0; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
606 LPTSTR SDL_Appname = NULL; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
607 Uint32 SDL_Appstyle = 0; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
608 HINSTANCE SDL_Instance = NULL; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
609 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
610 /* Register the class for this application */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
611 int |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
612 SDL_RegisterApp(char *name, Uint32 style, void *hInst) |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
613 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
614 WNDCLASS class; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
615 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
616 /* Only do this once... */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
617 if (app_registered) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
618 ++app_registered; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
619 return (0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
620 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
621 if (!name && !SDL_Appname) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
622 name = "SDL_app"; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
623 SDL_Appstyle = (CS_BYTEALIGNCLIENT | CS_OWNDC); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
624 SDL_Instance = hInst ? hInst : GetModuleHandle(NULL); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
625 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
626 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
627 if (name) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
628 SDL_Appname = WIN_UTF8ToString(name); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
629 SDL_Appstyle = style; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
630 SDL_Instance = hInst ? hInst : GetModuleHandle(NULL); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
631 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
632 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
633 /* Register the application class */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
634 class.hCursor = NULL; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
635 class.hIcon = LoadImage(SDL_Instance, SDL_Appname, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
636 IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
637 class.lpszMenuName = NULL; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
638 class.lpszClassName = SDL_Appname; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
639 class.hbrBackground = NULL; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
640 class.hInstance = SDL_Instance; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
641 class.style = SDL_Appstyle; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
642 class.lpfnWndProc = DefWindowProc; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
643 class.cbWndExtra = 0; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
644 class.cbClsExtra = 0; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
645 if (!RegisterClass(&class)) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
646 SDL_SetError("Couldn't register application class"); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
647 return (-1); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
648 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
649 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
650 app_registered = 1; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
651 return (0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
652 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
653 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
654 /* Unregisters the windowclass registered in SDL_RegisterApp above. */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
655 void |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
656 SDL_UnregisterApp() |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
657 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
658 WNDCLASS class; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
659 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
660 /* SDL_RegisterApp might not have been called before */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
661 if (!app_registered) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
662 return; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
663 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
664 --app_registered; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
665 if (app_registered == 0) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
666 /* Check for any registered window classes. */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
667 if (GetClassInfo(SDL_Instance, SDL_Appname, &class)) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
668 UnregisterClass(SDL_Appname, SDL_Instance); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
669 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
670 SDL_free(SDL_Appname); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
671 SDL_Appname = NULL; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
672 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
673 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
674 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
675 /* Sets an error message based on GetLastError() */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
676 void |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
677 WIN_SetError(const char *prefix) |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
678 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
679 TCHAR buffer[1024]; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
680 char *message; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
681 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
682 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
683 NULL, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
684 GetLastError(), 0, buffer, SDL_arraysize(buffer), NULL); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
685 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
686 message = WIN_StringToUTF8(buffer); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
687 SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ":" : "", message); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
688 SDL_free(message); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
689 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
690 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
691 /* vi: set ts=4 sw=4 expandtab: */ |
3770
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
692 |