Sync detect_prime_x11.cpp formatting changes from 3.x branch

This commit is contained in:
Wilson E. Alvarez 2021-12-17 15:02:21 -05:00
parent b0e93711b3
commit 3c198aecaa
No known key found for this signature in database
GPG key ID: A32174A3D2ED3F9E

View file

@ -91,7 +91,7 @@ void create_context() {
}; };
int fbcount; int fbcount;
GLXFBConfig fbconfig = 0; GLXFBConfig fbconfig = nullptr;
XVisualInfo *vi = nullptr; XVisualInfo *vi = nullptr;
XSetWindowAttributes swa; XSetWindowAttributes swa;
@ -100,8 +100,9 @@ void create_context() {
unsigned long valuemask = CWBorderPixel | CWColormap | CWEventMask; unsigned long valuemask = CWBorderPixel | CWColormap | CWEventMask;
GLXFBConfig *fbc = glXChooseFBConfig(x11_display, DefaultScreen(x11_display), visual_attribs, &fbcount); GLXFBConfig *fbc = glXChooseFBConfig(x11_display, DefaultScreen(x11_display), visual_attribs, &fbcount);
if (!fbc) if (!fbc) {
exit(1); exit(1);
}
vi = glXGetVisualFromFBConfig(x11_display, fbc[0]); vi = glXGetVisualFromFBConfig(x11_display, fbc[0]);
@ -120,8 +121,9 @@ void create_context() {
swa.colormap = XCreateColormap(x11_display, RootWindow(x11_display, vi->screen), vi->visual, AllocNone); swa.colormap = XCreateColormap(x11_display, RootWindow(x11_display, vi->screen), vi->visual, AllocNone);
x11_window = XCreateWindow(x11_display, RootWindow(x11_display, vi->screen), 0, 0, 10, 10, 0, vi->depth, InputOutput, vi->visual, valuemask, &swa); x11_window = XCreateWindow(x11_display, RootWindow(x11_display, vi->screen), 0, 0, 10, 10, 0, vi->depth, InputOutput, vi->visual, valuemask, &swa);
if (!x11_window) if (!x11_window) {
exit(1); exit(1);
}
glXMakeCurrent(x11_display, x11_window, glx_context); glXMakeCurrent(x11_display, x11_window, glx_context);
XFree(vi); XFree(vi);
@ -179,8 +181,9 @@ int detect_prime() {
close(fdset[0]); close(fdset[0]);
if (i) if (i) {
setenv("DRI_PRIME", "1", 1); setenv("DRI_PRIME", "1", 1);
}
create_context(); create_context();
const char *vendor = (const char *)glGetString(GL_VENDOR); const char *vendor = (const char *)glGetString(GL_VENDOR);