From 378a92b4c6ea652a02855a6b73e06290acc69268 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Sat, 9 Apr 2011 06:28:28 +0000 Subject: [PATCH] GSdx: Quick sanity check before creating a SDL window. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4558 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/GSWnd.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/GSdx/GSWnd.cpp b/plugins/GSdx/GSWnd.cpp index 41bb0affbc..60579f183f 100644 --- a/plugins/GSdx/GSWnd.cpp +++ b/plugins/GSdx/GSWnd.cpp @@ -327,7 +327,7 @@ GSWnd::~GSWnd() // Actually the destructor is not called when there is a GSclose or GSshutdown // The window still need to be closed -void GSWnd::Detach() +void GSWnd::Detach() { if(m_window != NULL) { @@ -345,6 +345,11 @@ bool GSWnd::Create(const string& title, int w, int h) h = theApp.GetConfig("ModeHeight", 480); } +#ifdef _LINUX + // Sanity check; if there aren't any video displays available, we can't create a window. + if (SDL_GetNumVideoDisplays() <= 0) return false; +#endif + m_window = SDL_CreateWindow(title.c_str(), 100, 100, w, h, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE); return true;