diff --git a/gfx/common/win32_common.cpp b/gfx/common/win32_common.cpp index 2a438a42ea..266081225f 100644 --- a/gfx/common/win32_common.cpp +++ b/gfx/common/win32_common.cpp @@ -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) diff --git a/gfx/common/win32_common.h b/gfx/common/win32_common.h index 70f4683ac0..ece2dd6ba0 100644 --- a/gfx/common/win32_common.h +++ b/gfx/common/win32_common.h @@ -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, diff --git a/gfx/d3d/d3d.cpp b/gfx/d3d/d3d.cpp index 87a395cd42..a87492cc06 100644 --- a/gfx/d3d/d3d.cpp +++ b/gfx/d3d/d3d.cpp @@ -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; diff --git a/ui/drivers/ui_win32.c b/ui/drivers/ui_win32.c index 538465dbac..3bb857f32d 100644 --- a/ui/drivers/ui_win32.c +++ b/ui/drivers/ui_win32.c @@ -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;