Fixes name conflict in X11 GL swap_interval
This commit is contained in:
parent
9b33cadbc1
commit
1077d74958
@ -403,18 +403,18 @@ char Fl_X11_Gl_Window_Driver::swap_type() {
|
||||
// -1 = not yet initialized, 0 = none found, 1 = GLX, 2 = MESA, 3 = SGI
|
||||
static signed char swap_interval_type = -1;
|
||||
|
||||
typedef void (*GLX_Set_Swap_Iterval_Proc) (Display *dpy, GLXDrawable drawable, int interval);
|
||||
typedef int (*MESA_Set_Swap_Iterval_Proc) (unsigned int interval);
|
||||
typedef int (*MESA_Get_Swap_Iterval_Proc) ();
|
||||
typedef int (*SGI_Set_Swap_Iterval_Proc) (int interval);
|
||||
typedef void (*Fl_GLX_Set_Swap_Iterval_Proc) (Display *dpy, GLXDrawable drawable, int interval);
|
||||
typedef int (*Fl_MESA_Set_Swap_Iterval_Proc) (unsigned int interval);
|
||||
typedef int (*Fl_MESA_Get_Swap_Iterval_Proc) ();
|
||||
typedef int (*Fl_SGI_Set_Swap_Iterval_Proc) (int interval);
|
||||
|
||||
static union {
|
||||
GLX_Set_Swap_Iterval_Proc EXT;
|
||||
MESA_Set_Swap_Iterval_Proc MESA;
|
||||
SGI_Set_Swap_Iterval_Proc SGI;
|
||||
} glXSwapInterval = { NULL };
|
||||
Fl_GLX_Set_Swap_Iterval_Proc EXT;
|
||||
Fl_MESA_Set_Swap_Iterval_Proc MESA;
|
||||
Fl_SGI_Set_Swap_Iterval_Proc SGI;
|
||||
} fl_glXSwapInterval = { NULL };
|
||||
|
||||
static MESA_Get_Swap_Iterval_Proc glXGetSwapIntervalMESA = NULL;
|
||||
static Fl_MESA_Get_Swap_Iterval_Proc fl_glXGetSwapIntervalMESA = NULL;
|
||||
|
||||
static void init_swap_interval() {
|
||||
if (swap_interval_type != -1) return;
|
||||
@ -423,14 +423,14 @@ static void init_swap_interval() {
|
||||
swap_interval_type = 0;
|
||||
const char *extensions = glXQueryExtensionsString(fl_display, fl_screen);
|
||||
if (strstr(extensions, "GLX_EXT_swap_control") && ((major > 1) || (minor >= 3))) {
|
||||
glXSwapInterval.EXT = (GLX_Set_Swap_Iterval_Proc)glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalEXT");
|
||||
fl_glXSwapInterval.EXT = (Fl_GLX_Set_Swap_Iterval_Proc)glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalEXT");
|
||||
swap_interval_type = 1;
|
||||
} else if (strstr(extensions, "GLX_MESA_swap_control")) {
|
||||
glXSwapInterval.MESA = (MESA_Set_Swap_Iterval_Proc)glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalMESA");
|
||||
glXGetSwapIntervalMESA = (MESA_Get_Swap_Iterval_Proc)glXGetProcAddressARB((const GLubyte*)"glXGetSwapIntervalMESA");
|
||||
fl_glXSwapInterval.MESA = (Fl_MESA_Set_Swap_Iterval_Proc)glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalMESA");
|
||||
fl_glXGetSwapIntervalMESA = (Fl_MESA_Get_Swap_Iterval_Proc)glXGetProcAddressARB((const GLubyte*)"glXGetSwapIntervalMESA");
|
||||
swap_interval_type = 2;
|
||||
} else if (strstr(extensions, "GLX_SGI_swap_control")) {
|
||||
glXSwapInterval.SGI = (SGI_Set_Swap_Iterval_Proc)glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalSGI");
|
||||
fl_glXSwapInterval.SGI = (Fl_SGI_Set_Swap_Iterval_Proc)glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalSGI");
|
||||
swap_interval_type = 3;
|
||||
}
|
||||
}
|
||||
@ -442,16 +442,16 @@ void Fl_X11_Gl_Window_Driver::swap_interval(int interval) {
|
||||
init_swap_interval();
|
||||
switch (swap_interval_type) {
|
||||
case 1:
|
||||
if (glXSwapInterval.EXT)
|
||||
glXSwapInterval.EXT(fl_display, fl_xid(pWindow), interval);
|
||||
if (fl_glXSwapInterval.EXT)
|
||||
fl_glXSwapInterval.EXT(fl_display, fl_xid(pWindow), interval);
|
||||
break;
|
||||
case 2:
|
||||
if (glXSwapInterval.MESA)
|
||||
glXSwapInterval.MESA((unsigned int)interval);
|
||||
if (fl_glXSwapInterval.MESA)
|
||||
fl_glXSwapInterval.MESA((unsigned int)interval);
|
||||
break;
|
||||
case 3:
|
||||
if (glXSwapInterval.SGI)
|
||||
glXSwapInterval.SGI(interval);
|
||||
if (fl_glXSwapInterval.SGI)
|
||||
fl_glXSwapInterval.SGI(interval);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -469,8 +469,8 @@ int Fl_X11_Gl_Window_Driver::swap_interval() const {
|
||||
interval = (int)val;
|
||||
break; }
|
||||
case 2:
|
||||
if (glXGetSwapIntervalMESA)
|
||||
interval = glXGetSwapIntervalMESA();
|
||||
if (fl_glXGetSwapIntervalMESA)
|
||||
interval = fl_glXGetSwapIntervalMESA();
|
||||
break;
|
||||
case 3:
|
||||
// not available
|
||||
|
Loading…
Reference in New Issue
Block a user