Mercurial > sdl-ios-xcode
annotate src/video/win32/SDL_win32events.c @ 3773:3b5691f85c0d gsoc2008_manymouse
Further x11 code improvments + comments
author | Szymon Wilczek <kazeuser@gmail.com> |
---|---|
date | Mon, 04 Aug 2008 11:18:10 +0000 |
parents | 8cc36a399a12 |
children | 8b5b67000dc0 |
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> |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
35 #define PACKETDATA ( PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE) |
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 { |
3768 | 144 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
|
145 } |
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 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
148 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
|
149 { |
3771
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
150 /*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
|
151 int h_context=LOWORD(lParam); |
3770
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
152 LPPOINT point; |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
153 GetCursorPos(&point); |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
154 ScreenToClient(hwnd, &point); |
3771
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
155 /*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
|
156 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
|
157 { |
3770
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
158 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
|
159 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
160 else |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
161 { |
3770
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
162 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
|
163 } |
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 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
166 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
|
167 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
168 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
|
169 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
|
170 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 } else { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
172 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
|
173 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 } |
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 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
177 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
178 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
|
179 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
180 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
|
181 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
|
182 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
|
183 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
184 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
|
185 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
|
186 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
|
187 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
|
188 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
|
189 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
|
190 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
|
191 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
|
192 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
|
193 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
|
194 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
|
195 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
196 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
|
197 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
|
198 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
199 /* 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
|
200 } else { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
201 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
|
202 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
|
203 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
204 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
|
205 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
|
206 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
|
207 } |
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 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
|
210 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
211 break; |
3771
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
212 case WM_INPUT:/*mouse events*/ |
3768 | 213 { |
214 LPBYTE lpb; | |
215 int w, h; | |
216 const RAWINPUTHEADER *header; | |
217 int index; | |
218 int i; | |
219 int size=0; | |
220 const RAWMOUSE *raw_mouse=NULL; | |
221 LPPOINT point; | |
222 USHORT flags; | |
3771
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
223 |
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
224 /*we're collecting data from the mouse*/ |
3768 | 225 GetRawInputData((HRAWINPUT) lParam, RID_INPUT, NULL, &size, sizeof (RAWINPUTHEADER)); |
226 lpb = SDL_malloc(size*sizeof(LPBYTE)); | |
227 GetRawInputData((HRAWINPUT) lParam, RID_INPUT, lpb, &size, sizeof (RAWINPUTHEADER)); | |
228 raw = (RAWINPUT *) lpb; | |
229 header = &raw->header; | |
230 flags=raw->data.mouse.usButtonFlags; | |
3771
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
231 |
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
232 /*we're checking which mouse generated the event*/ |
3768 | 233 for(i=0;i<total_mice;++i) |
234 { | |
235 if(mice[i]==header->hDevice) | |
236 { | |
237 index=i; | |
238 break; | |
239 } | |
240 } | |
3771
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
241 |
3768 | 242 GetCursorPos(&point); |
243 ScreenToClient(hwnd, &point); | |
244 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
|
245 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
|
246 |
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
247 /*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
|
248 if(i==tablet) |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
249 { |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
250 SDL_SendMouseMotion(index,0,(int)(&point->x),(int)(&point->y),pressure); |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
251 } |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
252 else |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
253 { |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
254 SDL_SendMouseMotion(index,0,(int)(&point->x),(int)(&point->y),0); |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
255 } |
3771
8cc36a399a12
comments added and improved code look(windows part)
Szymon Wilczek <kazeuser@gmail.com>
parents:
3770
diff
changeset
|
256 /*we're sending mouse buttons messages to check up if sth changed*/ |
3768 | 257 if(flags & RI_MOUSE_BUTTON_1_DOWN) |
258 { | |
259 SDL_SendMouseButton(index,SDL_PRESSED,SDL_BUTTON_LEFT); | |
260 } | |
261 else if(flags & RI_MOUSE_BUTTON_1_UP) | |
262 { | |
263 SDL_SendMouseButton(index,SDL_RELEASED,SDL_BUTTON_LEFT); | |
264 } | |
265 if(flags & RI_MOUSE_BUTTON_2_DOWN) | |
266 { | |
267 SDL_SendMouseButton(index,SDL_PRESSED,SDL_BUTTON_MIDDLE); | |
268 } | |
269 else if(flags & RI_MOUSE_BUTTON_2_UP) | |
270 { | |
271 SDL_SendMouseButton(index,SDL_RELEASED,SDL_BUTTON_MIDDLE); | |
272 } | |
273 if(flags & RI_MOUSE_BUTTON_3_DOWN) | |
274 { | |
275 SDL_SendMouseButton(index,SDL_PRESSED,SDL_BUTTON_RIGHT); | |
276 } | |
277 else if(flags & RI_MOUSE_BUTTON_3_UP) | |
278 { | |
279 SDL_SendMouseButton(index,SDL_RELEASED,SDL_BUTTON_RIGHT); | |
280 } | |
3770
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
281 if(flags & RI_MOUSE_WHEEL) |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
282 { |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
283 if(raw->data.mouse.usButtonData!=0) |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
284 { |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
285 SDL_SendMouseWheel(index, 0, raw->data.mouse.usButtonData); |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
286 } |
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
287 } |
3768 | 288 } |
289 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
|
290 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
|
291 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
292 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
|
293 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
|
294 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
295 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
|
296 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
|
297 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
298 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
|
299 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
|
300 } |
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 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
|
303 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
|
304 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
|
305 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
306 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
|
307 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
308 /* 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
|
309 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
|
310 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
|
311 } |
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 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
|
314 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
|
315 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
|
316 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
|
317 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
|
318 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
|
319 else |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
320 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
|
321 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
322 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
|
323 /* 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
|
324 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
325 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
|
326 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
|
327 && (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
|
328 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
|
329 } 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
|
330 && (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
|
331 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
|
332 } else { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
333 /* 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
|
334 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
|
335 } |
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 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
338 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
|
339 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
|
340 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
|
341 else |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
342 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
|
343 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
344 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
|
345 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
|
346 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
|
347 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
348 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
349 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
|
350 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
|
351 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
|
352 } |
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 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
|
355 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
356 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
|
357 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
|
358 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
359 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
|
360 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
361 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
|
362 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
|
363 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
|
364 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
|
365 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
|
366 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
|
367 else |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
368 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
|
369 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
370 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
|
371 /* 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
|
372 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
373 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
|
374 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
|
375 && !(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
|
376 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
|
377 } 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
|
378 && !(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
|
379 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
|
380 } else { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
381 /* 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
|
382 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
|
383 } |
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 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
386 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
|
387 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
|
388 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
|
389 else |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
390 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
|
391 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
392 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
|
393 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
|
394 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
|
395 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
396 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
397 /* 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
|
398 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
|
399 && 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
|
400 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
|
401 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
|
402 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
|
403 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
404 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
|
405 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
|
406 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
|
407 } |
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 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
|
410 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
411 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
|
412 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
413 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
|
414 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
415 /* 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
|
416 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
|
417 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
|
418 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
|
419 } 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
|
420 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
|
421 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
|
422 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
|
423 } else { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
424 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
|
425 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
|
426 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
|
427 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
|
428 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
429 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
|
430 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
431 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
|
432 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
433 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
|
434 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
435 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
|
436 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
437 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
|
438 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
439 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
|
440 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
441 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
|
442 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
|
443 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
|
444 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
|
445 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
|
446 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
447 /* 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
|
448 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
|
449 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
|
450 } |
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 /* 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
|
453 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
|
454 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
|
455 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
|
456 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
457 /* 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
|
458 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
|
459 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
|
460 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
|
461 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
|
462 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
|
463 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
464 /* 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
|
465 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
|
466 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
|
467 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
|
468 */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
469 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
|
470 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
|
471 style, |
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 & 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
|
473 NULL); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
474 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
475 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
|
476 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
|
477 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
478 /* 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
|
479 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
|
480 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
|
481 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
|
482 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
|
483 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
|
484 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
|
485 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
|
486 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
|
487 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
|
488 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
489 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
|
490 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
491 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
|
492 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
493 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
|
494 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
|
495 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
|
496 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
|
497 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
498 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
|
499 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
|
500 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
|
501 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
502 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
|
503 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
|
504 (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
|
505 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
|
506 } |
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 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
|
509 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
|
510 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
|
511 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
512 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
|
513 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
|
514 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
|
515 h); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
516 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
517 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
518 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
519 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
|
520 { |
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 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
|
523 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
524 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
|
525 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
|
526 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
|
527 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
|
528 } |
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 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
532 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
533 /* 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
|
534 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
|
535 { |
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 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
|
538 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
|
539 */ |
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 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
542 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
543 /* 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
|
544 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
|
545 { |
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 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
|
548 */ |
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 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
551 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
552 /* 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
|
553 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
|
554 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
555 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
|
556 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
|
557 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
|
558 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
|
559 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
|
560 } |
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 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
|
563 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
564 /* 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
|
565 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
|
566 { |
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 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
|
569 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
570 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
|
571 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
572 /* 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
|
573 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
|
574 (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
|
575 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
|
576 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
|
577 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
|
578 } |
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 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
582 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
583 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
|
584 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
585 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
|
586 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
587 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
|
588 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
589 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
|
590 } |
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 void |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
593 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
|
594 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
595 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
|
596 |
3768 | 597 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
|
598 TranslateMessage(&msg); |
3768 | 599 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
|
600 |
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 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
|
605 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
|
606 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
|
607 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
|
608 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
609 /* 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
|
610 int |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
611 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
|
612 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
613 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
|
614 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
615 /* 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
|
616 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
|
617 ++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 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
|
619 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
620 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
|
621 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
|
622 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
|
623 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
|
624 } |
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 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
|
627 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
|
628 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
|
629 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
|
630 } |
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 /* 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
|
633 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
|
634 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
|
635 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
|
636 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
|
637 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
|
638 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
|
639 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
|
640 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
|
641 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
|
642 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
|
643 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
|
644 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
|
645 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
|
646 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
|
647 } |
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 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
|
650 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
|
651 } |
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 /* 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
|
654 void |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
655 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
|
656 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
657 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
|
658 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
659 /* 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
|
660 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
|
661 return; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
662 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
663 --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
|
664 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
|
665 /* 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
|
666 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
|
667 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
|
668 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
669 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
|
670 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
|
671 } |
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 /* 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
|
675 void |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
676 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
|
677 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
678 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
|
679 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
|
680 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
681 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
|
682 NULL, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
683 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
|
684 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
685 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
|
686 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
|
687 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
|
688 } |
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 /* vi: set ts=4 sw=4 expandtab: */ |
3770
81b649bad6d2
Implementation finished
Szymon Wilczek <kazeuser@gmail.com>
parents:
3768
diff
changeset
|
691 |