mirror of
https://github.com/glfw/glfw.git
synced 2026-09-18 22:55:46 +00:00
Implemented display iteration for x11. Added attributes and queries for physical size, name and logical position. Updated test executable.
This commit is contained in:
+22
-8
@@ -18,6 +18,7 @@ static void print_mode(GLFWvidmode* mode)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
GLFWdisplay displayHandle;
|
||||
GLFWvidmode dtmode, modes[400];
|
||||
int modecount, i;
|
||||
|
||||
@@ -32,15 +33,28 @@ int main(void)
|
||||
printf("Desktop mode: ");
|
||||
print_mode(&dtmode);
|
||||
|
||||
// List available video modes
|
||||
modecount = glfwGetVideoModes(modes, sizeof(modes) / sizeof(GLFWvidmode));
|
||||
printf("Available modes:\n");
|
||||
for (i = 0; i < modecount; i++)
|
||||
{
|
||||
printf("%3i: ", i);
|
||||
print_mode(modes + i);
|
||||
}
|
||||
displayHandle = GLFW_DISPLAY_INVALID_HANDLE;
|
||||
|
||||
while( GLFW_DISPLAY_INVALID_HANDLE != ( displayHandle = glfwGetNextDisplay( displayHandle )))
|
||||
{
|
||||
printf( "Display name: %s\n"
|
||||
"Physical dimensions: %dmm x %dmm\n"
|
||||
"Logical position: (%d,%d)\n",
|
||||
glfwGetDisplayStringParam( displayHandle, GLFW_DISPLAY_PARAM_S_NAME ),
|
||||
glfwGetDisplayIntegerParam( displayHandle, GLFW_DISPLAY_PARAM_I_PHYS_WIDTH ),
|
||||
glfwGetDisplayIntegerParam( displayHandle, GLFW_DISPLAY_PARAM_I_PHYS_HEIGHT ),
|
||||
glfwGetDisplayIntegerParam( displayHandle, GLFW_DISPLAY_PARAM_I_SCREEN_X_POS ),
|
||||
glfwGetDisplayIntegerParam( displayHandle, GLFW_DISPLAY_PARAM_I_SCREEN_Y_POS )
|
||||
);
|
||||
// List available video modes
|
||||
modecount = glfwGetVideoModes(displayHandle, modes, sizeof(modes) / sizeof(GLFWvidmode));
|
||||
printf( "Available modes:\n" );
|
||||
for( i = 0; i < modecount; i ++ )
|
||||
{
|
||||
printf("%3i: ", i);
|
||||
print_mode(modes + i);
|
||||
}
|
||||
}
|
||||
glfwTerminate();
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user