Expand win32_window_init

This commit is contained in:
twinaphex 2015-11-19 08:30:37 +01:00
parent 9205424ab4
commit 9207acd6f2
4 changed files with 12 additions and 6 deletions

View File

@ -247,24 +247,30 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
return DefWindowProc(hwnd, message, wparam, lparam);
}
bool win32_window_init(WNDCLASSEX *wndclass, bool fullscreen)
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->lpfnWndProc = WndProc;
wndclass->hInstance = GetModuleHandle(NULL);
wndclass->hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass->lpszClassName = "RetroArch";
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;
if (!RegisterClassEx(wndclass))
return false;
/* TODO/FIXME - this is ugly. Find a better way */
if (class_name != NULL) /* this is non-NULL when we want a window for shader dialogs, abort here */
return true;
if (!win32_shader_dlg_init())
RARCH_ERR("[WGL]: wgl_shader_dlg_init() failed.\n");
#endif

View File

@ -61,7 +61,7 @@ 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);
bool win32_window_init(WNDCLASSEX *wndclass, bool fullscreen, const char *class_name);
bool win32_window_create(void *data, unsigned style,
RECT *mon_rect, unsigned width,

View File

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

View File

@ -310,7 +310,7 @@ static bool gfx_ctx_wgl_init(void *data)
win32_window_reset();
win32_monitor_init();
if (!win32_window_init(&wndclass, true))
if (!win32_window_init(&wndclass, true, NULL))
return false;
return true;