Move win32_window_init to C code

This commit is contained in:
twinaphex 2015-11-19 08:37:25 +01:00
parent 68750e45b1
commit f2f0e7efb2
4 changed files with 37 additions and 35 deletions

View File

@ -247,40 +247,6 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
return DefWindowProc(hwnd, message, wparam, lparam);
}
bool win32_window_init(WNDCLASSEX *wndclass, bool fullscreen, const char *class_name)
{
#ifndef _XBOX
wndclass->cbSize = sizeof(WNDCLASSEX);
wndclass->style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wndclass->hInstance = GetModuleHandle(NULL);
wndclass->hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass->lpszClassName = (class_name == NULL) ? "RetroArch" : class_name;
wndclass->hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON));
wndclass->hIconSm = (HICON)LoadImage(GetModuleHandle(NULL),
MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 16, 16, 0);
if (!fullscreen)
wndclass->hbrBackground = (HBRUSH)COLOR_WINDOW;
if (class_name == NULL)
wndclass->lpfnWndProc = WndProc;
else
wndclass->style |= CS_CLASSDC;
if (!RegisterClassEx(wndclass))
return false;
/* This is non-NULL when we want a window for shader dialogs,
* therefore early return here */
/* TODO/FIXME - this is ugly. Find a better way */
if (class_name != NULL)
return true;
if (!win32_shader_dlg_init())
RARCH_ERR("[WGL]: wgl_shader_dlg_init() failed.\n");
#endif
return true;
}
bool win32_window_create(void *data, unsigned style,
RECT *mon_rect, unsigned width,
unsigned height, bool fullscreen)

View File

@ -61,7 +61,9 @@ bool win32_set_video_mode(void *data,
bool win32_monitor_set_fullscreen(unsigned width,
unsigned height, unsigned refresh, char *dev_name);
bool win32_window_init(WNDCLASSEX *wndclass, bool fullscreen, const char *class_name);
#ifndef _XBOX
extern "C" bool win32_window_init(WNDCLASSEX *wndclass, bool fullscreen, const char *class_name);
#endif
bool win32_window_create(void *data, unsigned style,
RECT *mon_rect, unsigned width,

View File

@ -575,7 +575,9 @@ static bool d3d_construct(d3d_video_t *d3d,
#endif
memset(&d3d->windowClass, 0, sizeof(d3d->windowClass));
#ifndef _XBOX
win32_window_init(&d3d->windowClass, true, NULL);
#endif
#ifdef HAVE_MONITOR
bool windowed_full;

View File

@ -356,6 +356,38 @@ static LRESULT CALLBACK ShaderDlgWndProc(HWND hwnd, UINT message,
return DefWindowProc(hwnd, message, wparam, lparam);
}
bool win32_window_init(WNDCLASSEX *wndclass, bool fullscreen, const char *class_name)
{
wndclass->cbSize = sizeof(WNDCLASSEX);
wndclass->style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wndclass->hInstance = GetModuleHandle(NULL);
wndclass->hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass->lpszClassName = (class_name == NULL) ? "RetroArch" : class_name;
wndclass->hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON));
wndclass->hIconSm = (HICON)LoadImage(GetModuleHandle(NULL),
MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 16, 16, 0);
if (!fullscreen)
wndclass->hbrBackground = (HBRUSH)COLOR_WINDOW;
if (class_name == NULL)
wndclass->lpfnWndProc = WndProc;
else
wndclass->style |= CS_CLASSDC;
if (!RegisterClassEx(wndclass))
return false;
/* This is non-NULL when we want a window for shader dialogs,
* therefore early return here */
/* TODO/FIXME - this is ugly. Find a better way */
if (class_name != NULL)
return true;
if (!win32_shader_dlg_init())
RARCH_ERR("[WGL]: wgl_shader_dlg_init() failed.\n");
return true;
}
bool win32_shader_dlg_init(void)
{
static bool inited = false;