Esempio n. 1
0
void GLWindow::ResizeCheck()
{
	XEvent event;
    if (!glDisplay or !glWindow) return;

    XLockDisplay(glDisplay);
	while (XCheckTypedWindowEvent(glDisplay, glWindow, ConfigureNotify, &event))
	{
		if ((event.xconfigure.width != width) || (event.xconfigure.height != height))
		{
			width = event.xconfigure.width;
			height = event.xconfigure.height;
            Force43Ratio();
			UpdateWindowSize(width, height);
		}

        if (!fullScreen) {
            if ((event.xconfigure.x != conf.x) || (event.xconfigure.y != conf.y))
            {
                // Fixme; x&y occassionally gives values near the top left corner rather then the real values,
                // causing the window to change positions when adjusting ZZOgl's settings.
                conf.x = event.xconfigure.x;
                conf.y = event.xconfigure.y;
            }
        }
	}
    XUnlockDisplay(glDisplay);
}
void WindowsApplicationWindow::SetWindowSize(const Vector2u & Size)
{
	WindowWidth = Size.x;
	WindowHeight = Size.y;

	UpdateWindowSize();
}
void CVideoCompressionPage::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
{
	__super::OnHScroll(nSBCode, nPos, pScrollBar);
	if (!comp) return ;

	CSliderCtrl		*slider = (CSliderCtrl*)pScrollBar;
	long			pos;

	if (slider == &tb_irate) {
		pos = slider->GetPos();
		comp->put_KeyFrameRate(pos);
		UpdateIRate();
	} else
	if (slider == &tb_prate) {
		pos = slider->GetPos();
		comp->put_PFramesPerKeyFrame(pos);
		UpdatePRate();
	} else
	if (slider == &tb_quality) {
		pos = slider->GetPos();
		double	q = pos / 100.0;
		comp->put_Quality(q);
		UpdateQuality();
	} else
	if (slider == &tb_window) {
		pos = slider->GetPos();
		DWORDLONG	lpos = pos;
		comp->put_WindowSize(lpos);
		UpdateWindowSize();
	}
}
Esempio n. 4
0
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:
    case VOUT_DISPLAY_CHANGE_FULLSCREEN:
        return VLC_SUCCESS;
    case VOUT_DISPLAY_RESET_PICTURES:
    {
        if (sys->p_window->b_opaque)
            return VLC_EGENERIC;

        msg_Dbg(vd, "resetting pictures");

        if (sys->pool != NULL)
        {
            picture_pool_Release(sys->pool);
            sys->pool = NULL;
        }
        return VLC_SUCCESS;
    }
    case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
    case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
    case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
    {
        if (query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT
         || query == VOUT_DISPLAY_CHANGE_SOURCE_CROP) {
            const video_format_t *source;

            msg_Dbg(vd, "change source crop/aspect");
            source = va_arg(args, const video_format_t *);

            if (query == VOUT_DISPLAY_CHANGE_SOURCE_CROP) {
                video_format_CopyCrop(&sys->p_window->fmt, source);
                AndroidWindow_UpdateCrop(sys, sys->p_window);
            } else
                CopySourceAspect(&sys->p_window->fmt, source);

            UpdateWindowSize(&sys->p_window->fmt, sys->p_window->b_use_priv);
        } else {
            const vout_display_cfg_t *cfg;

            cfg = va_arg(args, const vout_display_cfg_t *);

            sys->i_display_width = cfg->display.width;
            sys->i_display_height = cfg->display.height;
            msg_Dbg(vd, "change display size: %dx%d", sys->i_display_width,
                                                      sys->i_display_height);
        }
        FixSubtitleFormat(sys);

        return VLC_SUCCESS;
    }
    default:
        msg_Warn(vd, "Unknown request in android_window");
    case VOUT_DISPLAY_CHANGE_ZOOM:
    case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
        return VLC_EGENERIC;
    }
