shader_dlg_init - some code reuse

This commit is contained in:
twinaphex 2015-11-19 08:34:59 +01:00
parent 9207acd6f2
commit 68750e45b1
2 changed files with 7 additions and 10 deletions

View File

@ -261,14 +261,18 @@ bool win32_window_init(WNDCLASSEX *wndclass, bool fullscreen, const char *class_
if (!fullscreen)
wndclass->hbrBackground = (HBRUSH)COLOR_WINDOW;
if (class_name != NULL)
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) /* this is non-NULL when we want a window for shader dialogs, abort here */
if (class_name != NULL)
return true;
if (!win32_shader_dlg_init())

View File

@ -376,17 +376,10 @@ bool win32_shader_dlg_init(void)
if (!InitCommonControlsEx(&comm_ctrl_init))
return false;
wc_shader_dlg.cbSize = sizeof(wc_shader_dlg);
wc_shader_dlg.style = CS_HREDRAW | CS_VREDRAW | CS_CLASSDC | CS_OWNDC;
wc_shader_dlg.lpfnWndProc = ShaderDlgWndProc;
wc_shader_dlg.hInstance = GetModuleHandle(NULL);
wc_shader_dlg.hCursor = LoadCursor(NULL, IDC_ARROW);
wc_shader_dlg.lpszClassName = "Shader Dialog";
wc_shader_dlg.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON));
wc_shader_dlg.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 16, 16, 0);
wc_shader_dlg.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
if (!RegisterClassEx(&wc_shader_dlg))
if (!win32_window_init(&wc_shader_dlg, true, "Shader Dialog"))
return false;
inited = true;