diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-08-24 14:51:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-08-24 21:08:17 +0300 |
commit | 8f670620dbf4c8092e9f834f9d65cbc607b81511 (patch) | |
tree | 1a1a8e51ecaa65955639c3f9279f6f704e6dac5d /src | |
parent | ed77e8fb99e16e72cde0e163a9b58c5cefd8d05d (diff) | |
download | manaverse-8f670620dbf4c8092e9f834f9d65cbc607b81511.tar.gz manaverse-8f670620dbf4c8092e9f834f9d65cbc607b81511.tar.bz2 manaverse-8f670620dbf4c8092e9f834f9d65cbc607b81511.tar.xz manaverse-8f670620dbf4c8092e9f834f9d65cbc607b81511.zip |
move WMInfo function calls into SDL helper.
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 2 | ||||
-rw-r--r-- | src/graphics.cpp | 2 | ||||
-rw-r--r-- | src/graphicsmanager.cpp | 14 | ||||
-rw-r--r-- | src/utils/copynpaste.cpp | 9 | ||||
-rw-r--r-- | src/utils/sdl2helper.cpp | 6 | ||||
-rw-r--r-- | src/utils/sdl2helper.h | 3 | ||||
-rw-r--r-- | src/utils/sdlhelper.cpp | 7 | ||||
-rw-r--r-- | src/utils/sdlhelper.h | 4 |
8 files changed, 29 insertions, 18 deletions
diff --git a/src/client.cpp b/src/client.cpp index b191e443d..02719debc 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -3067,7 +3067,7 @@ void Client::setIcon() #ifdef WIN32 static SDL_SysWMinfo pInfo; - SDL_GetWMInfo(&pInfo); + SDL::getWindowWMInfo(mainGraphics->getWindow(), &pInfo); // Attempt to load icon from .ico file HICON icon = (HICON) LoadImage(nullptr, iconFile.c_str(), IMAGE_ICON, 64, 64, LR_LOADFROMFILE); diff --git a/src/graphics.cpp b/src/graphics.cpp index 0fd8fced9..5376f2576 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -303,7 +303,7 @@ bool Graphics::videoInfo() #ifdef USE_SDL2 logger->log("Using video driver: %s", SDL_GetCurrentVideoDriver()); - // +++ probably SDL_GetRendererInfo can be used for info + // +++ SDL_GetRendererInfo can be used for software info #else char videoDriverName[65]; if (SDL_VideoDriverName(videoDriverName, 64)) diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index 0e0ac4fa3..0dcfbb377 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -403,12 +403,7 @@ void GraphicsManager::updatePlanformExtensions() { SDL_SysWMinfo info; SDL_VERSION(&info.version); -#ifdef USE_SDL2 - // +++ need use SDL_GetWindowWMInfo - if (false) -#else - if (SDL_GetWMInfo(&info)) -#endif + if (SDL::getWindowWMInfo(mainGraphics->getWindow(), &info)) { #ifdef WIN32 if (!mwglGetExtensionsString) @@ -991,12 +986,7 @@ void GraphicsManager::detectPixelSize() { SDL_SysWMinfo info; SDL_VERSION(&info.version); -#ifdef USE_SDL2 - // +++ need use SDL_GetWindowWMInfo - if (false) -#else - if (SDL_GetWMInfo(&info)) -#endif + if (SDL::getWindowWMInfo(mainGraphics->getWindow(), &info)) { #ifdef WIN32 HDC hdc = GetDC(info.window); diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp index 1d4297fd5..86b5a668c 100644 --- a/src/utils/copynpaste.cpp +++ b/src/utils/copynpaste.cpp @@ -35,6 +35,10 @@ #include "utils/copynpaste.h" +#include "graphics.h" + +#include "utils/sdlhelper.h" + #include <SDL_syswm.h> #include "debug.h" @@ -339,12 +343,10 @@ static char* getSelection(Display *const dpy, Window us, Atom selection) bool retrieveBuffer(std::string& text, size_t& pos) { -// +++ need use SDL_GetWindowWMInfo -#ifndef USE_SDL2 SDL_SysWMinfo info; SDL_VERSION(&info.version); - if (SDL_GetWMInfo(&info)) + if (SDL::getWindowWMInfo(mainGraphics->getWindow(), &info)) { Display *const dpy = info.info.x11.display; Window us = info.info.x11.window; @@ -378,7 +380,6 @@ bool retrieveBuffer(std::string& text, size_t& pos) return true; } } -#endif return false; } diff --git a/src/utils/sdl2helper.cpp b/src/utils/sdl2helper.cpp index 33a88cc8a..a65f381b3 100644 --- a/src/utils/sdl2helper.cpp +++ b/src/utils/sdl2helper.cpp @@ -26,6 +26,7 @@ #include "utils/stringutils.h" +#include <SDL_syswm.h> #include <SDL_video.h> #include "debug.h" @@ -62,4 +63,9 @@ void SDL::setVsync(const int val) SDL_GL_SetSwapInterval(val); } +bool SDL::getWindowWMInfo(SDL_Window *const window, SDL_SysWMinfo *const info) +{ + return SDL_GetWindowWMInfo(window, info); +} + #endif // USE_SDL2 diff --git a/src/utils/sdl2helper.h b/src/utils/sdl2helper.h index 3e7b20651..5ba2d45bb 100644 --- a/src/utils/sdl2helper.h +++ b/src/utils/sdl2helper.h @@ -27,6 +27,7 @@ #include "localconsts.h" struct SDL_Surface; +struct SDL_SysWMinfo; struct SDL_Window; namespace SDL @@ -42,6 +43,8 @@ namespace SDL void setGamma(SDL_Window *const window, const float gamma); void setVsync(const int val); + + bool getWindowWMInfo(SDL_Window *const window, SDL_SysWMinfo *const info); } // namespace SDL #endif // USE_SDL2 diff --git a/src/utils/sdlhelper.cpp b/src/utils/sdlhelper.cpp index 2690554be..204dd921d 100644 --- a/src/utils/sdlhelper.cpp +++ b/src/utils/sdlhelper.cpp @@ -26,6 +26,7 @@ #include "utils/stringutils.h" +#include <SDL_syswm.h> #include <SDL_video.h> #include "debug.h" @@ -88,4 +89,10 @@ void SDL::setVsync(const int val) SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, val); } +bool SDL::getWindowWMInfo(SDL_Surface *const window A_UNUSED, + SDL_SysWMinfo *const info) +{ + return SDL_GetWMInfo(info); +} + #endif // USE_SDL2 diff --git a/src/utils/sdlhelper.h b/src/utils/sdlhelper.h index acaf7111b..27d5cc2ab 100644 --- a/src/utils/sdlhelper.h +++ b/src/utils/sdlhelper.h @@ -30,6 +30,7 @@ #include "localconsts.h" struct SDL_Surface; +struct SDL_SysWMinfo; namespace SDL { @@ -46,6 +47,9 @@ namespace SDL void setGamma(SDL_Surface *const window A_UNUSED, const float gamma); void setVsync(const int val); + + bool getWindowWMInfo(SDL_Surface *const window A_UNUSED, + SDL_SysWMinfo *const info); } // namespace SDL #endif // USE_SDL2 |