void RiskGameView::Run() { sf::RenderWindow renderer(sf::VideoMode((unsigned int)SCREEN_WIDTH, (unsigned int)SCREEN_HEIGHT), WINDOW_TITLE); renderer.resetGLStates(); renderer_ = &renderer; AddScreen("statistics", new GameDisplay()); SetScreen("statistics"); sf::Event event; sf::Clock clock; while (renderer.isOpen() && RiskGame::Instance().IsRunning()) { while (renderer.pollEvent(event)) { desktop_.HandleEvent(event); if (event.type == sf::Event::Closed) { renderer.close(); } } desktop_.Update(clock.restart().asSeconds()); renderer.clear(); currentScreen_->Draw(renderer); currentScreen_->Update(); sfgui_.Display(renderer); renderer.display(); } }
static void KdAddScreen(ScreenInfo * pScreenInfo, KdScreenInfo * screen, int argc, char **argv) { int i; /* * Fill in fb visual type masks for this screen */ for (i = 0; i < pScreenInfo->numPixmapFormats; i++) { unsigned long visuals; Pixel rm, gm, bm; visuals = 0; rm = gm = bm = 0; if (pScreenInfo->formats[i].depth == screen->fb.depth) { visuals = screen->fb.visuals; rm = screen->fb.redMask; gm = screen->fb.greenMask; bm = screen->fb.blueMask; } fbSetVisualTypesAndMasks(pScreenInfo->formats[i].depth, visuals, 8, rm, gm, bm); } kdCurrentScreen = screen; AddScreen(KdScreenInit, argc, argv); }
bool SUIManager::LoadFromString( SPString stringStream ) { SPString screensString = SPStringHelper::XMLExcludeFrom(stringStream, L"ScreenList"); stringStream = SPStringHelper::XMLRemoveFirst(stringStream, L"ScreenList"); while(screensString.size() > 0) { SPString screenString = SPStringHelper::XMLExcludeFrom(screensString, L"SUIScreen"); screensString = SPStringHelper::XMLRemoveFirst(screensString, L"SUIScreen"); SPString screenNameString = SPStringHelper::XMLExcludeFrom(screenString, L"Name"); SUIScreenPtr screen = new SUIScreen(); screen->SetName(screenNameString); AddScreen(screen); dispalyStack.push_back(screen); screen->LoadFromString(screenString); } dispalyStack.clear(); SPString displayStackString = SPStringHelper::XMLExcludeFrom(stringStream, L"DisplayStack"); stringStream = SPStringHelper::XMLRemoveFirst(stringStream, L"DisplayStack"); while(displayStackString.size() > 0) { SPString screenNameString = SPStringHelper::XMLExcludeFrom(displayStackString, L"ScreenName"); displayStackString = SPStringHelper::XMLRemoveFirst(displayStackString, L"ScreenName"); dispalyStack.push_front(GetScreen(screenNameString)); } return true; }
status_t VirtualScreen::SetConfiguration(Desktop& desktop, ScreenConfigurations& configurations, uint32* _changedScreens) { // Remember previous screen modes typedef std::map<Screen*, display_mode> ScreenModeMap; ScreenModeMap previousModes; bool previousModesFailed = false; if (_changedScreens != NULL) { *_changedScreens = 0; try { for (int32 i = 0; i < fScreenList.CountItems(); i++) { Screen* screen = fScreenList.ItemAt(i)->screen; display_mode mode; screen->GetMode(mode); previousModes.insert(std::make_pair(screen, mode)); } } catch (...) { previousModesFailed = true; *_changedScreens = ~0L; } } _Reset(); ScreenList list; status_t status = gScreenManager->AcquireScreens(&desktop, NULL, 0, desktop.TargetScreen(), false, list); if (status != B_OK) { // TODO: we would try again here with force == true return status; } for (int32 i = 0; i < list.CountItems(); i++) { Screen* screen = list.ItemAt(i); AddScreen(screen, configurations); if (!previousModesFailed && _changedScreens != NULL) { // Figure out which screens have changed their mode display_mode mode; screen->GetMode(mode); ScreenModeMap::const_iterator found = previousModes.find(screen); if (found != previousModes.end() && memcmp(&mode, &found->second, sizeof(display_mode))) *_changedScreens |= 1 << i; } } UpdateFrame(); return B_OK; }
LTBOOL CTronScreenMgr::Init() { //build screen array m_screenArray.reserve(SCREEN_ID_UNASSIGNED); for (int nID = SCREEN_ID_MAIN; nID < SCREEN_ID_UNASSIGNED; ++nID) { AddScreen((eScreenID)nID); } return CScreenMgr::Init(); }
//----------------------------------------------------------------------------------------------------------------------------------- void ScreenManager::Transition(BaseScreen* transitionFrom, BaseScreen* transitionTo) { // Want to make sure that our screen exists to delete bool screenExists = false; for (BaseScreen* screen : m_activeScreens) { screenExists = screenExists || screen == transitionFrom; } assert(screenExists); AddScreen(transitionTo); RemoveScreen(transitionFrom); }
void InitOutput(ScreenInfo *screenInfo, int argc, char *argv[]) { int i, j; xnestOpenDisplay(argc, argv); screenInfo->imageByteOrder = ImageByteOrder(xnestDisplay); screenInfo->bitmapScanlineUnit = BitmapUnit(xnestDisplay); screenInfo->bitmapScanlinePad = BitmapPad(xnestDisplay); screenInfo->bitmapBitOrder = BitmapBitOrder(xnestDisplay); screenInfo->numPixmapFormats = 0; for (i = 0; i < xnestNumPixmapFormats; i++) for (j = 0; j < xnestNumDepths; j++) if ((xnestPixmapFormats[i].depth == 1) || (xnestPixmapFormats[i].depth == xnestDepths[j])) { screenInfo->formats[screenInfo->numPixmapFormats].depth = xnestPixmapFormats[i].depth; screenInfo->formats[screenInfo->numPixmapFormats].bitsPerPixel = xnestPixmapFormats[i].bits_per_pixel; screenInfo->formats[screenInfo->numPixmapFormats].scanlinePad = xnestPixmapFormats[i].scanline_pad; screenInfo->numPixmapFormats++; break; } xnestWindowPrivateIndex = AllocateWindowPrivateIndex(); xnestGCPrivateIndex = AllocateGCPrivateIndex(); xnestFontPrivateIndex = AllocateFontPrivateIndex(); if (!xnestNumScreens) xnestNumScreens = 1; for (i = 0; i < xnestNumScreens; i++) AddScreen(xnestOpenScreen, argc, argv); xnestNumScreens = screenInfo->numScreens; xnestDoFullGeneration = xnestFullGeneration; }
void xeglInitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) { glitz_drawable_format_t *format, templ; int i, maj, min, count; unsigned long mask; xglSetPixmapFormats (pScreenInfo); if (!eDisplay) { eDisplay = eglGetDisplay (":0"); if (!eglInitialize (eDisplay, &maj, &min)) FatalError ("can't open display"); eglGetScreensMESA (eDisplay, &eScreen, 1, &count); } templ.samples = 1; templ.doublebuffer = 1; templ.color.alpha_size = 8; mask = GLITZ_FORMAT_SAMPLES_MASK; format = glitz_egl_find_window_config (eDisplay, eScreen, mask, &templ, 0); if (!format) FatalError ("no visual format found"); xglSetVisualTypesAndMasks (pScreenInfo, format, (1 << TrueColor)); xglInitVisuals (pScreenInfo); AddScreen (xeglScreenInit, argc, argv); }
void PrinterInitOutput( ScreenInfo *pScreenInfo, int argc, char **argv) { PrinterDbPtr pDb, pDbEntry; int driverCount = 0, i; char **driverNames; char *configDir; /* * this little test is just a warning at startup to make sure * that the config directory exists. * * what this ugly looking if says is that if both ways of * calling configDir works and both directories don't exist, * then print an error saying we can't find the non-lang one. */ if (((configDir = XpGetConfigDir(TRUE)) != NULL) && (access(configDir, F_OK) == 0)) { xfree(configDir); } else if (((configDir = XpGetConfigDir(FALSE)) != NULL) && (access(configDir, F_OK) == 0)) { xfree(configDir); } else { ErrorF("Xp Extension: could not find config dir %s\n", configDir ? configDir : XPRINTDIR); if (configDir) xfree(configDir); } if(printerDb != (PrinterDbPtr)NULL) FreePrinterDb(); /* * Calling BuildPrinterDb serves to build the printer database, * and to initialize the attribute store for each printer. * The driver can, if it so desires, modify the attribute * store at a later time. */ if((pDb = BuildPrinterDb()) == (PrinterDbPtr)NULL) return; /* * We now have to decide how many screens to initialize, and call * AddScreen for each one. The printerDb must be properly initialized * for at least one screen's worth of printers prior to calling AddScreen * because InitPrintDrivers reads the printerDb to determine which * driver(s) to init on a particular screen. * We put each driver's printers on a different * screen, and call AddScreen for each screen/driver pair. */ /* count the number of printers */ for(pDbEntry = pDb, driverCount = 0; pDbEntry != (PrinterDbPtr)NULL; pDbEntry = pDbEntry->next, driverCount++) ; /* * Allocate memory for the worst case - a driver per printer */ driverNames = (char **)xalloc(sizeof(char *) * driverCount); /* * Assign the driver for the first printer to the first screen */ pDb->screenNum = screenInfo.numScreens; driverNames[0] = pDb->driverName; driverCount = 1; AddFormats(pScreenInfo, pDb->driverName); /* * For each printer, look to see if its driver is already assigned * to a screen, and if so copy that screen number into the printerDb. * Otherwise, assign a new screen number to the driver for this * printer. */ for(pDbEntry = pDb; pDbEntry != (PrinterDbPtr)NULL; pDbEntry = pDbEntry->next) { Bool foundMatch; for(i = 0, foundMatch = FALSE; i < driverCount; i++) { if(!strcmp(driverNames[i], pDbEntry->driverName)) { foundMatch = TRUE; pDbEntry->screenNum = screenInfo.numScreens + i; break; } } if(foundMatch == FALSE) { driverNames[driverCount] = pDbEntry->driverName; pDbEntry->screenNum = screenInfo.numScreens + driverCount; AddFormats(pScreenInfo, pDbEntry->driverName); driverCount++; } } for(i = 0; i < driverCount; i++) { int curScreen = screenInfo.numScreens; if(AddScreen(InitPrintDrivers, argc, argv) < 0) { PrinterDbPtr pPrev; /* * AddScreen failed, so we pull the associated printers * from the list. */ ErrorF("Xp Extension: Could not add screen for driver %s\n", driverNames[i]); for(pPrev = pDbEntry = printerDb; pDbEntry != (PrinterDbPtr)NULL; pDbEntry = pDbEntry->next) { if(pDbEntry->screenNum == curScreen) { if(pPrev == printerDb) { printerDb = pDbEntry->next; pPrev = printerDb; } else pPrev->next = pDbEntry->next; xfree(pDbEntry->name); xfree(pDbEntry); pDbEntry = pPrev; } else { if(pDbEntry->screenNum > curScreen) pDbEntry->screenNum--; pPrev = pDbEntry; } } } } xfree(driverNames); AugmentFontPath(); if(pScreenInfo->numScreens > MAXSCREENS) { ErrorF("The number of printer screens requested "); ErrorF("exceeds the allowable limit of %d screens.\n", MAXSCREENS); ErrorF("Please reduce the number of requested printers in your "); ErrorF("\nX%sprinters file.", display); ErrorF("Server exiting...\n"); exit(-1); } }
void InitOutput(ScreenInfo * screenInfo, int argc, char *argv[]) { int i; /* Log the command line */ winLogCommandLine(argc, argv); #if CYGDEBUG winDebug("InitOutput\n"); #endif /* Validate command-line arguments */ if (serverGeneration == 1 && !winValidateArgs()) { FatalError("InitOutput - Invalid command-line arguments found. " "Exiting.\n"); } /* Check for duplicate invocation on same display number. */ if (serverGeneration == 1 && !winCheckDisplayNumber()) { if (g_fSilentDupError) g_fSilentFatalError = TRUE; FatalError("InitOutput - Duplicate invocation on display " "number: %s. Exiting.\n", display); } #ifdef XWIN_XF86CONFIG /* Try to read the xorg.conf-style configuration file */ if (!winReadConfigfile()) winErrorFVerb(1, "InitOutput - Error reading config file\n"); #else winMsg(X_INFO, "xorg.conf is not supported\n"); winMsg(X_INFO, "See http://x.cygwin.com/docs/faq/cygwin-x-faq.html " "for more information\n"); winConfigFiles(); #endif /* Load preferences from XWinrc file */ LoadPreferences(); /* Setup global screen info parameters */ screenInfo->imageByteOrder = IMAGE_BYTE_ORDER; screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; screenInfo->numPixmapFormats = NUMFORMATS; /* Describe how we want common pixmap formats padded */ for (i = 0; i < NUMFORMATS; i++) { screenInfo->formats[i] = g_PixmapFormats[i]; } /* Load pointers to DirectDraw functions */ winGetDDProcAddresses(); /* Detect supported engines */ winDetectSupportedEngines(); /* Store the instance handle */ g_hInstance = GetModuleHandle(NULL); /* Initialize each screen */ for (i = 0; i < g_iNumScreens; ++i) { /* Initialize the screen */ if (-1 == AddScreen(winScreenInit, argc, argv)) { FatalError("InitOutput - Couldn't add screen %d", i); } } #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) /* Generate a cookie used by internal clients for authorization */ if (g_fXdmcpEnabled || g_fAuthEnabled) winGenerateAuthorization(); /* Perform some one time initialization */ if (1 == serverGeneration) { /* * setlocale applies to all threads in the current process. * Apply locale specified in LANG environment variable. */ setlocale(LC_ALL, ""); } #endif #if CYGDEBUG || YES winDebug("InitOutput - Returning.\n"); #endif }
/* * InitOutput -- * Initialize screenInfo for all actually accessible framebuffers. * That includes vt-manager setup, querying all possible devices and * collecting the pixmap formats. */ void InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) { int i, j, k, scr_index, was_blocked = 0; char **modulelist; pointer *optionlist; Pix24Flags screenpix24, pix24; MessageType pix24From = X_DEFAULT; Bool pix24Fail = FALSE; Bool autoconfig = FALSE; GDevPtr configured_device; xf86Initialising = TRUE; if (serverGeneration == 1) { if ((xf86ServerName = strrchr(argv[0], '/')) != 0) xf86ServerName++; else xf86ServerName = argv[0]; xf86PrintBanner(); xf86PrintMarkers(); if (xf86LogFile) { time_t t; const char *ct; t = time(NULL); ct = ctime(&t); xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s", xf86LogFile, ct); } /* Read and parse the config file */ if (!xf86DoConfigure && !xf86DoShowOptions) { switch (xf86HandleConfigFile(FALSE)) { case CONFIG_OK: break; case CONFIG_PARSE_ERROR: xf86Msg(X_ERROR, "Error parsing the config file\n"); return; case CONFIG_NOFILE: autoconfig = TRUE; break; } } InstallSignalHandlers(); /* Initialise the loader */ LoaderInit(); /* Tell the loader the default module search path */ LoaderSetPath(xf86ModulePath); if (xf86Info.ignoreABI) { LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL); } if (xf86DoShowOptions) DoShowOptions(); /* Do a general bus probe. This will be a PCI probe for x86 platforms */ xf86BusProbe(); if (xf86DoConfigure) DoConfigure(); if (autoconfig) { if (!xf86AutoConfig()) { xf86Msg(X_ERROR, "Auto configuration failed\n"); return; } } #ifdef XF86PM xf86OSPMClose = xf86OSPMOpen(); #endif /* Load all modules specified explicitly in the config file */ if ((modulelist = xf86ModulelistFromConfig(&optionlist))) { xf86LoadModules(modulelist, optionlist); free(modulelist); free(optionlist); } /* Load all driver modules specified in the config file */ /* If there aren't any specified in the config file, autoconfig them */ /* FIXME: Does not handle multiple active screen sections, but I'm not * sure if we really want to handle that case*/ configured_device = xf86ConfigLayout.screens->screen->device; if ((!configured_device) || (!configured_device->driver)) { if (!autoConfigDevice(configured_device)) { xf86Msg(X_ERROR, "Automatic driver configuration failed\n"); return ; } } if ((modulelist = xf86DriverlistFromConfig())) { xf86LoadModules(modulelist, NULL); free(modulelist); } /* Load all input driver modules specified in the config file. */ if ((modulelist = xf86InputDriverlistFromConfig())) { xf86LoadModules(modulelist, NULL); free(modulelist); } /* * It is expected that xf86AddDriver()/xf86AddInputDriver will be * called for each driver as it is loaded. Those functions save the * module pointers for drivers. * XXX Nothing keeps track of them for other modules. */ /* XXX What do we do if not all of these could be loaded? */ /* * At this point, xf86DriverList[] is all filled in with entries for * each of the drivers to try and xf86NumDrivers has the number of * drivers. If there are none, return now. */ if (xf86NumDrivers == 0) { xf86Msg(X_ERROR, "No drivers available.\n"); return; } /* * Call each of the Identify functions and call the driverFunc to check * if HW access is required. The Identify functions print out some * identifying information, and anything else that might be * needed at this early stage. */ for (i = 0; i < xf86NumDrivers; i++) { if (xf86DriverList[i]->Identify != NULL) xf86DriverList[i]->Identify(0); if (!xorgHWAccess || !xorgHWOpenConsole) { xorgHWFlags flags; if(!xf86DriverList[i]->driverFunc || !xf86DriverList[i]->driverFunc(NULL, GET_REQUIRED_HW_INTERFACES, &flags)) flags = HW_IO; if(NEED_IO_ENABLED(flags)) xorgHWAccess = TRUE; if(!(flags & HW_SKIP_CONSOLE)) xorgHWOpenConsole = TRUE; } } if (xorgHWOpenConsole) xf86OpenConsole(); else xf86Info.dontVTSwitch = TRUE; if (xf86BusConfig() == FALSE) return; xf86PostProbe(); /* * Sort the drivers to match the requested ording. Using a slow * bubble sort. */ for (j = 0; j < xf86NumScreens - 1; j++) { for (i = 0; i < xf86NumScreens - j - 1; i++) { if (xf86Screens[i + 1]->confScreen->screennum < xf86Screens[i]->confScreen->screennum) { ScrnInfoPtr tmpScrn = xf86Screens[i + 1]; xf86Screens[i + 1] = xf86Screens[i]; xf86Screens[i] = tmpScrn; } } } /* Fix up the indexes */ for (i = 0; i < xf86NumScreens; i++) { xf86Screens[i]->scrnIndex = i; } /* * Call the driver's PreInit()'s to complete initialisation for the first * generation. */ for (i = 0; i < xf86NumScreens; i++) { xf86VGAarbiterScrnInit(xf86Screens[i]); xf86VGAarbiterLock(xf86Screens[i]); if (xf86Screens[i]->PreInit && xf86Screens[i]->PreInit(xf86Screens[i], 0)) xf86Screens[i]->configured = TRUE; xf86VGAarbiterUnlock(xf86Screens[i]); } for (i = 0; i < xf86NumScreens; i++) if (!xf86Screens[i]->configured) xf86DeleteScreen(i--, 0); /* * If no screens left, return now. */ if (xf86NumScreens == 0) { xf86Msg(X_ERROR, "Screen(s) found, but none have a usable configuration.\n"); return; } for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->name == NULL) { XNFasprintf(&xf86Screens[i]->name, "screen%d", i); xf86MsgVerb(X_WARNING, 0, "Screen driver %d has no name set, using `%s'.\n", i, xf86Screens[i]->name); } } /* Remove (unload) drivers that are not required */ for (i = 0; i < xf86NumDrivers; i++) if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0) xf86DeleteDriver(i); /* * At this stage we know how many screens there are. */ for (i = 0; i < xf86NumScreens; i++) xf86InitViewport(xf86Screens[i]); /* * Collect all pixmap formats and check for conflicts at the display * level. Should we die here? Or just delete the offending screens? */ screenpix24 = Pix24DontCare; for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->imageByteOrder != xf86Screens[0]->imageByteOrder) FatalError("Inconsistent display bitmapBitOrder. Exiting\n"); if (xf86Screens[i]->bitmapScanlinePad != xf86Screens[0]->bitmapScanlinePad) FatalError("Inconsistent display bitmapScanlinePad. Exiting\n"); if (xf86Screens[i]->bitmapScanlineUnit != xf86Screens[0]->bitmapScanlineUnit) FatalError("Inconsistent display bitmapScanlineUnit. Exiting\n"); if (xf86Screens[i]->bitmapBitOrder != xf86Screens[0]->bitmapBitOrder) FatalError("Inconsistent display bitmapBitOrder. Exiting\n"); /* Determine the depth 24 pixmap format the screens would like */ if (xf86Screens[i]->pixmap24 != Pix24DontCare) { if (screenpix24 == Pix24DontCare) screenpix24 = xf86Screens[i]->pixmap24; else if (screenpix24 != xf86Screens[i]->pixmap24) FatalError("Inconsistent depth 24 pixmap format. Exiting\n"); } } /* check if screenpix24 is consistent with the config/cmdline */ if (xf86Info.pixmap24 != Pix24DontCare) { pix24 = xf86Info.pixmap24; pix24From = xf86Info.pix24From; if (screenpix24 != Pix24DontCare && screenpix24 != xf86Info.pixmap24) pix24Fail = TRUE; } else if (screenpix24 != Pix24DontCare) { pix24 = screenpix24; pix24From = X_PROBED; } else pix24 = Pix24Use32; if (pix24Fail) FatalError("Screen(s) can't use the required depth 24 pixmap format" " (%d). Exiting\n", PIX24TOBPP(pix24)); /* Initialise the depth 24 format */ for (j = 0; j < numFormats && formats[j].depth != 24; j++) ; formats[j].bitsPerPixel = PIX24TOBPP(pix24); /* Collect additional formats */ for (i = 0; i < xf86NumScreens; i++) { for (j = 0; j < xf86Screens[i]->numFormats; j++) { for (k = 0; ; k++) { if (k >= numFormats) { if (k >= MAXFORMATS) FatalError("Too many pixmap formats! Exiting\n"); formats[k] = xf86Screens[i]->formats[j]; numFormats++; break; } if (formats[k].depth == xf86Screens[i]->formats[j].depth) { if ((formats[k].bitsPerPixel == xf86Screens[i]->formats[j].bitsPerPixel) && (formats[k].scanlinePad == xf86Screens[i]->formats[j].scanlinePad)) break; FatalError("Inconsistent pixmap format for depth %d." " Exiting\n", formats[k].depth); } } } } formatsDone = TRUE; if (xf86Info.vtno >= 0 ) { #define VT_ATOM_NAME "XFree86_VT" Atom VTAtom=-1; CARD32 *VT = NULL; int ret; /* This memory needs to stay available until the screen has been initialized, and we can create the property for real. */ if ( (VT = malloc(sizeof(CARD32)))==NULL ) { FatalError("Unable to make VT property - out of memory. Exiting...\n"); } *VT = xf86Info.vtno; VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE); for (i = 0, ret = Success; i < xf86NumScreens && ret == Success; i++) { ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex, VTAtom, XA_INTEGER, 32, 1, VT ); if (ret != Success) xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING, "Failed to register VT property\n"); } } if (SeatId) { Atom SeatAtom; SeatAtom = MakeAtom(SEAT_ATOM_NAME, sizeof(SEAT_ATOM_NAME) - 1, TRUE); for (i = 0; i < xf86NumScreens; i++) { int ret; ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex, SeatAtom, XA_STRING, 8, strlen(SeatId)+1, SeatId ); if (ret != Success) { xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING, "Failed to register seat property\n"); } } } /* If a screen uses depth 24, show what the pixmap format is */ for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->depth == 24) { xf86Msg(pix24From, "Depth 24 pixmap format is %d bpp\n", PIX24TOBPP(pix24)); break; } } } else { /* * serverGeneration != 1; some OSs have to do things here, too. */ if (xorgHWOpenConsole) xf86OpenConsole(); #ifdef XF86PM /* should we reopen it here? We need to deal with an already opened device. We could leave this to the OS layer. For now we simply close it here */ if (xf86OSPMClose) xf86OSPMClose(); if ((xf86OSPMClose = xf86OSPMOpen()) != NULL) xf86MsgVerb(X_INFO, 3, "APM registered successfully\n"); #endif /* Make sure full I/O access is enabled */ if (xorgHWAccess) xf86EnableIO(); } /* * Use the previously collected parts to setup pScreenInfo */ pScreenInfo->imageByteOrder = xf86Screens[0]->imageByteOrder; pScreenInfo->bitmapScanlinePad = xf86Screens[0]->bitmapScanlinePad; pScreenInfo->bitmapScanlineUnit = xf86Screens[0]->bitmapScanlineUnit; pScreenInfo->bitmapBitOrder = xf86Screens[0]->bitmapBitOrder; pScreenInfo->numPixmapFormats = numFormats; for (i = 0; i < numFormats; i++) pScreenInfo->formats[i] = formats[i]; /* Make sure the server's VT is active */ if (serverGeneration != 1) { xf86Resetting = TRUE; /* All screens are in the same state, so just check the first */ if (!xf86Screens[0]->vtSema) { #ifdef HAS_USL_VTS ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ); #endif xf86AccessEnter(); was_blocked = xf86BlockSIGIO(); } } for (i = 0; i < xf86NumScreens; i++) if (!xf86ColormapAllocatePrivates(xf86Screens[i])) FatalError("Cannot register DDX private keys"); if (!dixRegisterPrivateKey(&xf86ScreenKeyRec, PRIVATE_SCREEN, 0) || !dixRegisterPrivateKey(&xf86CreateRootWindowKeyRec, PRIVATE_SCREEN, 0)) FatalError("Cannot register DDX private keys"); for (i = 0; i < xf86NumScreens; i++) { xf86VGAarbiterLock(xf86Screens[i]); /* * Almost everything uses these defaults, and many of those that * don't, will wrap them. */ xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess; #ifdef XFreeXDGA xf86Screens[i]->SetDGAMode = xf86SetDGAMode; #endif xf86Screens[i]->DPMSSet = NULL; xf86Screens[i]->LoadPalette = NULL; xf86Screens[i]->SetOverscan = NULL; xf86Screens[i]->DriverFunc = NULL; xf86Screens[i]->pScreen = NULL; scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv); xf86VGAarbiterUnlock(xf86Screens[i]); if (scr_index == i) { /* * Hook in our ScrnInfoRec, and initialise some other pScreen * fields. */ dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates, xf86ScreenKey, xf86Screens[i]); xf86Screens[i]->pScreen = screenInfo.screens[scr_index]; /* The driver should set this, but make sure it is set anyway */ xf86Screens[i]->vtSema = TRUE; } else { /* This shouldn't normally happen */ FatalError("AddScreen/ScreenInit failed for driver %d\n", i); } DebugF("InitOutput - xf86Screens[%d]->pScreen = %p\n", i, xf86Screens[i]->pScreen ); DebugF("xf86Screens[%d]->pScreen->CreateWindow = %p\n", i, xf86Screens[i]->pScreen->CreateWindow ); dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates, xf86CreateRootWindowKey, xf86Screens[i]->pScreen->CreateWindow); xf86Screens[i]->pScreen->CreateWindow = xf86CreateRootWindow; if (PictureGetSubpixelOrder (xf86Screens[i]->pScreen) == SubPixelUnknown) { xf86MonPtr DDC = (xf86MonPtr)(xf86Screens[i]->monitor->DDC); PictureSetSubpixelOrder (xf86Screens[i]->pScreen, DDC ? (DDC->features.input_type ? SubPixelHorizontalRGB : SubPixelNone) : SubPixelUnknown); } #ifdef RANDR if (!xf86Info.disableRandR) xf86RandRInit (screenInfo.screens[scr_index]); xf86Msg(xf86Info.randRFrom, "RandR %s\n", xf86Info.disableRandR ? "disabled" : "enabled"); #endif } xf86VGAarbiterWrapFunctions(); xf86UnblockSIGIO(was_blocked); xf86InitOrigins(); xf86Resetting = FALSE; xf86Initialising = FALSE; RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, xf86Wakeup, NULL); }
void InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[]) { int i; if (serverGeneration == 1) XwinExtensionInit(); /* Log the command line */ winLogCommandLine(argc, argv); #if CYGDEBUG winDebug("InitOutput\n"); #endif /* Validate command-line arguments */ if (serverGeneration == 1 && !winValidateArgs()) { FatalError("InitOutput - Invalid command-line arguments found. " "Exiting.\n"); } /* Check for duplicate invocation on same display number. */ if (serverGeneration == 1 && !winCheckDisplayNumber()) { if (g_fSilentDupError) g_fSilentFatalError = TRUE; FatalError("InitOutput - Duplicate invocation on display " "number: %s. Exiting.\n", display); } #ifdef XWIN_XF86CONFIG /* Try to read the xorg.conf-style configuration file */ if (!winReadConfigfile()) winErrorFVerb(1, "InitOutput - Error reading config file\n"); #else winMsg(X_INFO, "xorg.conf is not supported\n"); winMsg(X_INFO, "See http://x.cygwin.com/docs/faq/cygwin-x-faq.html " "for more information\n"); winConfigFiles(); #endif /* Load preferences from XWinrc file */ LoadPreferences(); /* Setup global screen info parameters */ pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER; pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; pScreenInfo->numPixmapFormats = NUMFORMATS; /* Describe how we want common pixmap formats padded */ for (i = 0; i < NUMFORMATS; i++) { pScreenInfo->formats[i] = g_PixmapFormats[i]; } /* Load pointers to DirectDraw functions */ winGetDDProcAddresses(); /* Detect supported engines */ winDetectSupportedEngines(); #ifdef XWIN_MULTIWINDOW /* Load libraries for taskbar grouping */ winPropertyStoreInit(); #endif /* Store the instance handle */ g_hInstance = GetModuleHandle(NULL); /* Create the messaging window */ if (serverGeneration == 1) winCreateMsgWindowThread(); /* Initialize each screen */ for (i = 0; i < g_iNumScreens; ++i) { /* Initialize the screen */ if (-1 == AddScreen(winScreenInit, argc, argv)) { FatalError("InitOutput - Couldn't add screen %d", i); } } /* Unless full xinerama has been explicitly enabled, register all native screens with pseudoramiX */ if (!noPanoramiXExtension) noPseudoramiXExtension = TRUE; if ((g_ScreenInfo[0].fMultipleMonitors) && !noPseudoramiXExtension) { int pass; PseudoramiXExtensionInit(); /* Add primary monitor on pass 0, other monitors on pass 1, to ensure the primary monitor is first in XINERAMA list */ for (pass = 0; pass < 2; pass++) { int iMonitor; for (iMonitor = 1; ; iMonitor++) { struct GetMonitorInfoData data; QueryMonitor(iMonitor, &data); if (data.bMonitorSpecifiedExists) { MONITORINFO mi; mi.cbSize = sizeof(MONITORINFO); if (GetMonitorInfo(data.monitorHandle, &mi)) { /* pass == 1 XOR primary monitor flags is set */ if ((!(pass == 1)) != (!(mi.dwFlags & MONITORINFOF_PRIMARY))) { /* Note the screen origin in a normalized coordinate space where (0,0) is at the top left of the native virtual desktop area */ data.monitorOffsetX = data.monitorOffsetX - GetSystemMetrics(SM_XVIRTUALSCREEN); data.monitorOffsetY = data.monitorOffsetY - GetSystemMetrics(SM_YVIRTUALSCREEN); winDebug ("InitOutput - screen %d added at virtual desktop coordinate (%d,%d) (pseudoramiX) \n", iMonitor-1, data.monitorOffsetX, data.monitorOffsetY); PseudoramiXAddScreen(data.monitorOffsetX, data.monitorOffsetY, data.monitorWidth, data.monitorHeight); } } } else break; } } } #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) /* Generate a cookie used by internal clients for authorization */ if (g_fXdmcpEnabled || g_fAuthEnabled) winGenerateAuthorization(); /* Perform some one time initialization */ if (1 == serverGeneration) { /* * setlocale applies to all threads in the current process. * Apply locale specified in LANG environment variable. */ setlocale(LC_ALL, ""); } #endif #if CYGDEBUG || YES winDebug("InitOutput - Returning.\n"); #endif }
void InitOutput(ScreenInfo *scrInfo, int argc, char **argv) { int i; int NumFormats = 0; vncPrintBanner(); #if XORG >= 113 #ifdef GLXEXT if (serverGeneration == 1) #if XORG >= 116 LoadExtensionList(&glxExt, 1, TRUE); #else LoadExtension(&glxExt, TRUE); #endif #endif #endif /* initialize pixmap formats */ /* must have a pixmap depth to match every screen depth */ for (i = 0; i < vfbNumScreens; i++) { vfbPixmapDepths[vfbScreens[i].fb.depth] = TRUE; } /* RENDER needs a good set of pixmaps. */ if (Render) { vfbPixmapDepths[1] = TRUE; vfbPixmapDepths[4] = TRUE; vfbPixmapDepths[8] = TRUE; /* vfbPixmapDepths[15] = TRUE; */ vfbPixmapDepths[16] = TRUE; vfbPixmapDepths[24] = TRUE; vfbPixmapDepths[32] = TRUE; } for (i = 1; i <= 32; i++) { if (vfbPixmapDepths[i]) { if (NumFormats >= MAXFORMATS) FatalError ("MAXFORMATS is too small for this server\n"); scrInfo->formats[NumFormats].depth = i; scrInfo->formats[NumFormats].bitsPerPixel = vfbBitsPerPixel(i); scrInfo->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD; NumFormats++; } } scrInfo->imageByteOrder = IMAGE_BYTE_ORDER; scrInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; scrInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; scrInfo->bitmapBitOrder = BITMAP_BIT_ORDER; scrInfo->numPixmapFormats = NumFormats; /* initialize screens */ for (i = 0; i < vfbNumScreens; i++) { if (-1 == AddScreen(vfbScreenInit, argc, argv)) { FatalError("Couldn't add screen %d", i); } } if (!AddCallback(&ClientStateCallback, vfbClientStateChange, 0)) { FatalError("AddCallback failed\n"); } } /* end InitOutput */
ScreenManager::ScreenManager(Stalker *stalker) : m_activeScreen("None"), m_stalker(stalker) { AddScreen("SplashScreen", ScreenTypes::SplashScreen); }