Esempio n. 1
0
void MFDisplay_ResetDisplay()
{
	MFCALLSTACK;

	sizeHints->flags = PSize | PMinSize | PMaxSize;
	sizeHints->min_width = sizeHints->max_width = sizeHints->base_width = gDisplay.width;
	sizeHints->min_height = sizeHints->max_height = sizeHints->base_height = gDisplay.height;

	XSetWMNormalHints(xdisplay, window, sizeHints);
	XResizeWindow(xdisplay, window, gDisplay.width, gDisplay.height);

	if(!gDisplay.windowed && numModes > 1)
	{
		XF86VidModeSwitchToMode(xdisplay, screen, vidModes[currentMode]);

		XGrabPointer(xdisplay, window, True, ButtonPressMask, GrabModeAsync, GrabModeAsync, window, None, CurrentTime);
		XFlush(xdisplay);

		// A little trick to make sure the entire window is on the screen
		XWarpPointer(xdisplay, None, window, 0, 0, 0, 0, gDisplay.width - 1, gDisplay.height - 1);
		XWarpPointer(xdisplay, None, window, 0, 0, 0, 0, 0, 0);
		XFlush(xdisplay);
	}

	MFRenderer_ResetDisplay();
}
Esempio n. 2
0
void MFDisplay_ResetDisplay()
{
	MFCALLSTACK;

	MFRenderer_ResetDisplay();
}
Esempio n. 3
0
MF_API bool MFDisplay_Reset(MFDisplay *pDisplay, const MFDisplaySettings *pSettings)
{
/*
	sizeHints->flags = PSize | PMinSize | PMaxSize;
	sizeHints->min_width = sizeHints->max_width = sizeHints->base_width = gDisplay.width;
	sizeHints->min_height = sizeHints->max_height = sizeHints->base_height = gDisplay.height;

	XSetWMNormalHints(xdisplay, window, sizeHints);
	XResizeWindow(xdisplay, window, gDisplay.width, gDisplay.height);

	if(!gDisplay.windowed && numModes > 1)
	{
		XF86VidModeSwitchToMode(xdisplay, screen, vidModes[currentMode]);

		XGrabPointer(xdisplay, window, True, ButtonPressMask, GrabModeAsync, GrabModeAsync, window, None, CurrentTime);
		XFlush(xdisplay);

		// A little trick to make sure the entire window is on the screen
		XWarpPointer(xdisplay, None, window, 0, 0, 0, 0, gDisplay.width - 1, gDisplay.height - 1);
		XWarpPointer(xdisplay, None, window, 0, 0, 0, 0, 0, 0);
		XFlush(xdisplay);
	}
*/

	if(!pDisplay)
		pDisplay = gpCurrentDisplay;

	if(pSettings)
	{
		MFWindowParams params = *MFWindow_GetWindowParameters(pSettings->pWindow);

		params.bFullscreen = pSettings->bFullscreen;
		params.width = pSettings->width;
		params.height = pSettings->height;
		params.flags = (params.flags & ~MFWF_CanResize) | ((pSettings->flags & MFDF_CanResizeWindow) ? MFWF_CanResize : 0);

		MFWindow_Update(pSettings->pWindow, &params);
	}

	if(!pSettings)
		pSettings = &pDisplay->settings;

	if(!MFRenderer_ResetDisplay(pDisplay, pSettings))
	{
		// TODO: Oh no! shall we revert to previous settings?
		return false;
	}

	pDisplay->settings = *pSettings;
	if(pDisplay->settings.bFullscreen)
	{
		pDisplay->fullscreenWidth = pDisplay->settings.width;
		pDisplay->fullscreenHeight = pDisplay->settings.height;
	}
	else
	{
		pDisplay->windowWidth = pDisplay->settings.width;
		pDisplay->windowHeight = pDisplay->settings.height;
	}

	pDisplay->aspectRatio = (float)pDisplay->settings.width / (float)pDisplay->settings.height;

	return true;
}