1 /* 2 SDL - Simple DirectMedia Layer 3 Copyright (C) 1997-2012 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 (at) 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 FULLSCREEN() \ 55 ((SDL_VideoSurface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) 56 57 #define WINDIB_FULLSCREEN() \ 58 ( \ 59 SDL_VideoSurface && \ 60 FULLSCREEN() && \ 61 (((SDL_VideoSurface->flags & SDL_OPENGL ) == SDL_OPENGL ) || \ 62 ((SDL_strcmp(this->name, "windib") == 0) || \ 63 (SDL_strcmp(this->name, "gapi") == 0))) \ 64 ) 65 #define DDRAW_FULLSCREEN() \ 66 ( \ 67 SDL_VideoSurface && \ 68 FULLSCREEN() && \ 69 ((SDL_VideoSurface->flags & SDL_OPENGL ) != SDL_OPENGL ) && \ 70 (SDL_strcmp(this->name, "directx") == 0) \ 71 ) 72 73 #define DINPUT_FULLSCREEN() \ 74 ( \ 75 FULLSCREEN() && \ 76 (strcmp(this->name, "directx") == 0) \ 77 ) 78 79 #define DINPUT() (strcmp(this->name, "directx") == 0) 80 81 /* The main window -- and a function to set it for the audio */ 82 #ifdef _WIN32_WCE 83 extern LPWSTR SDL_Appname; 84 #else 85 extern LPSTR SDL_Appname; 86 #endif 87 extern HINSTANCE SDL_Instance; 88 extern HWND SDL_Window; 89 extern BOOL SDL_windowid; 90 91 /* Variables and functions exported to other parts of the native video 92 subsystem (SDL_sysevents.c) 93 */ 94 extern void WIN_FlushMessageQueue(); 95 96 /* Called by windows message loop when application is activated */ 97 extern void (*WIN_Activate)(_THIS, BOOL active, BOOL minimized); 98 99 /* Called by windows message loop when system palette is available */ 100 extern void (*WIN_RealizePalette)(_THIS); 101 102 /* Called by windows message loop when the system palette changes */ 103 extern void (*WIN_PaletteChanged)(_THIS, HWND window); 104 105 /* Called by windows message loop when a portion of the screen needs update */ 106 extern void (*WIN_WinPAINT)(_THIS, HDC hdc); 107 108 /* Called by windows message loop when the message isn't handled */ 109 extern LONG (*HandleMessage)(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); 110 111 /* The window cursor (from SDL_sysmouse.c) */ 112 extern HCURSOR SDL_hcursor; 113 114 /* The bounds of the window in screen coordinates */ 115 extern RECT SDL_bounds; 116 117 /* The position of the window in windowed mode */ 118 extern int SDL_windowX; 119 extern int SDL_windowY; 120 121 /* Flag -- SDL is performing a resize, rather than the user */ 122 extern int SDL_resizing; 123 124 /* Flag -- the mouse is in relative motion mode */ 125 extern int mouse_relative; 126 127 /* The GDI fullscreen mode currently active */ 128 #ifndef NO_CHANGEDISPLAYSETTINGS 129 extern DEVMODE SDL_desktop_mode; 130 extern DEVMODE SDL_fullscreen_mode; 131 #endif 132 133 /* The system gamma ramp for GDI modes */ 134 extern WORD *gamma_saved; 135 136 /* This is really from SDL_dx5audio.c */ 137 extern void DX5_SoundFocus(HWND window); 138 139 /* DJM: This is really from SDL_sysevents.c, we need it in 140 GDL_CreateWindow as well */ 141 LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); 142 143 #ifdef _WIN64 144 #define SDL_ToUnicode ToUnicode 145 #else 146 /* JFP: Implementation of ToUnicode() that works on 9x/ME/2K/XP */ 147 typedef int (WINAPI *ToUnicodeFN)(UINT, UINT, const BYTE *, LPWSTR, int, UINT); 148 149 extern ToUnicodeFN SDL_ToUnicode; 150 #endif 151 152 #endif /* SDL_lowvideo_h */ 153