aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorJohannes Schickel2015-02-16 02:13:11 +0100
committerJohannes Schickel2015-02-16 02:13:11 +0100
commit3745ddbefd6ab401458b862d124ebe80592a88bc (patch)
tree81b5cd632d4032bb7dc5e58b3f7a2642faad4ee4 /backends/platform
parent3f22c12c56572d7c0b46e734179255062f81f45c (diff)
downloadscummvm-rg350-3745ddbefd6ab401458b862d124ebe80592a88bc.tar.gz
scummvm-rg350-3745ddbefd6ab401458b862d124ebe80592a88bc.tar.bz2
scummvm-rg350-3745ddbefd6ab401458b862d124ebe80592a88bc.zip
WIN32: Add experimental SDL2 support.
Based on changes by aquadran.
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/sdl/sdl-window.cpp11
-rw-r--r--backends/platform/sdl/sdl-window.h10
-rw-r--r--backends/platform/sdl/win32/win32-main.cpp2
-rw-r--r--backends/platform/sdl/win32/win32-window.cpp9
-rw-r--r--backends/platform/sdl/win32/win32.cpp2
5 files changed, 30 insertions, 4 deletions
diff --git a/backends/platform/sdl/sdl-window.cpp b/backends/platform/sdl/sdl-window.cpp
index d603ba0114..8dec27d948 100644
--- a/backends/platform/sdl/sdl-window.cpp
+++ b/backends/platform/sdl/sdl-window.cpp
@@ -28,6 +28,8 @@
#include "icons/scummvm.xpm"
+#include <SDL_syswm.h>
+
SdlWindow::SdlWindow()
#if SDL_VERSION_ATLEAST(2, 0, 0)
: _window(nullptr), _inputGrabState(false), _windowCaption("ScummVM"), _windowIcon(nullptr)
@@ -171,6 +173,15 @@ void SdlWindow::iconifyWindow() {
#endif
}
+bool SdlWindow::getSDLWMInformation(SDL_SysWMinfo *info) const {
+ SDL_VERSION(&info->version);
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ return SDL_GetWindowWMInfo(_window, info);
+#else
+ return SDL_GetWMInfo(info);
+#endif
+}
+
#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_Surface *copySDLSurface(SDL_Surface *src) {
const bool locked = SDL_MUSTLOCK(src) == SDL_TRUE;
diff --git a/backends/platform/sdl/sdl-window.h b/backends/platform/sdl/sdl-window.h
index 46997f373d..cc54673f4c 100644
--- a/backends/platform/sdl/sdl-window.h
+++ b/backends/platform/sdl/sdl-window.h
@@ -27,6 +27,8 @@
#include "common/str.h"
+struct SDL_SysWMinfo;
+
class SdlWindow {
public:
SdlWindow();
@@ -65,6 +67,14 @@ public:
*/
void iconifyWindow();
+ /**
+ * Query platform specific SDL window manager information.
+ *
+ * Since this is an SDL internal structure clients are responsible
+ * for accessing it in a version safe manner.
+ */
+ bool getSDLWMInformation(SDL_SysWMinfo *info) const;
+
#if SDL_VERSION_ATLEAST(2, 0, 0)
public:
/**
diff --git a/backends/platform/sdl/win32/win32-main.cpp b/backends/platform/sdl/win32/win32-main.cpp
index e5b26c3ff0..c6c15c00e8 100644
--- a/backends/platform/sdl/win32/win32-main.cpp
+++ b/backends/platform/sdl/win32/win32-main.cpp
@@ -40,7 +40,9 @@
#include "base/main.h"
int __stdcall WinMain(HINSTANCE /*hInst*/, HINSTANCE /*hPrevInst*/, LPSTR /*lpCmdLine*/, int /*iShowCmd*/) {
+#if !SDL_VERSION_ATLEAST(2, 0, 0)
SDL_SetModuleHandle(GetModuleHandle(NULL));
+#endif
return main(__argc, __argv);
}
diff --git a/backends/platform/sdl/win32/win32-window.cpp b/backends/platform/sdl/win32/win32-window.cpp
index a418d899d5..814c165f6f 100644
--- a/backends/platform/sdl/win32/win32-window.cpp
+++ b/backends/platform/sdl/win32/win32-window.cpp
@@ -37,11 +37,14 @@ void SdlWindow_Win32::setupIcon() {
HMODULE handle = GetModuleHandle(NULL);
HICON ico = LoadIcon(handle, MAKEINTRESOURCE(1001 /* IDI_ICON */));
if (ico) {
- SDL_SysWMinfo wminfo;
- SDL_VERSION(&wminfo.version);
- if (SDL_GetWMInfo(&wminfo)) {
+ SDL_SysWMinfo wminfo;
+ if (getSDLWMInformation(&wminfo)) {
// Replace the handle to the icon associated with the window class by our custom icon
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ SetClassLongPtr(wminfo.info.win.window, GCLP_HICON, (ULONG_PTR)ico);
+#else
SetClassLongPtr(wminfo.window, GCLP_HICON, (ULONG_PTR)ico);
+#endif
// Since there wasn't any default icon, we can't use the return value from SetClassLong
// to check for errors (it would be 0 in both cases: error or no previous value for the
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index 78a7c685eb..0f70c00b40 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -54,7 +54,7 @@ void OSystem_Win32::init() {
#if defined(USE_TASKBAR)
// Initialize taskbar manager
- _taskbarManager = new Win32TaskbarManager();
+ _taskbarManager = new Win32TaskbarManager(_window);
#endif
// Invoke parent implementation of this method