(!1654) Xnest: fetch allowed screen depths from xcb screen info
There's even no need to keep our own copies, since we can ask XCB's copy any time. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									790c268dbb
								
							
						
					
					
						commit
						d88ae96439
					
				| 
						 | 
					@ -44,8 +44,6 @@ int xnestNumVisuals;
 | 
				
			||||||
int xnestDefaultVisualIndex;
 | 
					int xnestDefaultVisualIndex;
 | 
				
			||||||
Colormap *xnestDefaultColormaps;
 | 
					Colormap *xnestDefaultColormaps;
 | 
				
			||||||
static uint16_t xnestNumDefaultColormaps;
 | 
					static uint16_t xnestNumDefaultColormaps;
 | 
				
			||||||
int *xnestDepths;
 | 
					 | 
				
			||||||
int xnestNumDepths;
 | 
					 | 
				
			||||||
XPixmapFormatValues *xnestPixmapFormats;
 | 
					XPixmapFormatValues *xnestPixmapFormats;
 | 
				
			||||||
int xnestNumPixmapFormats;
 | 
					int xnestNumPixmapFormats;
 | 
				
			||||||
Drawable xnestDefaultDrawables[MAXDEPTH + 1];
 | 
					Drawable xnestDefaultDrawables[MAXDEPTH + 1];
 | 
				
			||||||
