|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T v
Length: 1424 (0x590) Types: TextFile Names: »visual.frag«
└─⟦8648bda34⟧ Bits:30007244 EUUGD5_II: X11R5 └─⟦2ca9b63e1⟧ »./contrib-1/contrib-1.00« └─⟦a8392fb20⟧ └─⟦this⟧ »contrib/examples/OReilly/Vol1/basicwin/getvis/visual.frag«
#include <X11/Xlib.h> #include <X11/Xutil.h> visual() { Display *display; Colormap colormap; Window window; int screen; . . . XVisualInfo vTemplate; /* template of the visual we want */ XVisualInfo *visualList; /* list of XVisualInfo structs that match */ int visualsMatched; /* number of visuals that match */ . . . /* * Set up the XVisualInfo template so that it returns * a list of all the visuals of depth 8 defined on the * current screen by the X server */ vTemplate.screen = screen; vTemplate.depth = 8; .XX "XGetVisualInfo, example using" visualList = XGetVisualInfo (display, VisualScreenMask | VisualDepthMask, &vTemplate, &visualsMatched); if ( visualsMatched == 0 ) fatalError ("No matching visuals\en"); /* * Create a colormap for a window using the first of the visuals * in the list ov XVisualInfo structs returned by XGetVisualInfo. */ .XX "XCreateColormap, example using" colormap = XCreateColormap (display, RootWindow(display, screen), visualList[0].visual, AllocNone); . . . window = XCreateWindow (display, RootWindow(display, screen), x, y, width, height, border_width, vTemplate.depth, InputOutput, visualList[0].visual, mask, &attributes); XSetWindowColormap(display, window, colormap); .XX "XSetWindowColormap, example using" /* All done with visual information. Free it. */ XFree(visualList); .XX "XFree, example using" . . . } /* end routine */ .Pe