Merge pull request #789 from archshift/linuxvideo

Fix for black screen on Linux upon starting a game
This commit is contained in:
Lioncash 2014-08-21 15:55:29 -04:00
commit 48f52b9662
2 changed files with 19 additions and 1 deletions

View File

@ -97,6 +97,17 @@ bool cInterfaceGLX::Create(void *window_handle)
XWindow.Initialize(dpy); XWindow.Initialize(dpy);
Window parent = (Window)window_handle; Window parent = (Window)window_handle;
XWindowAttributes attribs;
if (!XGetWindowAttributes(dpy, parent, &attribs))
{
ERROR_LOG(VIDEO, "Window attribute retrieval failed");
return false;
}
s_backbuffer_width = attribs.width;
s_backbuffer_height = attribs.height;
win = XWindow.CreateXWindow(parent, vi); win = XWindow.CreateXWindow(parent, vi);
return true; return true;
} }

View File

@ -22,9 +22,16 @@ Window cX11Window::CreateXWindow(Window parent, XVisualInfo *vi)
// Setup window attributes // Setup window attributes
attr.colormap = colormap; attr.colormap = colormap;
XWindowAttributes attribs;
if (!XGetWindowAttributes(dpy, parent, &attribs))
{
ERROR_LOG(VIDEO, "Window attribute retrieval failed");
return 0;
}
// Create the window // Create the window
win = XCreateWindow(dpy, parent, win = XCreateWindow(dpy, parent,
0, 0, 1, 1, 0, 0, 0, attribs.width, attribs.height, 0,
vi->depth, InputOutput, vi->visual, vi->depth, InputOutput, vi->visual,
CWColormap, &attr); CWColormap, &attr);
XSelectInput(dpy, parent, StructureNotifyMask); XSelectInput(dpy, parent, StructureNotifyMask);