BOOL InitDesktop (void) { /* * Init ZOrderInfo here. */ InitZOrderInfo (&sg_MainWinZOrder, HWND_DESKTOP); InitZOrderInfo (&sg_TopMostWinZOrder, HWND_DESKTOP); /* * Init heap of clipping rects. */ InitFreeClipRectList (&sg_FreeClipRectList, SIZE_CLIPRECTHEAP); /* * Init heap of invalid rects. */ InitFreeClipRectList (&sg_FreeInvRectList, SIZE_INVRECTHEAP); /* * Load system resource here. */ if (!InitSystemRes ()) { fprintf (stderr, "DESKTOP: Can not initialize system resource!\n"); return FALSE; } // Init Window Management information. if (!InitWndManagementInfo()) { fprintf (stderr, "DESKTOP: Can not initialize window management information!\n"); return FALSE; } return TRUE; }
/******************* Initialization and termination of GDI *******************/ BOOL InitGDI (void) { if (!InitTextBitmapBuffer ()) { fprintf (stderr, "GDI: Can not initialize text bitmap buffer!\n"); goto error; } #ifdef _RBF_SUPPORT #ifdef _INCORE_RES if (!InitIncoreRBFonts ()) { fprintf (stderr, "GDI: Can not initialize incore RBF fonts!\n"); goto error; } #endif #endif #ifdef _VBF_SUPPORT if (!InitIncoreVBFonts ()) { fprintf (stderr, "GDI: Can not initialize incore VBF fonts!\n"); goto error; } #endif #ifndef _INCORE_RES #ifdef _RBF_SUPPORT if (!InitRawBitmapFonts ()) { fprintf (stderr, "GDI: Can not initialize raw bitmap fonts!\n"); goto error; } #endif #ifdef _VBF_SUPPORT if (!InitVarBitmapFonts ()) { fprintf (stderr, "GDI: Can not initialize var bitmap fonts!\n"); goto error; } #endif #ifdef _QPF_SUPPORT if (!InitQPFonts ()) { fprintf (stderr, "GDI: Can not initialize QPF fonts!\n"); goto error; } #endif #ifdef _TTF_SUPPORT if (!InitFreeTypeFonts ()) { fprintf (stderr, "GDI: Can not initialize TrueType fonts!\n"); goto error; } #endif #ifdef _TYPE1_SUPPORT if (!InitType1Fonts ()) { fprintf (stderr, "GDI: Can not initialize Type1 fonts!\n"); goto error; } #endif #endif /* !_INCORE_RES */ /* TODO: add other font support here */ #ifdef _DEBUG dumpDevFonts (); #endif if (!InitSysFont ()) { fprintf (stderr, "GDI: Can not create system fonts!\n"); goto error; } InitFreeClipRectList (&sg_FreeClipRectList, SIZE_CLIPRECTHEAP); pthread_mutex_init (&__mg_gdilock, NULL); pthread_mutex_init (&dcslot, NULL); dc_InitClipRgnInfo(); dc_Init_ScreenDC (); return TRUE; error: return FALSE; }