Skip to content

Commit 08c6d59

Browse files
committed
window: use non-unicode api
1 parent 04c15bd commit 08c6d59

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

src/ruisapp/glue/windows/display.cxx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -382,23 +382,26 @@ LRESULT CALLBACK window_procedure(
382382
}
383383
} // namespace
384384

385-
display_wrapper::window_class_wrapper::window_class_wrapper(const char* window_class_name, WNDPROC window_procedure) :
385+
display_wrapper::window_class_wrapper::window_class_wrapper(
386+
const char* window_class_name, //
387+
WNDPROC window_procedure
388+
) :
386389
window_class_name(window_class_name)
387390
{
388-
WNDCLASS wc;
391+
WNDCLASSA wc;
389392

390393
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // redraw on resize, own DC for window
391-
wc.lpfnWndProc = window_procedure;
394+
wc.lpfnWndProc = &window_procedure;
392395
wc.cbClsExtra = 0; // no extra window data
393396
wc.cbWndExtra = 0; // no extra window data
394397
wc.hInstance = GetModuleHandle(nullptr); // instance handle
395398
wc.hIcon = LoadIcon(nullptr, IDI_WINLOGO);
396399
wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
397-
wc.hbrBackground = nullptr; // no background required for OpenGL
400+
wc.hbrBackground = nullptr; // no background needed for OpenGL
398401
wc.lpszMenuName = nullptr; // we don't want a menu
399402
wc.lpszClassName = this->window_class_name; // set the window class name
400403

401-
auto res = RegisterClass(&wc);
404+
auto res = RegisterClassA(&wc);
402405

403406
if (res == 0) {
404407
// TODO: add error information to the exception message using GetLastError() and FormatMessage()
@@ -408,7 +411,7 @@ display_wrapper::window_class_wrapper::window_class_wrapper(const char* window_c
408411

409412
display_wrapper::window_class_wrapper::~window_class_wrapper()
410413
{
411-
auto res = UnregisterClass(
414+
auto res = UnregisterClassA(
412415
this->window_class_name, //
413416
GetModuleHandle(nullptr)
414417
);

src/ruisapp/glue/windows/display.hxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ public:
3636
struct window_class_wrapper {
3737
const char* const window_class_name;
3838

39-
window_class_wrapper(const char* window_class_name, WNDPROC window_procedure);
39+
window_class_wrapper(
40+
const char* window_class_name, //
41+
WNDPROC window_procedure
42+
);
4043

4144
window_class_wrapper(const window_class_wrapper&) = delete;
4245
window_class_wrapper& operator=(const window_class_wrapper) = delete;

src/ruisapp/glue/windows/window.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ native_window::window_wrapper::window_wrapper(
3434
bool visible
3535
) :
3636
handle([&]() {
37-
auto hwnd = CreateWindowEx(
37+
auto hwnd = CreateWindowExA(
3838
WS_EX_APPWINDOW | WS_EX_WINDOWEDGE, // extended style
3939
window_class.window_class_name,
4040
window_params.title.c_str(),

0 commit comments

Comments
 (0)