From 899184656a08484f2a0afcdf87796a042f1dba63 Mon Sep 17 00:00:00 2001 From: Fabien Costantini Date: Thu, 4 Dec 2008 17:33:30 +0000 Subject: STR#2086 related Fixes : This one was really tough to track, understand: In fact, the problem was comming from the misplacement of the menu window, which itself came from invalid measurement, which itself came from invalid fl_witdh() measurement, but only when fl_gc is not valid because fl_width() relies on Win32 on the call of GetTextExtentPoint32W which can't succeed if the HDC(here fl_gc) is not valid ! Now the fix: A best-effort algorithm has been furthered to supply a valid fltk hdc if we can have one or a screen hdc if no fltk window is found by fl::first_window(). Note that when fl_gc is NULL inside fl_width() call, it can happen that Fl_Window::current() is not null but invalid (already deleted). Finally, in the case of the buggy menu window observed here, this fl_gc was set to NULL just after an Fl_Menu_Window deletion and re-creation in Fl_Menu_Item::pulldown(). Also added a comment to describe the new fl_width() behavior. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6540 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/fl_font.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/fl_font.cxx') diff --git a/src/fl_font.cxx b/src/fl_font.cxx index 20bdc198b..6f9a1e0f6 100644 --- a/src/fl_font.cxx +++ b/src/fl_font.cxx @@ -26,7 +26,9 @@ // #ifdef WIN32 +#ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN +#endif /* We require Windows 2000 features such as GetGlyphIndices */ # if !defined(WINVER) || (WINVER < 0x0500) # define WINVER 0x0500 -- cgit v1.2.3