Conversation
| pt32f.x = cvRound(event_button->x); | ||
| pt32f.y = cvRound(event_button->y); | ||
| pt32f.x = cvFloor(event_button->x); | ||
| pt32f.y = cvFloor(event_button->y); |
There was a problem hiding this comment.
Which values are come from GTK to trigger this problem?
There was a problem hiding this comment.
For 512 by 512 image it can be 511.89, for example. It worked fine in gtk2 because it outputs already floored values.
There was a problem hiding this comment.
Thank you!
Also there are cases with image size less than minimal window size (e.g 10x10) - need to check that this mode work properly too, because floor() doesn't guarantee that we don't exceed image sizes.
To make fix reliable, we should restore (uncomment) the condition below:
- https://github.com/opencv/opencv/blame/3.4.14/modules/highgui/src/window_gtk.cpp#L1877
- dropped by this change: 2a4fb15#diff-15ec6f281c27e7b677a2cee166713fe01b748e1cafd8c59fe95f07d323a48d91R1832 (GitHub is buggy to show that in "collapsed" file)
There was a problem hiding this comment.
I'm not sure window has minimal size. I just tested 1x1 image and it sort of works(I couldnt click on this pixel but I think its my fault).
There was a problem hiding this comment.
@alalek, should I restore the condition just in case or is this PR okay as it is?
There was a problem hiding this comment.
I prefer to restore the condition or use clamp().
cvRound => cvFloor replacement is incomplete (there are several places left) and probably we still need that condition.
BTW, There is similar problem with JavaScript (e.g, here).
There was a problem hiding this comment.
I brought back bounds check and fixed rounding for motion too. I see, in JS canvas sends events about its border too.
Fixing #20141