From 280720df7cc93bcb181026e57ac1187666c5e6ce Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Thu, 9 Sep 2010 15:59:20 +0000 Subject: Fixed Windows class name (xclass) setup and caching mechanism. This was not yet completely converted to UTF-8. Cleaned up related code, removed old comments. Tested and confirmed that the xclass() setup works and that different icons can be set for different window classes (as it was in FLTK 1.1.10). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7704 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_win32.cxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index fb1f66b2a..af04135d7 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -1400,14 +1400,16 @@ Fl_X* Fl_X::make(Fl_Window* w) { first_class_name = class_name; } - const wchar_t* class_namew = L"FLTK"; - const wchar_t* message_namew = L"FLTK::ThreadWakeup"; + wchar_t class_namew[100]; // (limited) buffer for Windows class name + + // convert UTF-8 class_name to wchar_t for RegisterClassExW and CreateWindowExW + + fl_utf8toUtf16(class_name,strlen(class_name), // in + (unsigned short*)class_namew, // out + sizeof(class_namew)/sizeof(wchar_t)); // max. size + if (!class_name_list.has_name(class_name)) { - WNDCLASSEX wc; WNDCLASSEXW wcw; - - memset(&wc, 0, sizeof(wc)); - wc.cbSize = sizeof(WNDCLASSEX); memset(&wcw, 0, sizeof(wcw)); wcw.cbSize = sizeof(WNDCLASSEXW); @@ -1428,13 +1430,11 @@ Fl_X* Fl_X::make(Fl_Window* w) { wcw.hbrBackground = NULL; wcw.lpszMenuName = NULL; wcw.lpszClassName = class_namew; - wcw.cbSize = sizeof(WNDCLASSEXW); RegisterClassExW(&wcw); - class_name_list.add_name((const char *)class_namew); + class_name_list.add_name(class_name); } - // const char* message_name = "FLTK::ThreadWakeup"; - // if (!fl_wake_msg) fl_wake_msg = RegisterWindowMessage(message_name); + const wchar_t* message_namew = L"FLTK::ThreadWakeup"; if (!fl_wake_msg) fl_wake_msg = RegisterWindowMessageW(message_namew); HWND parent; -- cgit v1.2.3