Implement wxDisplay::GetFromWindow() for wxGTK/Windows.
As wxWindow doesn't have an associated HWND when using wxGTK, use MonitorFromPoint() instead of MonitorFromWindow() for this port. Closes #14408. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71912 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
7462bddbaf
commit
fa88bebec1
@ -608,8 +608,16 @@ int wxDisplayFactoryMSW::GetFromPoint(const wxPoint& pt)
|
||||
|
||||
int wxDisplayFactoryMSW::GetFromWindow(const wxWindow *window)
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
return FindDisplayFromHMONITOR(gs_MonitorFromWindow(GetHwndOf(window),
|
||||
MONITOR_DEFAULTTONULL));
|
||||
#else
|
||||
const wxSize halfsize = window->GetSize() / 2;
|
||||
wxPoint pt = window->GetScreenPosition();
|
||||
pt.x += halfsize.x;
|
||||
pt.y += halfsize.y;
|
||||
return GetFromPoint(pt);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // wxUSE_DISPLAY
|
||||
|
Loading…
Reference in New Issue
Block a user