Mercurial > sdl-ios-xcode
annotate src/video/win32/SDL_win32events.c @ 3768:1b87a8beab9d gsoc2008_manymouse
Project part1
author | Szymon Wilczek <kazeuser@gmail.com> |
---|---|
date | Wed, 30 Jul 2008 16:09:24 +0000 |
parents | abc8acb8e3d7 |
children | 81b649bad6d2 |
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; | |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
65 |
3768 | 66 int pressure=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
|
67 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
68 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
|
69 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
|
70 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
71 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
|
72 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
|
73 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
74 /* 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
|
75 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
|
76 */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
77 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
|
78 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
|
79 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
|
80 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
|
81 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
|
82 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
83 } |
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 /* 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
|
89 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
|
90 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
|
91 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
|
92 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
93 } |
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 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
|
97 } |
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 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
|
100 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
|
101 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
102 SDL_WindowData *data; |
3768 | 103 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
|
104 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
|
105 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
106 /* 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
|
107 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
|
108 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
|
109 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
110 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
|
111 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
|
112 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
|
113 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
|
114 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
|
115 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
|
116 } |
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 /* 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
|
119 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
|
120 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
|
121 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
|
122 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
123 #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
|
124 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
125 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
|
126 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
|
127 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
|
128 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
|
129 } else { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
130 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
|
131 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
132 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
|
133 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
|
134 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
135 #endif |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
136 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
137 switch (msg) { |
3768 | 138 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
|
139 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
140 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
|
141 { |
3768 | 142 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
|
143 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
144 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
145 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
146 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
|
147 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
148 int h_context=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
|
149 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
|
150 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
151 SDL_SendProximity(0, 0, 0, SDL_PROXIMITYOUT); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
152 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
153 else |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
154 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
155 SDL_SendProximity(0, 0, 0, SDL_PROXIMITYIN); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
156 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
157 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
158 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
159 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
|
160 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
161 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
|
162 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
|
163 0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
164 } else { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
165 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
|
166 0); |
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 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
169 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
170 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
171 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
|
172 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
173 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
|
174 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
|
175 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
|
176 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
177 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
|
178 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
|
179 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
|
180 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
|
181 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
|
182 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
|
183 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
|
184 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
|
185 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
|
186 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
|
187 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
|
188 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
189 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
|
190 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
|
191 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
192 /* 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
|
193 } else { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
194 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
|
195 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
|
196 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
197 if (minimized) { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
198 SDL_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
|
199 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
|
200 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
201 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
202 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
|
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 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
205 case WT_CTXOPEN: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
206 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
207 SDL_SendMouseMotion(0,1,1,0,0); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
208 SDL_SendMouseMotion(0,1,-1,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
|
209 } |
3768 | 210 /*case WM_MOUSEMOVE: |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
211 { |
3768 | 212 LPBYTE lpb; |
213 const RAWINPUTHEADER *header; | |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
214 int index; |
3768 | 215 int i; |
216 int size=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
|
217 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
|
218 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
|
219 |
3768 | 220 //index = data->videodata->mouse; |
221 GetRawInputData((HRAWINPUT) lParam, RID_INPUT, NULL, &size, sizeof (RAWINPUTHEADER)); | |
222 lpb = SDL_malloc(size*sizeof(LPBYTE)); | |
223 GetRawInputData((HRAWINPUT) lParam, RID_INPUT, lpb, &size, sizeof (RAWINPUTHEADER)); | |
224 raw = (RAWINPUT *) lpb; | |
225 header = &raw->header; | |
226 for(i=0;i<total_mice;++i) | |
227 { | |
228 if(mice[i]==header->hDevice) | |
229 { | |
230 index=i; | |
231 break; | |
232 } | |
233 } | |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
234 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
|
235 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
236 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
|
237 TRACKMOUSEEVENT tme; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
238 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
239 tme.cbSize = sizeof(tme); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
240 tme.dwFlags = TME_LEAVE; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
241 tme.hwndTrack = hwnd; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
242 TrackMouseEvent(&tme); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
243 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
244 SDL_SetMouseFocus(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
|
245 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
246 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
247 /* mouse has moved within the window */ |
3768 | 248 //x = LOWORD(lParam); |
249 //y = HIWORD(lParam); | |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
250 //printf("index: %d\n",index); |
3768 | 251 /*if (WTPacketsPeek(g_hCtx[data->windowID],1,&packet)) |
252 { | |
253 pressure=(int)packet.pkNormalPressure; | |
254 }*/ | |
255 /*if (mouse->relative_mode) { | |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
256 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
|
257 POINT center; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
258 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
|
259 center.x = (w / 2); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
260 center.y = (h / 2); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
261 x -= center.x; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
262 y -= center.y; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
263 if (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
|
264 ClientToScreen(hwnd, ¢er); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
265 SetCursorPos(center.x, center.y); |
3768 | 266 SDL_SendMouseMotion(index, 1, x, y,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
|
267 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
268 } else { |
3768 | 269 SDL_SendMouseMotion(index, 0, x, y,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
|
270 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
271 } |
3768 | 272 return (0);*/ |
273 case WM_INPUT: | |
274 { | |
275 LPBYTE lpb; | |
276 int w, h; | |
277 const RAWINPUTHEADER *header; | |
278 int index; | |
279 int i; | |
280 int size=0; | |
281 SDL_Mouse *mouse; | |
282 const RAWMOUSE *raw_mouse=NULL; | |
283 LPPOINT point; | |
284 USHORT flags; | |
285 GetRawInputData((HRAWINPUT) lParam, RID_INPUT, NULL, &size, sizeof (RAWINPUTHEADER)); | |
286 lpb = SDL_malloc(size*sizeof(LPBYTE)); | |
287 GetRawInputData((HRAWINPUT) lParam, RID_INPUT, lpb, &size, sizeof (RAWINPUTHEADER)); | |
288 raw = (RAWINPUT *) lpb; | |
289 header = &raw->header; | |
290 //raw_mouse=&raw->data.mouse; | |
291 flags=raw->data.mouse.usButtonFlags; | |
292 for(i=0;i<total_mice;++i) | |
293 { | |
294 if(mice[i]==header->hDevice) | |
295 { | |
296 index=i; | |
297 break; | |
298 } | |
299 } | |
300 mouse = SDL_GetMouse(index); | |
301 GetCursorPos(&point); | |
302 ScreenToClient(hwnd, &point); | |
303 SDL_GetWindowSize(data->windowID, &w, &h); | |
304 SDL_UpdateCoordinates(w,h); | |
305 SDL_SendMouseMotion(index,0,(int)(&point->x),(int)(&point->y),pressure); | |
306 if(flags & RI_MOUSE_BUTTON_1_DOWN) | |
307 { | |
308 SDL_SendMouseButton(index,SDL_PRESSED,SDL_BUTTON_LEFT); | |
309 } | |
310 else if(flags & RI_MOUSE_BUTTON_1_UP) | |
311 { | |
312 SDL_SendMouseButton(index,SDL_RELEASED,SDL_BUTTON_LEFT); | |
313 } | |
314 if(flags & RI_MOUSE_BUTTON_2_DOWN) | |
315 { | |
316 SDL_SendMouseButton(index,SDL_PRESSED,SDL_BUTTON_MIDDLE); | |
317 } | |
318 else if(flags & RI_MOUSE_BUTTON_2_UP) | |
319 { | |
320 SDL_SendMouseButton(index,SDL_RELEASED,SDL_BUTTON_MIDDLE); | |
321 } | |
322 if(flags & RI_MOUSE_BUTTON_3_DOWN) | |
323 { | |
324 SDL_SendMouseButton(index,SDL_PRESSED,SDL_BUTTON_RIGHT); | |
325 } | |
326 else if(flags & RI_MOUSE_BUTTON_3_UP) | |
327 { | |
328 SDL_SendMouseButton(index,SDL_RELEASED,SDL_BUTTON_RIGHT); | |
329 } | |
330 } | |
331 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
|
332 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
|
333 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
334 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
|
335 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
|
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 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
|
338 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
|
339 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
340 if (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
|
341 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
|
342 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
343 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
344 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
|
345 |
3768 | 346 |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
347 |
3768 | 348 /* case WM_MOUSEWHEEL: |
3767
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
349 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
350 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
|
351 int motion = (short) 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
|
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 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
|
354 SDL_SendMouseWheel(index, 0, motion); |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
355 } |
3768 | 356 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
|
357 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
358 case WM_SYSKEYDOWN: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
359 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
|
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 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
|
362 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
363 /* 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
|
364 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
|
365 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
|
366 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
367 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
368 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
|
369 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
|
370 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
|
371 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
|
372 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
|
373 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
|
374 else |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
375 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
|
376 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
377 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
|
378 /* 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
|
379 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
380 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
|
381 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
|
382 && (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
|
383 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
|
384 } 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
|
385 && (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
|
386 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
|
387 } else { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
388 /* 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
|
389 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
|
390 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
391 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
392 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
393 case VK_MENU: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
394 if (lParam & EXTENDED_KEYMASK) |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
395 wParam = VK_RMENU; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
396 else |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
397 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
|
398 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
399 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
|
400 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
|
401 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
|
402 break; |
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_PRESSED, |
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_SYSKEYUP: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
412 case WM_KEYUP: |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
413 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
414 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
|
415 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
416 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
|
417 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
|
418 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
|
419 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
|
420 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
|
421 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
|
422 else |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
423 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
|
424 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
425 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
|
426 /* 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
|
427 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
428 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
|
429 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
|
430 && !(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
|
431 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
|
432 } 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
|
433 && !(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
|
434 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
|
435 } else { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
436 /* 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
|
437 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
|
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 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
440 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
441 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
|
442 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
|
443 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
|
444 else |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
445 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
|
446 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
447 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
|
448 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
|
449 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
|
450 break; |
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 /* 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
|
453 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
|
454 && 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
|
455 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
|
456 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
|
457 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
|
458 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
459 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
|
460 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
|
461 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
|
462 } |
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 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
|
465 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
466 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
|
467 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
468 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
|
469 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
470 /* 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
|
471 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
|
472 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
|
473 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
|
474 } 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
|
475 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
|
476 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
|
477 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
|
478 } else { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
479 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
|
480 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
|
481 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
|
482 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
|
483 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
484 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
|
485 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
486 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
|
487 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
488 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
|
489 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
490 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
|
491 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
492 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
|
493 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
494 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
|
495 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
496 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
|
497 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
|
498 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
|
499 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
|
500 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
|
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 /* 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
|
503 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
|
504 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
|
505 } |
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 /* 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
|
508 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
|
509 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
|
510 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
|
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 /* 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
|
513 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
|
514 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
|
515 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
|
516 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
|
517 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
|
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 /* 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
|
520 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
|
521 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
|
522 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
|
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 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
|
525 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
|
526 style, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
527 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
|
528 NULL); |
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 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
|
531 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
|
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 /* 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
|
534 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
|
535 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
|
536 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
|
537 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
|
538 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
|
539 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
|
540 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
|
541 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
|
542 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
|
543 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
544 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
|
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 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
|
547 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
548 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
|
549 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
|
550 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
|
551 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
|
552 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
553 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
|
554 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
|
555 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
|
556 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
557 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
|
558 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
|
559 (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
|
560 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
|
561 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
562 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
563 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
|
564 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
|
565 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
|
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 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
|
568 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
|
569 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
|
570 h); |
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 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
573 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
574 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
|
575 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
576 /* |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
577 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
|
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 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
|
580 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
|
581 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
|
582 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
|
583 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
584 */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
585 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
586 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
587 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
588 /* 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
|
589 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
|
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 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
|
593 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
|
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 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
596 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
597 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
598 /* 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
|
599 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
|
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 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
|
603 */ |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
604 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
605 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
606 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
607 /* 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
|
608 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
|
609 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
610 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
|
611 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
|
612 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
|
613 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
|
614 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
|
615 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
616 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
617 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
|
618 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
619 /* 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
|
620 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
|
621 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
622 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
623 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
|
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 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
|
626 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
627 /* 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
|
628 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
|
629 (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
|
630 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
|
631 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
|
632 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
|
633 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
634 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
635 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
636 break; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
637 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
638 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
|
639 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
640 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
|
641 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
642 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
|
643 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
644 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
|
645 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
646 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
647 void |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
648 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
|
649 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
650 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
|
651 |
3768 | 652 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
|
653 TranslateMessage(&msg); |
3768 | 654 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
|
655 |
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 } |
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 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
|
660 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
|
661 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
|
662 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
|
663 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
664 /* 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
|
665 int |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
666 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
|
667 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
668 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
|
669 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
670 /* 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
|
671 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
|
672 ++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
|
673 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
|
674 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
675 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
|
676 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
|
677 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
|
678 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
|
679 } |
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 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
|
682 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
|
683 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
|
684 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
|
685 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
686 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
687 /* 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
|
688 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
|
689 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
|
690 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
|
691 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
|
692 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
|
693 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
|
694 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
|
695 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
|
696 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
|
697 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
|
698 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
|
699 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
|
700 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
|
701 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
|
702 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
703 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
704 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
|
705 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
|
706 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
707 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
708 /* 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
|
709 void |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
710 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
|
711 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
712 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
|
713 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
714 /* 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
|
715 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
|
716 return; |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
717 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
718 --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
|
719 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
|
720 /* 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
|
721 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
|
722 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
|
723 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
724 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
|
725 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
|
726 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
727 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
728 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
729 /* 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
|
730 void |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
731 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
|
732 { |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
733 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
|
734 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
|
735 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
736 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
|
737 NULL, |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
738 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
|
739 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
740 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
|
741 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
|
742 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
|
743 } |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
744 |
abc8acb8e3d7
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents:
2324
diff
changeset
|
745 /* vi: set ts=4 sw=4 expandtab: */ |