示例#1
0
BOOL WINAPI
ValidateRect(HWND hwnd, CONST RECT *lprc)
{
	RECT	rc;

	if(!hwnd)
		MwRedrawScreen();
	else {
		/* subtract from update region*/
		if(!lprc) {
			GetClientRect(hwnd, &rc);
			if( hwnd->style & WS_CAPTION )
				rc.bottom += mwSYSMETRICS_CYCAPTION;
			if( (hwnd->style & (WS_BORDER | WS_DLGFRAME)) != 0 ) {
				rc.bottom += mwSYSMETRICS_CYFRAME + 1;
		rc.right += mwSYSMETRICS_CXFRAME;
			}
		} else
			rc = *lprc;

		MwUnionUpdateRegion(hwnd, rc.left, rc.top,
			rc.right-rc.left, rc.bottom-rc.top, FALSE);

		/* if update region empty, mark window as painted*/
		if(hwnd->update->numRects == 0)
			if(hwnd->gotPaintMsg == PAINT_NEEDSPAINT)
				hwnd->gotPaintMsg = PAINT_PAINTED;
	}
	return TRUE;
}
示例#2
0
BOOL WINAPI
InvalidateRect(HWND hwnd, CONST RECT *lpRect, BOOL bErase)
{
	/* FIXME: handle bErase*/
	if(!hwnd)
		MwRedrawScreen();
	else {
#if UPDATEREGIONS
		RECT	rc;

		/* add to update region*/
		if(!lpRect)
			GetClientRect(hwnd, &rc);
		else rc = *lpRect;
		rc.bottom += mwSYSMETRICS_CYCAPTION +
			mwSYSMETRICS_CYFRAME + 1;
		rc.right += mwSYSMETRICS_CXFRAME;
		MwUnionUpdateRegion(hwnd, rc.left, rc.top,
			rc.right-rc.left, rc.bottom-rc.top, TRUE);

		/* if update region not empty, mark as needing painting*/
		if(hwnd->update->numRects != 0)
#endif
			if(hwnd->gotPaintMsg == PAINT_PAINTED)
				hwnd->gotPaintMsg = PAINT_NEEDSPAINT;
	}
	return TRUE;
}
示例#3
0
/*
 * Deliver a window expose event.
 * Most of the work is in calculating the update region
 * for better redraw look and feel, and then queuing a
 * WM_PAINT message to the window.
 */
void
MwDeliverExposureEvent(HWND wp, MWCOORD x, MWCOORD y, MWCOORD width,
	MWCOORD height)
{
	if (wp->unmapcount)
		return;

	MwUnionUpdateRegion(wp, x, y, width, height, TRUE);
	PostMessage(wp, WM_PAINT, 0, 0L);
}
示例#4
0
HWND WINAPI
SetFocus(HWND hwnd)
{
	HWND	oldfocus;
	HWND	top, top2;

	/* if NULL or hidden, set focus to desktop*/
	if(!hwnd || hwnd->unmapcount)
		hwnd = rootwp;

	if(hwnd == focuswp)
		return focuswp;

	oldfocus = focuswp;
	top = MwGetTopWindow(oldfocus);
	top2 = MwGetTopWindow(hwnd);
	SendMessage(oldfocus, WM_KILLFOCUS, (WPARAM)hwnd, 0L);
	/* send deactivate. Note: should be sent before changing the focuswp var*/
	if(top2 != top)
		SendMessage(top, WM_ACTIVATE, (WPARAM)MAKELONG(WA_INACTIVE, 0), (LPARAM)top2);

	focuswp = hwnd;
	SendMessage(focuswp, WM_SETFOCUS, (WPARAM)oldfocus, 0L);

	/* FIXME SetActiveWindow() here?*/
	if(top2 != top) {
		/* repaint captions*/
		MwPaintNCArea(top);
#if 0
		/* Make sure that caption area is fully invalidated,
		 * as repaint will be in active color.
		 * FIXME: this doesn't work; breaks terminal emulator
		 * on focus out/in
		 */
		MwUnionUpdateRegion(top2, 0, 0,
			top2->winrect.right-top2->winrect.left,
			mwSYSMETRICS_CYCAPTION+4, TRUE);
#endif
		/* send activate*/
		SendMessage(top2, WM_ACTIVATE, (WPARAM)MAKELONG(WA_ACTIVE, 0),
			(LPARAM)top);
		MwPaintNCArea(top2);
	}

	return oldfocus;
}
示例#5
0
BOOL WINAPI
InvalidateRect(HWND hwnd, CONST RECT *lpRect, BOOL bErase)
{
	if(!hwnd)
		MwRedrawScreen();
	else {
#if UPDATEREGIONS
		RECT	rc;

		/* add to update region*/
		if(!lpRect) {
			GetClientRect(hwnd, &rc);
			if( hwnd->style & WS_CAPTION )
				rc.bottom += mwSYSMETRICS_CYCAPTION;
			if( (hwnd->style & (WS_BORDER | WS_DLGFRAME)) != 0 ) {
				rc.bottom += mwSYSMETRICS_CYFRAME + 1;
		rc.right += mwSYSMETRICS_CXFRAME;
			}
		}
		else
			rc = *lpRect;

		MwUnionUpdateRegion(hwnd, rc.left, rc.top,
			rc.right-rc.left, rc.bottom-rc.top, TRUE);

		/* if update region not empty, mark as needing painting*/
		if(hwnd->update->numRects != 0)
#endif

			if(hwnd->gotPaintMsg == PAINT_PAINTED)
				hwnd->gotPaintMsg = PAINT_NEEDSPAINT;
		if( bErase )
			hwnd->nEraseBkGnd++;
	}
	return TRUE;
}