/* this is piece by piece taken from gtk+ 2.9.0 (CVS-head with a patch applied regarding XShape's input-masks) so people without gtk+ >= 2.9.0 can compile and run input_shape_test.c */ static void do_shape_combine_mask (GdkWindow* window, GdkBitmap* mask, gint x, gint y) { Pixmap pixmap; int ignore; int maj; int min; if (!XShapeQueryExtension (GDK_WINDOW_XDISPLAY (window), &ignore, &ignore)) return; if (!XShapeQueryVersion (GDK_WINDOW_XDISPLAY (window), &maj, &min)) return; /* for shaped input we need at least XShape 1.1 */ if (maj != 1 && min < 1) return; if (mask) pixmap = GDK_DRAWABLE_XID (mask); else { x = 0; y = 0; pixmap = None; } XShapeCombineMask (GDK_WINDOW_XDISPLAY (window), GDK_DRAWABLE_XID (window), ShapeInput, x, y, pixmap, ShapeSet); }
void Shape::init() { kwin_shape_version = 0; int dummy; if(!XShapeQueryExtension(qt_xdisplay(), &kwin_shape_event, &dummy)) return; int major, minor; if(!XShapeQueryVersion(qt_xdisplay(), &major, &minor)) return; kwin_shape_version = major * 0x10 + minor; }
/** * Program entry point. * * Note that standard input comes from the AllTray process, and * standard output goes to the AllTray process. Therefore, stdin and * stdout are communication channels with AllTray. */ int main(int argc, char *argv[]) { Display *dpy = XOpenDisplay(NULL); if(dpy == NULL) { printf("ERROR: XOpenDisplay() failed\n"); exit(1); } int shape_ver_major = 0; int shape_ver_minor = 0; Bool shape_supported = XShapeQueryVersion(dpy, &shape_ver_major, &shape_ver_minor); if(shape_supported == False) { // TODO: Fall back to uglier behavior instead of aborting. printf("ERROR: X11 SHAPE extension is unsupported\n"); exit(1); } setvbuf(stdout, NULL, _IONBF, 0); return(event_loop(dpy)); }
DisplayInfo * myDisplayInit (GdkDisplay *gdisplay) { DisplayInfo *display; int major, minor; int dummy; gchar *hostnametmp; display = g_new0 (DisplayInfo, 1); display->gdisplay = gdisplay; display->dpy = (Display *) gdk_x11_display_get_xdisplay (gdisplay); display->session = NULL; display->quit = FALSE; display->reload = FALSE; XSetErrorHandler (handleXError); /* Initialize internal atoms */ if (!myDisplayInitAtoms (display)) { g_warning ("Some internal atoms were not properly created."); } /* Test XShape extension support */ major = 0; minor = 0; display->shape_version = 0; if (XShapeQueryExtension (display->dpy, &display->shape_event_base, &dummy)) { display->have_shape = TRUE; if (XShapeQueryVersion (display->dpy, &major, &minor)) { display->shape_version = major * 1000 + minor; } } else { g_warning ("The display does not support the XShape extension."); display->have_shape = FALSE; display->shape_event_base = 0; } #ifdef HAVE_XSYNC display->have_xsync = FALSE; display->xsync_error_base = 0; display->xsync_event_base = 0; major = SYNC_MAJOR_VERSION; minor = SYNC_MINOR_VERSION; if (XSyncQueryExtension (display->dpy, &display->xsync_event_base, &display->xsync_error_base) && XSyncInitialize (display->dpy, &major, &minor)) { display->have_xsync = TRUE; } else { g_warning ("The display does not support the XSync extension."); display->have_xsync = FALSE; display->xsync_event_base = 0; display->xsync_error_base = 0; } #endif /* HAVE_XSYNC */ #ifdef HAVE_RENDER if (XRenderQueryExtension (display->dpy, &display->render_event_base, &display->render_error_base)) { display->have_render = TRUE; } else { g_warning ("The display does not support the XRender extension."); display->have_render = FALSE; display->render_event_base = 0; display->render_error_base = 0; } #else /* HAVE_RENDER */ display->have_render = FALSE; #endif /* HAVE_RENDER */ #ifdef HAVE_RANDR if (XRRQueryExtension (display->dpy, &display->xrandr_event_base, &display->xrandr_error_base)) { display->have_xrandr = TRUE; } else { g_warning ("The display does not support the XRandr extension."); display->have_xrandr = FALSE; display->xrandr_event_base = 0; display->xrandr_error_base = 0; } #else /* HAVE_RANDR */ display->have_xrandr = FALSE; #endif /* HAVE_RANDR */ myDisplayCreateCursor (display); myDisplayCreateTimestampWin (display); display->xfilter = NULL; display->screens = NULL; display->clients = NULL; display->xgrabcount = 0; display->double_click_time = 250; display->double_click_distance = 5; display->nb_screens = 0; display->current_time = CurrentTime; hostnametmp = g_new0 (gchar, (size_t) MAX_HOSTNAME_LENGTH + 1); if (gethostname ((char *) hostnametmp, MAX_HOSTNAME_LENGTH)) { g_warning ("The display's hostname could not be determined."); display->hostname = NULL; } else { hostnametmp[MAX_HOSTNAME_LENGTH] = '\0'; display->hostname = g_strdup(hostnametmp); } g_free (hostnametmp); compositorInitDisplay (display); return display; }
void wsXInit(Display *mDisplay) { int eventbase; int errorbase; // NOTE TO MYSELF: Use global mDisplay, get rid of wsDisplay. wsDisplay = mDisplay; XSetErrorHandler(wsErrorHandler); /* enable DND atoms */ wsXDNDInitialize(); { /* on remote display XShm will be disabled - LGB */ char *dispname = DisplayString(wsDisplay); int localdisp = 1; if (dispname && *dispname != ':') { localdisp = 0; wsUseXShm = 0; } mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[ws] display name: %s => %s display.\n", dispname, localdisp ? "local" : "REMOTE"); if (!localdisp) mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_WS_RemoteDisplay); } if (!XShmQueryExtension(wsDisplay)) { mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_WS_NoXshm); wsUseXShm = 0; } #ifdef CONFIG_XSHAPE if (!XShapeQueryExtension(wsDisplay, &eventbase, &errorbase)) { mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_WS_NoXshape); wsUseXShape = 0; } #else wsUseXShape = 0; #endif XSynchronize(wsDisplay, True); wsScreen = DefaultScreen(wsDisplay); wsRootWin = RootWindow(wsDisplay, wsScreen); #ifdef CONFIG_XF86VM { int clock; XF86VidModeModeLine modeline; XF86VidModeGetModeLine(wsDisplay, wsScreen, &clock, &modeline); wsMaxX = modeline.hdisplay; wsMaxY = modeline.vdisplay; } #endif { wsOrgX = wsOrgY = 0; if (!wsMaxX) wsMaxX = DisplayWidth(wsDisplay, wsScreen); if (!wsMaxY) wsMaxY = DisplayHeight(wsDisplay, wsScreen); } vo_screenwidth = wsMaxX; vo_screenheight = wsMaxY; xinerama_x = wsOrgX; xinerama_y = wsOrgY; update_xinerama_info(); wsMaxX = vo_screenwidth; wsMaxY = vo_screenheight; wsOrgX = xinerama_x; wsOrgY = xinerama_y; wsGetDepthOnScreen(); mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[ws] Screen depth: %d\n", wsDepthOnScreen); mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[ws] size: %dx%d\n", wsMaxX, wsMaxY); #ifdef CONFIG_XINERAMA mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[ws] origin: +%d+%d\n", wsOrgX, wsOrgY); #endif mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[ws] red mask: 0x%x\n", wsRedMask); mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[ws] green mask: 0x%x\n", wsGreenMask); mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[ws] blue mask: 0x%x\n", wsBlueMask); #ifdef MP_DEBUG if (wsUseXShm) { int minor, major, shp; XShmQueryVersion(wsDisplay, &major, &minor, &shp); mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[ws] XShm version is %d.%d\n", major, minor); } #ifdef CONFIG_XSHAPE if (wsUseXShape) { int minor, major; XShapeQueryVersion(wsDisplay, &major, &minor); mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[ws] XShape version is %d.%d\n", major, minor); } #endif #endif wsOutMask = wsGetOutMask(); switch (wsOutMask) { case wsRGB32: out_pix_fmt = PIX_FMT_RGB32; break; case wsBGR32: out_pix_fmt = PIX_FMT_BGR32; break; case wsRGB24: out_pix_fmt = PIX_FMT_RGB24; break; case wsBGR24: out_pix_fmt = PIX_FMT_BGR24; break; case wsRGB16: out_pix_fmt = PIX_FMT_RGB565; break; case wsBGR16: out_pix_fmt = PIX_FMT_BGR565; break; case wsRGB15: out_pix_fmt = PIX_FMT_RGB555; break; case wsBGR15: out_pix_fmt = PIX_FMT_BGR555; break; } }
void Extensions::init() { int event_base, error_base; data_nextensions = 0; shape_version = 0; if( XShapeQueryExtension( display(), &shape_event_base, &error_base )) { int major, minor; if( XShapeQueryVersion( display(), &major, &minor )) { shape_version = major * 0x10 + minor; addData( "SHAPE" ); } } #ifdef HAVE_XRANDR has_randr = XRRQueryExtension( display(), &randr_event_base, &error_base ); if( has_randr ) { int major, minor; XRRQueryVersion( display(), &major, &minor ); has_randr = ( major > 1 || ( major == 1 && minor >= 1 ) ); addData( "RANDR" ); } #else has_randr = false; #endif #ifdef HAVE_XDAMAGE has_damage = XDamageQueryExtension( display(), &damage_event_base, &error_base ); if( has_damage ) addData( "DAMAGE" ); #else has_damage = false; #endif composite_version = 0; #ifdef HAVE_XCOMPOSITE if( XCompositeQueryExtension( display(), &event_base, &error_base )) { int major = 0, minor = 0; XCompositeQueryVersion( display(), &major, &minor ); composite_version = major * 0x10 + minor; addData( "Composite" ); } #endif fixes_version = 0; #ifdef HAVE_XFIXES if( XFixesQueryExtension( display(), &event_base, &error_base )) { int major = 0, minor = 0; XFixesQueryVersion( display(), &major, &minor ); fixes_version = major * 0x10 + minor; addData( "XFIXES" ); } #endif render_version = 0; #ifdef HAVE_XRENDER if( XRenderQueryExtension( display(), &event_base, &error_base )) { int major = 0, minor = 0; XRenderQueryVersion( display(), &major, &minor ); render_version = major * 0x10 + minor; addData( "RENDER" ); } #endif has_glx = false; #ifdef HAVE_OPENGL has_glx = glXQueryExtension( display(), &event_base, &error_base ); if( has_glx ) addData( "GLX" ); #endif #ifdef HAVE_XSYNC if( XSyncQueryExtension( display(), &sync_event_base, &error_base )) { int major = 0, minor = 0; if( XSyncInitialize( display(), &major, &minor )) { has_sync = true; addData( "SYNC" ); } } #endif kDebug( 1212 ) << "Extensions: shape: 0x" << QString::number( shape_version, 16 ) << " composite: 0x" << QString::number( composite_version, 16 ) << " render: 0x" << QString::number( render_version, 16 ) << " fixes: 0x" << QString::number( fixes_version, 16 ) << endl; }
void wsXInit( void* mDisplay ) { int eventbase; int errorbase; if(mDisplay){ wsDisplay=mDisplay; } else { char * DisplayName = ":0.0"; if ( getenv( "DISPLAY" ) ) DisplayName=getenv( "DISPLAY" ); wsDisplay=XOpenDisplay( DisplayName ); if ( !wsDisplay ) { mp_msg( MSGT_GPLAYER,MSGL_FATAL,MSGTR_WS_CouldNotOpenDisplay ); exit( 0 ); } } /* enable DND atoms */ wsXDNDInitialize(); { /* on remote display XShm will be disabled - LGB */ char *dispname=DisplayString(wsDisplay); int localdisp=1; if (dispname&&*dispname!=':') { localdisp=0; wsUseXShm=0; } mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[ws] display name: %s => %s display.\n",dispname,localdisp?"local":"REMOTE"); if (!localdisp) mp_msg( MSGT_GPLAYER,MSGL_V,MSGTR_WS_RemoteDisplay ); } if ( !XShmQueryExtension( wsDisplay ) ) { mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_WS_NoXshm ); wsUseXShm=0; } #ifdef HAVE_XSHAPE if ( !XShapeQueryExtension( wsDisplay,&eventbase,&errorbase ) ) { mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_WS_NoXshape ); wsUseXShape=0; } #else wsUseXShape=0; #endif XSynchronize( wsDisplay,True ); wsScreen=DefaultScreen( wsDisplay ); wsRootWin=RootWindow( wsDisplay,wsScreen ); #ifdef HAVE_XF86VM { int clock; XF86VidModeModeLine modeline; XF86VidModeGetModeLine( wsDisplay,wsScreen,&clock ,&modeline ); wsMaxX=modeline.hdisplay; wsMaxY=modeline.vdisplay; } #endif { wsOrgX = wsOrgY = 0; if ( !wsMaxX ) wsMaxX=DisplayWidth( wsDisplay,wsScreen ); if ( !wsMaxY ) wsMaxY=DisplayHeight( wsDisplay,wsScreen ); } vo_screenwidth = wsMaxX; vo_screenheight = wsMaxY; xinerama_x = wsOrgX; xinerama_y = wsOrgY; update_xinerama_info(); wsMaxX = vo_screenwidth; wsMaxY = vo_screenheight; wsOrgX = xinerama_x; wsOrgY = xinerama_y; wsGetDepthOnScreen(); #ifdef DEBUG { int minor,major,shp; mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] Screen depth: %d\n",wsDepthOnScreen ); mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] size: %dx%d\n",wsMaxX,wsMaxY ); #ifdef HAVE_XINERAMA mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] origin: +%d+%d\n",wsOrgX,wsOrgY ); #endif mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] red mask: 0x%x\n",wsRedMask ); mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] green mask: 0x%x\n",wsGreenMask ); mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] blue mask: 0x%x\n",wsBlueMask ); if ( wsUseXShm ) { XShmQueryVersion( wsDisplay,&major,&minor,&shp ); mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] XShm version is %d.%d\n",major,minor ); } #ifdef HAVE_XSHAPE if ( wsUseXShape ) { XShapeQueryVersion( wsDisplay,&major,&minor ); mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] XShape version is %d.%d\n",major,minor ); } #endif } #endif wsOutMask=wsGetOutMask(); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[ws] Initialized converter: " ); sws_rgb2rgb_init(get_sws_cpuflags()); switch ( wsOutMask ) { case wsRGB32: mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to rgb32\n" ); wsConvFunc=rgb32torgb32; break; case wsBGR32: mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to bgr32\n" ); wsConvFunc=rgb32tobgr32; break; case wsRGB24: mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to rgb24\n" ); wsConvFunc=rgb32to24; break; case wsBGR24: mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to bgr24\n" ); wsConvFunc=rgb32tobgr24; break; case wsRGB16: mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to rgb16\n" ); wsConvFunc=rgb32to16; break; case wsBGR16: mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to bgr16\n" ); wsConvFunc=rgb32tobgr16; break; case wsRGB15: mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to rgb15\n" ); wsConvFunc=rgb32to15; break; case wsBGR15: mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to bgr15\n" ); wsConvFunc=rgb32tobgr15; break; } XSetErrorHandler( wsErrorHandler ); }
void wsInit(Display *display) { int eventbase; int errorbase; mp_msg(MSGT_GPLAYER, MSGL_V, "X init.\n"); wsDisplay = display; wsSetErrorHandler(); /* enable DND atoms */ wsXDNDInitialize(); { /* on remote display XShm will be disabled - LGB */ char *dispname = DisplayString(wsDisplay); int localdisp = 1; if (dispname && *dispname != ':') { localdisp = 0; wsUseXShm = False; } mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[ws] display name: %s => %s display.\n", dispname, localdisp ? "local" : "REMOTE"); if (!localdisp) mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_WS_RemoteDisplay); } #ifdef HAVE_SHM if (!XShmQueryExtension(wsDisplay)) #endif wsUseXShm = False; if (!wsUseXShm) mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_WS_NoXshm); #ifdef CONFIG_XSHAPE if (!XShapeQueryExtension(wsDisplay, &eventbase, &errorbase)) #endif wsUseXShape = False; if (!wsUseXShape) mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_WS_NoXshape); XSynchronize(wsDisplay, True); wsScreen = DefaultScreen(wsDisplay); wsRootWin = RootWindow(wsDisplay, wsScreen); #ifdef CONFIG_XF86VM { int clock; XF86VidModeModeLine modeline; XF86VidModeGetModeLine(wsDisplay, wsScreen, &clock, &modeline); wsMaxX = modeline.hdisplay; wsMaxY = modeline.vdisplay; } #endif { wsOrgX = wsOrgY = 0; if (!wsMaxX) wsMaxX = DisplayWidth(wsDisplay, wsScreen); if (!wsMaxY) wsMaxY = DisplayHeight(wsDisplay, wsScreen); } wsWindowUpdateXinerama(NULL); wsGetScreenDepth(); mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[ws] Screen depth: %d\n", wsScreenDepth); mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[ws] size: %dx%d\n", wsMaxX, wsMaxY); #ifdef CONFIG_XINERAMA mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[ws] origin: +%d+%d\n", wsOrgX, wsOrgY); #endif mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[ws] red mask: 0x%x\n", wsRedMask); mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[ws] green mask: 0x%x\n", wsGreenMask); mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[ws] blue mask: 0x%x\n", wsBlueMask); #ifdef HAVE_SHM if (wsUseXShm) { int minor, major, shp; XShmQueryVersion(wsDisplay, &major, &minor, &shp); mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[ws] XShm version is %d.%d\n", major, minor); } #endif #ifdef CONFIG_XSHAPE if (wsUseXShape) { int minor, major; XShapeQueryVersion(wsDisplay, &major, &minor); mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[ws] XShape version is %d.%d\n", major, minor); } #endif if (wsScreenDepth == 32 && wsRedMask == 0xff0000 && wsGreenMask == 0x00ff00 && wsBlueMask == 0x0000ff) out_pix_fmt = PIX_FMT_RGB32; else if (wsScreenDepth == 32 && wsRedMask == 0x0000ff && wsGreenMask == 0x00ff00 && wsBlueMask == 0xff0000) out_pix_fmt = PIX_FMT_BGR32; else if (wsScreenDepth == 24 && wsRedMask == 0xff0000 && wsGreenMask == 0x00ff00 && wsBlueMask == 0x0000ff) out_pix_fmt = PIX_FMT_RGB24; else if (wsScreenDepth == 24 && wsRedMask == 0x0000ff && wsGreenMask == 0x00ff00 && wsBlueMask == 0xff0000) out_pix_fmt = PIX_FMT_BGR24; else if (wsScreenDepth == 16 && wsRedMask == 0xf800 && wsGreenMask == 0x7e0 && wsBlueMask == 0x1f) out_pix_fmt = PIX_FMT_RGB565; else if (wsScreenDepth == 16 && wsRedMask == 0x1f && wsGreenMask == 0x7e0 && wsBlueMask == 0xf800) out_pix_fmt = PIX_FMT_BGR565; else if (wsScreenDepth == 15 && wsRedMask == 0x7c00 && wsGreenMask == 0x3e0 && wsBlueMask == 0x1f) out_pix_fmt = PIX_FMT_RGB555; else if (wsScreenDepth == 15 && wsRedMask == 0x1f && wsGreenMask == 0x3e0 && wsBlueMask == 0x7c00) out_pix_fmt = PIX_FMT_BGR555; }
void SplashInitPlatform(Splash * splash) { int shapeVersionMajor, shapeVersionMinor; // This setting enables the synchronous Xlib mode! // Don't use it == 1 in production builds! #if (defined DEBUG) _Xdebug = 1; #endif pthread_mutex_init(&splash->lock, NULL); // We should not ignore any errors. //XSetErrorHandler(HandleError); // XSetIOErrorHandler(HandleIOError); XSetIOErrorHandler(NULL); splash->display = XOpenDisplay(NULL); if (!splash->display) { splash->isVisible = -1; return; } shapeSupported = XShapeQueryExtension(splash->display, &shapeEventBase, &shapeErrorBase); if (shapeSupported) { XShapeQueryVersion(splash->display, &shapeVersionMajor, &shapeVersionMinor); } splash->screen = XDefaultScreenOfDisplay(splash->display); splash->visual = XDefaultVisualOfScreen(splash->screen); switch (splash->visual->class) { case TrueColor: { int depth = XDefaultDepthOfScreen(splash->screen); splash->byteAlignment = 1; splash->maskRequired = shapeSupported; initFormat(&splash->screenFormat, splash->visual->red_mask, splash->visual->green_mask, splash->visual->blue_mask, 0); splash->screenFormat.byteOrder = (XImageByteOrder(splash->display) == LSBFirst ? BYTE_ORDER_LSBFIRST : BYTE_ORDER_MSBFIRST); splash->screenFormat.depthBytes = (depth + 7) / 8; // TrueColor depth probably can't be less // than 8 bits, and it's always byte padded break; } case PseudoColor: { int availableColors; int numColors; int numComponents[3]; unsigned long colorIndex[SPLASH_COLOR_MAP_SIZE]; XColor xColors[SPLASH_COLOR_MAP_SIZE]; int i; int depth = XDefaultDepthOfScreen(splash->screen); int scale = 65535 / MAX_COLOR_VALUE; availableColors = GetNumAvailableColors(splash->display, splash->screen, splash->visual->map_entries); numColors = quantizeColors(availableColors, numComponents); if (numColors > availableColors) { // Could not allocate the color cells. Most probably // the pool got exhausted. Disable the splash screen. XCloseDisplay(splash->display); splash->isVisible = -1; splash->display = NULL; splash->screen = NULL; splash->visual = NULL; fprintf(stderr, "Warning: unable to initialize the splashscreen. Not enough available color cells.\n"); return; } splash->cmap = AllocColors(splash->display, splash->screen, numColors, colorIndex); for (i = 0; i < numColors; i++) { splash->colorIndex[i] = colorIndex[i]; } initColorCube(numComponents, splash->colorMap, splash->dithers, splash->colorIndex); for (i = 0; i < numColors; i++) { xColors[i].pixel = colorIndex[i]; xColors[i].red = (unsigned short) QUAD_RED(splash->colorMap[colorIndex[i]]) * scale; xColors[i].green = (unsigned short) QUAD_GREEN(splash->colorMap[colorIndex[i]]) * scale; xColors[i].blue = (unsigned short) QUAD_BLUE(splash->colorMap[colorIndex[i]]) * scale; xColors[i].flags = DoRed | DoGreen | DoBlue; } XStoreColors(splash->display, splash->cmap, xColors, numColors); initFormat(&splash->screenFormat, 0, 0, 0, 0); splash->screenFormat.colorIndex = splash->colorIndex; splash->screenFormat.depthBytes = (depth + 7) / 8; // or always 8? splash->screenFormat.colorMap = splash->colorMap; splash->screenFormat.dithers = splash->dithers; splash->screenFormat.numColors = numColors; splash->screenFormat.byteOrder = BYTE_ORDER_NATIVE; break; } default: ; /* FIXME: should probably be fixed, but javaws splash screen doesn't support other visuals either */ } }