Esempio n. 5
0
void GLWindow::GetWindowSize()
{
    if (!NativeDisplay or !NativeWindow) return;

	u32 depth = 0;
#ifdef GLX_API
	unsigned int borderDummy;
	Window winDummy;
    s32 xDummy;
    s32 yDummy;
	u32 width;
	u32 height;

    XLockDisplay(NativeDisplay);
	XGetGeometry(NativeDisplay, NativeWindow, &winDummy, &xDummy, &yDummy, &width, &height, &borderDummy, &depth);
    XUnlockDisplay(NativeDisplay);
#endif

	// FIXME: Not sure it works but that could remove latest X11 bits.
#ifdef EGL_API
	int width;
	int height;
	eglQuerySurface(eglDisplay, eglSurface, EGL_WIDTH, &width);
	eglQuerySurface(eglDisplay, eglSurface, EGL_HEIGHT, &height);
#endif

    // update the gl buffer size
    UpdateWindowSize(width, height);

#ifndef USE_GSOPEN2
	// too verbose!
    ZZLog::Dev_Log("Resolution %dx%d. Depth %d bpp. Position (%d,%d)", width, height, depth, conf.x, conf.y);
#endif
}
// Actual window procedure that will handle saving window size/position and moving
// the controls whilst the window sizes.
static LRESULT CALLBACK SizingProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    DialogData *pdd = (DialogData *)GetProp(hwnd, DIALOG_DATA_PROPERTY);
    if (!pdd)
        return DefWindowProc(hwnd, msg, wParam, lParam);

    switch (msg)
    {
        case WM_ERASEBKGND:
        {
            LRESULT lr = CallWindowProc(pdd->wndProc, hwnd, msg, wParam, lParam);
            pdd->DrawGripper((HDC)wParam);
            return lr;
        }

        case WM_SIZE:
        {
            if (wParam != SIZE_MINIMIZED)
            {
                pdd->bMaximised = wParam == SIZE_MAXIMIZED;
                UpdateWindowSize(pdd, LOWORD(lParam), HIWORD(lParam), hwnd);
            }
        }
        break;

        case WM_NCHITTEST:
        {
            // If the gripper is enabled then perform a simple hit test on our gripper area.
            POINT pt = { LOWORD(lParam), HIWORD(lParam) };
            ScreenToClient(hwnd, &pt);
            if (pdd->InsideGripper(PointI(pt.x, pt.y)))
                return HTBOTTOMRIGHT;
        }
        break;

        case WM_GETMINMAXINFO:
        {
            // Our opportunity to say that we do not want the dialog to grow or shrink any more.
            LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam;
            lpmmi->ptMinTrackSize = pdd->ptSmallest;
        }
        return 0;

        case WM_DESTROY:
        {
            WNDPROC wndProc = pdd->wndProc;
            delete pdd;
            return CallWindowProc(wndProc, hwnd, msg, wParam, lParam);
        }
    }

    return CallWindowProc(pdd->wndProc, hwnd, msg, wParam, lParam);
}
// overriden
BOOL CVideoCompressionPage::OnInitDialog()
{
	BOOL ok = CDSPropertyPage::OnInitDialog();
	if (!ok) return FALSE;

	// prepare titlebar
	title.ModifyStyle(0, WS_CLIPCHILDREN);
	title.ModifyStyleEx(0, WS_EX_CONTROLPARENT);

	WCHAR		wstrDesc[1024];
	WCHAR		wstrVer[1024];
	int			cbDesc, cbVer;

	memset(wstrDesc, 0, sizeof(wstrDesc));
	memset(wstrVer, 0, sizeof(wstrVer));

	cbDesc = 1024;
	cbVer = 1024;

	comp->GetInfo(wstrVer, &cbVer, wstrDesc, &cbDesc,
				  &def_irate, &def_prate, &def_quality, 
				  &flags);
	def_window = 1;

	// keep the strings
	desc = CString(wstrDesc);
	version = CString(wstrVer);

	label_desc.SetWindowText(desc);
	label_version.SetWindowText(version);

	tb_irate.SetRange(-1, 250);
	tb_prate.SetRange(-1, 250);
	tb_quality.SetRange(0, 100);
	tb_window.SetRange(-1, 100);

	UpdateIRate();
	UpdatePRate();
	UpdateQuality();
	UpdateWindowSize();

	bool		kf = (flags & CompressionCaps_CanKeyFrame) == CompressionCaps_CanKeyFrame;
	bool		bf = (flags & CompressionCaps_CanBFrame) == CompressionCaps_CanBFrame;
	bool		cq = (flags & CompressionCaps_CanQuality) == CompressionCaps_CanQuality;
	bool		cw = (flags & CompressionCaps_CanWindow) == CompressionCaps_CanWindow;

	label_irate.EnableWindow(kf);	tb_irate.EnableWindow(kf);		label_irate_val.EnableWindow(kf);	btn_def_irate.EnableWindow(kf);
	label_prate.EnableWindow(bf);	tb_prate.EnableWindow(bf);		label_prate_val.EnableWindow(bf);	btn_def_prate.EnableWindow(bf);
	label_quality.EnableWindow(cq);	tb_quality.EnableWindow(cq);	label_quality_val.EnableWindow(cq);	btn_def_quality.EnableWindow(cq);
	label_window.EnableWindow(cw);	tb_window.EnableWindow(cw);		label_window_val.EnableWindow(cw);	btn_def_window.EnableWindow(cw);

	return TRUE;
}
Esempio n. 8
0
static picture_pool_t *PoolAlloc(vout_display_t *vd, unsigned requested_count)
{
    vout_display_sys_t *sys = vd->sys;
    picture_pool_t *pool = NULL;
    picture_t **pp_pics = NULL;
    unsigned int i = 0;

    msg_Dbg(vd, "PoolAlloc: request %d frames", requested_count);
    if (SetupWindowSurface(sys, requested_count) != 0)
        goto error;

    requested_count = sys->p_window->i_pic_count;
    msg_Dbg(vd, "PoolAlloc: got %d frames", requested_count);

    UpdateWindowSize(&sys->p_window->fmt, sys->p_window->b_use_priv);

    pp_pics = calloc(requested_count, sizeof(picture_t));

    for (i = 0; i < requested_count; i++)
    {
        picture_t *p_pic = PictureAlloc(sys, &sys->p_window->fmt);
        if (!p_pic)
            goto error;
        if (!sys->p_window->b_opaque) {
            p_pic->p_sys->pf_lock_pic = DefaultLockPicture;
            p_pic->p_sys->pf_unlock_pic = DefaultUnlockPicture;
        }

        pp_pics[i] = p_pic;
    }

    picture_pool_configuration_t pool_cfg;
    memset(&pool_cfg, 0, sizeof(pool_cfg));
    pool_cfg.picture_count = requested_count;
    pool_cfg.picture       = pp_pics;
    pool_cfg.lock          = PoolLockPicture;
    pool_cfg.unlock        = PoolUnlockPicture;
    pool = picture_pool_NewExtended(&pool_cfg);

error:
    if (!pool && pp_pics) {
        for (unsigned j = 0; j < i; j++)
            picture_Release(pp_pics[j]);
    }
    free(pp_pics);
    return pool;
}
Esempio n. 9
0
void GLWindow::GetWindowSize()
{
    if (!glDisplay or !glWindow) return;

	unsigned int borderDummy;
	Window winDummy;
    s32 xDummy;
    s32 yDummy;
	
    XLockDisplay(glDisplay);
	XGetGeometry(glDisplay, glWindow, &winDummy, &xDummy, &yDummy, &width, &height, &borderDummy, &depth);
    XUnlockDisplay(glDisplay);

    // update the gl buffer size
    UpdateWindowSize(width, height);

#ifndef USE_GSOPEN2
	// too verbose!
    ZZLog::Dev_Log("Resolution %dx%d. Depth %d bpp. Position (%d,%d)", width, height, depth, conf.x, conf.y);
#endif
}
void WindowsApplicationWindow::SetWindowHeight(unsigned int height)
{
	WindowHeight = height;

	UpdateWindowSize();
}
void WindowsApplicationWindow::SetWindowWidth(unsigned int width)
{
	WindowWidth = width;

	UpdateWindowSize();
}
Esempio n. 12
0
MRESULT EXPENTRY ClientWndProc ( HWND hwndWnd, ULONG ulMsg, MPARAM mpParm1, MPARAM mpParm2 )
{
   switch ( ulMsg )
   {
   // For HELP debugging
   #if 0
      case HM_ERROR:
         {
            CHAR     szTempBuffer[256];

            sprintf( szTempBuffer, "Received HM_ERROR message, mp1=0X%8.8X", (ULONG)mpParm1 );
            WinMessageBox ( HWND_DESKTOP, HWND_DESKTOP, szTempBuffer, "HM_ERROR", 0, MB_OK );
         }
         break;

      case HM_EXT_HELP_UNDEFINED:
         WinMessageBox ( HWND_DESKTOP, HWND_DESKTOP, "Received HM_EXT_HELP_UNDEFINED message", "HM_EXT_HELP_UNDEFINED", 0, MB_OK );
         break;

      case HM_HELPSUBITEM_NOT_FOUND:
         WinMessageBox ( HWND_DESKTOP, HWND_DESKTOP, "Received HM_HELPSUBITEM_NOT_FOUND message", "HM_HELPSUBITEM_NOT_FOUND", 0, MB_OK );
         break;
   #endif

      case HM_QUERY_KEYS_HELP:
         return (MRESULT)IDP_KEYS_INFO;
         break;

      case WM_BUTTON1CLICK:
         MoveCursorToPointer( hwndWnd, (*(POINTS *)&mpParm1).x, (*(POINTS *)&mpParm1).y );
         break;

   #if 0
      case WM_BUTTON2CLICK:
         {
            HPS      hpsClient;
            POINTL   ptl;
            INT      xC, yC;


            xC = ( ( (*(POINTS *)&mpParm1).x - cxChar) / cxChar );
            yC = ( ( cyClient - (*(POINTS *)&mpParm1).y ) / cyChar );

            hpsClient = WinGetPS( hwndWnd );
            GpiSetColor( hpsClient, CLR_PALEGRAY );
            if ( xC < 10 )
               GpiSetMix( hpsClient, FM_XOR );
            else if ( xC < 20 )
               GpiSetMix( hpsClient, FM_INVERT );
            else if ( xC < 30 )
               GpiSetMix( hpsClient, FM_NOTXORSRC );
            else if ( xC < 40 )
               GpiSetMix( hpsClient, FM_NOTMASKSRC );
            else if ( xC < 50 )
               GpiSetMix( hpsClient, FM_SUBTRACT );
///            GpiSetBackColor( hpsClient, CLR_PALEGRAY );
///            GpiSetBackMix( hpsClient, BM_OVERPAINT );
///            ptl.x = ( ( (*(POINTS *)&mpParm1).x - cxChar ) / cxChar ) * cxChar + cxChar;
///            ptl.y = ( ( (*(POINTS *)&mpParm1).y - cyClient ) / cyChar - 1 ) * cyChar + cyClient;
            ptl.x = cxChar + ( xC * cxChar );
            ptl.y = cyClient - ( ( yC + 1) * cyChar );
            GpiMove( hpsClient, &ptl );
            ptl.x += cxChar;
            ptl.y += cyChar;
            if ( yC < 5 )
               GpiBox( hpsClient, DRO_FILL, &ptl, 0, 0 );
            else
               GpiBox( hpsClient, DRO_OUTLINE, &ptl, 0, 0 );
///            GpiSetBackColor( hpsClient, CLR_BACKGROUND );
///            GpiSetMix( hpsClient, FM_DEFAULT );
            WinReleasePS( hpsClient );
         }
         break;
   #endif

      case WM_CHAR:
         if ( !( CHARMSG(&ulMsg)->fs & KC_KEYUP ) )
         {
            if ( CHARMSG(&ulMsg)->fs & KC_CHAR )
            {
               ProcessCharMsg( hwndWnd, ulMsg, mpParm1, mpParm2 );
            }
            else if ( CHARMSG(&ulMsg)->fs & KC_VIRTUALKEY )
            {
               if ( !ProcessCursorMsg( hwndWnd, ulMsg, mpParm1, mpParm2 ) )
               {
                  return WinDefWindowProc( hwndWnd, ulMsg, mpParm1, mpParm2 );
               }
            }
         }
         break;

      case WM_CLOSE:
         if ( QueryAbandonChanges( hwndWnd ) )
            return WinDefWindowProc ( hwndWnd, ulMsg, mpParm1, mpParm2 );
         break;

      case WM_COMMAND:
         return ProcessCommandMsg( hwndWnd, ulMsg, mpParm1, mpParm2 );
         break;

      case WM_CREATE:
         hwndMenu = WinWindowFromID( WinQueryWindow( hwndWnd, QW_PARENT ), FID_MENU );
         hwndHScroll = WinWindowFromID( WinQueryWindow( hwndWnd, QW_PARENT ), FID_HORZSCROLL );
         hwndVScroll = WinWindowFromID( WinQueryWindow( hwndWnd, QW_PARENT ), FID_VERTSCROLL );
         SetWindowTitle( hwndWnd );
         break;

      case WM_DESTROY:
         ClearFile( hwndWnd );
         break;

      case WM_ERASEBACKGROUND:
         return MRFROMSHORT ( TRUE ) ;

      case WM_HELP:
         ProcessHelpMessage( hwndWnd, mpParm1, mpParm2 );
         break;

      case WM_HSCROLL:
         if ( !ProcessHScrollMsg( hwndWnd, ulMsg, mpParm1, mpParm2 ) )
            return WinDefWindowProc( hwndWnd, ulMsg, mpParm1, mpParm2 );
         break;

      case WM_PAINT:
         PaintScreen( hwndWnd );
         break;

      case WM_SAVEAPPLICATION:
         SaveSettings( hwndWnd, habAnchor );
         return WinDefWindowProc( hwndWnd, ulMsg, mpParm1, mpParm2 );
         break;

      case WM_SETFOCUS:
         if ( SHORT1FROMMP( mpParm2 ) )
            CreateCursor( hwndWnd );
         else
            DestroyCursor( hwndWnd );
         break;

      case WM_SIZE:
         UpdateWindowSize( hwndWnd, SHORT1FROMMP( mpParm2), SHORT2FROMMP( mpParm2 ) );
         if ( hwndWnd == WinQueryFocus( HWND_DESKTOP ) )
         {
            DestroyCursor( hwndWnd );
            CreateCursor( hwndWnd );
         }
         break;

      case WM_VSCROLL:
         if ( !ProcessVScrollMsg( hwndWnd, ulMsg, mpParm1, mpParm2 ) )
            return WinDefWindowProc( hwndWnd, ulMsg, mpParm1, mpParm2 );
         break;

      default:
         return WinDefWindowProc( hwndWnd, ulMsg, mpParm1, mpParm2 );
         break;
   }

   return MRFROMSHORT ( FALSE ) ;
}
Esempio n. 13
0
BOOL ResizeDlg::OnWndMsg(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *res )
//    Actual window procedure that will handle saving window size/position and moving
//    the controls whilst the window sizes.
{
    if(dd == NULL) {
        return CDialog::OnWndMsg(msg, wParam, lParam, res);
    }
    switch( msg ) {
    case WM_ERASEBKGND:
    {
        BOOL r = CDialog::OnWndMsg(msg, wParam, lParam, res);
        DialogData *pdd = (DialogData*)dd;
        if( pdd && pdd->m_bShowSizingGrip && !pdd->m_bMaximised ) {
            VAPI( ::DrawFrameControl( reinterpret_cast<HDC>( wParam ),
                                      pdd->m_rcGrip,
                                      DFC_SCROLL, DFCS_SCROLLSIZEGRIP ) );
        }
        return r;
    }
    case WM_SIZE:
    {
        DialogData *pdd = (DialogData*)dd;
        if( pdd && wParam != SIZE_MINIMIZED ) {
            pdd->m_bMaximised = ( wParam == SIZE_MAXIMIZED ? true : false );
            UpdateWindowSize( LOWORD( lParam ), HIWORD( lParam ), *this);
        }
    }
    break;
    case WM_NCHITTEST:
    {
        //
        //        If the gripper is enabled then perform a simple hit test on our gripper area.
        DialogData *pdd = (DialogData*)dd;
        if( pdd && pdd->m_bShowSizingGrip ) {
            POINT pt = { LOWORD(lParam), HIWORD(lParam) };
            (void)ScreenToClient( &pt );
            if( PtInRect( pdd->m_rcGrip, pt ) )
                return (BOOL)HTBOTTOMRIGHT;
        }
    }
    break;
    case WM_GETMINMAXINFO:
    {
        //
        //        Our opportunity to say that we do not want the dialog to grow or shrink any more.
        DialogData *pdd = (DialogData*)dd;
        LPMINMAXINFO lpmmi = reinterpret_cast<LPMINMAXINFO>( lParam );
        lpmmi->ptMinTrackSize = pdd->m_ptSmallest;
        if( pdd->m_bLargestSet ) {
            lpmmi->ptMaxTrackSize = pdd->m_ptLargest;
        }
    }
    return (BOOL)0;
    case WM_NOTIFY:
    {
        if( reinterpret_cast<LPNMHDR>(lParam)->code == PSN_SETACTIVE ) {
            CRect rc;
            VAPI( ::GetClientRect( *GetParent( ), &rc ) );
            UpdateWindowSize( rc.Width(), rc.Height(), *GetParent( ) );
        }
    }
    break;
    case WM_DESTROY:
    {
        //
        //        Our opportunty for cleanup.
        //        Simply acquire all of our objects, free the appropriate memory and remove the
        //        properties from the window. If we do not remove the properties then they will constitute
        //        a resource leak.
        DialogData *pdd = (DialogData*)dd;
        if( pdd ) {
            RegistryData rd;
            rd.m_wpl.length = sizeof( rd.m_wpl );
            VAPI( GetWindowPlacement( &rd.m_wpl ) );

            if( pdd->hkRootSave && pdd->pcszName ) {
                (void)RegSetValueExRecursive( pdd->hkRootSave, pdd->pcszName,
                                              NULL, REG_BINARY,
                                              reinterpret_cast<LPBYTE>( &rd ),
                                              sizeof( rd ) );
            }

            if( pdd->psd ) {
                free(pdd->psd);
            }
            free(pdd);
        }

    }
    break;
    }
    return CDialog::OnWndMsg(msg, wParam, lParam, res);
}