1/*
2    SDL - Simple DirectMedia Layer
3    Copyright (C) 1997-2006 Sam Lantinga
4
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9
10    This library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with this library; if not, write to the Free Software
17    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
19    Sam Lantinga
20    slouken@libsdl.org
21*/
22#include "SDL_config.h"
23
24#ifndef _SDL_lowvideo_h
25#define _SDL_lowvideo_h
26
27#define WIN32_LEAN_AND_MEAN
28#include <windows.h>
29
30#ifndef SetClassLongPtr
31#define SetClassLongPtr	SetClassLong
32#endif
33#ifndef GetWindowLongPtr
34#define GetWindowLongPtr	GetWindowLong
35#endif
36#ifndef SetWindowLongPtr
37#define SetWindowLongPtr	SetWindowLong
38#endif
39#ifndef GWLP_WNDPROC
40#define GWLP_WNDPROC	GWL_WNDPROC
41#endif
42#ifndef GWLP_HINSTANCE
43#define GWLP_HINSTANCE GWL_HINSTANCE
44#endif
45#ifndef GCLP_HICON
46#define GCLP_HICON GCL_HICON
47#endif
48
49#include "../SDL_sysvideo.h"
50
51/* Hidden "this" pointer for the video functions */
52#define _THIS	SDL_VideoDevice *this
53
54#define WINDIB_FULLSCREEN()						\
55(									\
56	SDL_VideoSurface &&						\
57	((SDL_VideoSurface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) && \
58	(((SDL_VideoSurface->flags & SDL_OPENGL   ) == SDL_OPENGL    ) || \
59	((SDL_strcmp(this->name, "windib") == 0) || \
60	 (SDL_strcmp(this->name, "gapi") == 0))) \
61)
62#define DDRAW_FULLSCREEN() 						\
63(									\
64	SDL_VideoSurface &&						\
65	((SDL_VideoSurface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) && \
66	((SDL_VideoSurface->flags & SDL_OPENGL    ) != SDL_OPENGL    ) && \
67	(SDL_strcmp(this->name, "directx") == 0)				\
68)
69
70#define DINPUT_FULLSCREEN()	DDRAW_FULLSCREEN()
71
72/* The main window -- and a function to set it for the audio */
73#ifdef _WIN32_WCE
74extern LPWSTR SDL_Appname;
75#else
76extern LPSTR SDL_Appname;
77#endif
78extern HINSTANCE SDL_Instance;
79extern HWND SDL_Window;
80extern BOOL SDL_windowid;
81
82/* Variables and functions exported to other parts of the native video
83   subsystem (SDL_sysevents.c)
84*/
85extern void WIN_FlushMessageQueue();
86
87/* Called by windows message loop when application is activated */
88extern void (*WIN_Activate)(_THIS, BOOL active, BOOL minimized);
89
90/* Called by windows message loop when system palette is available */
91extern void (*WIN_RealizePalette)(_THIS);
92
93/* Called by windows message loop when the system palette changes */
94extern void (*WIN_PaletteChanged)(_THIS, HWND window);
95
96/* Called by windows message loop when a portion of the screen needs update */
97extern void (*WIN_WinPAINT)(_THIS, HDC hdc);
98
99/* Called by windows message loop when the message isn't handled */
100extern LONG (*HandleMessage)(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
101
102/* The window cursor (from SDL_sysmouse.c) */
103extern HCURSOR SDL_hcursor;
104
105/* The bounds of the window in screen coordinates */
106extern RECT SDL_bounds;
107
108/* The position of the window in windowed mode */
109extern int SDL_windowX;
110extern int SDL_windowY;
111
112/* Flag -- SDL is performing a resize, rather than the user */
113extern int SDL_resizing;
114
115/* Flag -- the mouse is in relative motion mode */
116extern int mouse_relative;
117
118/* The GDI fullscreen mode currently active */
119#ifndef NO_CHANGEDISPLAYSETTINGS
120extern DEVMODE SDL_desktop_mode;
121extern DEVMODE SDL_fullscreen_mode;
122#endif
123
124/* The system gamma ramp for GDI modes */
125extern WORD *gamma_saved;
126
127/* This is really from SDL_dx5audio.c */
128extern void DX5_SoundFocus(HWND window);
129
130/* DJM: This is really from SDL_sysevents.c, we need it in
131   GDL_CreateWindow as well */
132LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
133
134/* JFP: Implementation of ToUnicode() that works on 9x/ME/2K/XP */
135typedef int (WINAPI *ToUnicodeFN)(UINT, UINT, PBYTE, LPWSTR, int, UINT);
136
137extern ToUnicodeFN SDL_ToUnicode;
138
139#endif /* SDL_lowvideo_h */
140