Merge pull request #2739 from StevenPuttemans:bug_1523
This commit is contained in:
commit
44acfc38a1
@ -1436,8 +1436,6 @@ static LRESULT CALLBACK HighGUIProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
|
|||||||
if( window->on_mouse )
|
if( window->on_mouse )
|
||||||
{
|
{
|
||||||
POINT pt;
|
POINT pt;
|
||||||
RECT rect;
|
|
||||||
SIZE size = {0,0};
|
|
||||||
|
|
||||||
int flags = (wParam & MK_LBUTTON ? CV_EVENT_FLAG_LBUTTON : 0)|
|
int flags = (wParam & MK_LBUTTON ? CV_EVENT_FLAG_LBUTTON : 0)|
|
||||||
(wParam & MK_RBUTTON ? CV_EVENT_FLAG_RBUTTON : 0)|
|
(wParam & MK_RBUTTON ? CV_EVENT_FLAG_RBUTTON : 0)|
|
||||||
@ -1463,6 +1461,16 @@ static LRESULT CALLBACK HighGUIProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
|
|||||||
pt.x = GET_X_LPARAM( lParam );
|
pt.x = GET_X_LPARAM( lParam );
|
||||||
pt.y = GET_Y_LPARAM( lParam );
|
pt.y = GET_Y_LPARAM( lParam );
|
||||||
|
|
||||||
|
if (window->flags & CV_WINDOW_AUTOSIZE)
|
||||||
|
{
|
||||||
|
// As user can't change window size, do not scale window coordinates. Underlying windowing system
|
||||||
|
// may prevent full window from being displayed and in this case coordinates should not be scaled.
|
||||||
|
window->on_mouse( event, pt.x, pt.y, flags, window->on_mouse_param );
|
||||||
|
} else {
|
||||||
|
// Full window is displayed using different size. Scale coordinates to match underlying positions.
|
||||||
|
RECT rect;
|
||||||
|
SIZE size = {0, 0};
|
||||||
|
|
||||||
GetClientRect( window->hwnd, &rect );
|
GetClientRect( window->hwnd, &rect );
|
||||||
icvGetBitmapData( window, &size, 0, 0 );
|
icvGetBitmapData( window, &size, 0, 0 );
|
||||||
|
|
||||||
@ -1470,6 +1478,7 @@ static LRESULT CALLBACK HighGUIProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
|
|||||||
pt.y*size.cy/MAX(rect.bottom - rect.top,1), flags,
|
pt.y*size.cy/MAX(rect.bottom - rect.top,1), flags,
|
||||||
window->on_mouse_param );
|
window->on_mouse_param );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user