|
@@ -61,8 +61,6 @@ PlatformWindowManagerSDL::PlatformWindowManagerSDL()
|
|
mOffscreenRender = false;
|
|
mOffscreenRender = false;
|
|
|
|
|
|
mInputState = KeyboardInputState::NONE;
|
|
mInputState = KeyboardInputState::NONE;
|
|
-
|
|
|
|
- buildMonitorsList();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
PlatformWindowManagerSDL::~PlatformWindowManagerSDL()
|
|
PlatformWindowManagerSDL::~PlatformWindowManagerSDL()
|
|
@@ -75,9 +73,8 @@ PlatformWindowManagerSDL::~PlatformWindowManagerSDL()
|
|
|
|
|
|
RectI PlatformWindowManagerSDL::getPrimaryDesktopArea()
|
|
RectI PlatformWindowManagerSDL::getPrimaryDesktopArea()
|
|
{
|
|
{
|
|
- // TODO SDL
|
|
|
|
- AssertFatal(0, "");
|
|
|
|
- return RectI(0,0,0,0);
|
|
|
|
|
|
+ // Primary is monitor 0
|
|
|
|
+ return getMonitorRect(0);
|
|
}
|
|
}
|
|
|
|
|
|
Point2I PlatformWindowManagerSDL::getDesktopResolution()
|
|
Point2I PlatformWindowManagerSDL::getDesktopResolution()
|
|
@@ -100,46 +97,60 @@ S32 PlatformWindowManagerSDL::getDesktopBitDepth()
|
|
return bbp;
|
|
return bbp;
|
|
}
|
|
}
|
|
|
|
|
|
-void PlatformWindowManagerSDL::buildMonitorsList()
|
|
|
|
-{
|
|
|
|
- // TODO SDL
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
S32 PlatformWindowManagerSDL::findFirstMatchingMonitor(const char* name)
|
|
S32 PlatformWindowManagerSDL::findFirstMatchingMonitor(const char* name)
|
|
{
|
|
{
|
|
- /// TODO SDL
|
|
|
|
- AssertFatal(0, "");
|
|
|
|
|
|
+ S32 count = SDL_GetNumVideoDisplays();
|
|
|
|
+ for (U32 index = 0; index < count; ++index)
|
|
|
|
+ {
|
|
|
|
+ if (dStrstr(name, SDL_GetDisplayName(index)) == name)
|
|
|
|
+ return index;
|
|
|
|
+ }
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
U32 PlatformWindowManagerSDL::getMonitorCount()
|
|
U32 PlatformWindowManagerSDL::getMonitorCount()
|
|
{
|
|
{
|
|
- // TODO SDL
|
|
|
|
- AssertFatal(0, "");
|
|
|
|
- return 1;
|
|
|
|
|
|
+ S32 monitorCount = SDL_GetNumVideoDisplays();
|
|
|
|
+ if (monitorCount < 0)
|
|
|
|
+ {
|
|
|
|
+ Con::errorf("SDL_GetNumVideoDisplays() failed: %s", SDL_GetError());
|
|
|
|
+ monitorCount = 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return (U32)monitorCount;
|
|
}
|
|
}
|
|
|
|
|
|
const char* PlatformWindowManagerSDL::getMonitorName(U32 index)
|
|
const char* PlatformWindowManagerSDL::getMonitorName(U32 index)
|
|
{
|
|
{
|
|
- // TODO SDL
|
|
|
|
- AssertFatal(0, "");
|
|
|
|
|
|
+ const char* monitorName = SDL_GetDisplayName(index);
|
|
|
|
+ if (monitorName == NULL)
|
|
|
|
+ Con::errorf("SDL_GetDisplayName() failed: %s", SDL_GetError());
|
|
|
|
|
|
- return "Monitor";
|
|
|
|
|
|
+ return monitorName;
|
|
}
|
|
}
|
|
|
|
|
|
RectI PlatformWindowManagerSDL::getMonitorRect(U32 index)
|
|
RectI PlatformWindowManagerSDL::getMonitorRect(U32 index)
|
|
{
|
|
{
|
|
- // TODO SDL
|
|
|
|
- AssertFatal(0, "");
|
|
|
|
|
|
+ SDL_Rect sdlRect;
|
|
|
|
+ if (0 != SDL_GetDisplayBounds(index, &sdlRect))
|
|
|
|
+ {
|
|
|
|
+ Con::errorf("SDL_GetDisplayBounds() failed: %s", SDL_GetError());
|
|
|
|
+ return RectI(0, 0, 0, 0);
|
|
|
|
+ }
|
|
|
|
|
|
- return RectI(0, 0, 0,0 );
|
|
|
|
|
|
+ return RectI(sdlRect.x, sdlRect.y, sdlRect.w, sdlRect.h);
|
|
}
|
|
}
|
|
|
|
|
|
void PlatformWindowManagerSDL::getMonitorRegions(Vector<RectI> ®ions)
|
|
void PlatformWindowManagerSDL::getMonitorRegions(Vector<RectI> ®ions)
|
|
{
|
|
{
|
|
- // TODO SDL
|
|
|
|
- AssertFatal(0, "");
|
|
|
|
|
|
+ SDL_Rect sdlRect;
|
|
|
|
+ S32 monitorCount = SDL_GetNumVideoDisplays();
|
|
|
|
+ for (S32 index = 0; index < monitorCount; ++index)
|
|
|
|
+ {
|
|
|
|
+ if (0 == SDL_GetDisplayBounds(index, &sdlRect))
|
|
|
|
+ regions.push_back(RectI(sdlRect.x, sdlRect.y, sdlRect.w, sdlRect.h));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
void PlatformWindowManagerSDL::getWindows(VectorPtr<PlatformWindow*> &windows)
|
|
void PlatformWindowManagerSDL::getWindows(VectorPtr<PlatformWindow*> &windows)
|