From 21957f21642a98422612bc1b268b20c7377f0eff Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 4 Nov 2010 21:51:09 -0300 Subject: [PATCH] Remove related stuff for non-background switch mode (in Allegro source code for Win32). --- src/allegro/src/win/wdispsw.c | 43 ----------------------------------- src/allegro/src/win/wwnd.c | 23 +++---------------- 2 files changed, 3 insertions(+), 63 deletions(-) diff --git a/src/allegro/src/win/wdispsw.c b/src/allegro/src/win/wdispsw.c index 61dc20931..b67c50831 100644 --- a/src/allegro/src/win/wdispsw.c +++ b/src/allegro/src/win/wdispsw.c @@ -32,9 +32,6 @@ int _win_app_foreground = TRUE; -static HANDLE foreground_event = NULL; -static int allegro_thread_priority = THREAD_PRIORITY_NORMAL; - /* _win_reset_switch_mode: @@ -49,9 +46,6 @@ void _win_reset_switch_mode(void) set_display_switch_mode(SWITCH_BACKGROUND); _win_app_foreground = TRUE; - - /* This has a nice side-effect: releasing the blocked threads. */ - SetEvent(foreground_event); } @@ -60,7 +54,6 @@ void _win_reset_switch_mode(void) */ void sys_directx_display_switch_init(void) { - foreground_event = CreateEvent(NULL, TRUE, TRUE, NULL); _win_reset_switch_mode(); } @@ -70,7 +63,6 @@ void sys_directx_display_switch_init(void) */ void sys_directx_display_switch_exit(void) { - CloseHandle(foreground_event); } @@ -107,8 +99,6 @@ int sys_directx_set_display_switch_mode(int mode) */ void _win_switch_in(void) { - int mode; - _TRACE(PREFIX_I "switch in\n"); _win_app_foreground = TRUE; @@ -119,17 +109,6 @@ void _win_switch_in(void) if (win_gfx_driver && win_gfx_driver->switch_in) win_gfx_driver->switch_in(); - /* handle switch modes */ - mode = get_display_switch_mode(); - - if ((mode == SWITCH_AMNESIA) || (mode == SWITCH_PAUSE)) { - _TRACE(PREFIX_I "AMNESIA or PAUSE mode recovery\n"); - SetEvent(foreground_event); - - /* restore old priority and wake up */ - SetThreadPriority(allegro_thread, allegro_thread_priority); - } - _switch_in(); } @@ -140,8 +119,6 @@ void _win_switch_in(void) */ void _win_switch_out(void) { - int mode; - _TRACE(PREFIX_I "switch out\n"); _win_app_foreground = FALSE; @@ -149,19 +126,6 @@ void _win_switch_out(void) if (win_gfx_driver && win_gfx_driver->switch_out) win_gfx_driver->switch_out(); - /* handle switch modes */ - mode = get_display_switch_mode(); - - if ((mode == SWITCH_AMNESIA) || (mode == SWITCH_PAUSE)) { - _TRACE(PREFIX_I "AMNESIA or PAUSE mode suspension\n"); - ResetEvent(foreground_event); - - /* if the thread doesn't stop, lower its priority only if another window is active */ - allegro_thread_priority = GetThreadPriority(allegro_thread); - if ((HINSTANCE)GetWindowLong(GetForegroundWindow(), GWL_HINSTANCE) != allegro_inst) - SetThreadPriority(allegro_thread, THREAD_PRIORITY_LOWEST); - } - _switch_out(); } @@ -173,12 +137,5 @@ void _win_switch_out(void) */ int _win_thread_switch_out(void) { - int mode = get_display_switch_mode(); - - if ((mode == SWITCH_AMNESIA) || (mode == SWITCH_PAUSE)) { - WaitForSingleObject(foreground_event, INFINITE); - return TRUE; - } - return FALSE; } diff --git a/src/allegro/src/win/wwnd.c b/src/allegro/src/win/wwnd.c index 3601f4131..863333490 100644 --- a/src/allegro/src/win/wwnd.c +++ b/src/allegro/src/win/wwnd.c @@ -71,7 +71,6 @@ static HANDLE wnd_thread = NULL; static int old_style = 0; /* custom window msgs */ -#define SWITCH_TIMER 1 static UINT msg_call_proc = 0; static UINT msg_suicide = 0; @@ -152,23 +151,9 @@ static LRESULT CALLBACK directx_wnd_proc(HWND wnd, UINT message, WPARAM wparam, if (HIWORD(wparam)) break; - if (gfx_driver && !gfx_driver->windowed) { - /* 1.2s delay to let Windows complete the switch in fullscreen mode */ - SetTimer(allegro_wnd, SWITCH_TIMER, 1200, NULL); - } - else { - /* no delay in windowed mode */ - _win_switch_in(); - } - } - break; - - case WM_TIMER: - if (wparam == SWITCH_TIMER) { - KillTimer(allegro_wnd, SWITCH_TIMER); - _win_switch_in(); - return 0; - } + /* no delay in windowed mode */ + _win_switch_in(); + } break; case WM_ENTERSIZEMOVE: @@ -508,9 +493,7 @@ int init_directx_window(void) switch (result) { case WAIT_OBJECT_0: /* window was created successfully */ wnd_thread = events[1]; - SetThreadPriority(wnd_thread, THREAD_PRIORITY_ABOVE_NORMAL); break; - default: /* thread failed to create window */ return -1; }