2006-07-10 21:04:37 +00:00
|
|
|
/*
|
|
|
|
SDL - Simple DirectMedia Layer
|
2011-02-11 22:37:15 -08:00
|
|
|
Copyright (C) 1997-2011 Sam Lantinga
|
2006-07-10 21:04:37 +00:00
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
|
|
|
Sam Lantinga
|
|
|
|
slouken@libsdl.org
|
|
|
|
*/
|
|
|
|
#include "SDL_config.h"
|
|
|
|
|
|
|
|
#include "SDL_main.h"
|
|
|
|
#include "SDL_video.h"
|
|
|
|
#include "SDL_mouse.h"
|
|
|
|
#include "../SDL_sysvideo.h"
|
|
|
|
#include "../SDL_pixels_c.h"
|
|
|
|
|
2011-01-20 18:04:05 -08:00
|
|
|
#include "SDL_windowsvideo.h"
|
2011-02-04 12:29:58 -08:00
|
|
|
#include "SDL_windowsframebuffer.h"
|
2011-01-20 18:04:05 -08:00
|
|
|
#include "SDL_windowsshape.h"
|
2006-07-10 21:04:37 +00:00
|
|
|
|
|
|
|
/* Initialization/Query functions */
|
|
|
|
static int WIN_VideoInit(_THIS);
|
|
|
|
static void WIN_VideoQuit(_THIS);
|
|
|
|
|
Andrey A.
I made a video driver GAPI/RAW for WinCE (SDL-1.3).
RAW mode has a priority, and also, GAPI mode works with environment
"SDL_VIDEO_RENDERER=gapi" and for RAW mode "SDL_VIDEO_RENDERER=raw".
I checked the work on the screens of VGA, WVGA, QVGA, WQVGA, HVGA,
+ tested all modes with WindowsMobile Emulator.
Also, correctly draws the pointer position and the scale of the pointer
for VGA/WVGA modes,
correctly draws top left position for DM orientation screen, and
portrait/landscape/square geometry the screen also correct.
Also, I added a small fix for GDI fullscreen mode.
Patch for latest revision SDL-1.3 in an attachment.
Also added small path for mingw32ce build.
2010-07-27 21:31:28 -07:00
|
|
|
|
2011-01-20 18:04:05 -08:00
|
|
|
/* Windows driver bootstrap functions */
|
2006-07-10 21:04:37 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
WIN_Available(void)
|
|
|
|
{
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
WIN_DeleteDevice(SDL_VideoDevice * device)
|
|
|
|
{
|
|
|
|
SDL_VideoData *data = (SDL_VideoData *) device->driverdata;
|
|
|
|
|
|
|
|
SDL_UnregisterApp();
|
Andrey A.
I made a video driver GAPI/RAW for WinCE (SDL-1.3).
RAW mode has a priority, and also, GAPI mode works with environment
"SDL_VIDEO_RENDERER=gapi" and for RAW mode "SDL_VIDEO_RENDERER=raw".
I checked the work on the screens of VGA, WVGA, QVGA, WQVGA, HVGA,
+ tested all modes with WindowsMobile Emulator.
Also, correctly draws the pointer position and the scale of the pointer
for VGA/WVGA modes,
correctly draws top left position for DM orientation screen, and
portrait/landscape/square geometry the screen also correct.
Also, I added a small fix for GDI fullscreen mode.
Patch for latest revision SDL-1.3 in an attachment.
Also added small path for mingw32ce build.
2010-07-27 21:31:28 -07:00
|
|
|
#ifdef _WIN32_WCE
|
|
|
|
if(data->hAygShell) {
|
2011-01-24 21:20:30 -08:00
|
|
|
SDL_UnloadObject(data->hAygShell);
|
Andrey A.
I made a video driver GAPI/RAW for WinCE (SDL-1.3).
RAW mode has a priority, and also, GAPI mode works with environment
"SDL_VIDEO_RENDERER=gapi" and for RAW mode "SDL_VIDEO_RENDERER=raw".
I checked the work on the screens of VGA, WVGA, QVGA, WQVGA, HVGA,
+ tested all modes with WindowsMobile Emulator.
Also, correctly draws the pointer position and the scale of the pointer
for VGA/WVGA modes,
correctly draws top left position for DM orientation screen, and
portrait/landscape/square geometry the screen also correct.
Also, I added a small fix for GDI fullscreen mode.
Patch for latest revision SDL-1.3 in an attachment.
Also added small path for mingw32ce build.
2010-07-27 21:31:28 -07:00
|
|
|
}
|
2006-07-10 21:04:37 +00:00
|
|
|
#endif
|
2010-11-30 17:58:51 -08:00
|
|
|
if (data->userDLL) {
|
2011-01-24 21:20:30 -08:00
|
|
|
SDL_UnloadObject(data->userDLL);
|
2010-11-30 17:58:51 -08:00
|
|
|
}
|
|
|
|
|
2006-07-10 21:04:37 +00:00
|
|
|
SDL_free(device->driverdata);
|
|
|
|
SDL_free(device);
|
|
|
|
}
|
|
|
|
|
|
|
|
static SDL_VideoDevice *
|
|
|
|
WIN_CreateDevice(int devindex)
|
|
|
|
{
|
|
|
|
SDL_VideoDevice *device;
|
|
|
|
SDL_VideoData *data;
|
|
|
|
|
|
|
|
SDL_RegisterApp(NULL, 0, NULL);
|
|
|
|
|
|
|
|
/* Initialize all variables that we clean on shutdown */
|
|
|
|
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
|
|
|
|
if (device) {
|
|
|
|
data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
|
2010-05-09 20:47:22 -07:00
|
|
|
} else {
|
|
|
|
data = NULL;
|
2006-07-10 21:04:37 +00:00
|
|
|
}
|
2010-05-09 20:47:22 -07:00
|
|
|
if (!data) {
|
2006-07-10 21:04:37 +00:00
|
|
|
SDL_OutOfMemory();
|
|
|
|
if (device) {
|
|
|
|
SDL_free(device);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
device->driverdata = data;
|
|
|
|
|
Andrey A.
I made a video driver GAPI/RAW for WinCE (SDL-1.3).
RAW mode has a priority, and also, GAPI mode works with environment
"SDL_VIDEO_RENDERER=gapi" and for RAW mode "SDL_VIDEO_RENDERER=raw".
I checked the work on the screens of VGA, WVGA, QVGA, WQVGA, HVGA,
+ tested all modes with WindowsMobile Emulator.
Also, correctly draws the pointer position and the scale of the pointer
for VGA/WVGA modes,
correctly draws top left position for DM orientation screen, and
portrait/landscape/square geometry the screen also correct.
Also, I added a small fix for GDI fullscreen mode.
Patch for latest revision SDL-1.3 in an attachment.
Also added small path for mingw32ce build.
2010-07-27 21:31:28 -07:00
|
|
|
#ifdef _WIN32_WCE
|
2011-01-24 21:20:30 -08:00
|
|
|
data->hAygShell = SDL_LoadObject("\\windows\\aygshell.dll");
|
Andrey A.
I made a video driver GAPI/RAW for WinCE (SDL-1.3).
RAW mode has a priority, and also, GAPI mode works with environment
"SDL_VIDEO_RENDERER=gapi" and for RAW mode "SDL_VIDEO_RENDERER=raw".
I checked the work on the screens of VGA, WVGA, QVGA, WQVGA, HVGA,
+ tested all modes with WindowsMobile Emulator.
Also, correctly draws the pointer position and the scale of the pointer
for VGA/WVGA modes,
correctly draws top left position for DM orientation screen, and
portrait/landscape/square geometry the screen also correct.
Also, I added a small fix for GDI fullscreen mode.
Patch for latest revision SDL-1.3 in an attachment.
Also added small path for mingw32ce build.
2010-07-27 21:31:28 -07:00
|
|
|
if(0 == data->hAygShell)
|
2011-01-24 21:20:30 -08:00
|
|
|
data->hAygShell = SDL_LoadObject("aygshell.dll");
|
Andrey A.
I made a video driver GAPI/RAW for WinCE (SDL-1.3).
RAW mode has a priority, and also, GAPI mode works with environment
"SDL_VIDEO_RENDERER=gapi" and for RAW mode "SDL_VIDEO_RENDERER=raw".
I checked the work on the screens of VGA, WVGA, QVGA, WQVGA, HVGA,
+ tested all modes with WindowsMobile Emulator.
Also, correctly draws the pointer position and the scale of the pointer
for VGA/WVGA modes,
correctly draws top left position for DM orientation screen, and
portrait/landscape/square geometry the screen also correct.
Also, I added a small fix for GDI fullscreen mode.
Patch for latest revision SDL-1.3 in an attachment.
Also added small path for mingw32ce build.
2010-07-27 21:31:28 -07:00
|
|
|
data->SHFullScreen = (0 != data->hAygShell ?
|
2011-01-24 21:20:30 -08:00
|
|
|
(PFNSHFullScreen) SDL_LoadFunction(data->hAygShell, "SHFullScreen") : 0);
|
Andrey A.
I made a video driver GAPI/RAW for WinCE (SDL-1.3).
RAW mode has a priority, and also, GAPI mode works with environment
"SDL_VIDEO_RENDERER=gapi" and for RAW mode "SDL_VIDEO_RENDERER=raw".
I checked the work on the screens of VGA, WVGA, QVGA, WQVGA, HVGA,
+ tested all modes with WindowsMobile Emulator.
Also, correctly draws the pointer position and the scale of the pointer
for VGA/WVGA modes,
correctly draws top left position for DM orientation screen, and
portrait/landscape/square geometry the screen also correct.
Also, I added a small fix for GDI fullscreen mode.
Patch for latest revision SDL-1.3 in an attachment.
Also added small path for mingw32ce build.
2010-07-27 21:31:28 -07:00
|
|
|
data->CoordTransform = NULL;
|
|
|
|
#endif
|
|
|
|
|
2011-01-24 21:20:30 -08:00
|
|
|
data->userDLL = SDL_LoadObject("USER32.DLL");
|
2010-11-30 17:58:51 -08:00
|
|
|
if (data->userDLL) {
|
2011-01-24 21:20:30 -08:00
|
|
|
data->CloseTouchInputHandle = (BOOL (WINAPI *)( HTOUCHINPUT )) SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle");
|
|
|
|
data->GetTouchInputInfo = (BOOL (WINAPI *)( HTOUCHINPUT, UINT, PTOUCHINPUT, int )) SDL_LoadFunction(data->userDLL, "GetTouchInputInfo");
|
|
|
|
data->RegisterTouchWindow = (BOOL (WINAPI *)( HWND, ULONG )) SDL_LoadFunction(data->userDLL, "RegisterTouchWindow");
|
2010-11-30 17:58:51 -08:00
|
|
|
}
|
|
|
|
|
2006-07-10 21:04:37 +00:00
|
|
|
/* Set the function pointers */
|
|
|
|
device->VideoInit = WIN_VideoInit;
|
2006-07-17 06:47:33 +00:00
|
|
|
device->VideoQuit = WIN_VideoQuit;
|
2009-12-06 08:03:38 +00:00
|
|
|
device->GetDisplayBounds = WIN_GetDisplayBounds;
|
2006-07-10 21:04:37 +00:00
|
|
|
device->GetDisplayModes = WIN_GetDisplayModes;
|
|
|
|
device->SetDisplayMode = WIN_SetDisplayMode;
|
|
|
|
device->PumpEvents = WIN_PumpEvents;
|
|
|
|
|
|
|
|
#undef CreateWindow
|
|
|
|
device->CreateWindow = WIN_CreateWindow;
|
|
|
|
device->CreateWindowFrom = WIN_CreateWindowFrom;
|
|
|
|
device->SetWindowTitle = WIN_SetWindowTitle;
|
2009-01-03 01:01:53 +00:00
|
|
|
device->SetWindowIcon = WIN_SetWindowIcon;
|
2006-07-10 21:04:37 +00:00
|
|
|
device->SetWindowPosition = WIN_SetWindowPosition;
|
|
|
|
device->SetWindowSize = WIN_SetWindowSize;
|
|
|
|
device->ShowWindow = WIN_ShowWindow;
|
|
|
|
device->HideWindow = WIN_HideWindow;
|
|
|
|
device->RaiseWindow = WIN_RaiseWindow;
|
|
|
|
device->MaximizeWindow = WIN_MaximizeWindow;
|
|
|
|
device->MinimizeWindow = WIN_MinimizeWindow;
|
|
|
|
device->RestoreWindow = WIN_RestoreWindow;
|
|
|
|
device->SetWindowGrab = WIN_SetWindowGrab;
|
|
|
|
device->DestroyWindow = WIN_DestroyWindow;
|
|
|
|
device->GetWindowWMInfo = WIN_GetWindowWMInfo;
|
2011-02-04 12:29:58 -08:00
|
|
|
device->CreateWindowFramebuffer = WIN_CreateWindowFramebuffer;
|
|
|
|
device->UpdateWindowFramebuffer = WIN_UpdateWindowFramebuffer;
|
|
|
|
device->DestroyWindowFramebuffer = WIN_DestroyWindowFramebuffer;
|
2010-07-09 20:24:44 -04:00
|
|
|
|
|
|
|
device->shape_driver.CreateShaper = Win32_CreateShaper;
|
|
|
|
device->shape_driver.SetWindowShape = Win32_SetWindowShape;
|
|
|
|
device->shape_driver.ResizeWindowShape = Win32_ResizeWindowShape;
|
|
|
|
|
2011-01-24 17:38:18 -08:00
|
|
|
#if SDL_VIDEO_OPENGL_WGL
|
2006-07-17 06:47:33 +00:00
|
|
|
device->GL_LoadLibrary = WIN_GL_LoadLibrary;
|
|
|
|
device->GL_GetProcAddress = WIN_GL_GetProcAddress;
|
2009-02-09 05:32:12 +00:00
|
|
|
device->GL_UnloadLibrary = WIN_GL_UnloadLibrary;
|
2006-07-17 06:47:33 +00:00
|
|
|
device->GL_CreateContext = WIN_GL_CreateContext;
|
|
|
|
device->GL_MakeCurrent = WIN_GL_MakeCurrent;
|
|
|
|
device->GL_SetSwapInterval = WIN_GL_SetSwapInterval;
|
|
|
|
device->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
|
|
|
|
device->GL_SwapWindow = WIN_GL_SwapWindow;
|
|
|
|
device->GL_DeleteContext = WIN_GL_DeleteContext;
|
|
|
|
#endif
|
2010-08-22 12:34:31 -07:00
|
|
|
device->StartTextInput = WIN_StartTextInput;
|
|
|
|
device->StopTextInput = WIN_StopTextInput;
|
|
|
|
device->SetTextInputRect = WIN_SetTextInputRect;
|
2006-07-10 21:04:37 +00:00
|
|
|
|
2010-07-08 05:43:34 -07:00
|
|
|
device->SetClipboardText = WIN_SetClipboardText;
|
|
|
|
device->GetClipboardText = WIN_GetClipboardText;
|
|
|
|
device->HasClipboardText = WIN_HasClipboardText;
|
|
|
|
|
2006-07-10 21:04:37 +00:00
|
|
|
device->free = WIN_DeleteDevice;
|
|
|
|
|
|
|
|
return device;
|
|
|
|
}
|
|
|
|
|
2011-01-20 18:04:05 -08:00
|
|
|
VideoBootStrap WINDOWS_bootstrap = {
|
2011-01-24 15:46:11 -08:00
|
|
|
"windows", "SDL Windows video driver", WIN_Available, WIN_CreateDevice
|
2006-07-10 21:04:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int
|
|
|
|
WIN_VideoInit(_THIS)
|
|
|
|
{
|
2009-12-04 09:01:48 +00:00
|
|
|
if (WIN_InitModes(_this) < 0) {
|
|
|
|
return -1;
|
|
|
|
}
|
2006-07-10 21:04:37 +00:00
|
|
|
|
|
|
|
WIN_InitKeyboard(_this);
|
|
|
|
WIN_InitMouse(_this);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
WIN_VideoQuit(_THIS)
|
|
|
|
{
|
|
|
|
WIN_QuitModes(_this);
|
|
|
|
WIN_QuitKeyboard(_this);
|
|
|
|
WIN_QuitMouse(_this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* vim: set ts=4 sw=4 expandtab: */
|