Add Cocoa graphics switching to glfwinfo

This commit is contained in:
Camilla Löwy 2019-03-27 15:59:36 +01:00
parent 056c5d3f90
commit 9e54b97cfa

View File

@ -100,6 +100,7 @@ static void usage(void)
printf(" --srgb request an sRGB capable framebuffer\n"); printf(" --srgb request an sRGB capable framebuffer\n");
printf(" --singlebuffer request single-buffering\n"); printf(" --singlebuffer request single-buffering\n");
printf(" --no-error request a context that does not emit errors\n"); printf(" --no-error request a context that does not emit errors\n");
printf(" --graphics-switching request macOS graphics switching\n");
} }
static void error_callback(int error, const char* description) static void error_callback(int error, const char* description)
@ -369,7 +370,8 @@ int main(int argc, char** argv)
MAJOR, MINOR, PROFILE, ROBUSTNESS, VERSION, MAJOR, MINOR, PROFILE, ROBUSTNESS, VERSION,
REDBITS, GREENBITS, BLUEBITS, ALPHABITS, DEPTHBITS, STENCILBITS, REDBITS, GREENBITS, BLUEBITS, ALPHABITS, DEPTHBITS, STENCILBITS,
ACCUMREDBITS, ACCUMGREENBITS, ACCUMBLUEBITS, ACCUMALPHABITS, ACCUMREDBITS, ACCUMGREENBITS, ACCUMBLUEBITS, ACCUMALPHABITS,
AUXBUFFERS, SAMPLES, STEREO, SRGB, SINGLEBUFFER, NOERROR_SRSLY }; AUXBUFFERS, SAMPLES, STEREO, SRGB, SINGLEBUFFER, NOERROR_SRSLY,
GRAPHICS_SWITCHING };
const struct option options[] = const struct option options[] =
{ {
{ "behavior", 1, NULL, BEHAVIOR }, { "behavior", 1, NULL, BEHAVIOR },
@ -401,6 +403,7 @@ int main(int argc, char** argv)
{ "srgb", 0, NULL, SRGB }, { "srgb", 0, NULL, SRGB },
{ "singlebuffer", 0, NULL, SINGLEBUFFER }, { "singlebuffer", 0, NULL, SINGLEBUFFER },
{ "no-error", 0, NULL, NOERROR_SRSLY }, { "no-error", 0, NULL, NOERROR_SRSLY },
{ "graphics-switching", 0, NULL, GRAPHICS_SWITCHING },
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
@ -615,6 +618,9 @@ int main(int argc, char** argv)
case NOERROR_SRSLY: case NOERROR_SRSLY:
glfwWindowHint(GLFW_CONTEXT_NO_ERROR, GLFW_TRUE); glfwWindowHint(GLFW_CONTEXT_NO_ERROR, GLFW_TRUE);
break; break;
case GRAPHICS_SWITCHING:
glfwWindowHint(GLFW_COCOA_GRAPHICS_SWITCHING, GLFW_TRUE);
break;
default: default:
usage(); usage();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);