add more functionality to miniglx for glitz
This commit is contained in:
@@ -52,14 +52,20 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* It can have the values #True or #False.
|
* It can have the values #True or #False.
|
||||||
*/
|
*/
|
||||||
|
#ifndef MINIGLX_NO_XTYPES
|
||||||
typedef int Bool;
|
typedef int Bool;
|
||||||
|
#endif
|
||||||
|
typedef int MINI_Bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Color map.
|
* \brief Color map.
|
||||||
*
|
*
|
||||||
* Alias for private ::MiniGLXColormapRec structure.
|
* Alias for private ::MiniGLXColormapRec structure.
|
||||||
*/
|
*/
|
||||||
|
typedef struct MiniGLXColormapRec *MINI_Colormap;
|
||||||
|
#ifndef MINIGLX_NO_XTYPES
|
||||||
typedef struct MiniGLXColormapRec *Colormap;
|
typedef struct MiniGLXColormapRec *Colormap;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Window attributes.
|
* \brief Window attributes.
|
||||||
@@ -67,7 +73,7 @@ typedef struct MiniGLXColormapRec *Colormap;
|
|||||||
typedef struct MiniGLXSetWindowAttributesRec {
|
typedef struct MiniGLXSetWindowAttributesRec {
|
||||||
int background_pixel; /**< \brief background pixel */
|
int background_pixel; /**< \brief background pixel */
|
||||||
int border_pixel; /**< \brief border pixel value */
|
int border_pixel; /**< \brief border pixel value */
|
||||||
Colormap colormap; /**< \brief color map to be associated with window */
|
MINI_Colormap colormap; /**< \brief color map to be associated with window */
|
||||||
int event_mask; /**< \brief set of events that should be saved */
|
int event_mask; /**< \brief set of events that should be saved */
|
||||||
} XSetWindowAttributes;
|
} XSetWindowAttributes;
|
||||||
|
|
||||||
@@ -85,10 +91,13 @@ typedef struct MiniGLXVisualRec Visual;
|
|||||||
*
|
*
|
||||||
* \sa \ref datatypes.
|
* \sa \ref datatypes.
|
||||||
*/
|
*/
|
||||||
typedef unsigned int VisualID;
|
#ifndef MINIGLX_NO_XTYPES
|
||||||
|
typedef unsigned long VisualID;
|
||||||
|
#endif
|
||||||
|
typedef unsigned long MINI_VisualID;
|
||||||
typedef struct MiniGLXXVisualInfoRec {
|
typedef struct MiniGLXXVisualInfoRec {
|
||||||
Visual *visual; /**< \brief pointer to the GLX Visual */
|
Visual *visual; /**< \brief pointer to the GLX Visual */
|
||||||
VisualID visualid; /**< \brief visual ID */
|
MINI_VisualID visualid; /**< \brief visual ID */
|
||||||
int screen; /**< \brief screen number */
|
int screen; /**< \brief screen number */
|
||||||
int depth; /**< \brief bit depth */
|
int depth; /**< \brief bit depth */
|
||||||
#if defined(__cplusplus) || defined(c_plusplus)
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
@@ -115,7 +124,10 @@ typedef struct MiniGLXFBConfigRec {
|
|||||||
*
|
*
|
||||||
* \sa \ref datatypes.
|
* \sa \ref datatypes.
|
||||||
*/
|
*/
|
||||||
|
#ifndef MINIGLX_NO_XTYPES
|
||||||
typedef struct MiniGLXDisplayRec Display;
|
typedef struct MiniGLXDisplayRec Display;
|
||||||
|
#endif
|
||||||
|
typedef struct MiniGLXDisplayRec MINI_Display;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Window handle.
|
* \brief Window handle.
|
||||||
@@ -124,7 +136,10 @@ typedef struct MiniGLXDisplayRec Display;
|
|||||||
*
|
*
|
||||||
* \sa \ref datatypes.
|
* \sa \ref datatypes.
|
||||||
*/
|
*/
|
||||||
|
#ifndef MINIGLX_NO_XTYPES
|
||||||
typedef struct MiniGLXWindowRec *Window;
|
typedef struct MiniGLXWindowRec *Window;
|
||||||
|
#endif
|
||||||
|
typedef struct MiniGLXWindowRec *MINI_Window;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Drawable.
|
* \brief Drawable.
|
||||||
@@ -136,7 +151,10 @@ typedef struct MiniGLXWindowRec *Window;
|
|||||||
*
|
*
|
||||||
* \sa \ref datatypes.
|
* \sa \ref datatypes.
|
||||||
*/
|
*/
|
||||||
|
#ifndef MINIGLX_NO_XTYPES
|
||||||
typedef struct MiniGLXWindowRec *Drawable;
|
typedef struct MiniGLXWindowRec *Drawable;
|
||||||
|
#endif
|
||||||
|
typedef struct MiniGLXWindowRec *MINI_Drawable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief GLX drawable.
|
* \brief GLX drawable.
|
||||||
@@ -174,9 +192,9 @@ typedef struct MiniGLXContextRec *GLXContext;
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
int type;
|
int type;
|
||||||
unsigned long serial; /* # of last request processed by server */
|
unsigned long serial; /* # of last request processed by server */
|
||||||
Bool send_event; /* true if this came from a SendEvent request */
|
MINI_Bool send_event; /* true if this came from a SendEvent request */
|
||||||
Display *display; /* Display the event was read from */
|
MINI_Display *display; /* Display the event was read from */
|
||||||
Window window;
|
MINI_Window window;
|
||||||
int x, y;
|
int x, y;
|
||||||
int width, height;
|
int width, height;
|
||||||
int count; /* if non-zero, at least this many more */
|
int count; /* if non-zero, at least this many more */
|
||||||
@@ -185,53 +203,53 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
int type;
|
int type;
|
||||||
unsigned long serial; /* # of last request processed by server */
|
unsigned long serial; /* # of last request processed by server */
|
||||||
Bool send_event; /* true if this came from a SendEvent request */
|
MINI_Bool send_event; /* true if this came from a SendEvent request */
|
||||||
Display *display; /* Display the event was read from */
|
MINI_Display *display; /* Display the event was read from */
|
||||||
Window parent; /* parent of the window */
|
MINI_Window parent; /* parent of the window */
|
||||||
Window window; /* window id of window created */
|
MINI_Window window; /* window id of window created */
|
||||||
int x, y; /* window location */
|
int x, y; /* window location */
|
||||||
int width, height; /* size of window */
|
int width, height; /* size of window */
|
||||||
int border_width; /* border width */
|
int border_width; /* border width */
|
||||||
Bool override_redirect; /* creation should be overridden */
|
MINI_Bool override_redirect; /* creation should be overridden */
|
||||||
} XCreateWindowEvent;
|
} XCreateWindowEvent;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int type;
|
int type;
|
||||||
unsigned long serial; /* # of last request processed by server */
|
unsigned long serial; /* # of last request processed by server */
|
||||||
Bool send_event; /* true if this came from a SendEvent request */
|
MINI_Bool send_event; /* true if this came from a SendEvent request */
|
||||||
Display *display; /* Display the event was read from */
|
MINI_Display *display; /* Display the event was read from */
|
||||||
Window event;
|
MINI_Window event;
|
||||||
Window window;
|
MINI_Window window;
|
||||||
} XDestroyWindowEvent;
|
} XDestroyWindowEvent;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int type;
|
int type;
|
||||||
unsigned long serial; /* # of last request processed by server */
|
unsigned long serial; /* # of last request processed by server */
|
||||||
Bool send_event; /* true if this came from a SendEvent request */
|
MINI_Bool send_event; /* true if this came from a SendEvent request */
|
||||||
Display *display; /* Display the event was read from */
|
MINI_Display *display; /* Display the event was read from */
|
||||||
Window event;
|
MINI_Window event;
|
||||||
Window window;
|
MINI_Window window;
|
||||||
Bool from_configure;
|
MINI_Bool from_configure;
|
||||||
} XUnmapEvent;
|
} XUnmapEvent;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int type;
|
int type;
|
||||||
unsigned long serial; /* # of last request processed by server */
|
unsigned long serial; /* # of last request processed by server */
|
||||||
Bool send_event; /* true if this came from a SendEvent request */
|
MINI_Bool send_event; /* true if this came from a SendEvent request */
|
||||||
Display *display; /* Display the event was read from */
|
MINI_Display *display; /* Display the event was read from */
|
||||||
Window event;
|
MINI_Window event;
|
||||||
Window window;
|
MINI_Window window;
|
||||||
Bool override_redirect; /* boolean, is override set... */
|
MINI_Bool override_redirect; /* boolean, is override set... */
|
||||||
} XMapEvent;
|
} XMapEvent;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int type;
|
int type;
|
||||||
unsigned long serial; /* # of last request processed by server */
|
unsigned long serial; /* # of last request processed by server */
|
||||||
Bool send_event; /* true if this came from a SendEvent request */
|
MINI_Bool send_event; /* true if this came from a SendEvent request */
|
||||||
Display *display; /* Display the event was read from */
|
MINI_Display *display; /* Display the event was read from */
|
||||||
Window parent;
|
MINI_Window parent;
|
||||||
Window window;
|
MINI_Window window;
|
||||||
} XMapRequestEvent;
|
} XMapRequestEvent;
|
||||||
|
|
||||||
typedef union _XEvent {
|
typedef union _XEvent {
|
||||||
@@ -263,6 +281,7 @@ typedef union _XEvent {
|
|||||||
#define CWColormap (1L<<13)
|
#define CWColormap (1L<<13)
|
||||||
#define PseudoColor 3
|
#define PseudoColor 3
|
||||||
#define TrueColor 4
|
#define TrueColor 4
|
||||||
|
#define VisualIDMask 0x1
|
||||||
#define VisualScreenMask 0x2
|
#define VisualScreenMask 0x2
|
||||||
#define Expose 12
|
#define Expose 12
|
||||||
#define CreateNotify 16
|
#define CreateNotify 16
|
||||||
@@ -318,11 +337,11 @@ typedef union _XEvent {
|
|||||||
/**
|
/**
|
||||||
* \name Server-specific functions
|
* \name Server-specific functions
|
||||||
*/
|
*/
|
||||||
extern Display *
|
extern MINI_Display *
|
||||||
__miniglx_StartServer( const char *display_name );
|
__miniglx_StartServer( const char *display_name );
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
__miniglx_Select( Display *dpy, int maxfd,
|
__miniglx_Select( MINI_Display *dpy, int maxfd,
|
||||||
fd_set *rfds, fd_set *wfds, fd_set *xfds,
|
fd_set *rfds, fd_set *wfds, fd_set *xfds,
|
||||||
struct timeval *tv );
|
struct timeval *tv );
|
||||||
|
|
||||||
@@ -331,25 +350,25 @@ __miniglx_Select( Display *dpy, int maxfd,
|
|||||||
* \name Simulated Xlib functions
|
* \name Simulated Xlib functions
|
||||||
*/
|
*/
|
||||||
/*@{*/
|
/*@{*/
|
||||||
extern Display *
|
extern MINI_Display *
|
||||||
XOpenDisplay( const char *dpy_name );
|
XOpenDisplay( const char *dpy_name );
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
XCloseDisplay( Display *display );
|
XCloseDisplay( MINI_Display *display );
|
||||||
|
|
||||||
extern Window
|
extern MINI_Window
|
||||||
XCreateWindow( Display *display, Window parent, int x, int y,
|
XCreateWindow( MINI_Display *display, MINI_Window parent, int x, int y,
|
||||||
unsigned int width, unsigned int height,
|
unsigned int width, unsigned int height,
|
||||||
unsigned int border_width, int depth, unsigned int winclass,
|
unsigned int border_width, int depth, unsigned int winclass,
|
||||||
Visual *visual, unsigned long valuemask,
|
Visual *visual, unsigned long valuemask,
|
||||||
XSetWindowAttributes *attributes );
|
XSetWindowAttributes *attributes );
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
XNextEvent(Display *display, XEvent *event_return);
|
XNextEvent(MINI_Display *display, XEvent *event_return);
|
||||||
|
|
||||||
extern Bool
|
extern MINI_Bool
|
||||||
XCheckMaskEvent( Display *dpy, long event_mask, XEvent *event_return );
|
XCheckMaskEvent( MINI_Display *dpy, long event_mask, XEvent *event_return );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return the root window.
|
* \brief Return the root window.
|
||||||
@@ -365,27 +384,27 @@ XCheckMaskEvent( Display *dpy, long event_mask, XEvent *event_return );
|
|||||||
#define DefaultScreen(dpy) 0
|
#define DefaultScreen(dpy) 0
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
XDestroyWindow( Display *display, Window w );
|
XDestroyWindow( MINI_Display *display, MINI_Window w );
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
XMapWindow( Display *display, Window w );
|
XMapWindow( MINI_Display *display, MINI_Window w );
|
||||||
|
|
||||||
/* Should clients have access to this?
|
/* Should clients have access to this?
|
||||||
*/
|
*/
|
||||||
extern void
|
extern void
|
||||||
XUnmapWindow( Display *display, Window w );
|
XUnmapWindow( MINI_Display *display, MINI_Window w );
|
||||||
|
|
||||||
extern Colormap
|
extern MINI_Colormap
|
||||||
XCreateColormap( Display *display, Window w, Visual *visual, int alloc );
|
XCreateColormap( MINI_Display *display, MINI_Window w, Visual *visual, int alloc );
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
XFreeColormap( Display *display, Colormap cmap );
|
XFreeColormap( MINI_Display *display, MINI_Colormap cmap );
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
XFree( void *data );
|
XFree( void *data );
|
||||||
|
|
||||||
extern XVisualInfo *
|
extern XVisualInfo *
|
||||||
XGetVisualInfo( Display *display, long vinfo_mask,
|
XGetVisualInfo( MINI_Display *display, long vinfo_mask,
|
||||||
XVisualInfo *vinfo_template, int *nitems_return );
|
XVisualInfo *vinfo_template, int *nitems_return );
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
@@ -396,23 +415,23 @@ XGetVisualInfo( Display *display, long vinfo_mask,
|
|||||||
*/
|
*/
|
||||||
/*@{*/
|
/*@{*/
|
||||||
extern XVisualInfo*
|
extern XVisualInfo*
|
||||||
glXChooseVisual( Display *dpy, int screen, int *attribList );
|
glXChooseVisual( MINI_Display *dpy, int screen, int *attribList );
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
glXGetConfig( Display *dpy, XVisualInfo *vis, int attrib, int *value );
|
glXGetConfig( MINI_Display *dpy, XVisualInfo *vis, int attrib, int *value );
|
||||||
|
|
||||||
extern GLXContext
|
extern GLXContext
|
||||||
glXCreateContext( Display *dpy, XVisualInfo *vis,
|
glXCreateContext( MINI_Display *dpy, XVisualInfo *vis,
|
||||||
GLXContext shareList, Bool direct );
|
GLXContext shareList, MINI_Bool direct );
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
glXDestroyContext( Display *dpy, GLXContext ctx );
|
glXDestroyContext( MINI_Display *dpy, GLXContext ctx );
|
||||||
|
|
||||||
extern Bool
|
extern MINI_Bool
|
||||||
glXMakeCurrent( Display *dpy, GLXDrawable drawable, GLXContext ctx);
|
glXMakeCurrent( MINI_Display *dpy, GLXDrawable drawable, GLXContext ctx);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
glXSwapBuffers( Display *dpy, GLXDrawable drawable );
|
glXSwapBuffers( MINI_Display *dpy, GLXDrawable drawable );
|
||||||
|
|
||||||
extern GLXContext
|
extern GLXContext
|
||||||
glXGetCurrentContext( void );
|
glXGetCurrentContext( void );
|
||||||
@@ -423,22 +442,22 @@ glXGetCurrentDrawable( void );
|
|||||||
extern void
|
extern void
|
||||||
(*glXGetProcAddress(const GLubyte *procname))( void );
|
(*glXGetProcAddress(const GLubyte *procname))( void );
|
||||||
|
|
||||||
extern Bool
|
extern MINI_Bool
|
||||||
glXQueryVersion( Display *dpy, int *major, int *minor );
|
glXQueryVersion( MINI_Display *dpy, int *major, int *minor );
|
||||||
|
|
||||||
/* Added in MiniGLX 1.1 */
|
/* Added in MiniGLX 1.1 */
|
||||||
extern GLXPbuffer
|
extern GLXPbuffer
|
||||||
glXCreatePbuffer( Display *dpy, GLXFBConfig config, const int *attribList );
|
glXCreatePbuffer( MINI_Display *dpy, GLXFBConfig config, const int *attribList );
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
|
glXDestroyPbuffer( MINI_Display *dpy, GLXPbuffer pbuf );
|
||||||
|
|
||||||
extern GLXFBConfig *
|
extern GLXFBConfig *
|
||||||
glXChooseFBConfig( Display *dpy, int screen, const int *attribList,
|
glXChooseFBConfig( MINI_Display *dpy, int screen, const int *attribList,
|
||||||
int *nitems );
|
int *nitems );
|
||||||
|
|
||||||
extern XVisualInfo *
|
extern XVisualInfo *
|
||||||
glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config );
|
glXGetVisualFromFBConfig( MINI_Display *dpy, GLXFBConfig config );
|
||||||
|
|
||||||
extern void *glXAllocateMemoryMESA(Display *dpy, int scrn,
|
extern void *glXAllocateMemoryMESA(Display *dpy, int scrn,
|
||||||
size_t size, float readFreq,
|
size_t size, float readFreq,
|
||||||
|
@@ -1215,8 +1215,20 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc)
|
|||||||
fd,
|
fd,
|
||||||
(get_ver != NULL) ? (*get_ver)() : 20040602,
|
(get_ver != NULL) ? (*get_ver)() : 20040602,
|
||||||
(__GLcontextModes **) &dpy->driver_modes);
|
(__GLcontextModes **) &dpy->driver_modes);
|
||||||
}
|
|
||||||
|
|
||||||
|
/* fill in dummy visual ids */
|
||||||
|
{
|
||||||
|
__GLcontextModes *temp;
|
||||||
|
temp = (__GLcontextModes *)dpy->driver_modes;
|
||||||
|
i = 1;
|
||||||
|
while (temp)
|
||||||
|
{
|
||||||
|
temp->visualID = i++;
|
||||||
|
temp=temp->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if ( psp == NULL ) {
|
if ( psp == NULL ) {
|
||||||
if ( pSAREA != MAP_FAILED ) {
|
if ( pSAREA != MAP_FAILED ) {
|
||||||
@@ -1631,50 +1643,102 @@ XGetVisualInfo( Display *dpy, long vinfo_mask, XVisualInfo *vinfo_template, int
|
|||||||
const __GLcontextModes *mode;
|
const __GLcontextModes *mode;
|
||||||
XVisualInfo *results;
|
XVisualInfo *results;
|
||||||
Visual *visResults;
|
Visual *visResults;
|
||||||
int i, n;
|
int i, n=0;
|
||||||
|
|
||||||
ASSERT(vinfo_mask == VisualScreenMask);
|
// ASSERT(vinfo_mask == VisualScreenMask);
|
||||||
ASSERT(vinfo_template.screen == 0);
|
ASSERT(vinfo_template.screen == 0);
|
||||||
|
|
||||||
n = 0;
|
if (vinfo_mask == VisualIDMask)
|
||||||
for ( mode = dpy->driver_modes ; mode != NULL ; mode = mode->next )
|
{
|
||||||
n++;
|
for ( mode = dpy->driver_modes ; mode != NULL ; mode= mode->next )
|
||||||
|
if (mode->visualID == vinfo_template->visualid)
|
||||||
|
n=1;
|
||||||
|
|
||||||
results = (XVisualInfo *)calloc(1, n * sizeof(XVisualInfo));
|
if (n==0)
|
||||||
if (!results) {
|
return NULL;
|
||||||
*nitens_return = 0;
|
|
||||||
return NULL;
|
results = (XVisualInfo *)calloc(1, n * sizeof(XVisualInfo));
|
||||||
}
|
if (!results) {
|
||||||
|
*nitens_return = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
visResults = (Visual *)calloc(1, n * sizeof(Visual));
|
||||||
|
if (!results) {
|
||||||
|
free(results);
|
||||||
|
*nitens_return = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
visResults = (Visual *)calloc(1, n * sizeof(Visual));
|
for ( mode = dpy->driver_modes ; mode != NULL ; mode= mode->next )
|
||||||
if (!results) {
|
if (mode->visualID == vinfo_template->visualid)
|
||||||
free(results);
|
{
|
||||||
*nitens_return = 0;
|
visResults[0].mode=mode;
|
||||||
return NULL;
|
visResults[0].visInfo = results;
|
||||||
}
|
visResults[0].dpy = dpy;
|
||||||
|
if (dpy->driverContext.bpp == 32)
|
||||||
for ( mode = dpy->driver_modes, i = 0 ; mode != NULL ; mode = mode->next, i++ ) {
|
visResults[0].pixelFormat = PF_B8G8R8A8; /* XXX: FIX ME */
|
||||||
visResults[i].mode = mode;
|
else
|
||||||
visResults[i].visInfo = results + i;
|
visResults[0].pixelFormat = PF_B5G6R5; /* XXX: FIX ME */
|
||||||
visResults[i].dpy = dpy;
|
|
||||||
|
results[0].visual = visResults;
|
||||||
if (dpy->driverContext.bpp == 32)
|
results[0].visualid = mode->visualID;
|
||||||
visResults[i].pixelFormat = PF_B8G8R8A8; /* XXX: FIX ME */
|
|
||||||
else
|
|
||||||
visResults[i].pixelFormat = PF_B5G6R5; /* XXX: FIX ME */
|
|
||||||
|
|
||||||
results[i].visual = visResults + i;
|
|
||||||
results[i].visualid = i;
|
|
||||||
#if defined(__cplusplus) || defined(c_plusplus)
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
results[i].c_class = TrueColor;
|
results[0].c_class = TrueColor;
|
||||||
#else
|
#else
|
||||||
results[i].class = TrueColor;
|
results[0].class = TrueColor;
|
||||||
#endif
|
#endif
|
||||||
results[i].depth = mode->redBits +
|
results[0].depth = mode->redBits +
|
||||||
mode->redBits +
|
mode->redBits +
|
||||||
mode->redBits +
|
mode->redBits +
|
||||||
mode->redBits;
|
mode->redBits;
|
||||||
results[i].bits_per_rgb = dpy->driverContext.bpp;
|
results[0].bits_per_rgb = dpy->driverContext.bpp;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else // if (vinfo_mask == VisualScreenMask)
|
||||||
|
{
|
||||||
|
n = 0;
|
||||||
|
for ( mode = dpy->driver_modes ; mode != NULL ; mode = mode->next )
|
||||||
|
n++;
|
||||||
|
|
||||||
|
results = (XVisualInfo *)calloc(1, n * sizeof(XVisualInfo));
|
||||||
|
if (!results) {
|
||||||
|
*nitens_return = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
visResults = (Visual *)calloc(1, n * sizeof(Visual));
|
||||||
|
if (!results) {
|
||||||
|
free(results);
|
||||||
|
*nitens_return = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( mode = dpy->driver_modes, i = 0 ; mode != NULL ; mode = mode->next, i++ ) {
|
||||||
|
visResults[i].mode = mode;
|
||||||
|
visResults[i].visInfo = results + i;
|
||||||
|
visResults[i].dpy = dpy;
|
||||||
|
|
||||||
|
if (dpy->driverContext.bpp == 32)
|
||||||
|
visResults[i].pixelFormat = PF_B8G8R8A8; /* XXX: FIX ME */
|
||||||
|
else
|
||||||
|
visResults[i].pixelFormat = PF_B5G6R5; /* XXX: FIX ME */
|
||||||
|
|
||||||
|
results[i].visual = visResults + i;
|
||||||
|
results[i].visualid = mode->visualID;
|
||||||
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
|
results[i].c_class = TrueColor;
|
||||||
|
#else
|
||||||
|
results[i].class = TrueColor;
|
||||||
|
#endif
|
||||||
|
results[i].depth = mode->redBits +
|
||||||
|
mode->redBits +
|
||||||
|
mode->redBits +
|
||||||
|
mode->redBits;
|
||||||
|
results[i].bits_per_rgb = dpy->driverContext.bpp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*nitens_return = n;
|
*nitens_return = n;
|
||||||
return results;
|
return results;
|
||||||
|
Reference in New Issue
Block a user