void main (void) { QMSG qmsg; HMQ hmq; HWND hwndClient; ULONG flFrameFlags; WinInitialize(0); hmq = WinCreateMsgQueue(hab, 0); /* get access to shared memory */ DosGetNamedSharedMem((PVOID*)&memptr, MEM_NAME, PAG_READ); if (!memptr) WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, " FreeType/2 is not running!", "Error", 0, MB_OK | MB_ERROR); else { meminfo = memptr->address; if (meminfo->signature != 0x46524545) WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, " FreeType/2 is not running!", "Error", 0, MB_OK | MB_ERROR); else { flFrameFlags = FCF_TITLEBAR | FCF_SYSMENU | FCF_TASKLIST ; WinRegisterClass(hab, "MyClass", (PFNWP) ClientWndProc, CS_SIZEREDRAW, 0); hwndFrame = WinCreateStdWindow(HWND_DESKTOP, WS_VISIBLE, &flFrameFlags, "MyClass", "FreeType/2 Heap Usage", 0, (HMODULE) NULL, 0, &hwndClient); WinSetVisibleRegionNotify(hwndClient, TRUE); /* make titlebar text look better */ WinSetPresParam(WinWindowFromID(hwndFrame, FID_TITLEBAR), PP_FONTNAMESIZE, 9, (PVOID)"8.Helv"); WinSetWindowPos(hwndFrame, NULLHANDLE, 0, 0, 350, 42, SWP_MOVE | SWP_SIZE | SWP_SHOW); while (WinGetMsg(hab, &qmsg, (HWND) NULL, 0, 0)) WinDispatchMsg(hab, &qmsg); WinSetVisibleRegionNotify(hwndClient, FALSE); } } /* free shared memory block */ DosFreeMem(memptr); WinDestroyWindow(hwndFrame); WinDestroyMsgQueue(hmq); WinTerminate(hab); }
static BOOL _setDesktop(PGROPDATA pGrop) { PVIDEOMODE pMode = &pGrop->stModes.pList[pGrop->stModes.ulDesktopMode]; if ( !pGrop->pVideoSys->fnSetMode( pGrop->pVSData, pMode, FALSE, pGrop->hwndDT, pGrop->hdcDT ) ) return FALSE; WinSetVisibleRegionNotify( pGrop->hwnd, TRUE ); return TRUE; }
static BOOL _setFullscreen(PGROPDATA pGrop, ULONG ulModeIdx) { PVIDEOMODE pMode = &pGrop->stModes.pList[ulModeIdx]; RECTL rectl; LONG lX, lY, lW, lH; // Move _client_ window to up-left corner of screen, set client window size // equals mode size. rectl.xLeft = 0; rectl.yBottom = 0; rectl.xRight = pMode->ulWidth; rectl.yTop = pMode->ulHeight; WinCalcFrameRect( pGrop->hwndFrame, &rectl, FALSE ); lX = rectl.xLeft; lY = pGrop->ulDTHeight - pMode->ulHeight + rectl.yBottom; lW = rectl.xRight - rectl.xLeft; lH = rectl.yTop - rectl.yBottom; pGrop->fInternalResize = TRUE; WinSetWindowPos( pGrop->hwndFrame, HWND_TOP, lX, lY, lW, lH, SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE ); pGrop->fInternalResize = FALSE; _captureMouse( pGrop, TRUE ); #ifdef GROP_NO_MOUSE_IN_FULLSCREEN WinSetPointer( pGrop->hwndDT, NULLHANDLE ); #endif WinPostMsg( pGrop->hwnd, WM_VRNENABLED, 0, 0 ); WinSetVisibleRegionNotify( pGrop->hwnd, FALSE ); if ( !pGrop->pVideoSys->fnSetMode( pGrop->pVSData, pMode, TRUE, pGrop->hwndDT, pGrop->hdcDT ) ) return FALSE; return TRUE; }
BOOL Initialize(int argc, char* argv[]) { ULONG flCreate; PID pid; TID tid; debOut = fopen ("\\PIPE\\WATCHCAT", "w"); if (debOut) { fprintf(debOut, "MakMan/2 Init\n"); fflush(debOut); } GetScoresFromIni(); /* * create all semaphores for mutual exclusion and event timing */ if ( DosCreateEventSem( NULL, &hevTick , DC_SEM_SHARED, FALSE) || DosCreateEventSem( NULL, &hevSound , DC_SEM_SHARED, FALSE) || DosCreateEventSem( NULL, &hevTermGame , DC_SEM_SHARED, FALSE) || DosCreateEventSem( NULL, &hevTermSound, DC_SEM_SHARED, FALSE) ) return (FALSE); /* failed to create a semaphore */ WinShowPointer( HWND_DESKTOP, TRUE); habMain = WinInitialize( 0); if( !habMain) return( FALSE); hmqMain = WinCreateMsgQueue( habMain,0); if( !hmqMain) return( FALSE); WinLoadString( habMain, 0, IDS_TITLEBAR, sizeof(szTitle), szTitle); WinLoadString( habMain, 0, IDS_ERRORTITLE, sizeof(szErrorTitle), szErrorTitle); if( !WinRegisterClass( habMain , (PCH)szTitle , ClientWndProc , CS_SIZEREDRAW | CS_MOVENOTIFY , 0 )) return( FALSE); flCreate = (FCF_TITLEBAR | FCF_SYSMENU | FCF_MENU | FCF_BORDER | FCF_ICON | FCF_AUTOICON | FCF_ACCELTABLE | FCF_MINBUTTON | FCF_SHELLPOSITION ); hwndFrame = WinCreateStdWindow( HWND_DESKTOP, /* handle of the parent window */ 0, /* frame-window style */ &flCreate, /* creation flags */ szTitle, /* client-window class name */ szTitle, /* address of title-bar text */ WS_SYNCPAINT, /* client-window style */ 0, /* handle of the resource module */ IDR_MAIN, /* frame-window identifier */ &hwndClient); /* address of client-window handle */ if( !hwndFrame) return( FALSE); if (debOut) { fprintf(debOut, "Creating engine\n"); fflush(debOut); } // // Instantiate the Gfx Output engine // if (argc == 2) { strlwr(argv[1]); // make lower case if (strcmp(argv[1], "gpi") == 0) GfxEng = new gpi; else if (strcmp(argv[1], "dive") == 0) GfxEng = new dive; else { char buf[200]; sprintf(buf, "Usage : MakMan [gpi | dive]\n" "Unknown option %s\n", argv[1]); WinMessageBox(HWND_DESKTOP, hwndFrame, (PSZ) buf, (PSZ) szTitle, 0, MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL ); return FALSE; } } else GfxEng = new gpi; SndEng = new mmpm2; if (debOut) { fprintf(debOut, "Gfx engine : %p Snd : %p\n", GfxEng, SndEng); fflush(debOut); } if (!GfxEng->open()) { WinMessageBox(HWND_DESKTOP, hwndFrame, (PSZ) "Can't initialize selected Graphics Engine", (PSZ) szTitle, 0, MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL ); return FALSE; } if (!SndEng->open()) { WinMessageBox(HWND_DESKTOP, hwndFrame, (PSZ) "Can't initialize MMPM2 Sound Engine\nSound won't be available for this session", (PSZ) szTitle, 0, MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL ); } // // Finish up initializing the Window // // restore the previous position on screen int retc = WinRestoreWindowPos(szAppName, szKeyPosition, hwndFrame); if (debOut) { fprintf(debOut, "Restored old pos : %i\n",retc); fflush(debOut); } cxWidthBorder = (LONG) WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER); cyWidthBorder = (LONG) WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER); cyTitleBar = (LONG) WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR); cyMenu = (LONG) WinQuerySysValue(HWND_DESKTOP, SV_CYMENU); cyScreen = (LONG) WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN); sizlMaxClient.cx = fieldSizeX * tileWidth + cxWidthBorder * 2; sizlMaxClient.cy = fieldSizeY * tileHeight + cyWidthBorder * 2 + cyTitleBar + cyMenu ; // And now set the window to the correct size WinSetWindowPos( hwndFrame, HWND_TOP, 0, 0, sizlMaxClient.cx, sizlMaxClient.cy, SWP_SIZE | SWP_SHOW | SWP_ACTIVATE); lByteAlignX = WinQuerySysValue( HWND_DESKTOP, SV_CXBYTEALIGN); lByteAlignY = WinQuerySysValue( HWND_DESKTOP, SV_CYBYTEALIGN); // Turn on visible region notification. WinSetVisibleRegionNotify ( hwndClient, TRUE ); // And invalidate the visible region WinPostMsg ( hwndFrame, WM_VRNENABLED, 0L, 0L ); // Enter the program in the WPS/PM task list WinQueryWindowProcess( hwndFrame, &pid, &tid); swctl.hwnd = hwndFrame; swctl.idProcess = pid; strcpy( swctl.szSwtitle, szTitle); hsw = WinAddSwitchEntry(&swctl); hwndMenu = WinWindowFromID( hwndFrame, FID_MENU); // // Disable unused menu entries // EnableMenu(IDM_LEVEL, FALSE); EnableMenu(IDM_HELPINDEX, FALSE); EnableMenu(IDM_HELPEXTENDED, FALSE); EnableMenu(IDM_HELPHELPFORHELP, FALSE); // // Look for a Joystick (driver) // APIRET rc; ULONG action; GAME_PARM_STRUCT gameParms; ULONG dataLen; rc = DosOpen(GAMEPDDNAME, &hGame, &action, 0, FILE_READONLY, FILE_OPEN, OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, NULL); if (rc != 0) hGame = 0; else { // There is a driver loaded - can we talk to him? dataLen = sizeof(gameParms); // Look for any (Joy)sticks rc = DosDevIOCtl(hGame, IOCTL_CAT_USER, GAME_GET_PARMS, NULL, 0, NULL, &gameParms, dataLen, &dataLen); if (rc != 0 && debOut) { fprintf(debOut, "Couldn't call IOCtl for GAME$\n"); fflush(debOut); } } // ok so far? if (hGame == 0 || rc != 0) { if (debOut) { fprintf(debOut, "Joystick driver not found\n"); fflush(debOut); } DosClose(hGame); EnableMenu(IDM_JOY_A, FALSE); EnableMenu(IDM_JOY_B, FALSE); EnableMenu(IDM_CALIBRATE, FALSE); hGame = 0; } else { // all ok, deregister any superfluous menu entries // and calibrate sticks if (debOut) { fprintf(debOut, "JoyStat A: %i, B:%i\n", gameParms.useA, gameParms.useB); fflush(debOut); } /* * Keep only bits defined X and Y axis, they are bit 1 and bit 2 */ USHORT usTmp1 = gameParms.useA & GAME_USE_BOTH_NEWMASK; USHORT usTmp2 = gameParms.useB & GAME_USE_BOTH_NEWMASK; // No Joysticks if (gameParms.useA == 0 && gameParms.useB == 0) { EnableMenu(IDM_JOY_A, FALSE); EnableMenu(IDM_CAL_A, FALSE); EnableMenu(IDM_JOY_B, FALSE); EnableMenu(IDM_CAL_B, FALSE); } // One Joystick found // if usTmp2 is not 0, then Joystick 1 is an extended // type joystick (with 3 axes) but we don't care if (usTmp1 == GAME_USE_BOTH_NEWMASK && usTmp2 != GAME_USE_BOTH_NEWMASK ) { EnableMenu(IDM_JOY_B, FALSE); EnableMenu(IDM_CAL_B, FALSE); } // And now read the calibration values GAME_CALIB_STRUCT gameCalib; dataLen = sizeof(gameCalib); rc = DosDevIOCtl(hGame, IOCTL_CAT_USER, GAME_GET_CALIB, NULL, 0, NULL, &gameCalib, dataLen, &dataLen ); joyCal[1].x = gameCalib.Ax.centre; joyCal[1].y = gameCalib.Ay.centre; joyCal[2].x = gameCalib.Bx.centre; joyCal[2].y = gameCalib.By.centre; } /* * initialise help mechanism */ HelpInit(); // Set the default values for the various options... GetOptionsFromIni(); // initiate random number generator srand(time(NULL)); return TRUE; } /* end Initialize() */
void QFObjectRenderer::load() { ULONG column, row, bytesToRead; LONG errorCode; qfwp.setScreenText("Preparing VR object..."); // Allocate array of image buffer numbers and temporary buffer for compressed frames frame = new PULONG[columns]; for (column = 0; column < columns; column++) frame[column] = 0; buffer = new BYTE**[columns]; try { //Read video track into image buffers for (column = 0; column < columns; column++) { frame[column] = new ULONG[rows]; for (row = 0; row < rows; row++) frame[column][row] = 0; buffer[column] = new BYTE*[rows]; for (row = 0; row < rows; row++) { if (videoMap->chunkCursor->isValid()) { if (videoMap->sampleSize) /* Fixed sample size media */ bytesToRead = videoMap->sampleSize; else /* Using sample size table for media */ bytesToRead = videoMap->sampleCursor->element(); /* Seek to better-known file position, if available */ if (filePosition != videoMap->newFilePosition) filePosition = mmioSeek(movieFile_p, videoMap->newFilePosition, SEEK_SET); /* Read */ filePosition += mmioRead(movieFile_p, videoSetup->compressedFrame, bytesToRead); /* If instance is being deleted and no exception thrown (not plugin instance), get out of here */ if (!loading) throw (NoMoreData()); /* Prepare frame */ prepareFrame(column, row, bytesToRead); /* Update position tracking variables */ videoMap->newFilePosition += bytesToRead; videoMap->currentTime += videoMap->averageDuration; videoMap->sampleInMedia++; videoMap->sampleInChunk++; if (!videoMap->sampleSize) videoMap->sampleCursor->setToNext(); /* Update chunk cursors if we have hit the end of the chunk */ if (videoMap->sampleInChunk > videoMap->samplesPerChunk) { videoMap->chunkCursor->setToNext(); /* Update samples-per-chunk value, if necessary */ if (videoMap->chunkCursor->isValid()) { videoMap->newFilePosition = videoMap->chunkCursor->element(); if (videoMap->sampleToChunkCursor->isValid() && videoMap->chunkOffsetAtom->chunkOffsetTable.position(*(videoMap->chunkCursor)) == videoMap->sampleToChunkCursor->element().firstChunk) { videoMap->samplesPerChunk = videoMap->sampleToChunkCursor->element().samplesPerChunk; videoMap->sampleToChunkCursor->setToNext(); } } videoMap->sampleInChunk = 1; } /* New chunk */ } /* videoMap->chunkCursor->isValid() */ else { // Came up short on data. Adjust last column and step. columns = column; degreesPerColumn = ((columns < 2) ? .0 : (maxPanReg - minPanReg) / (minPanReg == .0 && maxPanReg == 360.0 ? columns : columns - 1)); break; } } /* row */ } /* column */ //Unlock registered version QUIKFLIK(this); qfwp.setScreenText(""); window_p->setFocus(); window_p->show(); visibleRegionEnabled(false); // Set up blitter first time setView(defaultPan_p, defaultTilt_p, defaultFov_p); update(); WinSetVisibleRegionNotify(window_p->handle(), TRUE); } catch (NoMoreData noMoreData) {} loading = false; }
void FAR wndThread(void FAR *pData) { PGROPDATA pGrop = (PGROPDATA)pData; PTIB tib; PPIB pib; ULONG ulFrameFlags; QMSG qmsg; SWP swp; PVIDEOSYS pVideoSys = aVideoSys[pGrop->ulVideoSysIdx]; // Change process type code for use Win* API from VIO session DosGetInfoBlocks( &tib, &pib ); if ( pib->pib_ultype == 2 || pib->pib_ultype == 0 ) { // VIO windowable or fullscreen protect-mode session. pib->pib_ultype = 3; // Presentation Manager protect-mode session. // ...and switch to the desktop (if we are in fullscreen now)? } // Select output video system. if ( (pGrop->ulVideoSysIdx < VIDEOSYSNUM) && pVideoSys->fnInit( &pGrop->stModes, &pGrop->pVSData ) ) { debug( "Requested video system %u initialized.", pGrop->ulVideoSysIdx ); pGrop->pVideoSys = pVideoSys; } else { ULONG ulIdx; debug( "Requested video system was not initialized. Try others..." ); pGrop->pVideoSys = NULL; for( ulIdx = 0; ulIdx < VIDEOSYSNUM; ulIdx++ ) { if ( pGrop->ulVideoSysIdx == ulIdx ) // Ignore video system requested by the user (already verifed). continue; pVideoSys = aVideoSys[ulIdx]; if ( pVideoSys->fnInit( &pGrop->stModes, &pGrop->pVSData ) ) { debug( "Video system %u initialized.", ulIdx ); pGrop->pVideoSys = pVideoSys; pGrop->ulVideoSysIdx = ulIdx; break; } } } // if ( (pGrop->ulVideoSysIdx < VIDEOSYSNUM) && pVideoSys->fnInit() ) else if ( pGrop->pVideoSys == NULL ) { debug( "Video system is not initialized." ); } else { // Output video system selected. // Prepare PM stuff. pGrop->hab = WinInitialize( 0 ); pGrop->hmq = WinCreateMsgQueue( pGrop->hab, 0 ); pGrop->hwndDT = WinQueryDesktopWindow( WinQueryAnchorBlock( HWND_DESKTOP ), 0 ); pGrop->hdcDT = WinQueryWindowDC( pGrop->hwndDT ); WinQueryWindowPos( pGrop->hwndDT, &swp ); pGrop->ulDTWidth = swp.cx; pGrop->ulDTHeight = swp.cy; pGrop->ulModeIdx = ~0; // ~0 - Mode is not selected yet. pGrop->hptrPointer = WinQuerySysPointer( HWND_DESKTOP, SPTR_ARROW, FALSE ); WinRegisterClass( pGrop->hab, WIN_CLIENT_CLASS, wndProc, CS_SIZEREDRAW | CS_MOVENOTIFY | CS_SYNCPAINT, sizeof(PGROPDATA) ); // Create the window. ulFrameFlags = FCF_TASKLIST | FCF_DLGBORDER | FCF_TITLEBAR | FCF_SYSMENU | FCF_MINBUTTON | FCF_SHELLPOSITION | FCF_SIZEBORDER | FCF_MINBUTTON | FCF_MAXBUTTON; pGrop->hwndFrame = WinCreateStdWindow( HWND_DESKTOP, 0, &ulFrameFlags, WIN_CLIENT_CLASS, "grop", 0, 0, 1, &pGrop->hwnd ); if ( pGrop->hwndFrame == NULLHANDLE ) { debug( "WinCreateStdWindow() failed" ); } else { WinSetWindowULong( pGrop->hwnd, 0, (ULONG)pGrop ); // Subclass frame window to control size changes. pGrop->fnOldFrameWinProc = WinSubclassWindow( pGrop->hwndFrame, wndFrameProc ); WinSetVisibleRegionNotify( pGrop->hwnd, TRUE ); if ( DosCreateMutexSem( NULL, &pGrop->hmtxData, 0, FALSE ) != NO_ERROR ) debug( "DosCreateMutexSem() failed" ); else { ULONG ulRC; ulRC = DosSetPriority( PRTYS_THREAD, PRTYC_TIMECRITICAL, 31, 0 ); if ( ulRC != NO_ERROR ) debug( "DosSetPriority(), rc = %u", ulRC ); ulRC = DosPostEventSem( pGrop->hevReady ); // Ready to work. if ( ulRC != NO_ERROR ) debug( "DosPostEventSem(), rc = %u", ulRC ); while( TRUE ) { // Work... while( WinGetMsg( pGrop->hab, &qmsg, (HWND)NULLHANDLE, 0L, 0L ) ) { ulRC = DosRequestMutexSem( pGrop->hmtxData, 500 ); if ( ulRC != NO_ERROR ) debug( "DosRequestMutexSem(), rc = ", ulRC ); WinDispatchMsg( pGrop->hab, &qmsg ); DosReleaseMutexSem( pGrop->hmtxData ); } if ( pGrop->stCallback.fnQuit == NULL ) break; debug( "Call stCallback.fnQuit()" ); pGrop->stCallback.fnQuit( pGrop ); } // Return to the desktop if we are in fullscreen. debug( "Fullscreen: %u", pGrop->fFullscreen ); if ( pGrop->fFullscreen ) { PVIDEOMODE pMode = &pGrop->stModes.pList[pGrop->stModes.ulDesktopMode]; debug( "Return to the desktop..." ); pGrop->pVideoSys->fnSetMode( pGrop->pVSData, pMode, FALSE, pGrop->hwndDT, pGrop->hdcDT ); debug( "Returned to the desktop" ); } DosCloseMutexSem( pGrop->hmtxData ); } debug( "Destroy window" ); if ( !WinDestroyWindow( pGrop->hwnd ) ) debug( "WinDestroyWindow() failed" ); pGrop->hwnd = NULLHANDLE; pGrop->hwndFrame = NULLHANDLE; } // Destroy PM stuff. debug( "WinDestroyMsgQueue()..." ); WinDestroyMsgQueue( pGrop->hmq ); debug( "WinTerminate()..." ); WinTerminate( pGrop->hab ); pGrop->hwndFrame = NULLHANDLE; pGrop->hwnd = NULLHANDLE; // Destroy output video system. if ( pGrop->stUserMode.pBuffer != NULL ) { debug( "Free video system's buffer" ); pGrop->pVideoSys->fnVideoBufFree( pGrop->pVSData, pGrop->stUserMode.pBuffer ); pGrop->stUserMode.pBuffer = NULL; } debug( "Close video system" ); pGrop->pVideoSys->fnDone( pGrop->pVSData, &pGrop->stModes ); pGrop->pVideoSys = NULL; } // if ( pGrop->pVideoSys == NULL ) else pGrop->tid = ((TID)(-1)); debug( "Post semaphore..." ); DosPostEventSem( pGrop->hevReady ); // Finalized. debug( "Exit thread." ); _endthread(); }
static void PMThread( void *arg ) { vout_display_t *vd = ( vout_display_t * )arg; vout_display_sys_t * sys = vd->sys; ULONG i_frame_flags; QMSG qm; char *psz_mode; ULONG i_kva_mode; /* */ video_format_t fmt; video_format_ApplyRotation(&fmt, &vd->fmt); /* */ vout_display_info_t info = vd->info; info.is_slow = false; info.has_double_click = true; info.needs_hide_mouse = true; info.has_pictures_invalid = false; MorphToPM(); sys->hab = WinInitialize( 0 ); sys->hmq = WinCreateMsgQueue( sys->hab, 0); WinRegisterClass( sys->hab, WC_VLC_KVA, WndProc, CS_SIZEREDRAW | CS_MOVENOTIFY, sizeof( PVOID )); sys->b_fixt23 = var_CreateGetBool( vd, "kva-fixt23"); if( !sys->b_fixt23 ) /* If an external window was specified, we'll draw in it. */ sys->parent_window = vout_display_NewWindow( vd, VOUT_WINDOW_TYPE_HWND ); if( sys->parent_window ) { sys->parent = ( HWND )sys->parent_window->handle.hwnd; ULONG i_style = WinQueryWindowULong( sys->parent, QWL_STYLE ); WinSetWindowULong( sys->parent, QWL_STYLE, i_style | WS_CLIPCHILDREN ); i_frame_flags = FCF_TITLEBAR; } else { sys->parent = HWND_DESKTOP; i_frame_flags = FCF_SYSMENU | FCF_TITLEBAR | FCF_MINMAX | FCF_SIZEBORDER | FCF_TASKLIST; } sys->frame = WinCreateStdWindow( sys->parent, /* parent window handle */ WS_VISIBLE, /* frame window style */ &i_frame_flags, /* window style */ WC_VLC_KVA, /* class name */ "", /* window title */ 0L, /* default client style */ NULLHANDLE, /* resource in exe file */ 1, /* frame window id */ &sys->client ); /* client window handle */ if( sys->frame == NULLHANDLE ) { msg_Err( vd, "cannot create a frame window"); goto exit_frame; } WinSetWindowPtr( sys->client, 0, vd ); if( !sys->parent_window ) { WinSetWindowPtr( sys->frame, 0, vd ); sys->p_old_frame = WinSubclassWindow( sys->frame, MyFrameWndProc ); } psz_mode = var_CreateGetString( vd, "kva-video-mode" ); i_kva_mode = KVAM_AUTO; if( strcmp( psz_mode, "snap" ) == 0 ) i_kva_mode = KVAM_SNAP; else if( strcmp( psz_mode, "wo" ) == 0 ) i_kva_mode = KVAM_WO; else if( strcmp( psz_mode, "vman" ) == 0 ) i_kva_mode = KVAM_VMAN; else if( strcmp( psz_mode, "dive" ) == 0 ) i_kva_mode = KVAM_DIVE; free( psz_mode ); if( kvaInit( i_kva_mode, sys->client, COLOR_KEY )) { msg_Err( vd, "cannot initialize KVA"); goto exit_kva_init; } kvaCaps( &sys->kvac ); msg_Dbg( vd, "selected video mode = %s", psz_video_mode[ sys->kvac.ulMode - 1 ]); if( OpenDisplay( vd, &fmt ) ) { msg_Err( vd, "cannot open display"); goto exit_open_display; } if( vd->cfg->is_fullscreen && !sys->parent_window ) WinPostMsg( sys->client, WM_VLC_FULLSCREEN_CHANGE, MPFROMLONG( true ), 0 ); kvaDisableScreenSaver(); /* Setup vout_display now that everything is fine */ vd->fmt = fmt; vd->info = info; vd->pool = Pool; vd->prepare = NULL; vd->display = Display; vd->control = Control; vd->manage = Manage; /* Prevent SIG_FPE */ _control87(MCW_EM, MCW_EM); sys->i_result = VLC_SUCCESS; DosPostEventSem( sys->ack_event ); if( !sys->parent_window ) WinSetVisibleRegionNotify( sys->frame, TRUE ); while( WinGetMsg( sys->hab, &qm, NULLHANDLE, 0, 0 )) WinDispatchMsg( sys->hab, &qm ); if( !sys->parent_window ) WinSetVisibleRegionNotify( sys->frame, FALSE ); kvaEnableScreenSaver(); CloseDisplay( vd ); /* fall through */ exit_open_display : kvaDone(); exit_kva_init : if( !sys->parent_window ) WinSubclassWindow( sys->frame, sys->p_old_frame ); WinDestroyWindow( sys->frame ); exit_frame : vout_display_DeleteWindow( vd, sys->parent_window ); if( sys->is_mouse_hidden ) WinShowPointer( HWND_DESKTOP, TRUE ); WinDestroyMsgQueue( sys->hmq ); WinTerminate( sys->hab ); sys->i_result = VLC_EGENERIC; DosPostEventSem( sys->ack_event ); }