Ejemplo n.º 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;
}
Ejemplo n.º 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;
}
Ejemplo n.º 3
0
/*
 * Update keyboard status and issue events on it if necessary.
 * This function doesn't block, but is normally only called when
 * there is known to be some data waiting to be read from the keyboard.
 */
BOOL
MwCheckKeyboardEvent(void)
{
	MWKEY	 	mwkey;		/* latest character */
	MWKEYMOD 	modifiers;	/* latest modifiers */
	MWSCANCODE	scancode;
	int	 	keystatus;	/* latest keyboard status */

	/* Read the latest keyboard status: */
	keystatus = GdReadKeyboard(&mwkey, &modifiers, &scancode);
	if(keystatus < 0) {
		if(keystatus == -2)	/* special case for ESC pressed*/
			MwTerminate();
		/*MwError(GR_ERROR_KEYBOARD_ERROR, 0);*/
		return FALSE;
	} else if(keystatus) {		/* Deliver events as appropriate: */
		switch (mwkey) {
		case MWKEY_QUIT:
			MwTerminate();
			/* no return*/
		case MWKEY_REDRAW:
			MwRedrawScreen();
			break;
		case MWKEY_PRINT:
			if (keystatus == 1)
				GdCaptureScreen("screen.bmp");
			break;
		}
		MwDeliverKeyboardEvent(mwkey, modifiers, scancode,
			keystatus==1? TRUE: FALSE);
		return TRUE;
	}
	return FALSE;
}
Ejemplo n.º 4
0
static void
CheckVtChange(void *arg)
{
	if(MwCheckVtChange()) {
#if ANIMATEPALETTE
		fade = 0;
#endif
		MwRedrawScreen();
	}
	GdAddTimer(50, CheckVtChange, NULL);
}
Ejemplo n.º 5
0
/*
 * Update keyboard status and issue events on it if necessary.
 * This function doesn't block, but is only called when Poll() returns TRUE
 * or MwSelect shows some data waiting to be read on the keyboard file descriptor.
 */
BOOL
MwCheckKeyboardEvent(void)
{
	MWKEY	 	mwkey;		/* latest character */
	MWKEYMOD 	modifiers;	/* latest modifiers */
	MWSCANCODE	scancode;
	int	 	keystatus;	/* latest keyboard status */

	if (kbddev.Poll && (kbddev.Poll() == 0))
			return FALSE;

	/* Read the latest keyboard status*/
	keystatus = GdReadKeyboard(&mwkey, &modifiers, &scancode);
	if (keystatus <= 0)
	{
		if (keystatus == KBD_QUIT)	/* special case for quit message*/
			MwTerminate();
		return FALSE;				/* read failed or no new data*/
	}

	/* handle special keys*/
	switch (mwkey)
	{
	case MWKEY_QUIT:
#if DEBUG
		if (modifiers & MWKMOD_CTRL)
			GdCaptureScreen(NULL, "screen.bmp");
		else
#endif
		MwTerminate();
		break;
	case MWKEY_REDRAW:
		MwRedrawScreen();
		break;
#if DEBUG
	case MWKEY_PRINT:
		if (keystatus == KBD_KEYPRESS)
			GdCaptureScreen(NULL, "screen.bmp");
		break;
#endif
	}

	/* Deliver keyboard events as appropriate*/
	MwDeliverKeyboardEvent(mwkey, modifiers, scancode, keystatus == KBD_KEYPRESS? TRUE: FALSE);
	return TRUE;
}
Ejemplo n.º 6
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;
}