Work around a Wine bug in wxDateTimePickerCtrl sizing
Don't assume that all Vista and later systems support DTM_GETIDEALSIZE, this is not the case under Wine even when it's emulating a Vista+ Windows version and trusting DTM_GETIDEALSIZE to always return the right value resulted in these controls having 0 size and not being shown at all when running wxWidgets programs under Wine. See https://bugs.winehq.org/show_bug.cgi?id=44680
This commit is contained in:
@@ -117,11 +117,18 @@ wxSize wxDateTimePickerCtrl::DoGetBestSize() const
|
|||||||
if ( wxGetWinVersion() >= wxWinVersion_Vista )
|
if ( wxGetWinVersion() >= wxWinVersion_Vista )
|
||||||
{
|
{
|
||||||
SIZE idealSize;
|
SIZE idealSize;
|
||||||
::SendMessage(m_hWnd, DTM_GETIDEALSIZE, 0, (LPARAM)&idealSize);
|
|
||||||
|
|
||||||
size = wxSize(idealSize.cx, idealSize.cy);
|
// Work around https://bugs.winehq.org/show_bug.cgi?id=44680 by
|
||||||
|
// checking for the return value: even if all "real" MSW systems do
|
||||||
|
// support this message, Wine does not, even when it's configured to
|
||||||
|
// return Vista or later version to the application.
|
||||||
|
if ( ::SendMessage(m_hWnd, DTM_GETIDEALSIZE, 0, (LPARAM)&idealSize) )
|
||||||
|
{
|
||||||
|
size = wxSize(idealSize.cx, idealSize.cy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else // Windows XP
|
|
||||||
|
if ( !size.x || !size.y )
|
||||||
{
|
{
|
||||||
wxClientDC dc(const_cast<wxDateTimePickerCtrl *>(this));
|
wxClientDC dc(const_cast<wxDateTimePickerCtrl *>(this));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user