Skip to content

Commit

Permalink
Fixed Windows class name (xclass) setup and caching mechanism. This was
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Albrecht Schlosser committed Sep 9, 2010
1 parent 862648e commit 280720d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Fl_win32.cxx
Expand Up @@ -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);

Expand All @@ -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;
Expand Down

0 comments on commit 280720d

Please sign in to comment.