-"Fixed" issue 222 : if your WM force grafx2 to get a smaller window more than 10 times, it will switch to PIXEL_SIMPLE. It will still flicker, but only if you try to go below 320x200.

-Btw, there seem to be a bug in Verbose_error_message : I needed to pad my message with spaces at the end, or it would display garbage. I think it doesn't detect the \0 properly and expects the last word to end with space...


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1276 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2010-01-18 10:43:00 +00:00
parent 357f8b37ef
commit 04d7359ef5

20
graph.c
View File

@ -205,7 +205,9 @@ int Init_mode_video(int width, int height, int fullscreen, int pix_ratio)
byte pixels_changed;
int absolute_mouse_x=Mouse_X*Pixel_width;
int absolute_mouse_y=Mouse_Y*Pixel_height;
static int Wrong_resize;
try_again:
switch (pix_ratio)
{
@ -251,15 +253,31 @@ int Init_mode_video(int width, int height, int fullscreen, int pix_ratio)
// Valeurs raisonnables: minimum 320x200
if (!fullscreen)
{
if (Wrong_resize>20 && (width < 320*pix_width || height < 200*pix_height))
{
if(pix_ratio != PIXEL_SIMPLE) {
pix_ratio = PIXEL_SIMPLE;
Verbose_error_message("Your WM is forcing GrafX2 to resize to something "
"smaller than the minimal resolution.\n"
"GrafX2 switched to a smaller\npixel scaler to avoid problems ");
goto try_again;
}
}
if (width > 320*pix_width && height > 200*pix_height)
Wrong_resize = 0;
if (width < 320*pix_width)
{
width = 320*pix_width;
screen_changed=1;
Wrong_resize++;
}
if (height < 200*pix_height)
{
height = 200*pix_height;
screen_changed=1;
Wrong_resize++;
}
Video_mode[0].Width = width;
Video_mode[0].Height = height;