src/video/x11/edid-parse.c
author Sam Lantinga <slouken@libsdl.org>
Mon, 31 Dec 2012 18:32:30 -0800
changeset 6796 424a12862805
child 6797 8a818a373436
permissions -rw-r--r--
Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension. It turns out there's all kinds of good information in the EDID data for a monitor...
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6796
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     1
/*
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     2
 * Copyright 2007 Red Hat, Inc.
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     3
 *
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     4
 * Permission is hereby granted, free of charge, to any person obtaining a
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     5
 * copy of this software and associated documentation files (the "Software"),
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     6
 * to deal in the Software without restriction, including without limitation
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     7
 * on the rights to use, copy, modify, merge, publish, distribute, sub
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     8
 * license, and/or sell copies of the Software, and to permit persons to whom
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     9
 * the Software is furnished to do so, subject to the following conditions:
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    10
 *
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    11
 * The above copyright notice and this permission notice (including the next
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    12
 * paragraph) shall be included in all copies or substantial portions of the
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    13
 * Software.
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    14
 *
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    17
 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    18
 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    19
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    20
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    21
 */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    22
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    23
/* Author: Soren Sandmann <sandmann@redhat.com> */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    24
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    25
#include "edid.h"
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    26
#include <stdlib.h>
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    27
#include <string.h>
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    28
#include <math.h>
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    29
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    30
#define TRUE 1
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    31
#define FALSE 0
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    32
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    33
static int
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    34
get_bit (int in, int bit)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    35
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    36
    return (in & (1 << bit)) >> bit;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    37
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    38
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    39
static int
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    40
get_bits (int in, int begin, int end)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    41
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    42
    int mask = (1 << (end - begin + 1)) - 1;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    43
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    44
    return (in >> begin) & mask;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    45
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    46
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    47
static int
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    48
decode_header (const uchar *edid)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    49
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    50
    if (memcmp (edid, "\x00\xff\xff\xff\xff\xff\xff\x00", 8) == 0)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    51
	return TRUE;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    52
    return FALSE;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    53
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    54
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    55
static int
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    56
decode_vendor_and_product_identification (const uchar *edid, MonitorInfo *info)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    57
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    58
    int is_model_year;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    59
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    60
    /* Manufacturer Code */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    61
    info->manufacturer_code[0]  = get_bits (edid[0x08], 2, 6);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    62
    info->manufacturer_code[1]  = get_bits (edid[0x08], 0, 1) << 3;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    63
    info->manufacturer_code[1] |= get_bits (edid[0x09], 5, 7);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    64
    info->manufacturer_code[2]  = get_bits (edid[0x09], 0, 4);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    65
    info->manufacturer_code[3]  = '\0';
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    66
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    67
    info->manufacturer_code[0] += 'A' - 1;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    68
    info->manufacturer_code[1] += 'A' - 1;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    69
    info->manufacturer_code[2] += 'A' - 1;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    70
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    71
    /* Product Code */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    72
    info->product_code = edid[0x0b] << 8 | edid[0x0a];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    73
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    74
    /* Serial Number */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    75
    info->serial_number =
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    76
	edid[0x0c] | edid[0x0d] << 8 | edid[0x0e] << 16 | edid[0x0f] << 24;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    77
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    78
    /* Week and Year */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    79
    is_model_year = FALSE;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    80
    switch (edid[0x10])
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    81
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    82
    case 0x00:
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    83
	info->production_week = -1;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    84
	break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    85
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    86
    case 0xff:
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    87
	info->production_week = -1;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    88
	is_model_year = TRUE;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    89
	break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    90
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    91
    default:
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    92
	info->production_week = edid[0x10];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    93
	break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    94
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    95
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    96
    if (is_model_year)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    97
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    98
	info->production_year = -1;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    99
	info->model_year = 1990 + edid[0x11];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   100
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   101
    else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   102
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   103
	info->production_year = 1990 + edid[0x11];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   104
	info->model_year = -1;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   105
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   106
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   107
    return TRUE;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   108
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   109
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   110
static int
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   111
decode_edid_version (const uchar *edid, MonitorInfo *info)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   112
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   113
    info->major_version = edid[0x12];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   114
    info->minor_version = edid[0x13];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   115
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   116
    return TRUE;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   117
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   118
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   119
static int
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   120
decode_display_parameters (const uchar *edid, MonitorInfo *info)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   121
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   122
    /* Digital vs Analog */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   123
    info->is_digital = get_bit (edid[0x14], 7);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   124
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   125
    if (info->is_digital)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   126
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   127
	int bits;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   128
	
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   129
	static const int bit_depth[8] =
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   130
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   131
	    -1, 6, 8, 10, 12, 14, 16, -1
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   132
	};
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   133
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   134
	static const Interface interfaces[6] =
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   135
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   136
	    UNDEFINED, DVI, HDMI_A, HDMI_B, MDDI, DISPLAY_PORT
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   137
	};
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   138
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   139
	bits = get_bits (edid[0x14], 4, 6);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   140
	info->digital.bits_per_primary = bit_depth[bits];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   141
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   142
	bits = get_bits (edid[0x14], 0, 3);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   143
	
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   144
	if (bits <= 5)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   145
	    info->digital.interface = interfaces[bits];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   146
	else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   147
	    info->digital.interface = UNDEFINED;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   148
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   149
    else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   150
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   151
	int bits = get_bits (edid[0x14], 5, 6);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   152
	
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   153
	static const double levels[][3] =
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   154
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   155
	    { 0.7,   0.3,    1.0 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   156
	    { 0.714, 0.286,  1.0 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   157
	    { 1.0,   0.4,    1.4 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   158
	    { 0.7,   0.0,    0.7 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   159
	};
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   160
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   161
	info->analog.video_signal_level = levels[bits][0];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   162
	info->analog.sync_signal_level = levels[bits][1];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   163
	info->analog.total_signal_level = levels[bits][2];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   164
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   165
	info->analog.blank_to_black = get_bit (edid[0x14], 4);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   166
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   167
	info->analog.separate_hv_sync = get_bit (edid[0x14], 3);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   168
	info->analog.composite_sync_on_h = get_bit (edid[0x14], 2);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   169
	info->analog.composite_sync_on_green = get_bit (edid[0x14], 1);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   170
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   171
	info->analog.serration_on_vsync = get_bit (edid[0x14], 0);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   172
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   173
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   174
    /* Screen Size / Aspect Ratio */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   175
    if (edid[0x15] == 0 && edid[0x16] == 0)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   176
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   177
	info->width_mm = -1;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   178
	info->height_mm = -1;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   179
	info->aspect_ratio = -1.0;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   180
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   181
    else if (edid[0x16] == 0)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   182
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   183
	info->width_mm = -1;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   184
	info->height_mm = -1; 
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   185
	info->aspect_ratio = 100.0 / (edid[0x15] + 99);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   186
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   187
    else if (edid[0x15] == 0)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   188
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   189
	info->width_mm = -1;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   190
	info->height_mm = -1;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   191
	info->aspect_ratio = 100.0 / (edid[0x16] + 99);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   192
	info->aspect_ratio = 1/info->aspect_ratio; /* portrait */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   193
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   194
    else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   195
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   196
	info->width_mm = 10 * edid[0x15];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   197
	info->height_mm = 10 * edid[0x16];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   198
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   199
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   200
    /* Gamma */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   201
    if (edid[0x17] == 0xFF)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   202
	info->gamma = -1.0;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   203
    else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   204
	info->gamma = (edid[0x17] + 100.0) / 100.0;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   205
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   206
    /* Features */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   207
    info->standby = get_bit (edid[0x18], 7);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   208
    info->suspend = get_bit (edid[0x18], 6);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   209
    info->active_off = get_bit (edid[0x18], 5);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   210
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   211
    if (info->is_digital)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   212
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   213
	info->digital.rgb444 = TRUE;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   214
	if (get_bit (edid[0x18], 3))
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   215
	    info->digital.ycrcb444 = 1;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   216
	if (get_bit (edid[0x18], 4))
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   217
	    info->digital.ycrcb422 = 1;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   218
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   219
    else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   220
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   221
	int bits = get_bits (edid[0x18], 3, 4);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   222
	ColorType color_type[4] =
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   223
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   224
	    MONOCHROME, RGB, OTHER_COLOR, UNDEFINED_COLOR
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   225
	};
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   226
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   227
	info->analog.color_type = color_type[bits];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   228
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   229
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   230
    info->srgb_is_standard = get_bit (edid[0x18], 2);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   231
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   232
    /* In 1.3 this is called "has preferred timing" */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   233
    info->preferred_timing_includes_native = get_bit (edid[0x18], 1);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   234
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   235
    /* FIXME: In 1.3 this indicates whether the monitor accepts GTF */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   236
    info->continuous_frequency = get_bit (edid[0x18], 0);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   237
    return TRUE;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   238
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   239
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   240
static double
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   241
decode_fraction (int high, int low)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   242
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   243
    double result = 0.0;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   244
    int i;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   245
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   246
    high = (high << 2) | low;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   247
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   248
    for (i = 0; i < 10; ++i)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   249
	result += get_bit (high, i) * pow (2, i - 10);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   250
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   251
    return result;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   252
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   253
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   254
static int
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   255
decode_color_characteristics (const uchar *edid, MonitorInfo *info)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   256
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   257
    info->red_x = decode_fraction (edid[0x1b], get_bits (edid[0x19], 6, 7));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   258
    info->red_y = decode_fraction (edid[0x1c], get_bits (edid[0x19], 5, 4));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   259
    info->green_x = decode_fraction (edid[0x1d], get_bits (edid[0x19], 2, 3));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   260
    info->green_y = decode_fraction (edid[0x1e], get_bits (edid[0x19], 0, 1));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   261
    info->blue_x = decode_fraction (edid[0x1f], get_bits (edid[0x1a], 6, 7));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   262
    info->blue_y = decode_fraction (edid[0x20], get_bits (edid[0x1a], 4, 5));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   263
    info->white_x = decode_fraction (edid[0x21], get_bits (edid[0x1a], 2, 3));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   264
    info->white_y = decode_fraction (edid[0x22], get_bits (edid[0x1a], 0, 1));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   265
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   266
    return TRUE;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   267
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   268
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   269
static int
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   270
decode_established_timings (const uchar *edid, MonitorInfo *info)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   271
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   272
    static const Timing established[][8] = 
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   273
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   274
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   275
	    { 800, 600, 60 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   276
	    { 800, 600, 56 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   277
	    { 640, 480, 75 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   278
	    { 640, 480, 72 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   279
	    { 640, 480, 67 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   280
	    { 640, 480, 60 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   281
	    { 720, 400, 88 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   282
	    { 720, 400, 70 }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   283
	},
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   284
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   285
	    { 1280, 1024, 75 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   286
	    { 1024, 768, 75 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   287
	    { 1024, 768, 70 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   288
	    { 1024, 768, 60 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   289
	    { 1024, 768, 87 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   290
	    { 832, 624, 75 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   291
	    { 800, 600, 75 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   292
	    { 800, 600, 72 }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   293
	},
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   294
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   295
	    { 0, 0, 0 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   296
	    { 0, 0, 0 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   297
	    { 0, 0, 0 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   298
	    { 0, 0, 0 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   299
	    { 0, 0, 0 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   300
	    { 0, 0, 0 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   301
	    { 0, 0, 0 },
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   302
	    { 1152, 870, 75 }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   303
	},
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   304
    };
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   305
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   306
    int i, j, idx;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   307
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   308
    idx = 0;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   309
    for (i = 0; i < 3; ++i)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   310
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   311
	for (j = 0; j < 8; ++j)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   312
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   313
	    int byte = edid[0x23 + i];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   314
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   315
	    if (get_bit (byte, j) && established[i][j].frequency != 0)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   316
		info->established[idx++] = established[i][j];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   317
	}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   318
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   319
    return TRUE;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   320
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   321
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   322
static int
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   323
decode_standard_timings (const uchar *edid, MonitorInfo *info)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   324
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   325
    int i;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   326
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   327
    for (i = 0; i < 8; i++)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   328
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   329
	int first = edid[0x26 + 2 * i];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   330
	int second = edid[0x27 + 2 * i];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   331
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   332
	if (first != 0x01 && second != 0x01)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   333
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   334
	    int w = 8 * (first + 31);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   335
	    int h;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   336
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   337
	    switch (get_bits (second, 6, 7))
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   338
	    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   339
	    case 0x00: h = (w / 16) * 10; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   340
	    case 0x01: h = (w / 4) * 3; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   341
	    case 0x02: h = (w / 5) * 4; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   342
	    case 0x03: h = (w / 16) * 9; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   343
	    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   344
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   345
	    info->standard[i].width = w;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   346
	    info->standard[i].height = h;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   347
	    info->standard[i].frequency = get_bits (second, 0, 5) + 60;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   348
	}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   349
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   350
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   351
    return TRUE;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   352
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   353
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   354
static void
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   355
decode_lf_string (const uchar *s, int n_chars, char *result)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   356
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   357
    int i;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   358
    for (i = 0; i < n_chars; ++i)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   359
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   360
	if (s[i] == 0x0a)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   361
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   362
	    *result++ = '\0';
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   363
	    break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   364
	}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   365
	else if (s[i] == 0x00)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   366
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   367
	    /* Convert embedded 0's to spaces */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   368
	    *result++ = ' ';
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   369
	}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   370
	else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   371
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   372
	    *result++ = s[i];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   373
	}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   374
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   375
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   376
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   377
static void
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   378
decode_display_descriptor (const uchar *desc,
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   379
			   MonitorInfo *info)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   380
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   381
    switch (desc[0x03])
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   382
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   383
    case 0xFC:
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   384
	decode_lf_string (desc + 5, 13, info->dsc_product_name);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   385
	break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   386
    case 0xFF:
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   387
	decode_lf_string (desc + 5, 13, info->dsc_serial_number);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   388
	break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   389
    case 0xFE:
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   390
	decode_lf_string (desc + 5, 13, info->dsc_string);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   391
	break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   392
    case 0xFD:
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   393
	/* Range Limits */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   394
	break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   395
    case 0xFB:
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   396
	/* Color Point */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   397
	break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   398
    case 0xFA:
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   399
	/* Timing Identifications */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   400
	break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   401
    case 0xF9:
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   402
	/* Color Management */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   403
	break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   404
    case 0xF8:
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   405
	/* Timing Codes */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   406
	break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   407
    case 0xF7:
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   408
	/* Established Timings */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   409
	break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   410
    case 0x10:
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   411
	break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   412
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   413
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   414
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   415
static void
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   416
decode_detailed_timing (const uchar *timing,
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   417
			DetailedTiming *detailed)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   418
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   419
    int bits;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   420
    StereoType stereo[] =
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   421
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   422
	NO_STEREO, NO_STEREO, FIELD_RIGHT, FIELD_LEFT,
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   423
	TWO_WAY_RIGHT_ON_EVEN, TWO_WAY_LEFT_ON_EVEN,
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   424
	FOUR_WAY_INTERLEAVED, SIDE_BY_SIDE
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   425
    };
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   426
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   427
    detailed->pixel_clock = (timing[0x00] | timing[0x01] << 8) * 10000;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   428
    detailed->h_addr = timing[0x02] | ((timing[0x04] & 0xf0) << 4);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   429
    detailed->h_blank = timing[0x03] | ((timing[0x04] & 0x0f) << 8);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   430
    detailed->v_addr = timing[0x05] | ((timing[0x07] & 0xf0) << 4);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   431
    detailed->v_blank = timing[0x06] | ((timing[0x07] & 0x0f) << 8);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   432
    detailed->h_front_porch = timing[0x08] | get_bits (timing[0x0b], 6, 7) << 8;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   433
    detailed->h_sync = timing[0x09] | get_bits (timing[0x0b], 4, 5) << 8;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   434
    detailed->v_front_porch =
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   435
	get_bits (timing[0x0a], 4, 7) | get_bits (timing[0x0b], 2, 3) << 4;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   436
    detailed->v_sync =
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   437
	get_bits (timing[0x0a], 0, 3) | get_bits (timing[0x0b], 0, 1) << 4;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   438
    detailed->width_mm =  timing[0x0c] | get_bits (timing[0x0e], 4, 7) << 8;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   439
    detailed->height_mm = timing[0x0d] | get_bits (timing[0x0e], 0, 3) << 8;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   440
    detailed->right_border = timing[0x0f];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   441
    detailed->top_border = timing[0x10];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   442
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   443
    detailed->interlaced = get_bit (timing[0x11], 7);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   444
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   445
    /* Stereo */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   446
    bits = get_bits (timing[0x11], 5, 6) << 1 | get_bit (timing[0x11], 0);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   447
    detailed->stereo = stereo[bits];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   448
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   449
    /* Sync */
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   450
    bits = timing[0x11];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   451
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   452
    detailed->digital_sync = get_bit (bits, 4);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   453
    if (detailed->digital_sync)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   454
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   455
	detailed->digital.composite = !get_bit (bits, 3);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   456
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   457
	if (detailed->digital.composite)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   458
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   459
	    detailed->digital.serrations = get_bit (bits, 2);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   460
	    detailed->digital.negative_vsync = FALSE;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   461
	}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   462
	else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   463
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   464
	    detailed->digital.serrations = FALSE;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   465
	    detailed->digital.negative_vsync = !get_bit (bits, 2);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   466
	}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   467
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   468
	detailed->digital.negative_hsync = !get_bit (bits, 0);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   469
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   470
    else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   471
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   472
	detailed->analog.bipolar = get_bit (bits, 3);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   473
	detailed->analog.serrations = get_bit (bits, 2);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   474
	detailed->analog.sync_on_green = !get_bit (bits, 1);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   475
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   476
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   477
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   478
static int
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   479
decode_descriptors (const uchar *edid, MonitorInfo *info)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   480
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   481
    int i;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   482
    int timing_idx;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   483
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   484
    timing_idx = 0;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   485
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   486
    for (i = 0; i < 4; ++i)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   487
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   488
	int index = 0x36 + i * 18;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   489
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   490
	if (edid[index + 0] == 0x00 && edid[index + 1] == 0x00)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   491
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   492
	    decode_display_descriptor (edid + index, info);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   493
	}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   494
	else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   495
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   496
	    decode_detailed_timing (
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   497
		edid + index, &(info->detailed_timings[timing_idx++]));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   498
	}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   499
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   500
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   501
    info->n_detailed_timings = timing_idx;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   502
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   503
    return TRUE;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   504
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   505
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   506
static void
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   507
decode_check_sum (const uchar *edid,
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   508
		  MonitorInfo *info)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   509
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   510
    int i;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   511
    uchar check = 0;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   512
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   513
    for (i = 0; i < 128; ++i)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   514
	check += edid[i];
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   515
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   516
    info->checksum = check;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   517
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   518
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   519
MonitorInfo *
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   520
decode_edid (const uchar *edid)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   521
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   522
    MonitorInfo *info = calloc (1, sizeof (MonitorInfo));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   523
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   524
    decode_check_sum (edid, info);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   525
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   526
    if (!decode_header (edid))
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   527
	return NULL;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   528
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   529
    if (!decode_vendor_and_product_identification (edid, info))
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   530
	return NULL;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   531
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   532
    if (!decode_edid_version (edid, info))
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   533
	return NULL;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   534
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   535
    if (!decode_display_parameters (edid, info))
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   536
	return NULL;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   537
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   538
    if (!decode_color_characteristics (edid, info))
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   539
	return NULL;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   540
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   541
    if (!decode_established_timings (edid, info))
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   542
	return NULL;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   543
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   544
    if (!decode_standard_timings (edid, info))
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   545
	return NULL;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   546
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   547
    if (!decode_descriptors (edid, info))
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   548
	return NULL;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   549
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   550
    return info;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   551
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   552
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   553
static const char *
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   554
yesno (int v)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   555
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   556
    return v? "yes" : "no";
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   557
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   558
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   559
void
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   560
dump_monitor_info (MonitorInfo *info)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   561
{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   562
    char *s;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   563
    int i;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   564
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   565
    printf ("Checksum: %d (%s)\n",
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   566
	    info->checksum, info->checksum? "incorrect" : "correct");
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   567
    printf ("Manufacturer Code: %s\n", info->manufacturer_code);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   568
    printf ("Product Code: 0x%x\n", info->product_code);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   569
    printf ("Serial Number: %u\n", info->serial_number);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   570
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   571
    if (info->production_week != -1)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   572
	printf ("Production Week: %d\n", info->production_week);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   573
    else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   574
	printf ("Production Week: unspecified\n");
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   575
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   576
    if (info->production_year != -1)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   577
	printf ("Production Year: %d\n", info->production_year);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   578
    else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   579
	printf ("Production Year: unspecified\n");
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   580
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   581
    if (info->model_year != -1)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   582
	printf ("Model Year: %d\n", info->model_year);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   583
    else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   584
	printf ("Model Year: unspecified\n");
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   585
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   586
    printf ("EDID revision: %d.%d\n", info->major_version, info->minor_version);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   587
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   588
    printf ("Display is %s\n", info->is_digital? "digital" : "analog");
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   589
    if (info->is_digital)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   590
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   591
	const char *interface;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   592
	if (info->digital.bits_per_primary != -1)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   593
	    printf ("Bits Per Primary: %d\n", info->digital.bits_per_primary);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   594
	else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   595
	    printf ("Bits Per Primary: undefined\n");
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   596
	
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   597
	switch (info->digital.interface)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   598
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   599
	case DVI: interface = "DVI"; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   600
	case HDMI_A: interface = "HDMI-a"; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   601
	case HDMI_B: interface = "HDMI-b"; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   602
	case MDDI: interface = "MDDI"; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   603
	case DISPLAY_PORT: interface = "DisplayPort"; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   604
	case UNDEFINED: interface = "undefined"; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   605
	}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   606
	printf ("Interface: %s\n", interface);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   607
	
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   608
	printf ("RGB 4:4:4: %s\n", yesno (info->digital.rgb444));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   609
	printf ("YCrCb 4:4:4: %s\n", yesno (info->digital.ycrcb444));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   610
	printf ("YCrCb 4:2:2: %s\n", yesno (info->digital.ycrcb422));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   611
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   612
    else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   613
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   614
	printf ("Video Signal Level: %f\n", info->analog.video_signal_level);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   615
	printf ("Sync Signal Level: %f\n", info->analog.sync_signal_level);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   616
	printf ("Total Signal Level: %f\n", info->analog.total_signal_level);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   617
	
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   618
	printf ("Blank to Black: %s\n",
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   619
		yesno (info->analog.blank_to_black));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   620
	printf ("Separate HV Sync: %s\n",
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   621
		yesno (info->analog.separate_hv_sync));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   622
	printf ("Composite Sync on H: %s\n",
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   623
		yesno (info->analog.composite_sync_on_h));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   624
	printf ("Serration on VSync: %s\n",
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   625
		yesno (info->analog.serration_on_vsync));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   626
	
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   627
	switch (info->analog.color_type)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   628
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   629
	case UNDEFINED_COLOR: s = "undefined"; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   630
	case MONOCHROME: s = "monochrome"; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   631
	case RGB: s = "rgb"; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   632
	case OTHER_COLOR: s = "other color"; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   633
	};
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   634
	
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   635
	printf ("Color: %s\n", s);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   636
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   637
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   638
    if (info->width_mm == -1)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   639
	printf ("Width: undefined\n");
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   640
    else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   641
	printf ("Width: %d mm\n", info->width_mm);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   642
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   643
    if (info->height_mm == -1)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   644
	printf ("Height: undefined\n");
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   645
    else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   646
	printf ("Height: %d mm\n", info->height_mm);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   647
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   648
    if (info->aspect_ratio > 0)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   649
	printf ("Aspect Ratio: %f\n", info->aspect_ratio);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   650
    else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   651
	printf ("Aspect Ratio: undefined\n");
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   652
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   653
    if (info->gamma >= 0)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   654
	printf ("Gamma: %f\n", info->gamma);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   655
    else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   656
	printf ("Gamma: undefined\n");
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   657
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   658
    printf ("Standby: %s\n", yesno (info->standby));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   659
    printf ("Suspend: %s\n", yesno (info->suspend));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   660
    printf ("Active Off: %s\n", yesno (info->active_off));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   661
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   662
    printf ("SRGB is Standard: %s\n", yesno (info->srgb_is_standard));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   663
    printf ("Preferred Timing Includes Native: %s\n",
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   664
	    yesno (info->preferred_timing_includes_native));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   665
    printf ("Continuous Frequency: %s\n", yesno (info->continuous_frequency));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   666
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   667
    printf ("Red X: %f\n", info->red_x);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   668
    printf ("Red Y: %f\n", info->red_y);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   669
    printf ("Green X: %f\n", info->green_x);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   670
    printf ("Green Y: %f\n", info->green_y);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   671
    printf ("Blue X: %f\n", info->blue_x);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   672
    printf ("Blue Y: %f\n", info->blue_y);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   673
    printf ("White X: %f\n", info->white_x);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   674
    printf ("White Y: %f\n", info->white_y);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   675
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   676
    printf ("Established Timings:\n");
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   677
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   678
    for (i = 0; i < 24; ++i)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   679
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   680
	Timing *timing = &(info->established[i]);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   681
	
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   682
	if (timing->frequency == 0)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   683
	    break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   684
	
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   685
	printf ("  %d x %d @ %d Hz\n",
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   686
		timing->width, timing->height, timing->frequency);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   687
	
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   688
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   689
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   690
    printf ("Standard Timings:\n");
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   691
    for (i = 0; i < 8; ++i)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   692
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   693
	Timing *timing = &(info->standard[i]);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   694
	
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   695
	if (timing->frequency == 0)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   696
	    break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   697
	
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   698
	printf ("  %d x %d @ %d Hz\n",
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   699
		timing->width, timing->height, timing->frequency);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   700
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   701
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   702
    for (i = 0; i < info->n_detailed_timings; ++i)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   703
    {
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   704
	DetailedTiming *timing = &(info->detailed_timings[i]);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   705
	const char *s;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   706
	
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   707
	printf ("Timing%s: \n",
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   708
		(i == 0 && info->preferred_timing_includes_native)?
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   709
		" (Preferred)" : "");
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   710
	printf ("  Pixel Clock: %d\n", timing->pixel_clock);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   711
	printf ("  H Addressable: %d\n", timing->h_addr);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   712
	printf ("  H Blank: %d\n", timing->h_blank);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   713
	printf ("  H Front Porch: %d\n", timing->h_front_porch);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   714
	printf ("  H Sync: %d\n", timing->h_sync);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   715
	printf ("  V Addressable: %d\n", timing->v_addr);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   716
	printf ("  V Blank: %d\n", timing->v_blank);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   717
	printf ("  V Front Porch: %d\n", timing->v_front_porch);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   718
	printf ("  V Sync: %d\n", timing->v_sync);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   719
	printf ("  Width: %d mm\n", timing->width_mm);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   720
	printf ("  Height: %d mm\n", timing->height_mm);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   721
	printf ("  Right Border: %d\n", timing->right_border);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   722
	printf ("  Top Border: %d\n", timing->top_border);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   723
	switch (timing->stereo)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   724
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   725
	case NO_STEREO:   s = "No Stereo"; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   726
	case FIELD_RIGHT: s = "Field Sequential, Right on Sync"; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   727
	case FIELD_LEFT:  s = "Field Sequential, Left on Sync"; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   728
	case TWO_WAY_RIGHT_ON_EVEN: s = "Two-way, Right on Even"; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   729
	case TWO_WAY_LEFT_ON_EVEN:  s = "Two-way, Left on Even"; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   730
	case FOUR_WAY_INTERLEAVED:  s = "Four-way Interleaved"; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   731
	case SIDE_BY_SIDE:          s = "Side-by-Side"; break;
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   732
	}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   733
	printf ("  Stereo: %s\n", s);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   734
	
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   735
	if (timing->digital_sync)
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   736
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   737
	    printf ("  Digital Sync:\n");
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   738
	    printf ("    composite: %s\n", yesno (timing->digital.composite));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   739
	    printf ("    serrations: %s\n", yesno (timing->digital.serrations));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   740
	    printf ("    negative vsync: %s\n",
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   741
		    yesno (timing->digital.negative_vsync));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   742
	    printf ("    negative hsync: %s\n",
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   743
		    yesno (timing->digital.negative_hsync));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   744
	}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   745
	else
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   746
	{
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   747
	    printf ("  Analog Sync:\n");
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   748
	    printf ("    bipolar: %s\n", yesno (timing->analog.bipolar));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   749
	    printf ("    serrations: %s\n", yesno (timing->analog.serrations));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   750
	    printf ("    sync on green: %s\n", yesno (
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   751
			timing->analog.sync_on_green));
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   752
	}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   753
    }
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   754
    
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   755
    printf ("Detailed Product information:\n");
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   756
    printf ("  Product Name: %s\n", info->dsc_product_name);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   757
    printf ("  Serial Number: %s\n", info->dsc_serial_number);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   758
    printf ("  Unspecified String: %s\n", info->dsc_string);
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   759
}
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   760