| 
						 | 
					@ -68,7 +66,7 @@ xnestOpenDisplay(int argc, char *argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    XVisualInfo vi;
 | 
					    XVisualInfo vi;
 | 
				
			||||||
    long mask;
 | 
					    long mask;
 | 
				
			||||||
    int i, j;
 | 
					    int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!xnestDoFullGeneration)
 | 
					    if (!xnestDoFullGeneration)
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
| 
						 | 
					@ -128,9 +126,6 @@ xnestOpenDisplay(int argc, char *argv[])
 | 
				
			||||||
                            xnestVisuals[i].visual->visualid);
 | 
					                            xnestVisuals[i].visual->visualid);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xnestDepths = XListDepths(xnestDisplay, xnestUpstreamInfo.screenId,
 | 
					 | 
				
			||||||
                              &xnestNumDepths);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    xnestPixmapFormats = XListPixmapFormats(xnestDisplay,
 | 
					    xnestPixmapFormats = XListPixmapFormats(xnestDisplay,
 | 
				
			||||||
                                            &xnestNumPixmapFormats);
 | 
					                                            &xnestNumPixmapFormats);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -142,10 +137,14 @@ xnestOpenDisplay(int argc, char *argv[])
 | 
				
			||||||
    for (i = 0; i <= MAXDEPTH; i++)
 | 
					    for (i = 0; i <= MAXDEPTH; i++)
 | 
				
			||||||
        xnestDefaultDrawables[i] = XCB_WINDOW_NONE;
 | 
					        xnestDefaultDrawables[i] = XCB_WINDOW_NONE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (i = 0; i < xnestNumPixmapFormats; i++)
 | 
					    for (i = 0; i < xnestNumPixmapFormats; i++) {
 | 
				
			||||||
        for (j = 0; j < xnestNumDepths; j++)
 | 
					        xcb_depth_iterator_t depth_iter;
 | 
				
			||||||
 | 
					        for (depth_iter = xcb_screen_allowed_depths_iterator(xnestUpstreamInfo.screenInfo);
 | 
				
			||||||
 | 
					             depth_iter.rem;
 | 
				
			||||||
 | 
					             xcb_depth_next(&depth_iter))
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            if (xnestPixmapFormats[i].depth == 1 ||
 | 
					            if (xnestPixmapFormats[i].depth == 1 ||
 | 
				
			||||||
                xnestPixmapFormats[i].depth == xnestDepths[j]) {
 | 
					                xnestPixmapFormats[i].depth == depth_iter.data->depth) {
 | 
				
			||||||
                uint32_t pixmap = xcb_generate_id(xnestUpstreamInfo.conn);
 | 
					                uint32_t pixmap = xcb_generate_id(xnestUpstreamInfo.conn);
 | 
				
			||||||
                xcb_create_pixmap(xnestUpstreamInfo.conn,
 | 
					                xcb_create_pixmap(xnestUpstreamInfo.conn,
 | 
				
			||||||
                                  xnestPixmapFormats[i].depth,
 | 
					                                  xnestPixmapFormats[i].depth,
 | 
				
			||||||
| 
						 | 
					@ -154,6 +153,8 @@ xnestOpenDisplay(int argc, char *argv[])
 | 
				
			||||||
                                  1, 1);
 | 
					                                  1, 1);
 | 
				
			||||||
                xnestDefaultDrawables[xnestPixmapFormats[i].depth] = pixmap;
 | 
					                xnestDefaultDrawables[xnestPixmapFormats[i].depth] = pixmap;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xnestBitmapGC = xcb_generate_id(xnestUpstreamInfo.conn);
 | 
					    xnestBitmapGC = xcb_generate_id(xnestUpstreamInfo.conn);
 | 
				
			||||||
    xcb_create_gc(xnestUpstreamInfo.conn,
 | 
					    xcb_create_gc(xnestUpstreamInfo.conn,
 | 
				
			||||||
| 
						 | 
					@ -209,7 +210,6 @@ xnestCloseDisplay(void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    free(xnestDefaultColormaps);
 | 
					    free(xnestDefaultColormaps);
 | 
				
			||||||
    XFree(xnestVisuals);
 | 
					    XFree(xnestVisuals);
 | 
				
			||||||
    XFree(xnestDepths);
 | 
					 | 
				
			||||||
    XFree(xnestPixmapFormats);
 | 
					    XFree(xnestPixmapFormats);
 | 
				
			||||||
    XCloseDisplay(xnestDisplay);
 | 
					    XCloseDisplay(xnestDisplay);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,8 +28,6 @@ extern int xnestNumVisuals;
 | 
				
			||||||
extern int xnestDefaultVisualIndex;
 | 
					extern int xnestDefaultVisualIndex;
 | 
				
			||||||
extern Colormap *xnestDefaultColormaps;
 | 
					extern Colormap *xnestDefaultColormaps;
 | 
				
			||||||
extern int xnestNumDefaultClormaps;
 | 
					extern int xnestNumDefaultClormaps;
 | 
				
			||||||
extern int *xnestDepths;
 | 
					 | 
				
			||||||
extern int xnestNumDepths;
 | 
					 | 
				
			||||||
extern XPixmapFormatValues *xnestPixmapFormats;
 | 
					extern XPixmapFormatValues *xnestPixmapFormats;
 | 
				
			||||||
extern int xnestNumPixmapFormats;
 | 
					extern int xnestNumPixmapFormats;
 | 
				
			||||||
extern Drawable xnestDefaultDrawables[MAXDEPTH + 1];
 | 
					extern Drawable xnestDefaultDrawables[MAXDEPTH + 1];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,6 +33,7 @@ is" without express or implied warranty.
 | 
				
			||||||
#include "servermd.h"
 | 
					#include "servermd.h"
 | 
				
			||||||
#include "dixfontstr.h"
 | 
					#include "dixfontstr.h"
 | 
				
			||||||
#include "extinit_priv.h"
 | 
					#include "extinit_priv.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "Xnest.h"
 | 
					#include "Xnest.h"
 | 
				
			||||||
#include "xnest-xcb.h"
 | 
					#include "xnest-xcb.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,7 +68,7 @@ Bool noGlxExtension = FALSE;
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
InitOutput(ScreenInfo * screen_info, int argc, char *argv[])
 | 
					InitOutput(ScreenInfo * screen_info, int argc, char *argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int i, j;
 | 
					    int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xnestOpenDisplay(argc, argv);
 | 
					    xnestOpenDisplay(argc, argv);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -76,10 +77,14 @@ InitOutput(ScreenInfo * screen_info, int argc, char *argv[])
 | 
				
			||||||
    screen_info->bitmapScanlinePad = xnestUpstreamInfo.setup->bitmap_format_scanline_pad;
 | 
					    screen_info->bitmapScanlinePad = xnestUpstreamInfo.setup->bitmap_format_scanline_pad;
 | 
				
			||||||
    screen_info->bitmapBitOrder = xnestUpstreamInfo.setup->bitmap_format_bit_order;
 | 
					    screen_info->bitmapBitOrder = xnestUpstreamInfo.setup->bitmap_format_bit_order;
 | 
				
			||||||
    screen_info->numPixmapFormats = 0;
 | 
					    screen_info->numPixmapFormats = 0;
 | 
				
			||||||
    for (i = 0; i < xnestNumPixmapFormats; i++)
 | 
					    for (i = 0; i < xnestNumPixmapFormats; i++) {
 | 
				
			||||||
        for (j = 0; j < xnestNumDepths; j++)
 | 
					        xcb_depth_iterator_t depth_iter;
 | 
				
			||||||
 | 
					        for (depth_iter = xcb_screen_allowed_depths_iterator(xnestUpstreamInfo.screenInfo);
 | 
				
			||||||
 | 
					             depth_iter.rem;
 | 
				
			||||||
 | 
					             xcb_depth_next(&depth_iter))
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            if ((xnestPixmapFormats[i].depth == 1) ||
 | 
					            if ((xnestPixmapFormats[i].depth == 1) ||
 | 
				
			||||||
                (xnestPixmapFormats[i].depth == xnestDepths[j])) {
 | 
					                (xnestPixmapFormats[i].depth == depth_iter.data->depth)) {
 | 
				
			||||||
                screen_info->formats[screen_info->numPixmapFormats].depth =
 | 
					                screen_info->formats[screen_info->numPixmapFormats].depth =
 | 
				
			||||||
                    xnestPixmapFormats[i].depth;
 | 
					                    xnestPixmapFormats[i].depth;
 | 
				
			||||||
                screen_info->formats[screen_info->numPixmapFormats].bitsPerPixel =
 | 
					                screen_info->formats[screen_info->numPixmapFormats].bitsPerPixel =
 | 
				
			||||||
| 
						 | 
					@ -89,6 +94,8 @@ InitOutput(ScreenInfo * screen_info, int argc, char *argv[])
 | 
				
			||||||
                screen_info->numPixmapFormats++;
 | 
					                screen_info->numPixmapFormats++;
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xnestFontPrivateIndex = xfont2_allocate_font_private_index();
 | 
					    xnestFontPrivateIndex = xfont2_allocate_font_private_index();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue