static int set_hide_mouseptr(int val, void *param) { hide_mouseptr = val ? 1 : 0; if (!hide_mouseptr && !visible && !FullscreenIsNow()) { // do we have to show the ptr again? WinSetCapture(HWND_DESKTOP, NULLHANDLE); WinShowPointer(HWND_DESKTOP, TRUE); visible = TRUE; } return 0; }
/**************************************************************************** * ShowMouse * * - Hides/shows the mouse depending on the state of the game * * - No I/O. * ****************************************************************************/ VOID ShowMouse(BOOL bShowMouse) { static INT cPointerLvl = 0; /* Pointer level, 0 = visible */ static POINTL ptl; /* Pointer position when hidden */ if (bShowMouse) { if (cPointerLvl == 1) { cPointerLvl = 0; WinSetPointerPos(HWND_DESKTOP, ptl.x, ptl.y); WinShowPointer(HWND_DESKTOP, TRUE); } } else { if (iGameMode != GAME_MODE_INIT1 && iGameMode != GAME_MODE_INIT2 && prfProfile.bMOUSECONTROL && cPointerLvl == 0) { cPointerLvl = 1; WinQueryPointerPos(HWND_DESKTOP, &ptl); WinShowPointer(HWND_DESKTOP, FALSE); } } }
/*----------------------------------------------- Back us out of zoom or pan mode. Called for a variety of reasons from the main window function. -----------------------------------------------*/ VOID CancelZoomOrPan (HWND hwnd) { if (fPan) /* Panning */ { /* erase the cross hairs */ EraseCrossHairs(hwnd); WinSetCapture (HWND_DESKTOP, (HWND) NULL); WinShowPointer (HWND_DESKTOP, TRUE); /* reshow normal mouse pointer */ fPan = FALSE; fGoodPan = FALSE; fZoomWin = FALSE; } if (fZoomWin) /* Zooming */ { /* erase the Zoom Box */ EraseZoomBox(hwnd); WinSetCapture (HWND_DESKTOP, (HWND) NULL); WinShowPointer (HWND_DESKTOP, TRUE); /* reshow normal mouse pointer */ fZoomWin = FALSE; fGoodZoom = FALSE; fPan = FALSE; } }
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() */
MRESULT EXPENTRY fnSaverWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { SWP swpDlg, swpParent; HWND hwndDlg; int rc; switch( msg ) { case WM_SUBCLASS_INIT: case WM_CREATE: { RECTL rclRect; // Any initialization of the window and variables should come here. // the timer for the moving text ulAnimationTimerID = WinStartTimer(WinQueryAnchorBlock(hwnd), hwnd, ANIMATION_TIMER_ID, 20); // setup the initial coordinates for the scrolling text WinQueryWindowRect(hwnd, &rclRect); textX = rclRect.xRight; textY = rclRect.yTop/2; // Hide mouse pointer, if we're in real screen-saving mode! if (!bOnlyPreviewMode) WinShowPointer(HWND_DESKTOP, FALSE); // Initialize WMCHAR record internal_InitWMCHARRecord(); break; } case WM_CHAR: if (!bOnlyPreviewMode) internal_SaveWMCHAREventToRecord(mp1, mp2); break; case WM_ASKPASSWORD: { // Get parameters char *pchPwdBuff = (char *) mp1; int iPwdBuffSize = (int) mp2; // Show mouse pointer, if we're screensaving. if (!bOnlyPreviewMode) WinShowPointer(HWND_DESKTOP, TRUE); hwndDlg = WinLoadDlg(hwnd, hwnd, fnAutoHiderDlgProc, hmodOurDLLHandle, DLG_PASSWORDPROTECTION, NULL); if (!hwndDlg) { // Could not load dialog window resources! if (!bOnlyPreviewMode) WinShowPointer(HWND_DESKTOP, FALSE); return (MRESULT) SSMODULE_ERROR_INTERNALERROR; } // Ok, dialog window loaded! // Now set its texts (NLS) internal_SetPageFont(hwndDlg); internal_SetPwdProtWindowText(hwndDlg); // Resize the window so text will fit! internal_ArrangePwdProtWindowControls(hwndDlg); // Initialize control(s)! WinSendDlgItemMsg(hwndDlg, EF_PASSWORD, EM_SETTEXTLIMIT, (MPARAM) (iPwdBuffSize-1), (MPARAM) 0); WinSetDlgItemText(hwndDlg, EF_PASSWORD, ""); // Center dialog in screen if (WinQueryWindowPos(hwndDlg, &swpDlg)) if (WinQueryWindowPos(hwnd, &swpParent)) { // Center dialog box within the screen int ix, iy; ix = swpParent.x + (swpParent.cx - swpDlg.cx)/2; iy = swpParent.y + (swpParent.cy - swpDlg.cy)/2; WinSetWindowPos(hwndDlg, HWND_TOP, ix, iy, 0, 0, SWP_MOVE); } WinSetWindowPos(hwndDlg, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER); // Re-send WM_CHAR messages if needed if (bFirstKeyGoesToPwdWindow) internal_ReplayWMCHARRecord(); // Process the dialog! rc = WinProcessDlg(hwndDlg); if (rc!=PB_OK) { // The user pressed cancel! rc = SSMODULE_ERROR_USERPRESSEDCANCEL; } else { // The user pressed OK! // Get the entered password WinQueryDlgItemText(hwndDlg, EF_PASSWORD, iPwdBuffSize, pchPwdBuff); rc = SSMODULE_NOERROR; } // Destroy window WinDestroyWindow(hwndDlg); // Hide mouse pointer again, if we're screensaving. if (!bOnlyPreviewMode) WinShowPointer(HWND_DESKTOP, FALSE); return (MRESULT) rc; } case WM_SHOWWRONGPASSWORD: // Show mouse pointer, if we're screensaving. if (!bOnlyPreviewMode) WinShowPointer(HWND_DESKTOP, TRUE); hwndDlg = WinLoadDlg(hwnd, hwnd, fnAutoHiderDlgProc, hmodOurDLLHandle, DLG_WRONGPASSWORD, NULL); if (!hwndDlg) { // Could not load dialog window resources! if (!bOnlyPreviewMode) WinShowPointer(HWND_DESKTOP, FALSE); return (MRESULT) SSMODULE_ERROR_INTERNALERROR; } // Ok, dialog window loaded! // Now set its texts (NLS) internal_SetPageFont(hwndDlg); internal_SetWrongPwdWindowText(hwndDlg); // Resize the window so text will fit! internal_ArrangeWrongPwdWindowControls(hwndDlg); // Center dialog in screen if (WinQueryWindowPos(hwndDlg, &swpDlg)) if (WinQueryWindowPos(hwnd, &swpParent)) { // Center dialog box within the screen int ix, iy; ix = swpParent.x + (swpParent.cx - swpDlg.cx)/2; iy = swpParent.y + (swpParent.cy - swpDlg.cy)/2; WinSetWindowPos(hwndDlg, HWND_TOP, ix, iy, 0, 0, SWP_MOVE); } WinSetWindowPos(hwndDlg, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER); // Process the dialog! rc = WinProcessDlg(hwndDlg); // Destroy window WinDestroyWindow(hwndDlg); // Hide mouse pointer again, if we're screensaving. if (!bOnlyPreviewMode) WinShowPointer(HWND_DESKTOP, FALSE); return (MRESULT) SSMODULE_NOERROR; case WM_SUBCLASS_UNINIT: case WM_DESTROY: // All kinds of cleanup (the opposite of everything done in WM_CREATE) // should come here. WinStopTimer(WinQueryAnchorBlock(hwnd), hwnd, ulAnimationTimerID); // Restore mouse pointer, if we're in real screen-saving mode! if (!bOnlyPreviewMode) WinShowPointer(HWND_DESKTOP, TRUE); break; case WM_ADJUSTWINDOWPOS: if (!bOnlyPreviewMode) { SWP *pSWP; // The following is required so that this window will be on // top of the xCenter window, evenif that is set to be always on top! // Real screensaving, here we should stay on top! // Set WS_TOPMOST flag again! WinSetWindowBits(hwnd, QWL_STYLE, WS_TOPMOST, WS_TOPMOST); pSWP = (SWP *) mp1; pSWP->hwndInsertBehind = HWND_TOP; pSWP->fl |= SWP_ZORDER; } break; case WM_PAINT: { HPS hpsBeginPaint; RECTL rclRect, blank, rclWindow; FONTMETRICS fm; int len; #ifdef DEBUG_LOGGING AddLog("WM_PAINT\n"); #endif hpsBeginPaint = WinBeginPaint(hwnd, NULLHANDLE, &rclRect); WinQueryWindowRect(hwnd, &rclRect); WinQueryWindowRect(hwnd, &rclWindow); WinSetWindowFontMy(hwnd, "10.Courier"); GpiQueryFontMetrics(hpsBeginPaint, sizeof(fm), &fm); rclRect.xLeft = textX; rclRect.yTop = textY; len = strlen(CfgDlgInit.pchText); rclRect.xRight = rclRect.xLeft + fm./*lAveCharWidth*/lMaxCharInc * len+5; rclRect.yBottom = rclRect.yTop - fm.lMaxBaselineExt; WinDrawText(hpsBeginPaint, len ,CfgDlgInit.pchText, &rclRect, CLR_WHITE, CLR_BLACK, DT_ERASERECT | DT_LEFT | DT_VCENTER); /* paint the black around the text*/ blank.xLeft = 0; blank.yBottom = 0; blank.xRight = rclRect.xLeft; blank.yTop = rclWindow.yTop; WinFillRect(hpsBeginPaint, &blank, CLR_BLACK); blank.xLeft = rclRect.xLeft-2; blank.yBottom = rclRect.yTop; blank.xRight = rclWindow.xRight; blank.yTop = rclWindow.yTop; WinFillRect(hpsBeginPaint, &blank, CLR_BLACK); blank.xLeft = rclRect.xRight; blank.yBottom = 0; blank.xRight = rclWindow.xRight; blank.yTop = rclRect.yTop; WinFillRect(hpsBeginPaint, &blank, CLR_BLACK); blank.xLeft = rclRect.xLeft-2; blank.yBottom = 0; blank.xRight = rclRect.xRight+2; blank.yTop = rclRect.yBottom; WinFillRect(hpsBeginPaint, &blank, CLR_BLACK); if (rclRect.xRight <= -10) { WinQueryWindowRect(hwnd, &rclRect); textX = rclRect.xRight; textY = rclRect.yTop/2; } WinEndPaint(hpsBeginPaint); #ifdef DEBUG_LOGGING AddLog("WM_PAINT done\n"); #endif return (MRESULT) FALSE; } case WM_TIMER: if (((SHORT)mp1)==ANIMATION_TIMER_ID) { // Timer, so make new image position textX -= 2; WinInvalidateRect(hwnd, NULL, FALSE); } break; default: break; } return WinDefWindowProc( hwnd, msg, mp1, mp2 ); }
static MRESULT EXPENTRY WndProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) { vout_display_t * vd = WinQueryWindowPtr( hwnd, 0 ); MRESULT result = ( MRESULT )TRUE; if ( !vd ) return WinDefWindowProc( hwnd, msg, mp1, mp2 ); vout_display_sys_t * sys = vd->sys; RECTL rcl; SWP swp; if ( sys->is_mouse_hidden && ((msg >= WM_MOUSEFIRST && msg <= WM_MOUSELAST) || (msg >= WM_EXTMOUSEFIRST && msg <= WM_EXTMOUSELAST) || msg == WM_MOUSELEAVE)) { WinShowPointer(HWND_DESKTOP, TRUE); sys->is_mouse_hidden = false; } switch( msg ) { /* the user wants to close the window */ case WM_CLOSE: vout_display_SendEventClose(vd); result = 0; break; case WM_MOUSEMOVE : { SHORT i_mouse_x = SHORT1FROMMP( mp1 ); SHORT i_mouse_y = SHORT2FROMMP( mp1 ); RECTL movie_rect; int i_movie_width, i_movie_height; int i_src_width, i_src_height; /* Get a current movie area */ kvaAdjustDstRect( &sys->kvas.rclSrcRect, &movie_rect ); i_movie_width = movie_rect.xRight - movie_rect.xLeft; i_movie_height = movie_rect.yTop - movie_rect.yBottom; i_src_width = sys->kvas.rclSrcRect.xRight - sys->kvas.rclSrcRect.xLeft; i_src_height = sys->kvas.rclSrcRect.yBottom - sys->kvas.rclSrcRect.yTop; int x = ( i_mouse_x - movie_rect.xLeft ) * i_src_width / i_movie_width + sys->kvas.rclSrcRect.xLeft; int y = ( i_mouse_y - movie_rect.yBottom ) * i_src_height / i_movie_height; /* Invert Y coordinate and add y offset */ y = ( i_src_height - y ) + sys->kvas.rclSrcRect.yTop;; vout_display_SendEventMouseMoved(vd, x, y); result = WinDefWindowProc( hwnd, msg, mp1,mp2 ); break; } case WM_BUTTON1DOWN : MousePressed( vd, hwnd, MOUSE_BUTTON_LEFT ); break; case WM_BUTTON2DOWN : MousePressed( vd, hwnd, MOUSE_BUTTON_RIGHT ); break; case WM_BUTTON3DOWN : MousePressed( vd, hwnd, MOUSE_BUTTON_CENTER ); break; case WM_BUTTON1UP : MouseReleased( vd, MOUSE_BUTTON_LEFT ); break; case WM_BUTTON2UP : MouseReleased( vd, MOUSE_BUTTON_RIGHT ); break; case WM_BUTTON3UP : MouseReleased( vd, MOUSE_BUTTON_CENTER ); break; case WM_BUTTON1DBLCLK : vout_display_SendEventMouseDoubleClick(vd); break; case WM_TRANSLATEACCEL : /* We have no accelerator table at all */ result = ( MRESULT )FALSE; break; case WM_CHAR : { USHORT i_flags = SHORT1FROMMP( mp1 ); USHORT i_ch = SHORT1FROMMP( mp2 ); USHORT i_vk = SHORT2FROMMP( mp2 ); int i_key = 0; /* If embedded window, let the parent process keys */ if( sys->parent_window ) { WinPostMsg( sys->parent, msg, mp1, mp2 ); break; } if( !( i_flags & KC_KEYUP )) { if( i_flags & KC_VIRTUALKEY ) /* convert the key if possible */ i_key = ConvertKey( i_vk ); else if(( i_flags & KC_CHAR ) && !HIBYTE( i_ch )) i_key = tolower( i_ch ); if( i_key ) { if( i_flags & KC_SHIFT ) i_key |= KEY_MODIFIER_SHIFT; if( i_flags & KC_CTRL ) i_key |= KEY_MODIFIER_CTRL; if( i_flags & KC_ALT ) i_key |= KEY_MODIFIER_ALT; vout_display_SendEventKey(vd, i_key); } } break; } /* Process Manage() call */ case WM_VLC_MANAGE : break; /* Fullscreen change */ case WM_VLC_FULLSCREEN_CHANGE : if( LONGFROMMP( mp1 )) { WinQueryWindowPos( sys->frame, &swp ); sys->client_rect.xLeft = swp.x; sys->client_rect.yBottom = swp.y; sys->client_rect.xRight = sys->client_rect.xLeft + swp.cx; sys->client_rect.yTop = sys->client_rect.yBottom + swp.cy; WinCalcFrameRect( sys->frame, &sys->client_rect, TRUE ); rcl.xLeft = 0; rcl.yBottom = 0; rcl.xRight = sys->i_screen_width; rcl.yTop = sys->i_screen_height; } else rcl = sys->client_rect; WinCalcFrameRect( sys->frame, &rcl, FALSE ); WinSetWindowPos( sys->frame, HWND_TOP, rcl.xLeft, rcl.yBottom, rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, SWP_MOVE | SWP_SIZE | SWP_ZORDER | SWP_SHOW | SWP_ACTIVATE ); break; /* Size change */ case WM_VLC_SIZE_CHANGE : rcl.xLeft = 0; rcl.yBottom = 0; rcl.xRight = LONGFROMMP( mp1 ); rcl.yTop = LONGFROMMP( mp2 ); WinCalcFrameRect( sys->frame, &rcl, FALSE ); WinSetWindowPos( sys->frame, NULLHANDLE, 0, 0, rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, SWP_SIZE ); WinQueryWindowPos( sys->frame, &swp ); sys->client_rect.xLeft = swp.x; sys->client_rect.yBottom = swp.y; sys->client_rect.xRight = sys->client_rect.xLeft + swp.cx; sys->client_rect.yTop = sys->client_rect.yBottom + swp.cy; WinCalcFrameRect( sys->frame, &sys->client_rect, TRUE ); break; default : return WinDefWindowProc( hwnd, msg, mp1, mp2 ); } /* If embedded window, we need to change our window size according to a * parent window size */ if( sys->parent_window ) { WinQueryWindowRect( sys->parent, &rcl ); if( rcl.xLeft != sys->parent_rect.xLeft || rcl.yBottom != sys->parent_rect.yBottom || rcl.xRight != sys->parent_rect.xRight || rcl.yTop != sys->parent_rect.yTop) { sys->parent_rect = rcl; WinCalcFrameRect( sys->frame, &rcl, FALSE ); WinSetWindowPos( sys->frame, NULLHANDLE, rcl.xLeft, rcl.yBottom, rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, SWP_SIZE | SWP_MOVE ); } } return result; }
/***************************************************************************** * Control: control facility for the vout *****************************************************************************/ static int Control( vout_display_t *vd, int query, va_list args ) { vout_display_sys_t *sys = vd->sys; switch (query) { case VOUT_DISPLAY_HIDE_MOUSE: { POINTL ptl; WinQueryPointerPos( HWND_DESKTOP, &ptl ); if( WinWindowFromPoint( HWND_DESKTOP, &ptl, TRUE ) == sys->client ) { WinShowPointer( HWND_DESKTOP, FALSE ); sys->is_mouse_hidden = true; } return VLC_SUCCESS; } case VOUT_DISPLAY_CHANGE_FULLSCREEN: { vout_display_cfg_t cfg = *va_arg(args, const vout_display_cfg_t *); if( sys->parent_window ) vout_window_SetFullScreen(sys->parent_window, cfg.is_fullscreen); else WinPostMsg( sys->client, WM_VLC_FULLSCREEN_CHANGE, MPFROMLONG( cfg.is_fullscreen ), 0 ); return VLC_SUCCESS; } case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE: { const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *); bool is_forced = va_arg(args, int); if( is_forced ) { if( sys->parent_window ) { vout_window_SetSize(sys->parent_window, cfg->display.width, cfg->display.height); /* Workaround : * If changing aspect ratio after resizing a main window, * an embedded window is misplaced. So reposition it, here. */ WinSetWindowPos( WinQueryWindow( sys->parent, QW_PARENT ), HWND_TOP, 0, 1, 0, 0, SWP_MOVE ); WinSetWindowPos( WinQueryWindow( sys->parent, QW_PARENT ), HWND_TOP, 0, 0, 0, 0, SWP_MOVE ); } else WinPostMsg( sys->client, WM_VLC_SIZE_CHANGE, MPFROMLONG( cfg->display.width ), MPFROMLONG( cfg->display.height )); } return VLC_SUCCESS; } case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT: case VOUT_DISPLAY_CHANGE_SOURCE_CROP: { const video_format_t *source = va_arg(args, const video_format_t *); if( query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT ) { sys->kvas.ulAspectWidth = ( int64_t )source->i_width * source->i_sar_num / source->i_sar_den; sys->kvas.ulAspectHeight = source->i_height; } else { sys->kvas.rclSrcRect.xLeft = source->i_x_offset; sys->kvas.rclSrcRect.yTop = source->i_y_offset; sys->kvas.rclSrcRect.xRight = source->i_x_offset + source->i_visible_width; sys->kvas.rclSrcRect.yBottom = source->i_y_offset + source->i_visible_height; } kvaSetup( &sys->kvas ); return VLC_SUCCESS; } case VOUT_DISPLAY_RESET_PICTURES: case VOUT_DISPLAY_CHANGE_WINDOW_STATE: case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: case VOUT_DISPLAY_CHANGE_ZOOM: case VOUT_DISPLAY_GET_OPENGL: /* TODO */ break; } msg_Err(vd, "Unsupported query(=%d) in vout display KVA", query); return VLC_EGENERIC; }
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 = vd->fmt; /* */ vout_display_info_t info = vd->info; info.is_slow = false; info.has_double_click = true; info.has_hide_mouse = false; 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 ) { vout_window_cfg_t wnd_cfg; wnd_cfg.is_standalone = false; wnd_cfg.type = VOUT_WINDOW_TYPE_HWND; wnd_cfg.x = var_InheritInteger(vd, "video-x"); wnd_cfg.y = var_InheritInteger(vd, "video-y"); wnd_cfg.width = vd->cfg->display.width; wnd_cfg.height = vd->cfg->display.height; /* If an external window was specified, we'll draw in it. */ sys->parent_window = vout_display_NewWindow( vd, &wnd_cfg ); } if( sys->parent_window ) { sys->parent = ( HWND )sys->parent_window->handle.hwnd; /* Workaround : * When an embedded window opened first, it is not positioned * correctly. So reposition it here, again. */ WinSetWindowPos( WinQueryWindow( sys->parent, QW_PARENT ), HWND_TOP, 0, 0, 0, 0, SWP_MOVE ); 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->b_fixt23 ) { 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 ) { if( sys->parent_window ) vout_window_SetFullScreen(sys->parent_window, true); else 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 ); while( WinGetMsg( sys->hab, &qm, NULLHANDLE, 0, 0 )) WinDispatchMsg( sys->hab, &qm ); kvaEnableScreenSaver(); CloseDisplay( vd ); /* fall through */ exit_open_display : kvaDone(); exit_kva_init : if( sys->b_fixt23 ) 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 ); }
void mouse_button(HWND hwnd, ULONG msg, MPARAM mp1) { if (!_mouse_enabled) return; switch (msg) { case WM_MOUSEMOVE: _mouse_x = SHORT1FROMMP(mp1); _mouse_y = SHORT2FROMMP(mp1); { SWP swp; WinQueryWindowPos(hwnd, &swp); // // check whether the pointer is outside or inside the window // if (FullscreenIsNow()) visible=TRUE; if (_mouse_x>=0 && _mouse_x<swp.cx && _mouse_y>=0 && _mouse_y<swp.cy) { // // FIXME: Don't capture the mouse pointer if it is in front // of a client dialog! // if (WinQueryCapture(HWND_DESKTOP)!=hwnd && hide_mouseptr && !FullscreenIsNow()) WinSetCapture(HWND_DESKTOP, hwnd); if (visible && /*_mouse_enabled &&*/ hide_mouseptr && !FullscreenIsNow()) { WinShowPointer(HWND_DESKTOP, FALSE); visible=FALSE; } } else { if (WinQueryCapture(HWND_DESKTOP)==hwnd && !FullscreenIsNow()) WinSetCapture(HWND_DESKTOP, NULLHANDLE); if (!visible && !FullscreenIsNow()) { WinShowPointer(HWND_DESKTOP, TRUE); visible=TRUE; } // // don't use 'outside'-values which appears one times // if the mouse pointer leaves the window // if (_mouse_x<0) _mouse_x=0; else if (_mouse_x>=swp.cx) _mouse_x=swp.cx-1; if (_mouse_y<0) _mouse_y=0; else if (_mouse_y>=swp.cy) _mouse_y=swp.cy-1; } } return; case WM_BUTTON1DOWN: mouse_button_left(1); return; case WM_BUTTON1UP: mouse_button_left(0); return; case WM_BUTTON2DOWN: mouse_button_right(1); return; case WM_BUTTON2UP: mouse_button_right(0); return; } }
MRESULT EXPENTRY ClientWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { static HAB hab ; static HWND hwndMenu ; static INT iCurrentRep = IDM_10 ; static INT iStatus = STATUS_READY ; static LONG lCalcRep, lRepAmts [] = { 10, 100, 1000, 10000, 100000 } ; static ULONG ulElapsedTime ; double A ; LONG lRep ; switch (msg) { case WM_CREATE: hab = WinQueryAnchorBlock (hwnd) ; hwndMenu = WinWindowFromID ( WinQueryWindow (hwnd, QW_PARENT), FID_MENU) ; return 0 ; case WM_COMMAND: switch (COMMANDMSG(&msg)->cmd) { case IDM_10: case IDM_100: case IDM_1000: case IDM_10000: case IDM_100000: WinCheckMenuItem (hwndMenu, iCurrentRep, FALSE) ; iCurrentRep = COMMANDMSG(&msg)->cmd ; WinCheckMenuItem (hwndMenu, iCurrentRep, TRUE) ; return 0 ; case IDM_START: WinEnableMenuItem (hwndMenu, IDM_START, FALSE) ; WinEnableMenuItem (hwndMenu, IDM_ABORT, TRUE) ; iStatus = STATUS_WORKING ; WinInvalidateRect (hwnd, NULL, FALSE) ; WinUpdateWindow (hwnd) ; WinSetPointer (HWND_DESKTOP, WinQuerySysPointer (HWND_DESKTOP, SPTR_WAIT, FALSE)) ; if (WinQuerySysValue (HWND_DESKTOP, SV_MOUSEPRESENT) == 0) WinShowPointer (HWND_DESKTOP, TRUE) ; lCalcRep = lRepAmts [iCurrentRep - IDM_10] ; ulElapsedTime = WinGetCurrentTime (hab) ; for (A = 1.0, lRep = 0 ; lRep < lCalcRep ; lRep++) A = Savage (A) ; ulElapsedTime = WinGetCurrentTime (hab) - ulElapsedTime ; if (WinQuerySysValue (HWND_DESKTOP, SV_MOUSEPRESENT) == 0) WinShowPointer (HWND_DESKTOP, FALSE) ; WinSetPointer (HWND_DESKTOP, WinQuerySysPointer (HWND_DESKTOP, SPTR_ARROW, FALSE)) ; iStatus = STATUS_DONE ; WinInvalidateRect (hwnd, NULL, FALSE) ; WinUpdateWindow (hwnd) ; WinEnableMenuItem (hwndMenu, IDM_START, TRUE) ; WinEnableMenuItem (hwndMenu, IDM_ABORT, FALSE) ; return 0 ; case IDM_ABORT: // Not much we can do here return 0 ; } break ; case WM_PAINT: PaintWindow (hwnd, iStatus, lCalcRep, ulElapsedTime) ; return 0 ; } return WinDefWindowProc (hwnd, msg, mp1, mp2) ; }
MRESULT EXPENTRY fnSaverWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { SWP swpDlg, swpParent; HWND hwndDlg; int rc; switch( msg ) { case WM_SUBCLASS_INIT: case WM_CREATE: // Any initialization of the window and variables should come here. // Hide mouse pointer, if we're in real screen-saving mode! if (!bOnlyPreviewMode) WinShowPointer(HWND_DESKTOP, FALSE); // Initialize WMCHAR record internal_InitWMCHARRecord(); break; case WM_CHAR: if (!bOnlyPreviewMode) internal_SaveWMCHAREventToRecord(mp1, mp2); break; case WM_ASKPASSWORD: { // Get parameters char *pchPwdBuff = (char *) mp1; int iPwdBuffSize = (int) mp2; // Show mouse pointer, if we're screensaving. if (!bOnlyPreviewMode) WinShowPointer(HWND_DESKTOP, TRUE); hwndDlg = WinLoadDlg(hwnd, hwnd, fnAutoHiderDlgProc, hmodOurDLLHandle, DLG_PASSWORDPROTECTION, NULL); if (!hwndDlg) { // Could not load dialog window resources! if (!bOnlyPreviewMode) WinShowPointer(HWND_DESKTOP, FALSE); return (MRESULT) SSMODULE_ERROR_INTERNALERROR; } // Ok, dialog window loaded! // Now set its texts (NLS) internal_SetPageFont(hwndDlg); internal_SetPwdProtWindowText(hwndDlg); // Resize the window so text will fit! internal_ArrangePwdProtWindowControls(hwndDlg); // Initialize control(s)! WinSendDlgItemMsg(hwndDlg, EF_PASSWORD, EM_SETTEXTLIMIT, (MPARAM) (iPwdBuffSize-1), (MPARAM) 0); WinSetDlgItemText(hwndDlg, EF_PASSWORD, ""); // Center dialog in screen if (WinQueryWindowPos(hwndDlg, &swpDlg)) if (WinQueryWindowPos(hwnd, &swpParent)) { // Center dialog box within the screen int ix, iy; ix = swpParent.x + (swpParent.cx - swpDlg.cx)/2; iy = swpParent.y + (swpParent.cy - swpDlg.cy)/2; WinSetWindowPos(hwndDlg, HWND_TOP, ix, iy, 0, 0, SWP_MOVE); } WinSetWindowPos(hwndDlg, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER); // Re-send WM_CHAR messages if needed if (bFirstKeyGoesToPwdWindow) internal_ReplayWMCHARRecord(); // Process the dialog! rc = WinProcessDlg(hwndDlg); if (rc!=PB_OK) { // The user pressed cancel! rc = SSMODULE_ERROR_USERPRESSEDCANCEL; } else { // The user pressed OK! // Get the entered password WinQueryDlgItemText(hwndDlg, EF_PASSWORD, iPwdBuffSize, pchPwdBuff); rc = SSMODULE_NOERROR; } // Destroy window WinDestroyWindow(hwndDlg); // Hide mouse pointer again, if we're screensaving. if (!bOnlyPreviewMode) WinShowPointer(HWND_DESKTOP, FALSE); return (MRESULT) rc; } case WM_SHOWWRONGPASSWORD: // Show mouse pointer, if we're screensaving. if (!bOnlyPreviewMode) WinShowPointer(HWND_DESKTOP, TRUE); hwndDlg = WinLoadDlg(hwnd, hwnd, fnAutoHiderDlgProc, hmodOurDLLHandle, DLG_WRONGPASSWORD, NULL); if (!hwndDlg) { // Could not load dialog window resources! if (!bOnlyPreviewMode) WinShowPointer(HWND_DESKTOP, FALSE); return (MRESULT) SSMODULE_ERROR_INTERNALERROR; } // Ok, dialog window loaded! // Now set its texts (NLS) internal_SetPageFont(hwndDlg); internal_SetWrongPwdWindowText(hwndDlg); // Resize the window so text will fit! internal_ArrangeWrongPwdWindowControls(hwndDlg); // Center dialog in screen if (WinQueryWindowPos(hwndDlg, &swpDlg)) if (WinQueryWindowPos(hwnd, &swpParent)) { // Center dialog box within the screen int ix, iy; ix = swpParent.x + (swpParent.cx - swpDlg.cx)/2; iy = swpParent.y + (swpParent.cy - swpDlg.cy)/2; WinSetWindowPos(hwndDlg, HWND_TOP, ix, iy, 0, 0, SWP_MOVE); } WinSetWindowPos(hwndDlg, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER); // Process the dialog! rc = WinProcessDlg(hwndDlg); // Destroy window WinDestroyWindow(hwndDlg); // Hide mouse pointer again, if we're screensaving. if (!bOnlyPreviewMode) WinShowPointer(HWND_DESKTOP, FALSE); return (MRESULT) SSMODULE_NOERROR; case WM_SUBCLASS_UNINIT: case WM_DESTROY: // All kinds of cleanup (the opposite of everything done in WM_CREATE) // should come here. // Restore mouse pointer, if we're in real screen-saving mode! if (!bOnlyPreviewMode) WinShowPointer(HWND_DESKTOP, TRUE); break; case WM_ADJUSTWINDOWPOS: if (!bOnlyPreviewMode) { SWP *pSWP; // The following is required so that this window will be on // top of the xCenter window, evenif that is set to be always on top! // Real screensaving, here we should stay on top! // Set WS_TOPMOST flag again! WinSetWindowBits(hwnd, QWL_STYLE, WS_TOPMOST, WS_TOPMOST); pSWP = (SWP *) mp1; pSWP->hwndInsertBehind = HWND_TOP; pSWP->fl |= SWP_ZORDER; } break; case WM_PAINT: { HPS hpsBeginPaint; RECTL rclRect; #ifdef DEBUG_LOGGING AddLog("WM_PAINT\n"); #endif hpsBeginPaint = WinBeginPaint(hwnd, NULL, &rclRect); WinQueryWindowRect(hwnd, &rclRect); // Fill with black WinFillRect(hpsBeginPaint, &rclRect, CLR_BLACK); WinEndPaint(hpsBeginPaint); return (MRESULT) FALSE; } default: break; } return WinDefWindowProc( hwnd, msg, mp1, mp2 ); }
MRESULT EXPENTRY threadTimerMgrProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { if (msg == WM_TIMER) { switch (LONGFROMMP(mp1)) { // scadenza ritardo sparizione puntatore mouse --------------------- case TID_MOUSEPTR: g.is.hidePtrTmr = 0; WinStopTimer(g.timerThrd.hab, g.timerThrd.hwnd, TID_MOUSEPTR); msg = _sysValue(SV_POINTERLEVEL); if (!msg) { WinShowPointer(HWND_DESKTOP, FALSE); WinShowPointer(HWND_DESKTOP, FALSE); } else if (msg > 0x7fff) { do { WinShowPointer(HWND_DESKTOP, FALSE); } while (_sysValue(SV_POINTERLEVEL) > 0x7fff); WinShowPointer(HWND_DESKTOP, FALSE); } /* endif */ g.is.ptrHidden = 1; break; // scadenza ritardo attivazione automatica finestre ---------------- case TID_AUTOFOCUS: _resetTimer(g.hwnd.autoFocus, TID_AUTOFOCUS); break; // scadenza ritardo sparizione barra titolo ------------------------ case TID_HIDETITLE: _resetTimer(g.hwnd.hideTitle, TID_HIDETITLE); break; // scadenza ritardo apparizione barra titolo ----------------------- case TID_UNHIDETITLE: _resetTimer(g.hwnd.unhideTitle, TID_UNHIDETITLE); break; // scadenza ritardo attivazione automatica barra menu -------------- // case TID_MENUACTIVATE: // _resetTimer(g.hwndActMenu, TID_MENUACTIVATE); // break; } /* endswitch */ return (MRESULT)FALSE; } /* endif */ // reset all the bitmaps if (msg == SMWM_RESETBITMAPS) { HINI hini; if (o.tb.on || o.tb.htbar || o.tb.roll) { if (freeBitmapResources() && (NULLHANDLE != (hini = stlrOpenProfile()))) { initResources(hini, FALSE); repaintAll(); PrfCloseProfile(hini); } /* endif */ } /* endif */ return (MRESULT)FALSE; } /* endif */ if ((msg == SMWM_DISABLE) && ((HWND)mp2 == hwnd)) { if ((BOOL)mp1) { // disabilita tutte le funzioni o.gen.disabled = 1; g.hwnd.menu = 0; g.is.cinitmenu = 0; freeBitmapResources(); stlrStopHitTestCheck(); } else if (!g.is.expired) { // riabilita funzioni HINI hini; o.gen.disabled = 0; if (NULLHANDLE != (hini = stlrOpenProfile())) initResources(hini, FALSE); } /* endif */ WinBroadcastMsg(HWND_DESKTOP, WM_STYLER2, (MPARAM)STLR_DISABLED, (MPARAM)o.gen.disabled, BMSG_POST | BMSG_FRAMEONLY | BMSG_DESCENDANTS); return (MRESULT)FALSE; } // end if if (msg == WM_STYLER2) { if ((ULONG)mp1 == STLR_HIDEALL) { g.is.hideall = !g.is.hideall; _stlrMsgPostAll(STLR_HIDEALL, 0); } else if ((ULONG)mp1 == STLR_ROLLALL) { g.is.rollall = !g.is.rollall; _stlrMsgPostAll(STLR_ROLLALL, 0); } /* endif */ return (MRESULT)FALSE; } /* endif */ return WinDefWindowProc(hwnd, msg, mp1, mp2); }
/***************************************************************************** * Control: control facility for the vout *****************************************************************************/ static int Control( vout_display_t *vd, int query, va_list args ) { vout_display_sys_t *sys = vd->sys; switch (query) { case VOUT_DISPLAY_HIDE_MOUSE: { POINTL ptl; WinQueryPointerPos( HWND_DESKTOP, &ptl ); if( !sys->is_mouse_hidden && WinWindowFromPoint( HWND_DESKTOP, &ptl, TRUE ) == sys->client ) { WinShowPointer( HWND_DESKTOP, FALSE ); sys->is_mouse_hidden = true; } return VLC_SUCCESS; } case VOUT_DISPLAY_CHANGE_FULLSCREEN: { bool fs = va_arg(args, int); WinPostMsg( sys->client, WM_VLC_FULLSCREEN_CHANGE, MPFROMLONG(fs), 0 ); return VLC_SUCCESS; } case VOUT_DISPLAY_CHANGE_WINDOW_STATE: { const unsigned state = va_arg( args, unsigned ); const bool is_on_top = (state & VOUT_WINDOW_STATE_ABOVE) != 0; if( is_on_top ) WinSetWindowPos( sys->frame, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER ); sys->is_on_top = is_on_top; return VLC_SUCCESS; } case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE: case VOUT_DISPLAY_CHANGE_ZOOM: { const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *); WinPostMsg( sys->client, WM_VLC_SIZE_CHANGE, MPFROMLONG( cfg->display.width ), MPFROMLONG( cfg->display.height )); return VLC_SUCCESS; } case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT: case VOUT_DISPLAY_CHANGE_SOURCE_CROP: { if( query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT ) { vout_display_place_t place; vout_display_PlacePicture(&place, &vd->source, vd->cfg, false); sys->kvas.ulAspectWidth = place.width; sys->kvas.ulAspectHeight = place.height; } else { video_format_t src_rot; video_format_ApplyRotation(&src_rot, &vd->source); sys->kvas.rclSrcRect.xLeft = src_rot.i_x_offset; sys->kvas.rclSrcRect.yTop = src_rot.i_y_offset; sys->kvas.rclSrcRect.xRight = src_rot.i_x_offset + src_rot.i_visible_width; sys->kvas.rclSrcRect.yBottom = src_rot.i_y_offset + src_rot.i_visible_height; } kvaSetup( &sys->kvas ); return VLC_SUCCESS; } case VOUT_DISPLAY_RESET_PICTURES: case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: /* TODO */ break; } msg_Err(vd, "Unsupported query(=%d) in vout display KVA", query); return VLC_EGENERIC; }