(Win32) Cleanups

This commit is contained in:
twinaphex 2015-11-11 17:41:20 +01:00
parent 0cb507886a
commit 8f9218ab1b
3 changed files with 12 additions and 7 deletions

View File

@ -79,9 +79,11 @@ void win32_monitor_init(void)
EnumDisplayMonitors(NULL, NULL, win32_monitor_enum_proc, 0);
}
void win32_monitor_from_window(HWND data)
void win32_monitor_from_window(HWND data, bool destroy)
{
win32_monitor_last = MonitorFromWindow(data, MONITOR_DEFAULTTONEAREST);
if (destroy)
DestroyWindow(data);
}
void win32_monitor_get_info(void)
@ -103,7 +105,7 @@ void win32_monitor_info(void *data, void *hm_data)
HMONITOR *hm_to_use = (HMONITOR*)hm_data;
if (!win32_monitor_last)
win32_monitor_from_window(GetDesktopWindow());
win32_monitor_from_window(GetDesktopWindow(), false);
*hm_to_use = win32_monitor_last;
fs_monitor = settings->video.monitor_index;

View File

@ -18,6 +18,12 @@
#define WIN32_COMMON_H__
#include <string.h>
#ifndef _XBOX
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include <boolean.h>
#include "../../driver.h"
#include "../video_context_driver.h"
@ -27,8 +33,6 @@ extern "C" {
#endif
#ifndef _XBOX
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "../drivers_wm/win32_resource.h"
LRESULT win32_handle_keyboard_event(HWND hwnd, UINT message,
@ -38,7 +42,7 @@ LRESULT win32_menu_loop(HWND handle, WPARAM wparam);
void win32_monitor_init(void);
void win32_monitor_from_window(HWND data);
void win32_monitor_from_window(HWND data, bool destroy);
void win32_monitor_get_info(void);

View File

@ -583,8 +583,7 @@ static void gfx_ctx_wgl_destroy(void *data)
if (g_hwnd)
{
win32_monitor_from_window(g_hwnd);
DestroyWindow(g_hwnd);
win32_monitor_from_window(g_hwnd, true);
UnregisterClass("RetroArch", GetModuleHandle(NULL));
g_hwnd = NULL;
}