예제 #1
0
파일: progress.c 프로젝트: AndreRH/wine
/*
 * Tests if a progress bar repaints itself immediately when it receives
 * some specific messages.
 */
static void test_redraw(void)
{
    RECT client_rect;
    LRESULT ret;

    SendMessageA(hProgressWnd, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
    SendMessageA(hProgressWnd, PBM_SETPOS, 10, 0);
    SendMessageA(hProgressWnd, PBM_SETSTEP, 20, 0);
    update_window(hProgressWnd);

    /* PBM_SETPOS */
    ok(SendMessageA(hProgressWnd, PBM_SETPOS, 50, 0) == 10, "PBM_SETPOS must return the previous position\n");
    ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_SETPOS: The progress bar should be redrawn immediately\n");
    
    /* PBM_DELTAPOS */
    ok(SendMessageA(hProgressWnd, PBM_DELTAPOS, 15, 0) == 50, "PBM_DELTAPOS must return the previous position\n");
    ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_DELTAPOS: The progress bar should be redrawn immediately\n");
    
    /* PBM_SETPOS */
    ok(SendMessageA(hProgressWnd, PBM_SETPOS, 80, 0) == 65, "PBM_SETPOS must return the previous position\n");
    ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_SETPOS: The progress bar should be redrawn immediately\n");
    
    /* PBM_STEPIT */
    ok(SendMessageA(hProgressWnd, PBM_STEPIT, 0, 0) == 80, "PBM_STEPIT must return the previous position\n");
    ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_STEPIT: The progress bar should be redrawn immediately\n");
    ret = SendMessageA(hProgressWnd, PBM_GETPOS, 0, 0);
    if (ret == 0)
        win_skip("PBM_GETPOS needs comctl32 > 4.70\n");
    else
        ok(ret == 100, "PBM_GETPOS returned a wrong position : %d\n", (UINT)ret);
    
    /* PBM_SETRANGE and PBM_SETRANGE32:
    Usually the progress bar doesn't repaint itself immediately. If the
    position is not in the new range, it does.
    Don't test this, it may change in future Windows versions. */

    SendMessageA(hProgressWnd, PBM_SETPOS, 0, 0);
    update_window(hProgressWnd);

    /* increase to 10 - no background erase required */
    erased = FALSE;
    SetRectEmpty(&last_paint_rect);
    SendMessageA(hProgressWnd, PBM_SETPOS, 10, 0);
    GetClientRect(hProgressWnd, &client_rect);
    ok(EqualRect(&last_paint_rect, &client_rect), "last_paint_rect was %s instead of %s\n",
       wine_dbgstr_rect(&last_paint_rect), wine_dbgstr_rect(&client_rect));
    update_window(hProgressWnd);
    ok(!erased, "Progress bar shouldn't have erased the background\n");

    /* decrease to 0 - background erase will be required */
    erased = FALSE;
    SetRectEmpty(&last_paint_rect);
    SendMessageA(hProgressWnd, PBM_SETPOS, 0, 0);
    GetClientRect(hProgressWnd, &client_rect);
    ok(EqualRect(&last_paint_rect, &client_rect), "last_paint_rect was %s instead of %s\n",
       wine_dbgstr_rect(&last_paint_rect), wine_dbgstr_rect(&client_rect));
    update_window(hProgressWnd);
    ok(erased, "Progress bar should have erased the background\n");
}
예제 #2
0
파일: clipping.c 프로젝트: AmesianX/RosWine
static void verify_region(HRGN hrgn, const RECT *rc)
{
    union
    {
        RGNDATA data;
        char buf[sizeof(RGNDATAHEADER) + sizeof(RECT)];
    } rgn;
    const RECT *rect;
    DWORD ret;

    ret = GetRegionData(hrgn, 0, NULL);
    if (IsRectEmpty(rc))
        ok(ret == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %u\n", ret);
    else
        ok(ret == sizeof(rgn.data.rdh) + sizeof(RECT), "expected sizeof(rgn), got %u\n", ret);

    if (!ret) return;

    ret = GetRegionData(hrgn, sizeof(rgn), &rgn.data);
    if (IsRectEmpty(rc))
        ok(ret == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %u\n", ret);
    else
        ok(ret == sizeof(rgn.data.rdh) + sizeof(RECT), "expected sizeof(rgn), got %u\n", ret);

    trace("size %u, type %u, count %u, rgn size %u, bound (%d,%d-%d,%d)\n",
          rgn.data.rdh.dwSize, rgn.data.rdh.iType,
          rgn.data.rdh.nCount, rgn.data.rdh.nRgnSize,
          rgn.data.rdh.rcBound.left, rgn.data.rdh.rcBound.top,
          rgn.data.rdh.rcBound.right, rgn.data.rdh.rcBound.bottom);
    if (rgn.data.rdh.nCount != 0)
    {
        rect = (const RECT *)rgn.data.Buffer;
        trace("rect (%d,%d-%d,%d)\n", rect->left, rect->top, rect->right, rect->bottom);
        ok(EqualRect(rect, rc), "rects don't match\n");
    }

    ok(rgn.data.rdh.dwSize == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %u\n", rgn.data.rdh.dwSize);
    ok(rgn.data.rdh.iType == RDH_RECTANGLES, "expected RDH_RECTANGLES, got %u\n", rgn.data.rdh.iType);
    if (IsRectEmpty(rc))
    {
        ok(rgn.data.rdh.nCount == 0, "expected 0, got %u\n", rgn.data.rdh.nCount);
        ok(rgn.data.rdh.nRgnSize == 0 ||
           broken(rgn.data.rdh.nRgnSize == 168), /* NT4 */
           "expected 0, got %u\n", rgn.data.rdh.nRgnSize);
    }
    else
    {
        ok(rgn.data.rdh.nCount == 1, "expected 1, got %u\n", rgn.data.rdh.nCount);
        ok(rgn.data.rdh.nRgnSize == sizeof(RECT) ||
           broken(rgn.data.rdh.nRgnSize == 168), /* NT4 */
           "expected sizeof(RECT), got %u\n", rgn.data.rdh.nRgnSize);
    }
    ok(EqualRect(&rgn.data.rdh.rcBound, rc), "rects don't match\n");
}
예제 #3
0
STDMETHODIMP CGfxFB::SetScnRect(const RECT *pRect)
{
	RECT rZero = {0,0,0,0};
	if(pRect==0)
	{
		m_bScnClip = FALSE;
		return S_OK;
	}
	if((EqualRect(pRect,&rZero))||(EqualRect(pRect,&m_rectScn) && m_bScnClip))
		return S_OK;
	m_rectScn = *pRect;
	m_bScnClip = TRUE;
	DP("[GFXFB]SetScnRect (%d,%d,%d,%d) \n", m_rectScn.left, m_rectScn.top, m_rectScn.right, m_rectScn.bottom);
	return Update();
}
예제 #4
0
void CALLBACK
PollTimer(HWND hwnd, UINT uMsg, UINT_PTR idTimer, DWORD dwTime)
{
    HDC hdc = GetDC(hwnd);
    if (hdc) {
        RECT rcClip, rcClient;
        LPCTSTR pszMsg;
        switch (GetClipBox(hdc, &rcClip)) {
        case NULLREGION:
            pszMsg = TEXT("completely covered");
            break;
        case SIMPLEREGION:
            GetClientRect(hwnd, &rcClient);
            if (EqualRect(&rcClient, &rcClip)) {
                pszMsg = TEXT("completely uncovered");
            } else {
                pszMsg = TEXT("partially covered");
            }
            break;
        case COMPLEXREGION:
            pszMsg = TEXT("partially covered");
            break;
        default:
            pszMsg = TEXT("Error");
            break;
        }
        // If we want to, we can also use RectVisible
        // or PtVisible - or go totally overboard by
        // using GetClipRgn
        ReleaseDC(hwnd, hdc);

        SetWindowText(hwnd, pszMsg);
    }
}
예제 #5
0
BOOL WINAPI
SubtractRect( LPRECT dest, const RECT *src1, const RECT *src2 )
{
    RECT tmp;

    if (IsRectEmpty( src1 ))
    {
	SetRectEmpty( dest );
	return FALSE;
    }
    *dest = *src1;
    if (IntersectRect( &tmp, src1, src2 ))
    {
	if (EqualRect( &tmp, dest ))
	{
	    SetRectEmpty( dest );
	    return FALSE;
	}
	if ((tmp.top == dest->top) && (tmp.bottom == dest->bottom))
	{
	    if (tmp.left == dest->left) dest->left = tmp.right;
	    else if (tmp.right == dest->right) dest->right = tmp.left;
	}
	else if ((tmp.left == dest->left) && (tmp.right == dest->right))
	{
	    if (tmp.top == dest->top) dest->top = tmp.bottom;
	    else if (tmp.bottom == dest->bottom) dest->bottom = tmp.top;
	}
    }
    return TRUE;
}
예제 #6
0
void CEdit::OnDragOver( LPDATAOBJECT pIDataSource, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect )
{
	CEditView *pView;
	int nBuffCol, nRow;
	*pdwEffect = GetDropEffect( pIDataSource, grfKeyState, pt, pView, nBuffCol, nRow );

	if ( *pdwEffect != DROPEFFECT_NONE )
	{
		RECT rcDragCaret;
		m_Selection.GetCaretRect( pView, nBuffCol, nRow, rcDragCaret );
		if ( !EqualRect( &rcDragCaret, &m_rcDragCaret ) )
		{
			// erase old caret
			DrawDragCaret( FALSE );

			m_rcDragCaret = rcDragCaret;

			// draw new caret
			DrawDragCaret( FALSE );
		}
	}
	else
	{
		// erase old caret
		DrawDragCaret( TRUE );
	}
}
	bool FSWinWatcher::IsCurrentFS ()
	{
#if !__GNUC__ 
// Not defined in my MinGW headers even on Vista 
// Maybe it will work later with MinGW
		QUERY_USER_NOTIFICATION_STATE state;
		if (SHQueryUserNotificationState (&state) != S_OK)
			return false;
		return state != QUNS_ACCEPTS_NOTIFICATIONS;
#else
		HWND hWnd = GetForegroundWindow ();
		if (!hWnd)
			return false;

		HMONITOR monitor = MonitorFromWindow (hWnd, MONITOR_DEFAULTTONULL);
		if (!monitor)
			return false;

		MONITORINFO lpmi;
		lpmi.cbSize = sizeof (lpmi);
		if (!GetMonitorInfo (monitor, &lpmi))
			return false;

		RECT monitorRect = lpmi.rcMonitor;
		RECT windowRect;
		GetWindowRect (hWnd, &windowRect);
		return EqualRect (&windowRect, &monitorRect) &&
				Proxy_->GetRootWindowsManager ()->GetPreferredWindow ()->effectiveWinId () != hWnd;
#endif
	}
예제 #8
0
파일: mouse.c 프로젝트: crank123/reactos
static void warp_check( SysMouseImpl* This, BOOL force )
{
    DWORD now = GetCurrentTime();
    const DWORD interval = This->clipped ? 500 : 10;

    if (force || (This->need_warp && (now - This->last_warped > interval)))
    {
        RECT rect, new_rect;
        POINT mapped_center;

        This->last_warped = now;
        This->need_warp = FALSE;
        if (!GetClientRect(This->base.win, &rect)) return;
        MapWindowPoints( This->base.win, 0, (POINT *)&rect, 2 );
        if (!This->clipped)
        {
            mapped_center.x = (rect.left + rect.right) / 2;
            mapped_center.y = (rect.top + rect.bottom) / 2;
            TRACE("Warping mouse to %d - %d\n", mapped_center.x, mapped_center.y);
            SetCursorPos( mapped_center.x, mapped_center.y );
        }
        if (This->base.dwCoopLevel & DISCL_EXCLUSIVE)
        {
            /* make sure we clip even if the window covers the whole screen */
            rect.left = max( rect.left, GetSystemMetrics( SM_XVIRTUALSCREEN ) + 1 );
            rect.top = max( rect.top, GetSystemMetrics( SM_YVIRTUALSCREEN ) + 1 );
            rect.right = min( rect.right, rect.left + GetSystemMetrics( SM_CXVIRTUALSCREEN ) - 2 );
            rect.bottom = min( rect.bottom, rect.top + GetSystemMetrics( SM_CYVIRTUALSCREEN ) - 2 );
            TRACE("Clipping mouse to %s\n", wine_dbgstr_rect( &rect ));
            ClipCursor( &rect );
            This->clipped = GetClipCursor( &new_rect ) && EqualRect( &rect, &new_rect );
        }
    }
}
예제 #9
0
void Protocol::Move
  (
  OpWndItemD* wi,
  LPRECT      lprc
  )

  {
  // make sure the borders are on pixel boundaries
  OWndLPtoDP(m_oiWnd, (LPPOINT)lprc, 2);
  OWndDPtoLP(m_oiWnd, (LPPOINT)lprc, 2);

  if(m_fFrames)
    {
    RECT  rcOld;

    CopyRect(&rcOld, &wi->m_rcItem);
    InvalidateGrabHandles(wi, TRUE);
    wi->Move(lprc);
    InvalidateGrabHandles(wi, FALSE);
    if(OWndIsHwndItem(wi) && !EqualRect(&rcOld, &wi->m_rcItem))
      {
      OWndInvalidateLogicalRect(m_oiWnd, &rcOld, TRUE);
      OWndInvalidateLogicalRect(m_oiWnd, &wi->m_rcItem, TRUE);
      }
    }
  else
    {
    wi->InvalidateGrabHandles(TRUE);
    wi->Move(lprc);
    wi->InvalidateGrabHandles(FALSE);
    }
  }
예제 #10
0
void InvertGrid( HWND hWindow, HDC hDC, LPRECT lpGridRect, int x, int y )
/***********************************************************************/
{
    RECT rRect1, rRect2;

    rRect1 = *lpGridRect;
    Image2Control( (LPINT)&rRect1.left, (LPINT)&rRect1.top );
    Image2Control( (LPINT)&rRect1.right, (LPINT)&rRect1.bottom );
    if ( x == 0 && y == 0 )
    {
        InvertSelection( hWindow, hDC, &rRect1, SL_BLOCK );
        return;
    }

    NewGridFromPoint( lpGridRect, x, y );
    rRect2 = *lpGridRect;
    Image2Control( (LPINT)&rRect2.left, (LPINT)&rRect2.top );
    Image2Control( (LPINT)&rRect2.right, (LPINT)&rRect2.bottom );

    if ( !EqualRect( &rRect1, &rRect2 ) )
    {
        InvertSelection( hWindow, hDC, &rRect1, SL_BLOCK );
        InvertSelection( hWindow, hDC, &rRect2, SL_BLOCK );
    }
}
예제 #11
0
STDMETHODIMP CGfxRMI::SetSrcRect(const RECT *pRect)
{
	if(EqualRect(pRect,&m_rectSrc))
		return S_OK;
	m_rectSrc = *pRect;
	return Update();
}
예제 #12
0
STDMETHODIMP CGfxRenesasHW::SetSrcRect(const RECT *pRect)
{
    if(EqualRect(pRect,&m_rectSrc))
        return S_OK;
    m_rectSrc = *pRect;

    return S_OK;
}
예제 #13
0
STDMETHODIMP CGfxFB::SetSrcRect(const RECT *pRect)
{
	if(EqualRect(pRect,&m_rectSrc))
		return S_OK;
	m_rectSrc = *pRect;
	DP("[GFXFB]Set SourceRect (%d,%d, %d, %d) \n", m_rectSrc.left, m_rectSrc.top, m_rectSrc.right, m_rectSrc.bottom);
	return Update();
}
예제 #14
0
파일: brush.cpp 프로젝트: Bluehorn/wxPython
 bool operator == ( const wxBrushRefData& brush ) const
 {
     return m_style == brush.m_style &&
             m_stipple.IsSameAs(brush.m_stipple) &&
             m_colour == brush.m_colour &&
             m_macBrushKind == brush.m_macBrushKind &&
             m_macThemeBrush == brush.m_macThemeBrush &&
             m_macThemeBackground == brush.m_macThemeBackground &&
             EqualRect(&m_macThemeBackgroundExtent, &brush.m_macThemeBackgroundExtent);
 }
예제 #15
0
파일: draglist.c 프로젝트: GYGit/reactos
/***********************************************************************
 *		DrawInsert (COMCTL32.15)
 *
 * Draws insert arrow by the side of the ListBox item in the parent window.
 *
 * RETURNS
 *      Nothing.
 */
VOID WINAPI DrawInsert (HWND hwndParent, HWND hwndLB, INT nItem)
{
    RECT rcItem, rcListBox, rcDragIcon;
    HDC hdc;
    DRAGLISTDATA * data;

    TRACE("(%p %p %d)\n", hwndParent, hwndLB, nItem);

    if (!hDragArrow)
        hDragArrow = LoadIconW(COMCTL32_hModule, (LPCWSTR)IDI_DRAGARROW);

    if (LB_ERR == SendMessageW(hwndLB, LB_GETITEMRECT, nItem, (LPARAM)&rcItem))
        return;

    if (!GetWindowRect(hwndLB, &rcListBox))
        return;

    /* convert item rect to parent co-ordinates */
    if (!MapWindowPoints(hwndLB, hwndParent, (LPPOINT)&rcItem, 2))
        return;

    /* convert list box rect to parent co-ordinates */
    if (!MapWindowPoints(HWND_DESKTOP, hwndParent, (LPPOINT)&rcListBox, 2))
        return;

    rcDragIcon.left = rcListBox.left - DRAGICON_HOTSPOT_X;
    rcDragIcon.top = rcItem.top - DRAGICON_HOTSPOT_Y;
    rcDragIcon.right = rcListBox.left;
    rcDragIcon.bottom = rcDragIcon.top + DRAGICON_HEIGHT;

    if (!GetWindowSubclass(hwndLB, DragList_SubclassWindowProc, DRAGLIST_SUBCLASSID, (DWORD_PTR*)&data))
        return;

    if (nItem < 0)
        SetRectEmpty(&rcDragIcon);

    /* prevent flicker by only redrawing when necessary */
    if (!EqualRect(&rcDragIcon, &data->last_drag_icon_rect))
    {
        /* get rid of any previous inserts drawn */
        RedrawWindow(hwndParent, &data->last_drag_icon_rect, NULL,
            RDW_INTERNALPAINT | RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);

        CopyRect(&data->last_drag_icon_rect, &rcDragIcon);

        if (nItem >= 0)
        {
            hdc = GetDC(hwndParent);

            DrawIcon(hdc, rcDragIcon.left, rcDragIcon.top, hDragArrow);

            ReleaseDC(hwndParent, hdc);
        }
    }
}
예제 #16
0
static void setdisplaymode(int i)
{
    HRESULT rc;

    rc = IDirectDraw_SetCooperativeLevel(lpDD,
        hwnd, DDSCL_ALLOWMODEX | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
    ok(rc==DD_OK,"SetCooperativeLevel returned: %x\n",rc);
    if (modes[i].dwFlags & DDSD_PIXELFORMAT)
    {
        if (modes[i].ddpfPixelFormat.dwFlags & DDPF_RGB)
        {
            rc = IDirectDraw_SetDisplayMode(lpDD,
                modes[i].dwWidth, modes[i].dwHeight,
                U1(modes[i].ddpfPixelFormat).dwRGBBitCount);
            ok(DD_OK==rc || DDERR_UNSUPPORTED==rc,"SetDisplayMode returned: %x\n",rc);
            if (rc == DD_OK)
            {
                RECT r, scrn, virt;

                SetRect(&virt, 0, 0, GetSystemMetrics(SM_CXVIRTUALSCREEN), GetSystemMetrics(SM_CYVIRTUALSCREEN));
                OffsetRect(&virt, GetSystemMetrics(SM_XVIRTUALSCREEN), GetSystemMetrics(SM_YVIRTUALSCREEN));
                SetRect(&scrn, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
                trace("Mode (%dx%d) [%dx%d] (%d %d)x(%d %d)\n", modes[i].dwWidth, modes[i].dwHeight,
                      scrn.right, scrn.bottom, virt.left, virt.top, virt.right, virt.bottom);

                ok(GetClipCursor(&r), "GetClipCursor() failed\n");
                /* ddraw sets clip rect here to the screen size, even for
                   multiple monitors */
                ok(EqualRect(&r, &scrn), "Invalid clip rect: (%d %d) x (%d %d)\n",
                   r.left, r.top, r.right, r.bottom);

                ok(ClipCursor(NULL), "ClipCursor() failed\n");
                ok(GetClipCursor(&r), "GetClipCursor() failed\n");
                ok(EqualRect(&r, &virt), "Invalid clip rect: (%d %d) x (%d %d)\n",
                   r.left, r.top, r.right, r.bottom);

                rc = IDirectDraw_RestoreDisplayMode(lpDD);
                ok(DD_OK==rc,"RestoreDisplayMode returned: %x\n",rc);
            }
        }
    }
}
예제 #17
0
STDMETHODIMP CGfxRMI::SetDstRect(const RECT *pRect)
{
	if(EqualRect(pRect,&m_rectDst))
		return S_OK;
	m_rectDst = *pRect;

	if ((DeviceIoControl(m_filehandle, AU1XXXMAE_SETDISPLAYRECT, (LPVOID)&m_rectDst, sizeof(RECT),(LPVOID)&m_DB, sizeof(DebugBuffers), &m_BytesReturned ,NULL)) != TRUE)
		return E_FAIL;
	
	return S_OK;
}
static void testcooperativelevels_exclusive(void)
{
    BOOL sfw, success;
    HRESULT rc;
    RECT window_rect;

    /* Do some tests with DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN mode */

    /* First, resize the window so it is not the same size as any screen */
    success = SetWindowPos(hwnd, 0, 0, 0, 281, 92, 0);
    ok(success, "SetWindowPos failed\n");

    /* Try to set exclusive mode only */
    rc = IDirectDraw_SetCooperativeLevel(lpDD,
        hwnd, DDSCL_EXCLUSIVE);
    ok(rc==DDERR_INVALIDPARAMS,"SetCooperativeLevel(DDSCL_EXCLUSIVE) returned: %x\n",rc);

    /* Full screen mode only */
    rc = IDirectDraw_SetCooperativeLevel(lpDD,
        hwnd, DDSCL_FULLSCREEN);
    ok(rc==DDERR_INVALIDPARAMS,"SetCooperativeLevel(DDSCL_FULLSCREEN) returned: %x\n",rc);

    /* Full screen mode + exclusive mode */

    rc = IDirectDraw_SetCooperativeLevel(lpDD, NULL, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE);
    ok(rc==DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, received %x\n", rc);

    sfw=FALSE;
    if(hwnd2)
        sfw=SetForegroundWindow(hwnd2);
    else
        skip("Failed to create the second window\n");

    rc = IDirectDraw_SetCooperativeLevel(lpDD,
        hwnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE);
    ok(rc==DD_OK,"SetCooperativeLevel(DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN) returned: %x\n",rc);

    if(sfw)
        ok(GetForegroundWindow()==hwnd,"Expected the main windows (%p) for foreground, received the second one (%p)\n",hwnd, hwnd2);

    /* rect_before_create is assumed to hold the screen rect */
    GetClientRect(hwnd, &window_rect);
    rc = EqualRect(&rect_before_create, &window_rect);
    ok(rc, "Fullscreen window has wrong size.\n");

    /* Set the focus window. Should fail */
    rc = IDirectDraw_SetCooperativeLevel(lpDD,
        hwnd, DDSCL_SETFOCUSWINDOW);
    ok(rc==DDERR_HWNDALREADYSET ||
       broken(rc==DDERR_INVALIDPARAMS) /* NT4/Win95 */,"SetCooperativeLevel(DDSCL_SETFOCUSWINDOW) returned: %x\n",rc);


    /* All done */
}
static void releasedirectdraw(void)
{
    if( lpDD != NULL )
    {
        IDirectDraw_Release(lpDD);
        lpDD = NULL;
        SetRect(&rect_after_delete, 0, 0,
                GetSystemMetrics(SM_CXSCREEN),
                GetSystemMetrics(SM_CYSCREEN));
        ok(EqualRect(&rect_before_create, &rect_after_delete) != 0,
           "Original display mode was not restored\n");
    }
}
예제 #20
0
STDMETHODIMP CGfxRMI::SetScnRect(const RECT *pRect)
{
	if(pRect==0)
	{
		m_bScnClip = FALSE;
		return S_OK;
	}
	if(EqualRect(pRect,&m_rectScn))// && m_bScnClip)
		return S_OK;
	m_rectScn = *pRect;
	m_bScnClip = TRUE;
	return Update();
}
예제 #21
0
/////////////////////////////////////////////////////////////
// The Move Function
/////////////////////////////////////////////////////////////
void ALMAPI TABLE_WLAY::Move(LPRECT newRect)
  {
  if (EqualRect(newRect, &(m_rcItem)) == FALSE)
      {
      OWndInvalidateLogicalRect(m_oiParent, &m_rcItem, TRUE);
      m_rcItem = *newRect;
      table->visRect = *newRect;
      // store the DP rect
      OWndLPtoDP(m_oiParent, (LPPOINT)&table->visRect, 2);

      OWndInvalidateLogicalRect(m_oiParent, &m_rcItem, TRUE);
      }
  }
예제 #22
0
파일: common.c 프로젝트: paa/vlc
void CommonManage(vout_display_t *vd)
{
    vout_display_sys_t *sys = vd->sys;

    /* We used to call the Win32 PeekMessage function here to read the window
     * messages. But since window can stay blocked into this function for a
     * long time (for example when you move your window on the screen), I
     * decided to isolate PeekMessage in another thread. */

    /* If we do not control our window, we check for geometry changes
     * ourselves because the parent might not send us its events. */
    if (sys->hparent) {
        RECT rect_parent;
        POINT point;

        GetClientRect(sys->hparent, &rect_parent);
        point.x = point.y = 0;
        ClientToScreen(sys->hparent, &point);
        OffsetRect(&rect_parent, point.x, point.y);

        if (!EqualRect(&rect_parent, &sys->rect_parent)) {
            sys->rect_parent = rect_parent;

            /* FIXME I find such #ifdef quite weirds. Are they really needed ? */

#if defined(MODULE_NAME_IS_direct3d) || defined(MODULE_NAME_IS_wingdi) || defined(MODULE_NAME_IS_wingapi)
            SetWindowPos(sys->hwnd, 0, 0, 0,
                         rect_parent.right - rect_parent.left,
                         rect_parent.bottom - rect_parent.top,
                         SWP_NOZORDER);
            UpdateRects(vd, NULL, NULL, true);
#else
            /* This one is to force the update even if only
             * the position has changed */
            SetWindowPos(sys->hwnd, 0, 1, 1,
                         rect_parent.right - rect_parent.left,
                         rect_parent.bottom - rect_parent.top, 0);

            SetWindowPos(sys->hwnd, 0, 0, 0,
                         rect_parent.right - rect_parent.left,
                         rect_parent.bottom - rect_parent.top, 0);

#endif
        }
    }

    /* */
    if (EventThreadGetAndResetHasMoved(sys->event))
        UpdateRects(vd, NULL, NULL, false);
}
예제 #23
0
bool CCommonAppUtils::IsFullscreenWindowActive()
{
    HWND hwnd = GetForegroundWindow();
    RECT rcWindow;
    GetWindowRect(hwnd, &rcWindow);

    HMONITOR hm = MonitorFromRect(&rcWindow, MONITOR_DEFAULTTONULL);
    if (!hm)
        return false;

    MONITORINFO mi = { sizeof(mi) };
    GetMonitorInfo(hm, &mi);

    return !!EqualRect(&rcWindow, &mi.rcMonitor);
}
예제 #24
0
파일: tooltips.c 프로젝트: bdidemus/wine
static void test_margin(void)
{
    RECT r, r1;
    HWND hwnd;
    DWORD ret;

    hwnd = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0,
                           10, 10, 300, 100,
                           NULL, NULL, NULL, 0);
    ok(hwnd != NULL, "failed to create tooltip wnd\n");

    ret = SendMessageA(hwnd, TTM_SETMARGIN, 0, 0);
    ok(!ret, "got %d\n", ret);

    SetRect(&r, -1, -1, 1, 1);
    ret = SendMessageA(hwnd, TTM_SETMARGIN, 0, (LPARAM)&r);
    ok(!ret, "got %d\n", ret);

    SetRect(&r1, 0, 0, 0, 0);
    ret = SendMessageA(hwnd, TTM_GETMARGIN, 0, (LPARAM)&r1);
    ok(!ret, "got %d\n", ret);
    ok(EqualRect(&r, &r1), "got %s, was %s\n", wine_dbgstr_rect(&r1), wine_dbgstr_rect(&r));

    ret = SendMessageA(hwnd, TTM_SETMARGIN, 0, 0);
    ok(!ret, "got %d\n", ret);

    SetRect(&r1, 0, 0, 0, 0);
    ret = SendMessageA(hwnd, TTM_GETMARGIN, 0, (LPARAM)&r1);
    ok(!ret, "got %d\n", ret);
    ok(EqualRect(&r, &r1), "got %s, was %s\n", wine_dbgstr_rect(&r1), wine_dbgstr_rect(&r));

    ret = SendMessageA(hwnd, TTM_GETMARGIN, 0, 0);
    ok(!ret, "got %d\n", ret);

    DestroyWindow(hwnd);
}
예제 #25
0
HRESULT D3DPresentEngine::SetDestinationRect(const RECT& rcDest)
{
    if (EqualRect(&rcDest, &m_rcDestRect))
    {
        return S_OK; // No change.
    }

    HRESULT hr = S_OK;

    AutoLock lock(m_ObjectLock);

    m_rcDestRect = rcDest;

    return hr;
}
예제 #26
0
파일: helper.cpp 프로젝트: rgde/rgdengine
    void Cursor::adjustPosToClient(float &x, float &y)
    {
        RECT client;
        RECT window;
        HWND hwnd = (HWND)core::application::get()->get_handle();

        GetClientRect(hwnd, &client);
        GetWindowRect(hwnd, &window);

        if (EqualRect(&client, &window))
            return;

        x = x * (client.right-client.left) / (window.right-window.left);
        y = y * (client.bottom-client.top) / (window.bottom-window.top);
    }
예제 #27
0
void CommonManage(vout_display_t *vd)
{
    vout_display_sys_t *sys = vd->sys;

    /* We used to call the Win32 PeekMessage function here to read the window
     * messages. But since window can stay blocked into this function for a
     * long time (for example when you move your window on the screen), I
     * decided to isolate PeekMessage in another thread. */

    /* If we do not control our window, we check for geometry changes
     * ourselves because the parent might not send us its events. */
    if (sys->hparent) {
        RECT rect_parent;
        POINT point;

        /* Check if the parent window has resized or moved */
        GetClientRect(sys->hparent, &rect_parent);
        point.x = point.y = 0;
        ClientToScreen(sys->hparent, &point);
        OffsetRect(&rect_parent, point.x, point.y);

        if (!EqualRect(&rect_parent, &sys->rect_parent)) {
            sys->rect_parent = rect_parent;

            /* This code deals with both resize and move
             *
             * For most drivers(direct3d, gdi, opengl), move is never
             * an issue. The surface automatically gets moved together
             * with the associated window (hvideownd)
             *
             * For directx, it is still important to call UpdateRects
             * on a move of the parent window, even if no resize occurred
             */
            SetWindowPos(sys->hwnd, 0, 0, 0,
                         rect_parent.right - rect_parent.left,
                         rect_parent.bottom - rect_parent.top,
                         SWP_NOZORDER);

            UpdateRects(vd, NULL, NULL, true);
        }
    }

    /* HasMoved means here resize or move */
    if (EventThreadGetAndResetHasMoved(sys->event))
        UpdateRects(vd, NULL, NULL, false);
}
예제 #28
0
STDMETHODIMP CGfxFB::SetDstRect(const RECT *pRect)
{
	if(EqualRect(pRect,&m_rectDst))
		return S_OK;

	m_rectDst = *pRect;
	IntersectRect(&m_rectDst,&m_rectScn,&m_rectDst);

#ifdef PXA_LINUX
	DP("FB Setdest(%d,%d,%d,%d) \n",m_rectDst.left, m_rectDst.top, m_rectDst.right, m_rectDst.bottom);
	return E_UNEXPECTED;

	m_fbvinfo.xres  = (m_rectDst.right - m_rectDst.left)&(~(DST_ALIGN-1));
	m_fbvinfo.yres  = (m_rectDst.bottom - m_rectDst.top)&(~(DST_ALIGN -1));

	m_fbvinfo.bits_per_pixel = 19;
	m_fbvinfo.nonstd = (FORMAT_PLANAR_420<< 20) | (m_rectDst.top << 10) | m_rectDst.left;

	if (m_pBuff != NULL)
	{
		munmap(m_pBuff, m_iBufSize);
		m_pBuff = NULL;
	}

	DP("Update info: left = %d, top = %d, xres = %d, yres = %d\n", m_fbvinfo.nonstd&0x3ff, (m_fbvinfo.nonstd>>10)&0x3ff, m_fbvinfo.xres, m_fbvinfo.yres);


	int ret = ioctl(m_iHndFB, FBIOPUT_VSCREENINFO, &m_fbvinfo);
	DP("Update()::FBIOPUT_VSCREENINFO :%d \n", ret);
	
	ioctl(m_iHndFB, FBIOGET_FSCREENINFO, &m_fbfinfo);
	m_iBufSize = m_fbfinfo.smem_len;
	DP("Update()::m_iBufSize  :%d \n", m_iBufSize );
	m_pBuff = (unsigned char *)mmap(0, m_iBufSize, PROT_READ | PROT_WRITE, MAP_SHARED, m_iHndFB, 0);
	if(m_pBuff ==NULL)
	{
		DP("Update()::set dest failed \n");
		return E_FAIL;
	}
#endif

	Update();
	return S_OK;
}
예제 #29
0
HWND __createWindow0(   MHND hmMonitor,LPCTSTR lpClassName,LPCTSTR lpWindowName,
                        DWORD dwStyle,int x,int y,int nWidth,
                        int nHeight,HWND hWndParent,HMENU hMenu,
                        HANDLE hInstance,LPVOID lpParam )
{
    HWND    retCode = NULL;

    if( (NULL != hmMonitor) && (NULL != lpClassName) &&
        (NULL != lpWindowName) && (NULL != hInstance) )
    {
        RECT    rRW     = {0,0,0,0};
        RECT    rRM     = {0,0,0,0};
        RECT    rSect   = {0,0,0,0};

        SetRect(&rRW,x,y,x+nWidth,y+nHeight);

        if( TRUE == _monitorBounds(hmMonitor,&rRM) )
        {
            __normaRectPos(&rRW,rRW,rRM);

            IntersectRect(&rSect,&rRM,&rRW);

            if( TRUE == EqualRect(&rSect,&rRW) )
            {
                x = rSect.left;
                y = rSect.top;
                nWidth = rSect.right - rSect.left;
                nHeight = rSect.bottom - rSect.top;
                retCode = CreateWindow(
                                            lpClassName,lpWindowName,
                                            dwStyle,x,y,nWidth,
                                            nHeight,hWndParent,hMenu,
                                            (HINSTANCE)hInstance,lpParam
                                        );
            } else  {
                    //  A coisa indefinida. Nao tenho sabdoria o que
                    //  fazer aqui mesmo
                    //  E necessario perguntar Jeannette
                    }
        }
    }

    return retCode;
}
예제 #30
0
파일: rebar.c 프로젝트: GYGit/reactos
static void dump_client(HWND hRebar)
{
    RECT r;
    BOOL notify;
    GetWindowRect(hRebar, &r);
    MapWindowPoints(HWND_DESKTOP, hMainWnd, &r, 2);
    if (height_change_notify_rect.top != -1)
    {
        RECT rcClient;
        GetClientRect(hRebar, &rcClient);
        assert(EqualRect(&rcClient, &height_change_notify_rect));
        notify = TRUE;
    }
    else
        notify = FALSE;
    printf("    {{%d, %d, %d, %d}, %d, %s},\n", r.left, r.top, r.right, r.bottom, SendMessageA(hRebar, RB_GETROWCOUNT, 0, 0),
        notify ? "TRUE" : "FALSE");
    SetRect(&height_change_notify_rect, -1, -1, -1, -1);
}