along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#undef WIN32_LEAN_AND_MEAN //hush a warning, SDL.h redefines this
#include <SDL.h>
#include <stdio.h>
return;
icon = LoadIcon( GetModuleHandle( NULL ), MAKEINTRESOURCE( IDI_ICON1 ) );
- SetClassLong( info.window, GCL_HICON, (LONG) icon );
+#ifndef _W64 //If Windows 64bit data types don't exist
+#define SetClassLongPtr SetClassLong
+#define GCLP_HICON GCL_HICON
+#define LONG_PTR LONG
+#endif
+ SetClassLongPtr( info.window, GCLP_HICON, (LONG_PTR)icon );
}
#else
static void VID_SetCaption()
SDL_QuitSubSystem(SDL_INIT_VIDEO);
}
-int VID_SetGamma (unsigned short *ramps)
+int VID_SetGamma (unsigned short *ramps, int rampsize)
{
- return !SDL_SetGammaRamp (ramps, ramps + 256, ramps + 512);
+ return !SDL_SetGammaRamp (ramps, ramps + rampsize, ramps + rampsize*2);
}
-int VID_GetGamma (unsigned short *ramps)
+int VID_GetGamma (unsigned short *ramps, int rampsize)
{
- return !SDL_GetGammaRamp( ramps, ramps + 256, ramps + 512);
+ return !SDL_GetGammaRamp (ramps, ramps + rampsize, ramps + rampsize*2);
}
-void VID_Finish (void)
+void VID_Finish (qboolean allowmousegrab)
{
Uint8 appstate;
qboolean vid_usemouse;
//react on appstate changes
appstate = SDL_GetAppState();
- if( !( appstate & SDL_APPMOUSEFOCUS ) || !( appstate & SDL_APPINPUTFOCUS ) )
+ vid_hidden = !(appstate & SDL_APPACTIVE);
+
+ if( vid_hidden || !( appstate & SDL_APPMOUSEFOCUS ) || !( appstate & SDL_APPINPUTFOCUS ) )
vid_activewindow = false;
else
vid_activewindow = true;
vid_usemouse = false;
- if( vid_mouse.integer && !key_consoleactive && !cls.demoplayback )
+ if( allowmousegrab && vid_mouse.integer && !key_consoleactive && !cls.demoplayback )
vid_usemouse = true;
if( vid_isfullscreen )
vid_usemouse = true;
vid_usemouse = false;
IN_Activate(vid_usemouse);
+
+ VID_UpdateGamma(false, 256);
}