Merge pull request #6650 from alphanu1/master

Restore resolution fix
This commit is contained in:
Twinaphex 2018-04-29 13:49:14 +02:00 committed by GitHub
commit 6cd046a42a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 29 deletions

View File

@ -50,7 +50,6 @@ const video_display_server_t dispserv_null = {
null_set_window_progress,
NULL,
NULL,
NULL,
"null"
};

View File

@ -65,6 +65,9 @@ calling RegisterWindowMessage(L("TaskbarButtonCreated")). That message must
be received by your application before it calls any ITaskbarList3 method.
*/
static unsigned orig_width = 0;
static unsigned orig_height = 0;
static void* win32_display_server_init(void)
{
HRESULT hr;
@ -98,6 +101,10 @@ static void* win32_display_server_init(void)
static void win32_display_server_destroy(void *data)
{
if (orig_width > 0 && orig_height > 0 )
video_display_server_switch_resolution(orig_width, orig_height,
0, 60);
dispserv_win32_t *dispserv = (dispserv_win32_t*)data;
#ifdef HAS_TASKBAR_EXT
@ -206,7 +213,12 @@ static bool win32_display_server_set_resolution(void *data,
if (!serv)
return false;
if (orig_width == 0)
orig_width = GetSystemMetrics(SM_CXSCREEN);
if (orig_height == 0)
orig_height = GetSystemMetrics(SM_CYSCREEN);
if (f_restore == 0)
freq = hz;
@ -270,14 +282,6 @@ static bool win32_display_server_set_resolution(void *data,
return true;
}
void win32_display_server_get_current_resolution(
unsigned *width, unsigned *height)
{
if (width)
*width = GetSystemMetrics(SM_CYSCREEN);
if (height)
*height = GetSystemMetrics(SM_CXSCREEN);
}
const video_display_server_t dispserv_win32 = {
win32_display_server_init,
@ -285,7 +289,6 @@ const video_display_server_t dispserv_win32 = {
win32_set_window_opacity,
win32_set_window_progress,
win32_set_window_decorations,
win32_display_server_get_current_resolution,
win32_display_server_set_resolution,
"win32"
};

View File

@ -43,7 +43,7 @@ static void crt_check_first_run(void)
if (!first_run)
return;
video_display_server_get_current_resolution(&orig_width, &orig_height);
first_run = false;
}
@ -178,8 +178,5 @@ void crt_video_restore(void)
if (first_run)
return;
video_display_server_switch_resolution(orig_width, orig_height,
0, 60);
first_run = true;
first_run = true;
}

View File

@ -82,15 +82,6 @@ bool video_display_server_set_window_decorations(bool on)
return false;
}
bool video_display_server_get_current_resolution(unsigned *width, unsigned *height)
{
if (current_display_server && current_display_server->get_current_resolution)
{
current_display_server->get_current_resolution(width, height);
return true;
}
return false;
}
bool video_display_server_switch_resolution(unsigned width, unsigned height,
int f_restore, int hz)

View File

@ -30,7 +30,6 @@ typedef struct video_display_server
bool (*set_window_opacity)(void *data, unsigned opacity);
bool (*set_window_progress)(void *data, int progress, bool finished);
bool (*set_window_decorations)(void *data, bool on);
void (*get_current_resolution)(unsigned *width, unsigned *height);
bool (*switch_resolution)(void *data, unsigned width,
unsigned height, int f_restore, int hz);
const char *ident;
@ -44,9 +43,6 @@ bool video_display_server_set_window_opacity(unsigned opacity);
bool video_display_server_set_window_progress(int progress, bool finished);
bool video_display_server_get_current_resolution(
unsigned *width, unsigned *height);
bool video_display_server_set_window_decorations(bool on);
bool video_display_server_switch_resolution(