Doxygen Source Code Documentation
layerutil.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include "layerutil.h"
Go to the source code of this file.
Functions | |
void | findServerOverlayVisualsInfo (Display *dpy) |
int | __glutGetTransparentPixel (Display *dpy, XVisualInfo *vinfo) |
XLayerVisualInfo * | __glutXGetLayerVisualInfo (Display *dpy, long lvinfo_mask, XLayerVisualInfo *lvinfo_template, int *nitems_return) |
Variables | |
Bool | layersRead = False |
OverlayInfo ** | overlayInfoPerScreen |
unsigned long * | numOverlaysPerScreen |
Function Documentation
|
Definition at line 67 of file layerutil.c. References dpy, findServerOverlayVisualsInfo(), i, numOverlaysPerScreen, _OverlayInfo::overlay_visual, _OverlayInfo::transparent_type, TransparentPixel, and _OverlayInfo::value. Referenced by associateNewColormap(), and glutEstablishOverlay().
00068 { 00069 int i, screen = vinfo->screen; 00070 OverlayInfo *overlayInfo; 00071 00072 findServerOverlayVisualsInfo(dpy); 00073 if (layersRead) { 00074 for (i = 0; i < numOverlaysPerScreen[screen]; i++) { 00075 overlayInfo = &overlayInfoPerScreen[screen][i]; 00076 if (vinfo->visualid == overlayInfo->overlay_visual) { 00077 if (overlayInfo->transparent_type == TransparentPixel) { 00078 return (int) overlayInfo->value; 00079 } else { 00080 return -1; 00081 } 00082 } 00083 } 00084 } 00085 return -1; 00086 } |
|
Definition at line 89 of file layerutil.c. References dpy, findServerOverlayVisualsInfo(), i, _XLayerVisualInfo::layer, _OverlayInfo::layer, malloc, numOverlaysPerScreen, _OverlayInfo::overlay_visual, _OverlayInfo::transparent_type, _XLayerVisualInfo::type, _XLayerVisualInfo::value, _OverlayInfo::value, _XLayerVisualInfo::vinfo, VisualLayerMask, VisualTransparentType, and VisualTransparentValue. Referenced by getOverlayVisualInfoCI(), and menuVisualSetup().
00091 { 00092 XVisualInfo *vinfo; 00093 XLayerVisualInfo *layerInfo; 00094 int numVisuals, count, i, j; 00095 00096 vinfo = XGetVisualInfo(dpy, lvinfo_mask & VisualAllMask, 00097 &lvinfo_template->vinfo, nitems_return); 00098 if (vinfo == NULL) 00099 return NULL; 00100 numVisuals = *nitems_return; 00101 findServerOverlayVisualsInfo(dpy); 00102 layerInfo = (XLayerVisualInfo *) 00103 malloc(numVisuals * sizeof(XLayerVisualInfo)); 00104 if (layerInfo == NULL) { 00105 XFree(vinfo); 00106 return NULL; 00107 } 00108 count = 0; 00109 for (i = 0; i < numVisuals; i++) { 00110 XVisualInfo *pVinfo = &vinfo[i]; 00111 int screen = pVinfo->screen; 00112 OverlayInfo *overlayInfo = NULL; 00113 00114 overlayInfo = NULL; 00115 if (layersRead) { 00116 for (j = 0; j < numOverlaysPerScreen[screen]; j++) 00117 if (pVinfo->visualid == 00118 overlayInfoPerScreen[screen][j].overlay_visual) { 00119 overlayInfo = &overlayInfoPerScreen[screen][j]; 00120 break; 00121 } 00122 } 00123 if (lvinfo_mask & VisualLayerMask) 00124 if (overlayInfo == NULL) { 00125 if (lvinfo_template->layer != 0) 00126 continue; 00127 } else if (lvinfo_template->layer != overlayInfo->layer) 00128 continue; 00129 if (lvinfo_mask & VisualTransparentType) 00130 if (overlayInfo == NULL) { 00131 if (lvinfo_template->type != None) 00132 continue; 00133 } else if (lvinfo_template->type != 00134 overlayInfo->transparent_type) 00135 continue; 00136 if (lvinfo_mask & VisualTransparentValue) 00137 if (overlayInfo == NULL) 00138 /* non-overlay visuals have no sense of 00139 TransparentValue */ 00140 continue; 00141 else if (lvinfo_template->value != overlayInfo->value) 00142 continue; 00143 layerInfo[count].vinfo = *pVinfo; 00144 if (overlayInfo == NULL) { 00145 layerInfo[count].layer = 0; 00146 layerInfo[count].type = None; 00147 layerInfo[count].value = 0; /* meaningless */ 00148 } else { 00149 layerInfo[count].layer = overlayInfo->layer; 00150 layerInfo[count].type = overlayInfo->transparent_type; 00151 layerInfo[count].value = overlayInfo->value; 00152 } 00153 count++; 00154 } 00155 XFree(vinfo); 00156 *nitems_return = count; 00157 if (count == 0) { 00158 XFree(layerInfo); 00159 return NULL; 00160 } else 00161 return layerInfo; 00162 } |
|
Definition at line 19 of file layerutil.c. References dpy, free, i, L, layersRead, malloc, and numOverlaysPerScreen. Referenced by __glutGetTransparentPixel(), and __glutXGetLayerVisualInfo().
00020 { 00021 static Atom overlayVisualsAtom; 00022 Atom actualType; 00023 Status status; 00024 unsigned long sizeData, bytesLeft; 00025 Window root; 00026 int actualFormat, numScreens, i; 00027 00028 if (layersRead == False) { 00029 overlayVisualsAtom = XInternAtom(dpy, 00030 "SERVER_OVERLAY_VISUALS", True); 00031 if (overlayVisualsAtom != None) { 00032 numScreens = ScreenCount(dpy); 00033 overlayInfoPerScreen = (OverlayInfo **) 00034 malloc(numScreens * sizeof(OverlayInfo *)); 00035 numOverlaysPerScreen = (unsigned long *) 00036 malloc(numScreens * sizeof(unsigned long)); 00037 if (overlayInfoPerScreen != NULL && 00038 numOverlaysPerScreen != NULL) { 00039 for (i = 0; i < numScreens; i++) { 00040 root = RootWindow(dpy, i); 00041 status = XGetWindowProperty(dpy, root, 00042 overlayVisualsAtom, 0L, (long) 10000, False, 00043 overlayVisualsAtom, &actualType, &actualFormat, 00044 &sizeData, &bytesLeft, 00045 (unsigned char **) &overlayInfoPerScreen[i]); 00046 if (status != Success || 00047 actualType != overlayVisualsAtom || 00048 actualFormat != 32 || sizeData < 4) 00049 numOverlaysPerScreen[i] = 0; 00050 else 00051 /* four 32-bit quantities per 00052 SERVER_OVERLAY_VISUALS entry */ 00053 numOverlaysPerScreen[i] = sizeData / 4; 00054 } 00055 layersRead = True; 00056 } else { 00057 if (overlayInfoPerScreen != NULL) 00058 free(overlayInfoPerScreen); 00059 if (numOverlaysPerScreen != NULL) 00060 free(numOverlaysPerScreen); 00061 } 00062 } 00063 } 00064 } |
Variable Documentation
|
Definition at line 14 of file layerutil.c. Referenced by findServerOverlayVisualsInfo(). |
|
Definition at line 16 of file layerutil.c. Referenced by __glutGetTransparentPixel(), __glutXGetLayerVisualInfo(), and findServerOverlayVisualsInfo(). |
|
Definition at line 15 of file layerutil.c. |