The coordinates recovered from the mouse's callback are wrong.
For example, with a window of 640x480 pixels, if i click on the bottom right corner the recovered coordinates are x:645 and y:507 instead of x:639 et y:479.
I looked into the code (window_w32.cpp line 1484):
pt.x = LOWORD( lParam );
pt.y = HIWORD( lParam );
GetClientRect( window->hwnd, &rect );
icvGetBitmapData( window, &size, 0, 0 );
window->on_mouse( event, pt.x*size.cx/MAX(rect.right - rect.left,1),
pt.y*size.cy/MAX(rect.bottom - rect.top,1), flags,
window->on_mouse_param );
And i'm wondering why do not simply do that:
POINT point;
GetCursorPos(&point);
ScreenToClient(window->hwnd, &point);
window->on_mouse( event, point.x, point.y, flags, window->on_mouse_param );
BR.