annotate src/video/win32/SDL_win32window.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: 1956
diff changeset
1 /*
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
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: 1956
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: 1956
diff changeset
4
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
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: 1956
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: 1956
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: 1956
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: 1956
diff changeset
9
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
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: 1956
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: 1956
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: 1956
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: 1956
diff changeset
14
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
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: 1956
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: 1956
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: 1956
diff changeset
18
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
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: 1956
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: 1956
diff changeset
21 */
3768
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
22
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
23 #if (_WIN32_WINNT < 0x0501)
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
24 #undef _WIN32_WINNT
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
25 #define _WIN32_WINNT 0x0501
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
26 #endif
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
27
3767
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
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: 1956
diff changeset
29
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
30 #include "../SDL_sysvideo.h"
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
31 #include "../../events/SDL_keyboard_c.h"
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
32
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
33 #include "SDL_win32video.h"
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
34
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
35 /* This is included after SDL_win32video.h, which includes windows.h */
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
36 #include "SDL_syswm.h"
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
37
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
38 #include <wintab.h>
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
39 #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: 1956
diff changeset
40 #define PACKETMODE 0
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
41 #include <pktdef.h>
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
42
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
43 extern HCTX* g_hCtx;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
44
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
45 int highestId=0;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
46
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
47 static int
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
48 SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
49 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
50 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
51 SDL_WindowData *data;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
52
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
53 /* Allocate the window data */
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
54 data = (SDL_WindowData *) SDL_malloc(sizeof(*data));
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
55 if (!data) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
56 SDL_OutOfMemory();
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
57 return -1;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
58 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
59 data->windowID = window->id;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
60 data->hwnd = hwnd;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
61 data->hdc = GetDC(hwnd);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
62 data->created = created;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
63 data->mouse_pressed = SDL_FALSE;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
64 data->videodata = videodata;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
65
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
66 /* Associate the data with the window */
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
67 if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
68 ReleaseDC(hwnd, data->hdc);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
69 SDL_free(data);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
70 WIN_SetError("SetProp() failed");
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
71 return -1;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
72 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
73
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
74 /* Set up the window proc function */
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
75 data->wndproc = (WNDPROC) GetWindowLongPtr(hwnd, GWLP_WNDPROC);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
76 if (data->wndproc == NULL) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
77 data->wndproc = DefWindowProc;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
78 } else {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
79 SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) WIN_WindowProc);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
80 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
81
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
82 /* Fill in the SDL window with the window data */
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
83 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
84 POINT point;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
85 point.x = 0;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
86 point.y = 0;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
87 if (ClientToScreen(hwnd, &point)) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
88 window->x = point.x;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
89 window->y = point.y;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
90 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
91 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
92 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
93 RECT rect;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
94 if (GetClientRect(hwnd, &rect)) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
95 window->w = rect.right;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
96 window->h = rect.bottom;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
97 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
98 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
99 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
100 DWORD 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: 1956
diff changeset
101 if (style & WS_VISIBLE) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
102 window->flags |= SDL_WINDOW_SHOWN;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
103 } else {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
104 window->flags &= ~SDL_WINDOW_SHOWN;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
105 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
106 if (style & (WS_BORDER | WS_THICKFRAME)) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
107 window->flags &= ~SDL_WINDOW_BORDERLESS;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
108 } else {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
109 window->flags |= SDL_WINDOW_BORDERLESS;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
110 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
111 if (style & WS_THICKFRAME) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
112 window->flags |= SDL_WINDOW_RESIZABLE;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
113 } else {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
114 window->flags &= ~SDL_WINDOW_RESIZABLE;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
115 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
116 if (style & WS_MAXIMIZE) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
117 window->flags |= SDL_WINDOW_MAXIMIZED;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
118 } else {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
119 window->flags &= ~SDL_WINDOW_MAXIMIZED;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
120 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
121 if (style & WS_MINIMIZE) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
122 window->flags |= SDL_WINDOW_MINIMIZED;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
123 } else {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
124 window->flags &= ~SDL_WINDOW_MINIMIZED;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
125 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
126 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
127 if (GetFocus() == hwnd) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
128 int index = data->videodata->keyboard;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
129 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: 1956
diff changeset
130 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: 1956
diff changeset
131
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
132 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: 1956
diff changeset
133 RECT rect;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
134 GetClientRect(hwnd, &rect);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
135 ClientToScreen(hwnd, (LPPOINT) & rect);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
136 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: 1956
diff changeset
137 ClipCursor(&rect);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
138 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
139 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
140
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
141 /* All done! */
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
142 window->driverdata = data;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
143 return 0;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
144 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
145
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
146 int
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
147 WIN_CreateWindow(_THIS, SDL_Window * window)
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
148 {
3768
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
149 RAWINPUTDEVICE Rid;
3767
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
150 AXIS TabX,TabY;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
151 LOGCONTEXT lc;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
152 HWND hwnd;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
153 HWND top;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
154 RECT rect;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
155 DWORD style = (WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
156 int x, y;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
157 int w, h;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
158
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
159 if (window->flags & SDL_WINDOW_BORDERLESS) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
160 style |= WS_POPUP;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
161 } else {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
162 style |= (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
163 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
164 if (window->flags & SDL_WINDOW_RESIZABLE) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
165 style |= (WS_THICKFRAME | WS_MAXIMIZEBOX);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
166 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
167
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
168 /* Figure out what the window area will be */
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
169 if (window->flags & SDL_WINDOW_FULLSCREEN) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
170 top = HWND_TOPMOST;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
171 } else {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
172 top = HWND_NOTOPMOST;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
173 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
174 rect.left = 0;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
175 rect.top = 0;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
176 rect.right = window->w;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
177 rect.bottom = window->h;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
178 AdjustWindowRectEx(&rect, style, FALSE, 0);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
179 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: 1956
diff changeset
180 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: 1956
diff changeset
181
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
182 if (window->x == SDL_WINDOWPOS_CENTERED) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
183 x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
184 } else if (window->x == SDL_WINDOWPOS_UNDEFINED) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
185 x = CW_USEDEFAULT;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
186 } else {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
187 x = window->x + rect.left;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
188 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
189 if (window->y == SDL_WINDOWPOS_CENTERED) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
190 y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
191 } else if (window->y == SDL_WINDOWPOS_UNDEFINED) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
192 y = CW_USEDEFAULT;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
193 } else {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
194 y = window->y + rect.top;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
195 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
196
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
197 hwnd =
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
198 CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, NULL, NULL,
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
199 SDL_Instance, NULL);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
200
3768
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
201 WTInfo(WTI_DEFSYSCTX, 0, &lc);
3767
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
202 lc.lcPktData = PACKETDATA;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
203 lc.lcPktMode = PACKETMODE;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
204 lc.lcOptions |= CXO_MESSAGES;
3768
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
205 lc.lcOptions |= CXO_SYSTEM;
3767
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
206 lc.lcMoveMask = PACKETDATA;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
207 lc.lcBtnDnMask=lc.lcBtnUpMask = PACKETDATA;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
208
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
209 WTInfo(WTI_DEVICES,DVC_X,&TabX);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
210 WTInfo(WTI_DEVICES,DVC_Y,&TabY);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
211
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
212 lc.lcInOrgX = 0;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
213 lc.lcInOrgY = 0;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
214
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
215 lc.lcInExtX = TabX.axMax;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
216 lc.lcInExtY = TabY.axMax;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
217
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
218 lc.lcOutOrgX = 0;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
219 lc.lcOutOrgY = 0;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
220
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
221 lc.lcOutExtX = GetSystemMetrics(SM_CXSCREEN);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
222 lc.lcOutExtY = -GetSystemMetrics(SM_CYSCREEN);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
223 if(window->id>highestId)
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
224 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
225 HCTX* tmp_hctx;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
226 highestId=window->id;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
227 tmp_hctx= (HCTX*)SDL_realloc(g_hCtx,(highestId+1)*sizeof(HCTX));
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
228 if (!tmp_hctx) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
229 SDL_OutOfMemory();
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
230 return -1;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
231 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
232 g_hCtx=tmp_hctx;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
233 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
234
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
235 g_hCtx[window->id] = WTOpen(hwnd, &lc, TRUE);
3768
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
236
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
237 Rid.usUsagePage = 0x01;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
238 Rid.usUsage = 0x02;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
239 //Rid.usUsage = MOUSE_MOVE_ABSOLUTE;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
240 Rid.dwFlags = RIDEV_INPUTSINK; // adds HID mouse and also ignores legacy mouse messages
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
241 Rid.hwndTarget = hwnd;
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
242
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
243 RegisterRawInputDevices(&Rid, 1, sizeof(Rid));
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
244
1b87a8beab9d Project part1
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
245
3767
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
246 WIN_PumpEvents(_this);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
247
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
248 if (!hwnd) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
249 WIN_SetError("Couldn't create window");
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
250 return -1;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
251 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
252
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
253 if (SetupWindowData(_this, window, hwnd, SDL_TRUE) < 0) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
254 DestroyWindow(hwnd);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
255 return -1;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
256 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
257 #ifdef SDL_VIDEO_OPENGL_WGL
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
258 if (window->flags & SDL_WINDOW_OPENGL) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
259 if (WIN_GL_SetupWindow(_this, window) < 0) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
260 WIN_DestroyWindow(_this, window);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
261 return -1;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
262 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
263 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
264 #endif
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
265 return 0;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
266 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
267
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
268 int
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
269 WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
270 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
271 HWND hwnd = (HWND) data;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
272 LPTSTR title;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
273 int titleLen;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
274
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
275 /* Query the title from the existing window */
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
276 titleLen = GetWindowTextLength(hwnd);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
277 title = SDL_stack_alloc(TCHAR, titleLen + 1);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
278 if (title) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
279 titleLen = GetWindowText(hwnd, title, titleLen);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
280 } else {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
281 titleLen = 0;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
282 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
283 if (titleLen > 0) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
284 window->title = WIN_StringToUTF8(title);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
285 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
286 if (title) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
287 SDL_stack_free(title);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
288 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
289
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
290 if (SetupWindowData(_this, window, hwnd, SDL_FALSE) < 0) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
291 return -1;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
292 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
293 return 0;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
294 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
295
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
296 void
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
297 WIN_SetWindowTitle(_THIS, SDL_Window * window)
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
298 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
299 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
300 LPTSTR title;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
301
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
302 if (window->title) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
303 title = WIN_UTF8ToString(window->title);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
304 } else {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
305 title = NULL;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
306 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
307 SetWindowText(hwnd, title ? title : TEXT(""));
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
308 if (title) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
309 SDL_free(title);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
310 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
311 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
312
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
313 void
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
314 WIN_SetWindowPosition(_THIS, SDL_Window * window)
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
315 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
316 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
317 RECT rect;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
318 DWORD style;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
319 HWND top;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
320 int x, y;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
321
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
322 /* Figure out what the window area will be */
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
323 if (window->flags & SDL_WINDOW_FULLSCREEN) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
324 top = HWND_TOPMOST;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
325 } else {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
326 top = HWND_NOTOPMOST;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
327 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
328 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: 1956
diff changeset
329 rect.left = 0;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
330 rect.top = 0;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
331 rect.right = window->w;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
332 rect.bottom = window->h;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
333 AdjustWindowRectEx(&rect, style,
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
334 (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: 1956
diff changeset
335 NULL), 0);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
336 x = window->x + rect.left;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
337 y = window->y + rect.top;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
338
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
339 SetWindowPos(hwnd, top, x, y, 0, 0, (SWP_NOCOPYBITS | SWP_NOSIZE));
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
340 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
341
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
342 void
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
343 WIN_SetWindowSize(_THIS, SDL_Window * window)
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
344 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
345 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
346 RECT rect;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
347 DWORD style;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
348 HWND top;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
349 int w, h;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
350
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
351 /* Figure out what the window area will be */
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
352 if (window->flags & SDL_WINDOW_FULLSCREEN) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
353 top = HWND_TOPMOST;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
354 } else {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
355 top = HWND_NOTOPMOST;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
356 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
357 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: 1956
diff changeset
358 rect.left = 0;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
359 rect.top = 0;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
360 rect.right = window->w;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
361 rect.bottom = window->h;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
362 AdjustWindowRectEx(&rect, style,
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
363 (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: 1956
diff changeset
364 NULL), 0);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
365 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: 1956
diff changeset
366 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: 1956
diff changeset
367
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
368 SetWindowPos(hwnd, top, 0, 0, h, w, (SWP_NOCOPYBITS | SWP_NOMOVE));
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
369 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
370
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
371 void
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
372 WIN_ShowWindow(_THIS, SDL_Window * window)
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
373 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
374 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
375
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
376 ShowWindow(hwnd, SW_SHOW);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
377 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
378
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
379 void
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
380 WIN_HideWindow(_THIS, SDL_Window * window)
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
381 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
382 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
383
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
384 ShowWindow(hwnd, SW_HIDE);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
385 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
386
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
387 void
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
388 WIN_RaiseWindow(_THIS, SDL_Window * window)
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
389 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
390 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
391 HWND top;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
392
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
393 if (window->flags & SDL_WINDOW_FULLSCREEN) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
394 top = HWND_TOPMOST;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
395 } else {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
396 top = HWND_NOTOPMOST;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
397 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
398 SetWindowPos(hwnd, top, 0, 0, 0, 0, (SWP_NOMOVE | SWP_NOSIZE));
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
399 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
400
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
401 void
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
402 WIN_MaximizeWindow(_THIS, SDL_Window * window)
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
403 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
404 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
405
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
406 ShowWindow(hwnd, SW_MAXIMIZE);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
407 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
408
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
409 void
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
410 WIN_MinimizeWindow(_THIS, SDL_Window * window)
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
411 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
412 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
413
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
414 ShowWindow(hwnd, SW_MINIMIZE);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
415 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
416
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
417 void
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
418 WIN_RestoreWindow(_THIS, SDL_Window * window)
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
419 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
420 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
421
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
422 ShowWindow(hwnd, SW_RESTORE);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
423 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
424
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
425 void
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
426 WIN_SetWindowGrab(_THIS, SDL_Window * window)
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
427 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
428 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
429
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
430 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: 1956
diff changeset
431 (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: 1956
diff changeset
432 RECT rect;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
433 GetClientRect(hwnd, &rect);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
434 ClientToScreen(hwnd, (LPPOINT) & rect);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
435 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: 1956
diff changeset
436 ClipCursor(&rect);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
437 } else {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
438 ClipCursor(NULL);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
439 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
440 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
441
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
442 void
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
443 WIN_DestroyWindow(_THIS, SDL_Window * window)
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
444 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
445 SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
446
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
447 if (data) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
448 #ifdef SDL_VIDEO_OPENGL_WGL
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
449 if (window->flags & SDL_WINDOW_OPENGL) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
450 WIN_GL_CleanupWindow(_this, window);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
451 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
452 #endif
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
453 ReleaseDC(data->hwnd, data->hdc);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
454 if (data->created) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
455 WTClose(g_hCtx[window->id]);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
456 DestroyWindow(data->hwnd);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
457 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
458 SDL_free(data);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
459 WTClose(g_hCtx[window->id]);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
460 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
461 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
462
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
463 SDL_bool
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
464 WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
465 {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
466 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
467 if (info->version.major <= SDL_MAJOR_VERSION) {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
468 info->window = hwnd;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
469 return SDL_TRUE;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
470 } else {
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
471 SDL_SetError("Application not compiled with SDL %d.%d\n",
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
472 SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
473 return SDL_FALSE;
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
474 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
475 }
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
476
abc8acb8e3d7 Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
Szymon Wilczek <kazeuser@gmail.com>
parents: 1956
diff changeset
477 /* vi: set ts=4 sw=4 expandtab: */