Restoring the desktop
Jon Abbott (1421) 2651 posts |
What’s the correct way of restoring the screen resolution and redrawing the desktop when a fullscreen Wimp app returns to the desktop? Is it a combination of OS_ScreenMode 1 when entering fullscreen and Wimp_SetMode when returning to the desktop? |
nemo (145) 2547 posts |
There’s no protocol (that I’m aware of) for taking the screen off the Wimp. Therefore fullscreen apps either suspend multitasking entirely (in which case just return to the mode the Wimp thought it was in and do a ForceRedraw of the whole screen before returning to Wimp_Poll), or continue in the desktop with a maximised borderless window (and if you need to change mode you absolutely do have to use Wimp_SetMode to do both mode changes). Obviously if you continue to multitask you must check that your window is still at the front after every Wimp_Poll, as something else may have popped up a dialog. If that happens, return to windowed mode. |
Jon Abbott (1421) 2651 posts |
The problem I’m seeing is the mode specifier returned by the initial query of the mode the Wimp is in, is getting corrupt between a game querying it when going full screen and setting it back on return to the desktop. If there’s no defined way of doing this, then I can presume what they’re doing isn’t breaking any rules. Logic tells me that mode specifiers returned by the OS are probably transient, but it’s not specifically mentioned in the documentation that any mode definition they point too is transient. Assuming this to be the case, it needs to take a copy of any mode definition pointed too by the mode specifier. Going by the documentation of Wimp_SetMode, this call shouldn’t be used by games to go full screen, only when returning to the desktop and forcing a redraw isn’t necessary. So I think the following method is probably sufficient:
EDIT: Slight correction, it should be using Wimp_ReadSysInfo to get the Wimp mode |
nemo (145) 2547 posts |
Correct.
It is easiest to use Wimp_SetMode to return to the previous Wimp mode, but it is not necessary. A normal mode change (and restoration of the palette in low colour modes), and a ForceRedraw is sufficient. SetMode isn’t necessary because the Wimp and all its tasks already know what mode they’re in, and that won’t have changed. But SetMode is easier than copying the palette, I agree. |