annotate src/video/wincommon/SDL_sysevents.c @ 946:8520712f8ef0

*** empty log message ***
author Sam Lantinga <slouken@libsdl.org>
date Sat, 21 Aug 2004 14:54:49 +0000
parents 31fa08b36380
children d31afac94eff
rev   line source
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
1 /*
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
3 Copyright (C) 1997, 1998, 1999 Sam Lantinga
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
9
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
13 Library General Public License for more details.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
14
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
16 License along with this library; if not, write to the Free
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
18
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
19 Sam Lantinga
252
e8157fcb3114 Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents: 179
diff changeset
20 slouken@libsdl.org
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
21 */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
22
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
23 #ifdef SAVE_RCSID
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
24 static char rcsid =
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
25 "@(#) $Id$";
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
26 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
27
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
28 #include <stdlib.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
29 #include <stdio.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
30 #include <windows.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
31
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
32 #include "SDL_getenv.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
33 #include "SDL_events.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
34 #include "SDL_video.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
35 #include "SDL_error.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
36 #include "SDL_syswm.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
37 #include "SDL_sysevents.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
38 #include "SDL_events_c.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
39 #include "SDL_sysvideo.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
40 #include "SDL_lowvideo.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
41 #include "SDL_syswm_c.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
42 #include "SDL_main.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
43
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
44 #ifdef WMMSG_DEBUG
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
45 #include "wmmsg.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
46 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
47
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
48 #ifdef _WIN32_WCE
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
49 #define NO_GETKEYBOARDSTATE
453
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
50 #define NO_CHANGEDISPLAYSETTINGS
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
51 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
52
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
53 /* The window we use for everything... */
453
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
54 #ifdef _WIN32_WCE
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
55 LPWSTR SDL_Appname = NULL;
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
56 #else
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
57 LPSTR SDL_Appname = NULL;
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
58 #endif
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
59 HINSTANCE SDL_Instance = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
60 HWND SDL_Window = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
61 RECT SDL_bounds = {0, 0, 0, 0};
833
31fa08b36380 Added support for SDL_VIDEO_WINDOW_POS and SDL_VIDEO_CENTERED on Windows
Sam Lantinga <slouken@libsdl.org>
parents: 829
diff changeset
62 int SDL_windowX = 0;
31fa08b36380 Added support for SDL_VIDEO_WINDOW_POS and SDL_VIDEO_CENTERED on Windows
Sam Lantinga <slouken@libsdl.org>
parents: 829
diff changeset
63 int SDL_windowY = 0;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
64 int SDL_resizing = 0;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
65 int mouse_relative = 0;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
66 int posted = 0;
304
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
67 #ifndef NO_CHANGEDISPLAYSETTINGS
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
68 DEVMODE SDL_fullscreen_mode;
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
69 #endif
338
518ffd98a8f6 Fixed gamma ramps in DirectX windowed and OpenGL modes
Sam Lantinga <slouken@libsdl.org>
parents: 335
diff changeset
70 WORD *gamma_saved = NULL;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
71
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
72
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
73 /* Functions called by the message processing function */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
74 LONG
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
75 (*HandleMessage)(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)=NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
76 void (*WIN_RealizePalette)(_THIS);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
77 void (*WIN_PaletteChanged)(_THIS, HWND window);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
78 void (*WIN_WinPAINT)(_THIS, HDC hdc);
338
518ffd98a8f6 Fixed gamma ramps in DirectX windowed and OpenGL modes
Sam Lantinga <slouken@libsdl.org>
parents: 335
diff changeset
79 extern void DIB_SwapGamma(_THIS);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
80
304
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
81 static void SDL_RestoreGameMode(void)
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
82 {
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
83 #ifndef NO_CHANGEDISPLAYSETTINGS
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
84 ShowWindow(SDL_Window, SW_RESTORE);
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
85 ChangeDisplaySettings(&SDL_fullscreen_mode, CDS_FULLSCREEN);
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
86 #endif
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
87 }
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
88 static void SDL_RestoreDesktopMode(void)
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
89 {
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
90 #ifndef NO_CHANGEDISPLAYSETTINGS
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
91 ShowWindow(SDL_Window, SW_MINIMIZE);
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
92 ChangeDisplaySettings(NULL, 0);
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
93 #endif
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
94 }
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
95
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
96 #ifdef WM_MOUSELEAVE
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
97 /*
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
98 Special code to handle mouse leave events - this sucks...
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
99 http://support.microsoft.com/support/kb/articles/q183/1/07.asp
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
100
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
101 TrackMouseEvent() is only available on Win98 and WinNT.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
102 _TrackMouseEvent() is available on Win95, but isn't yet in the mingw32
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
103 development environment, and only works on systems that have had IE 3.0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
104 or newer installed on them (which is not the case with the base Win95).
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
105 Therefore, we implement our own version of _TrackMouseEvent() which
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
106 uses our own implementation if TrackMouseEvent() is not available.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
107 */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
108 static BOOL (WINAPI *_TrackMouseEvent)(TRACKMOUSEEVENT *ptme) = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
109
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
110 static VOID CALLBACK
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
111 TrackMouseTimerProc(HWND hWnd, UINT uMsg, UINT idEvent, DWORD dwTime)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
112 {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
113 RECT rect;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
114 POINT pt;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
115
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
116 GetClientRect(hWnd, &rect);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
117 MapWindowPoints(hWnd, NULL, (LPPOINT)&rect, 2);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
118 GetCursorPos(&pt);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
119 if ( !PtInRect(&rect, pt) || (WindowFromPoint(pt) != hWnd) ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
120 if ( !KillTimer(hWnd, idEvent) ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
121 /* Error killing the timer! */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
122 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
123 PostMessage(hWnd, WM_MOUSELEAVE, 0, 0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
124 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
125 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
126 static BOOL WINAPI WIN_TrackMouseEvent(TRACKMOUSEEVENT *ptme)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
127 {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
128 if ( ptme->dwFlags == TME_LEAVE ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
129 return SetTimer(ptme->hwndTrack, ptme->dwFlags, 100,
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
130 (TIMERPROC)TrackMouseTimerProc);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
131 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
132 return FALSE;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
133 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
134 #endif /* WM_MOUSELEAVE */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
135
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
136 /* Function to retrieve the current keyboard modifiers */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
137 static void WIN_GetKeyboardState(void)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
138 {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
139 #ifndef NO_GETKEYBOARDSTATE
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
140 SDLMod state;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
141 BYTE keyboard[256];
327
13fc64213765 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 304
diff changeset
142 Uint8 *kstate = SDL_GetKeyState(NULL);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
143
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
144 state = KMOD_NONE;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
145 if ( GetKeyboardState(keyboard) ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
146 if ( keyboard[VK_LSHIFT] & 0x80) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
147 state |= KMOD_LSHIFT;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
148 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
149 if ( keyboard[VK_RSHIFT] & 0x80) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
150 state |= KMOD_RSHIFT;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
151 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
152 if ( keyboard[VK_LCONTROL] & 0x80) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
153 state |= KMOD_LCTRL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
154 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
155 if ( keyboard[VK_RCONTROL] & 0x80) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
156 state |= KMOD_RCTRL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
157 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
158 if ( keyboard[VK_LMENU] & 0x80) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
159 state |= KMOD_LALT;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
160 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
161 if ( keyboard[VK_RMENU] & 0x80) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
162 state |= KMOD_RALT;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
163 }
1
cf2af46e9e2a Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
164 if ( keyboard[VK_NUMLOCK] & 0x01) {
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
165 state |= KMOD_NUM;
327
13fc64213765 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 304
diff changeset
166 kstate[SDLK_NUMLOCK] = SDL_PRESSED;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
167 }
1
cf2af46e9e2a Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
168 if ( keyboard[VK_CAPITAL] & 0x01) {
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
169 state |= KMOD_CAPS;
327
13fc64213765 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 304
diff changeset
170 kstate[SDLK_CAPSLOCK] = SDL_PRESSED;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
171 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
172 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
173 SDL_SetModState(state);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
174 #endif /* !NO_GETKEYBOARDSTATE */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
175 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
176
145
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
177 /* The main Win32 event handler
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
178 DJM: This is no longer static as (DX5/DIB)_CreateWindow needs it
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
179 */
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
180 LONG CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
181 {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
182 SDL_VideoDevice *this = current_video;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
183 static int mouse_pressed = 0;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
184 static int in_window = 0;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
185 #ifdef WMMSG_DEBUG
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
186 fprintf(stderr, "Received windows message: ");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
187 if ( msg > MAX_WMMSG ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
188 fprintf(stderr, "%d", msg);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
189 } else {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
190 fprintf(stderr, "%s", wmtab[msg]);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
191 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
192 fprintf(stderr, " -- 0x%X, 0x%X\n", wParam, lParam);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
193 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
194 switch (msg) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
195
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
196 case WM_ACTIVATE: {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
197 SDL_VideoDevice *this = current_video;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
198 BOOL minimized;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
199 Uint8 appstate;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
200
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
201 minimized = HIWORD(wParam);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
202 if ( !minimized && (LOWORD(wParam) != WA_INACTIVE) ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
203 /* Gain the following states */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
204 appstate = SDL_APPACTIVE|SDL_APPINPUTFOCUS;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
205 if ( this->input_grab != SDL_GRAB_OFF ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
206 WIN_GrabInput(this, SDL_GRAB_ON);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
207 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
208 if ( !(SDL_GetAppState()&SDL_APPINPUTFOCUS) ) {
338
518ffd98a8f6 Fixed gamma ramps in DirectX windowed and OpenGL modes
Sam Lantinga <slouken@libsdl.org>
parents: 335
diff changeset
209 if ( ! DDRAW_FULLSCREEN() ) {
518ffd98a8f6 Fixed gamma ramps in DirectX windowed and OpenGL modes
Sam Lantinga <slouken@libsdl.org>
parents: 335
diff changeset
210 DIB_SwapGamma(this);
518ffd98a8f6 Fixed gamma ramps in DirectX windowed and OpenGL modes
Sam Lantinga <slouken@libsdl.org>
parents: 335
diff changeset
211 }
304
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
212 if ( WINDIB_FULLSCREEN() ) {
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
213 SDL_RestoreGameMode();
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
214 }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
215 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
216 posted = SDL_PrivateAppActive(1, appstate);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
217 WIN_GetKeyboardState();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
218 } else {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
219 /* Lose the following states */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
220 appstate = SDL_APPINPUTFOCUS;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
221 if ( minimized ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
222 appstate |= SDL_APPACTIVE;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
223 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
224 if ( this->input_grab != SDL_GRAB_OFF ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
225 WIN_GrabInput(this, SDL_GRAB_OFF);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
226 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
227 if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) {
338
518ffd98a8f6 Fixed gamma ramps in DirectX windowed and OpenGL modes
Sam Lantinga <slouken@libsdl.org>
parents: 335
diff changeset
228 if ( ! DDRAW_FULLSCREEN() ) {
518ffd98a8f6 Fixed gamma ramps in DirectX windowed and OpenGL modes
Sam Lantinga <slouken@libsdl.org>
parents: 335
diff changeset
229 DIB_SwapGamma(this);
518ffd98a8f6 Fixed gamma ramps in DirectX windowed and OpenGL modes
Sam Lantinga <slouken@libsdl.org>
parents: 335
diff changeset
230 }
304
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
231 if ( WINDIB_FULLSCREEN() ) {
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
232 SDL_RestoreDesktopMode();
ec53caed9fb2 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
233 }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
234 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
235 posted = SDL_PrivateAppActive(0, appstate);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
236 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
237 return(0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
238 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
239 break;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
240
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
241 case WM_MOUSEMOVE: {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
242
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
243 /* Mouse is handled by DirectInput when fullscreen */
13
e30a8ce27c22 Fixed double-mouse event bug on Windows using OpenGL
Sam Lantinga <slouken@lokigames.com>
parents: 1
diff changeset
244 if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
245 Sint16 x, y;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
246
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
247 /* mouse has entered the window */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
248 if ( ! in_window ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
249 #ifdef WM_MOUSELEAVE
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
250 TRACKMOUSEEVENT tme;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
251
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
252 tme.cbSize = sizeof(tme);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
253 tme.dwFlags = TME_LEAVE;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
254 tme.hwndTrack = SDL_Window;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
255 _TrackMouseEvent(&tme);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
256 #endif /* WM_MOUSELEAVE */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
257 in_window = TRUE;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
258
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
259 posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
260 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
261
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
262 /* mouse has moved within the window */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
263 x = LOWORD(lParam);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
264 y = HIWORD(lParam);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
265 if ( mouse_relative ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
266 POINT center;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
267 center.x = (SDL_VideoSurface->w/2);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
268 center.y = (SDL_VideoSurface->h/2);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
269 x -= (Sint16)center.x;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
270 y -= (Sint16)center.y;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
271 if ( x || y ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
272 ClientToScreen(SDL_Window, &center);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
273 SetCursorPos(center.x, center.y);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
274 posted = SDL_PrivateMouseMotion(0, 1, x, y);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
275 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
276 } else {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
277 posted = SDL_PrivateMouseMotion(0, 0, x, y);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
278 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
279 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
280 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
281 return(0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
282
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
283 #ifdef WM_MOUSELEAVE
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
284 case WM_MOUSELEAVE: {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
285
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
286 /* Mouse is handled by DirectInput when fullscreen */
13
e30a8ce27c22 Fixed double-mouse event bug on Windows using OpenGL
Sam Lantinga <slouken@lokigames.com>
parents: 1
diff changeset
287 if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
288 /* mouse has left the window */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
289 /* or */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
290 /* Elvis has left the building! */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
291 posted = SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
292 }
829
77bca0665b69 Fixed mouse focus events after resetting video mode on Windows
Sam Lantinga <slouken@libsdl.org>
parents: 565
diff changeset
293 in_window = FALSE;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
294 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
295 return(0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
296 #endif /* WM_MOUSELEAVE */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
297
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
298 case WM_LBUTTONDOWN:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
299 case WM_LBUTTONUP:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
300 case WM_MBUTTONDOWN:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
301 case WM_MBUTTONUP:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
302 case WM_RBUTTONDOWN:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
303 case WM_RBUTTONUP: {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
304 /* Mouse is handled by DirectInput when fullscreen */
13
e30a8ce27c22 Fixed double-mouse event bug on Windows using OpenGL
Sam Lantinga <slouken@lokigames.com>
parents: 1
diff changeset
305 if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
306 Sint16 x, y;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
307 Uint8 button, state;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
308
145
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
309 /* DJM:
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
310 We want the SDL window to take focus so that
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
311 it acts like a normal windows "component"
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
312 (e.g. gains keyboard focus on a mouse click).
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
313 */
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
314 SetFocus(SDL_Window);
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
315
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
316 /* Figure out which button to use */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
317 switch (msg) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
318 case WM_LBUTTONDOWN:
457
d0ab9718bf91 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 453
diff changeset
319 button = SDL_BUTTON_LEFT;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
320 state = SDL_PRESSED;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
321 break;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
322 case WM_LBUTTONUP:
457
d0ab9718bf91 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 453
diff changeset
323 button = SDL_BUTTON_LEFT;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
324 state = SDL_RELEASED;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
325 break;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
326 case WM_MBUTTONDOWN:
457
d0ab9718bf91 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 453
diff changeset
327 button = SDL_BUTTON_MIDDLE;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
328 state = SDL_PRESSED;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
329 break;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
330 case WM_MBUTTONUP:
457
d0ab9718bf91 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 453
diff changeset
331 button = SDL_BUTTON_MIDDLE;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
332 state = SDL_RELEASED;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
333 break;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
334 case WM_RBUTTONDOWN:
457
d0ab9718bf91 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 453
diff changeset
335 button = SDL_BUTTON_RIGHT;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
336 state = SDL_PRESSED;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
337 break;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
338 case WM_RBUTTONUP:
457
d0ab9718bf91 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 453
diff changeset
339 button = SDL_BUTTON_RIGHT;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
340 state = SDL_RELEASED;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
341 break;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
342 default:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
343 /* Eh? Unknown button? */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
344 return(0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
345 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
346 if ( state == SDL_PRESSED ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
347 /* Grab mouse so we get up events */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
348 if ( ++mouse_pressed > 0 ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
349 SetCapture(hwnd);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
350 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
351 } else {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
352 /* Release mouse after all up events */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
353 if ( --mouse_pressed <= 0 ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
354 ReleaseCapture();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
355 mouse_pressed = 0;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
356 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
357 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
358 if ( mouse_relative ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
359 /* RJR: March 28, 2000
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
360 report internal mouse position if in relative mode */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
361 x = 0; y = 0;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
362 } else {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
363 x = (Sint16)LOWORD(lParam);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
364 y = (Sint16)HIWORD(lParam);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
365 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
366 posted = SDL_PrivateMouseButton(
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
367 state, button, x, y);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
368 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
369 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
370 return(0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
371
61
994ed1d668e7 Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents: 36
diff changeset
372
994ed1d668e7 Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents: 36
diff changeset
373 #if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
994ed1d668e7 Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents: 36
diff changeset
374 case WM_MOUSEWHEEL:
994ed1d668e7 Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents: 36
diff changeset
375 if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
994ed1d668e7 Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents: 36
diff changeset
376 int move = (short)HIWORD(wParam);
162
0a26c92c2385 Fixed mouse wheel motion position on Windows
Sam Lantinga <slouken@libsdl.org>
parents: 149
diff changeset
377 if ( move ) {
0a26c92c2385 Fixed mouse wheel motion position on Windows
Sam Lantinga <slouken@libsdl.org>
parents: 149
diff changeset
378 Uint8 button;
0a26c92c2385 Fixed mouse wheel motion position on Windows
Sam Lantinga <slouken@libsdl.org>
parents: 149
diff changeset
379 if ( move > 0 )
451
24edec3cafe4 Added SDL_BUTTON_WHEELUP (4) and SDL_BUTTON_WHEELDOWN (5)
Sam Lantinga <slouken@libsdl.org>
parents: 447
diff changeset
380 button = SDL_BUTTON_WHEELUP;
162
0a26c92c2385 Fixed mouse wheel motion position on Windows
Sam Lantinga <slouken@libsdl.org>
parents: 149
diff changeset
381 else
451
24edec3cafe4 Added SDL_BUTTON_WHEELUP (4) and SDL_BUTTON_WHEELDOWN (5)
Sam Lantinga <slouken@libsdl.org>
parents: 447
diff changeset
382 button = SDL_BUTTON_WHEELDOWN;
61
994ed1d668e7 Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents: 36
diff changeset
383 posted = SDL_PrivateMouseButton(
162
0a26c92c2385 Fixed mouse wheel motion position on Windows
Sam Lantinga <slouken@libsdl.org>
parents: 149
diff changeset
384 SDL_PRESSED, button, 0, 0);
332
3d6dd1b7b7ba Mouse wheel fix patch.
Sam Lantinga <slouken@libsdl.org>
parents: 327
diff changeset
385 posted |= SDL_PrivateMouseButton(
3d6dd1b7b7ba Mouse wheel fix patch.
Sam Lantinga <slouken@libsdl.org>
parents: 327
diff changeset
386 SDL_RELEASED, button, 0, 0);
61
994ed1d668e7 Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents: 36
diff changeset
387 }
994ed1d668e7 Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents: 36
diff changeset
388 }
994ed1d668e7 Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents: 36
diff changeset
389 return(0);
994ed1d668e7 Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents: 36
diff changeset
390 #endif
994ed1d668e7 Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents: 36
diff changeset
391
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
392 #ifdef WM_GETMINMAXINFO
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
393 /* This message is sent as a way for us to "check" the values
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
394 * of a position change. If we don't like it, we can adjust
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
395 * the values before they are changed.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
396 */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
397 case WM_GETMINMAXINFO: {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
398 MINMAXINFO *info;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
399 RECT size;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
400 int x, y;
565
7d7e19b59866 David MacCormack fixed a bug in window sizing with Windows menus
Sam Lantinga <slouken@libsdl.org>
parents: 459
diff changeset
401 int style;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
402 int width;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
403 int height;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
404
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
405 /* We don't want to clobber an internal resize */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
406 if ( SDL_resizing )
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
407 return(0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
408
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
409 /* We allow resizing with the SDL_RESIZABLE flag */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
410 if ( SDL_PublicSurface &&
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
411 (SDL_PublicSurface->flags & SDL_RESIZABLE) ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
412 return(0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
413 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
414
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
415 /* Get the current position of our window */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
416 GetWindowRect(SDL_Window, &size);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
417 x = size.left;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
418 y = size.top;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
419
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
420 /* Calculate current width and height of our window */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
421 size.top = 0;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
422 size.left = 0;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
423 if ( SDL_PublicSurface != NULL ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
424 size.bottom = SDL_PublicSurface->h;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
425 size.right = SDL_PublicSurface->w;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
426 } else {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
427 size.bottom = 0;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
428 size.right = 0;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
429 }
565
7d7e19b59866 David MacCormack fixed a bug in window sizing with Windows menus
Sam Lantinga <slouken@libsdl.org>
parents: 459
diff changeset
430
7d7e19b59866 David MacCormack fixed a bug in window sizing with Windows menus
Sam Lantinga <slouken@libsdl.org>
parents: 459
diff changeset
431 /* DJM - according to the docs for GetMenu(), the
7d7e19b59866 David MacCormack fixed a bug in window sizing with Windows menus
Sam Lantinga <slouken@libsdl.org>
parents: 459
diff changeset
432 return value is undefined if hwnd is a child window.
7d7e19b59866 David MacCormack fixed a bug in window sizing with Windows menus
Sam Lantinga <slouken@libsdl.org>
parents: 459
diff changeset
433 Aparently it's too difficult for MS to check
7d7e19b59866 David MacCormack fixed a bug in window sizing with Windows menus
Sam Lantinga <slouken@libsdl.org>
parents: 459
diff changeset
434 inside their function, so I have to do it here.
7d7e19b59866 David MacCormack fixed a bug in window sizing with Windows menus
Sam Lantinga <slouken@libsdl.org>
parents: 459
diff changeset
435 */
7d7e19b59866 David MacCormack fixed a bug in window sizing with Windows menus
Sam Lantinga <slouken@libsdl.org>
parents: 459
diff changeset
436 style = GetWindowLong(hwnd, GWL_STYLE);
7d7e19b59866 David MacCormack fixed a bug in window sizing with Windows menus
Sam Lantinga <slouken@libsdl.org>
parents: 459
diff changeset
437 AdjustWindowRect(
7d7e19b59866 David MacCormack fixed a bug in window sizing with Windows menus
Sam Lantinga <slouken@libsdl.org>
parents: 459
diff changeset
438 &size,
7d7e19b59866 David MacCormack fixed a bug in window sizing with Windows menus
Sam Lantinga <slouken@libsdl.org>
parents: 459
diff changeset
439 style,
7d7e19b59866 David MacCormack fixed a bug in window sizing with Windows menus
Sam Lantinga <slouken@libsdl.org>
parents: 459
diff changeset
440 style & WS_CHILDWINDOW ? FALSE
7d7e19b59866 David MacCormack fixed a bug in window sizing with Windows menus
Sam Lantinga <slouken@libsdl.org>
parents: 459
diff changeset
441 : GetMenu(hwnd) != NULL);
7d7e19b59866 David MacCormack fixed a bug in window sizing with Windows menus
Sam Lantinga <slouken@libsdl.org>
parents: 459
diff changeset
442
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
443 width = size.right - size.left;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
444 height = size.bottom - size.top;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
445
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
446 /* Fix our size to the current size */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
447 info = (MINMAXINFO *)lParam;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
448 info->ptMaxSize.x = width;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
449 info->ptMaxSize.y = height;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
450 info->ptMaxPosition.x = x;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
451 info->ptMaxPosition.y = y;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
452 info->ptMinTrackSize.x = width;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
453 info->ptMinTrackSize.y = height;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
454 info->ptMaxTrackSize.x = width;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
455 info->ptMaxTrackSize.y = height;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
456 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
457 return(0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
458 #endif /* WM_GETMINMAXINFO */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
459
447
16d0449891b8 Fixed mouse grab going fullscreen to windowed in Windows
Sam Lantinga <slouken@libsdl.org>
parents: 338
diff changeset
460 case WM_WINDOWPOSCHANGED: {
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
461 SDL_VideoDevice *this = current_video;
447
16d0449891b8 Fixed mouse grab going fullscreen to windowed in Windows
Sam Lantinga <slouken@libsdl.org>
parents: 338
diff changeset
462 int w, h;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
463
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
464 GetClientRect(SDL_Window, &SDL_bounds);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
465 ClientToScreen(SDL_Window, (LPPOINT)&SDL_bounds);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
466 ClientToScreen(SDL_Window, (LPPOINT)&SDL_bounds+1);
833
31fa08b36380 Added support for SDL_VIDEO_WINDOW_POS and SDL_VIDEO_CENTERED on Windows
Sam Lantinga <slouken@libsdl.org>
parents: 829
diff changeset
467 if ( SDL_bounds.left || SDL_bounds.top ) {
31fa08b36380 Added support for SDL_VIDEO_WINDOW_POS and SDL_VIDEO_CENTERED on Windows
Sam Lantinga <slouken@libsdl.org>
parents: 829
diff changeset
468 SDL_windowX = SDL_bounds.left;
31fa08b36380 Added support for SDL_VIDEO_WINDOW_POS and SDL_VIDEO_CENTERED on Windows
Sam Lantinga <slouken@libsdl.org>
parents: 829
diff changeset
469 SDL_windowY = SDL_bounds.top;
31fa08b36380 Added support for SDL_VIDEO_WINDOW_POS and SDL_VIDEO_CENTERED on Windows
Sam Lantinga <slouken@libsdl.org>
parents: 829
diff changeset
470 }
447
16d0449891b8 Fixed mouse grab going fullscreen to windowed in Windows
Sam Lantinga <slouken@libsdl.org>
parents: 338
diff changeset
471 w = SDL_bounds.right-SDL_bounds.left;
16d0449891b8 Fixed mouse grab going fullscreen to windowed in Windows
Sam Lantinga <slouken@libsdl.org>
parents: 338
diff changeset
472 h = SDL_bounds.bottom-SDL_bounds.top;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
473 if ( this->input_grab != SDL_GRAB_OFF ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
474 ClipCursor(&SDL_bounds);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
475 }
447
16d0449891b8 Fixed mouse grab going fullscreen to windowed in Windows
Sam Lantinga <slouken@libsdl.org>
parents: 338
diff changeset
476 if ( SDL_PublicSurface &&
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
477 (SDL_PublicSurface->flags & SDL_RESIZABLE) ) {
447
16d0449891b8 Fixed mouse grab going fullscreen to windowed in Windows
Sam Lantinga <slouken@libsdl.org>
parents: 338
diff changeset
478 SDL_PrivateResize(w, h);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
479 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
480 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
481 break;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
482
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
483 /* We need to set the cursor */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
484 case WM_SETCURSOR: {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
485 Uint16 hittest;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
486
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
487 hittest = LOWORD(lParam);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
488 if ( hittest == HTCLIENT ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
489 SetCursor(SDL_hcursor);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
490 return(TRUE);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
491 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
492 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
493 break;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
494
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
495 /* We are about to get palette focus! */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
496 case WM_QUERYNEWPALETTE: {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
497 WIN_RealizePalette(current_video);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
498 return(TRUE);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
499 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
500 break;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
501
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
502 /* Another application changed the palette */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
503 case WM_PALETTECHANGED: {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
504 WIN_PaletteChanged(current_video, (HWND)wParam);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
505 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
506 break;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
507
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
508 /* We were occluded, refresh our display */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
509 case WM_PAINT: {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
510 HDC hdc;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
511 PAINTSTRUCT ps;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
512
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
513 hdc = BeginPaint(SDL_Window, &ps);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
514 if ( current_video->screen &&
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
515 !(current_video->screen->flags & SDL_OPENGL) ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
516 WIN_WinPAINT(current_video, hdc);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
517 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
518 EndPaint(SDL_Window, &ps);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
519 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
520 return(0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
521
145
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
522 /* DJM: Send an expose event in this case */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
523 case WM_ERASEBKGND: {
145
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
524 posted = SDL_PrivateExpose();
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
525 }
145
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
526 return(0);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
527
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
528 case WM_CLOSE: {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
529 if ( (posted = SDL_PrivateQuit()) )
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
530 PostQuitMessage(0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
531 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
532 return(0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
533
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
534 case WM_DESTROY: {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
535 PostQuitMessage(0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
536 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
537 return(0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
538
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
539 default: {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
540 /* Special handling by the video driver */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
541 if (HandleMessage) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
542 return(HandleMessage(current_video,
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
543 hwnd, msg, wParam, lParam));
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
544 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
545 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
546 break;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
547 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
548 return(DefWindowProc(hwnd, msg, wParam, lParam));
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
549 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
550
145
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
551 /* Allow the application handle to be stored and retrieved later */
149
0e66fd980014 Fixed compile errors and added call to SDL_SetModuleHandle() in WinMain()
Sam Lantinga <slouken@libsdl.org>
parents: 145
diff changeset
552 static void *SDL_handle = NULL;
145
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
553
149
0e66fd980014 Fixed compile errors and added call to SDL_SetModuleHandle() in WinMain()
Sam Lantinga <slouken@libsdl.org>
parents: 145
diff changeset
554 void SDL_SetModuleHandle(void *handle)
145
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
555 {
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
556 SDL_handle = handle;
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
557 }
149
0e66fd980014 Fixed compile errors and added call to SDL_SetModuleHandle() in WinMain()
Sam Lantinga <slouken@libsdl.org>
parents: 145
diff changeset
558 void *SDL_GetModuleHandle(void)
145
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
559 {
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
560 void *handle;
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
561
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
562 if ( SDL_handle ) {
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
563 handle = SDL_handle;
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
564 } else {
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
565 /* Warning:
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
566 If SDL is built as a DLL, this will return a handle to
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
567 the DLL, not the application, and DirectInput may fail
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
568 to initialize.
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
569 */
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
570 handle = GetModuleHandle(NULL);
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
571 }
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
572 return(handle);
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
573 }
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
574
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
575 /* This allows the SDL_WINDOWID hack */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
576 const char *SDL_windowid = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
577
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
578 /* Register the class for this application -- exported for winmain.c */
149
0e66fd980014 Fixed compile errors and added call to SDL_SetModuleHandle() in WinMain()
Sam Lantinga <slouken@libsdl.org>
parents: 145
diff changeset
579 int SDL_RegisterApp(char *name, Uint32 style, void *hInst)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
580 {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
581 static int initialized = 0;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
582 WNDCLASS class;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
583 #ifdef WM_MOUSELEAVE
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
584 HMODULE handle;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
585 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
586
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
587 /* Only do this once... */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
588 if ( initialized ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
589 return(0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
590 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
591
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
592 /* This function needs to be passed the correct process handle
145
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
593 by the application.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
594 */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
595 if ( ! hInst ) {
145
29a638dc26db Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 61
diff changeset
596 hInst = SDL_GetModuleHandle();
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
597 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
598
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
599 /* Register the application class */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
600 class.hCursor = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
601 #ifdef _WIN32_WCE
457
d0ab9718bf91 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 453
diff changeset
602 {
453
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
603 /* WinCE uses the UNICODE version */
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
604 int nLen = strlen(name)+1;
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
605 SDL_Appname = malloc(nLen*2);
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
606 MultiByteToWideChar(CP_ACP, 0, name, -1, SDL_Appname, nLen);
457
d0ab9718bf91 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 453
diff changeset
607 }
453
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
608 #else
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
609 {
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
610 int nLen = strlen(name)+1;
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
611 SDL_Appname = malloc(nLen);
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
612 strcpy(SDL_Appname, name);
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
613 }
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
614 #endif /* _WIN32_WCE */
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
615 class.hIcon = LoadImage(hInst, SDL_Appname, IMAGE_ICON,
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
616 0, 0, LR_DEFAULTCOLOR);
36
13ee9f4834ea Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents: 13
diff changeset
617 class.lpszMenuName = NULL;
453
a6fa62b1be09 Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents: 451
diff changeset
618 class.lpszClassName = SDL_Appname;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
619 class.hbrBackground = NULL;
149
0e66fd980014 Fixed compile errors and added call to SDL_SetModuleHandle() in WinMain()
Sam Lantinga <slouken@libsdl.org>
parents: 145
diff changeset
620 class.hInstance = hInst;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
621 class.style = style;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
622 #ifdef HAVE_OPENGL
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
623 class.style |= CS_OWNDC;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
624 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
625 class.lpfnWndProc = WinMessage;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
626 class.cbWndExtra = 0;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
627 class.cbClsExtra = 0;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
628 if ( ! RegisterClass(&class) ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
629 SDL_SetError("Couldn't register application class");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
630 return(-1);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
631 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
632 SDL_Instance = hInst;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
633
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
634 #ifdef WM_MOUSELEAVE
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
635 /* Get the version of TrackMouseEvent() we use */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
636 _TrackMouseEvent = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
637 handle = GetModuleHandle("USER32.DLL");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
638 if ( handle ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
639 _TrackMouseEvent = (BOOL (WINAPI *)(TRACKMOUSEEVENT *))GetProcAddress(handle, "TrackMouseEvent");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
640 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
641 if ( _TrackMouseEvent == NULL ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
642 _TrackMouseEvent = WIN_TrackMouseEvent;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
643 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
644 #endif /* WM_MOUSELEAVE */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
645
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
646 /* Check for SDL_WINDOWID hack */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
647 SDL_windowid = getenv("SDL_WINDOWID");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
648
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
649 initialized = 1;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
650 return(0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
651 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
652