Author: AlbrechtS
Date: 2010-09-09 08:59:20 -0700 (Thu, 09 Sep 2010)
New Revision: 7704
Log:
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).


Modified:
   branches/branch-1.3/src/Fl_win32.cxx

Modified: branches/branch-1.3/src/Fl_win32.cxx
===================================================================
--- branches/branch-1.3/src/Fl_win32.cxx        2010-09-07 23:16:42 UTC (rev 
7703)
+++ branches/branch-1.3/src/Fl_win32.cxx        2010-09-09 15:59:20 UTC (rev 
7704)
@@ -1400,14 +1400,16 @@
     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 @@
     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;

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to