Work around Wine bug with font handling in SysLink control

Prevent Wine from (wrongly) deleting the font we set for the control.

This avoids problems when trying to use the (unexpectedly deleted) font
that was used for wxHyperlinkCtrl later.
This commit is contained in:
Vadim Zeitlin 2022-12-04 00:00:02 +01:00
parent a47d005165
commit 966c00b930
2 changed files with 12 additions and 0 deletions

View file

@ -43,6 +43,7 @@ public:
long style = wxHL_DEFAULT_STYLE,
const wxString& name = wxASCII_STR(wxHyperlinkCtrlNameStr));
virtual ~wxHyperlinkCtrl();
// overridden base class methods
// -----------------------------

View file

@ -112,6 +112,17 @@ bool wxHyperlinkCtrl::Create(wxWindow *parent,
return true;
}
wxHyperlinkCtrl::~wxHyperlinkCtrl()
{
if ( m_hWnd )
{
// Due to https://bugs.winehq.org/show_bug.cgi?id=54066 we have to
// reset the font before the native control destroys it.
if ( wxIsRunningUnderWine() )
::SendMessage(m_hWnd, WM_SETFONT, 0, FALSE);
}
}
WXDWORD wxHyperlinkCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
{
WXDWORD msStyle = wxControl::MSWGetStyle( style, exstyle );