Don't pass Mode argument to GLContext_SelectVisual

This commit is contained in:
UnknownShadow200 2021-01-16 11:41:27 +11:00
parent d46dd99e58
commit f4c2ffa399
2 changed files with 12 additions and 10 deletions

View file

@ -341,9 +341,11 @@ static void ExtractFromFile(const cc_string* filename) {
String_Format1(&path, TEXPACKS_DIR "/%s", filename); String_Format1(&path, TEXPACKS_DIR "/%s", filename);
res = Stream_OpenFile(&stream, &path); res = Stream_OpenFile(&stream, &path);
if (res) { Logger_SysWarn2(res, "opening", &path); return; } if (res) {
ExtractFrom(&stream, &path); Logger_SysWarn2(res, "opening", &path); return;
}
ExtractFrom(&stream, &path);
res = stream.Close(&stream); res = stream.Close(&stream);
if (res) { Logger_SysWarn2(res, "closing", &path); } if (res) { Logger_SysWarn2(res, "closing", &path); }
} }

View file

@ -1228,7 +1228,7 @@ static void HookXErrors(void) {
/*########################################################################################################################* /*########################################################################################################################*
*--------------------------------------------------Public implementation--------------------------------------------------* *--------------------------------------------------Public implementation--------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
static XVisualInfo GLContext_SelectVisual(struct GraphicsMode* mode); static XVisualInfo GLContext_SelectVisual(void);
void Window_Init(void) { void Window_Init(void) {
Display* display = XOpenDisplay(NULL); Display* display = XOpenDisplay(NULL);
int screen; int screen;
@ -1265,19 +1265,17 @@ void Window_Create(int width, int height) {
XSetWindowAttributes attributes = { 0 }; XSetWindowAttributes attributes = { 0 };
XSizeHints hints = { 0 }; XSizeHints hints = { 0 };
Atom protocols[2]; Atom protocols[2];
struct GraphicsMode mode;
int supported, x, y; int supported, x, y;
x = Display_CentreX(width); x = Display_CentreX(width);
y = Display_CentreY(height); y = Display_CentreY(height);
InitGraphicsMode(&mode);
RegisterAtoms(); RegisterAtoms();
win_eventMask = StructureNotifyMask /*| SubstructureNotifyMask*/ | ExposureMask | win_eventMask = StructureNotifyMask /*| SubstructureNotifyMask*/ | ExposureMask |
KeyReleaseMask | KeyPressMask | KeymapStateMask | PointerMotionMask | KeyReleaseMask | KeyPressMask | KeymapStateMask | PointerMotionMask |
FocusChangeMask | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | FocusChangeMask | ButtonPressMask | ButtonReleaseMask | EnterWindowMask |
LeaveWindowMask | PropertyChangeMask; LeaveWindowMask | PropertyChangeMask;
win_visual = GLContext_SelectVisual(&mode); win_visual = GLContext_SelectVisual();
Platform_LogConst("Opening render window... "); Platform_LogConst("Opening render window... ");
attributes.colormap = XCreateColormap(win_display, win_rootWin, win_visual.visual, AllocNone); attributes.colormap = XCreateColormap(win_display, win_rootWin, win_visual.visual, AllocNone);
@ -4374,7 +4372,7 @@ static EGLConfig ctx_config;
static EGLint ctx_numConfig; static EGLint ctx_numConfig;
#ifdef CC_BUILD_X11 #ifdef CC_BUILD_X11
static XVisualInfo GLContext_SelectVisual(struct GraphicsMode* mode) { static XVisualInfo GLContext_SelectVisual(void) {
XVisualInfo info; XVisualInfo info;
cc_result res; cc_result res;
int screen = DefaultScreen(win_display); int screen = DefaultScreen(win_display);
@ -4654,7 +4652,7 @@ static void GetAttribs(struct GraphicsMode* mode, int* attribs, int depth) {
attribs[i++] = 0; attribs[i++] = 0;
} }
static XVisualInfo GLContext_SelectVisual(struct GraphicsMode* mode) { static XVisualInfo GLContext_SelectVisual(void) {
int attribs[20]; int attribs[20];
int major, minor; int major, minor;
XVisualInfo* visual = NULL; XVisualInfo* visual = NULL;
@ -4662,8 +4660,10 @@ static XVisualInfo GLContext_SelectVisual(struct GraphicsMode* mode) {
int fbcount, screen; int fbcount, screen;
GLXFBConfig* fbconfigs; GLXFBConfig* fbconfigs;
XVisualInfo info; XVisualInfo info;
struct GraphicsMode mode;
GetAttribs(mode, attribs, GLCONTEXT_DEFAULT_DEPTH); InitGraphicsMode(&mode);
GetAttribs(&mode, attribs, GLCONTEXT_DEFAULT_DEPTH);
if (!glXQueryVersion(win_display, &major, &minor)) { if (!glXQueryVersion(win_display, &major, &minor)) {
Logger_Abort("glXQueryVersion failed"); Logger_Abort("glXQueryVersion failed");
} }
@ -4685,7 +4685,7 @@ static XVisualInfo GLContext_SelectVisual(struct GraphicsMode* mode) {
} }
/* Some really old devices will only supply 16 bit depths */ /* Some really old devices will only supply 16 bit depths */
if (!visual) { if (!visual) {
GetAttribs(mode, attribs, 16); GetAttribs(&mode, attribs, 16);
visual = glXChooseVisual(win_display, screen, attribs); visual = glXChooseVisual(win_display, screen, attribs);
} }
if (!visual) Logger_Abort("Requested GraphicsMode not available."); if (!visual) Logger_Abort("Requested GraphicsMode not available.");