1706f2543Smrg/* 2706f2543Smrg * Copyright 2003 Red Hat Inc., Durham, North Carolina. 3706f2543Smrg * 4706f2543Smrg * All Rights Reserved. 5706f2543Smrg * 6706f2543Smrg * Permission is hereby granted, free of charge, to any person obtaining 7706f2543Smrg * a copy of this software and associated documentation files (the 8706f2543Smrg * "Software"), to deal in the Software without restriction, including 9706f2543Smrg * without limitation on the rights to use, copy, modify, merge, 10706f2543Smrg * publish, distribute, sublicense, and/or sell copies of the Software, 11706f2543Smrg * and to permit persons to whom the Software is furnished to do so, 12706f2543Smrg * subject to the following conditions: 13706f2543Smrg * 14706f2543Smrg * The above copyright notice and this permission notice (including the 15706f2543Smrg * next paragraph) shall be included in all copies or substantial 16706f2543Smrg * portions of the Software. 17706f2543Smrg * 18706f2543Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19706f2543Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20706f2543Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21706f2543Smrg * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS 22706f2543Smrg * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 23706f2543Smrg * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 24706f2543Smrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25706f2543Smrg * SOFTWARE. 26706f2543Smrg */ 27706f2543Smrg 28706f2543Smrg/* 29706f2543Smrg * Authors: 30706f2543Smrg * Rickard E. (Rik) Faith <faith@redhat.com> 31706f2543Smrg * 32706f2543Smrg */ 33706f2543Smrg 34706f2543Smrg#include <stdio.h> 35706f2543Smrg#include <stdlib.h> 36706f2543Smrg#include <X11/Xlib.h> 37706f2543Smrg#include <X11/extensions/XEVI.h> 38706f2543Smrg 39706f2543Smrgint main(int argc, char **argv) 40706f2543Smrg{ 41706f2543Smrg Display *display = NULL; 42706f2543Smrg int major_version, minor_version; 43706f2543Smrg ExtendedVisualInfo *evi; 44706f2543Smrg int count; 45706f2543Smrg int i; 46706f2543Smrg 47706f2543Smrg if (argc == 2) { 48706f2543Smrg if (!(display = XOpenDisplay(argv[1]))) { 49706f2543Smrg printf("Cannot open display %s\n", argv[1]); 50706f2543Smrg return -1; 51706f2543Smrg } 52706f2543Smrg } else { 53706f2543Smrg printf("Usage: %s display\n", argv[0]); 54706f2543Smrg return -1; 55706f2543Smrg } 56706f2543Smrg 57706f2543Smrg if (!display && !(display = XOpenDisplay(NULL))) { 58706f2543Smrg printf("Cannot open default display\n"); 59706f2543Smrg return -1; 60706f2543Smrg } 61706f2543Smrg 62706f2543Smrg if (!XeviQueryVersion(display, &major_version, &minor_version)) { 63706f2543Smrg printf("EVI extension not present\n"); 64706f2543Smrg return -1; 65706f2543Smrg } 66706f2543Smrg printf("EVI Extension version: %d.%d\n", major_version, minor_version); 67706f2543Smrg 68706f2543Smrg XeviGetVisualInfo(display, NULL, 0, &evi, &count); 69706f2543Smrg 70706f2543Smrg for (i = 0; i < count; i++) { 71706f2543Smrg printf("%02d vid=0x%02lx screen=%d level=%d type=%u value=%u" 72706f2543Smrg " min=%u max=%u conflicts=%u\n", 73706f2543Smrg i, 74706f2543Smrg (long unsigned)evi[i].core_visual_id, 75706f2543Smrg evi[i].screen, 76706f2543Smrg evi[i].level, 77706f2543Smrg evi[i].transparency_type, 78706f2543Smrg evi[i].transparency_value, 79706f2543Smrg evi[i].min_hw_colormaps, 80706f2543Smrg evi[i].max_hw_colormaps, 81706f2543Smrg evi[i].num_colormap_conflicts); 82706f2543Smrg } 83706f2543Smrg 84706f2543Smrg XCloseDisplay(display); 85706f2543Smrg return 0; 86706f2543Smrg} 87