-
-
Notifications
You must be signed in to change notification settings - Fork 56.3k
add scrollWheel to Cocoa #23394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add scrollWheel to Cocoa #23394
Conversation
|
hi can I do something about trailing whitespace? |
You just need to remove it and commit to git. |
Tested locally with both mouse and trackpad using the code below. Left "consider hasPreciseScrollingDeltas; differentiate CV_EVENT_MOUSEHWHEEL;" suggestions as cpoerschke@5f86d9c commit on https://github.com/cpoerschke/opencv/tree/Cocoa-Scroll-Wheel branch -- feel free to cherry-pick. Looked a little into alternatives to
|
The solution proposed by cpoerschke for me is fine. |
@cpoerschke Thank you for testing. @thewoz please consider to add |
hi, @VadimLevin I add hasPreciseScrollingDeltas to the PR |
|
||
if( mp.x >= 0 && mp.y >= 0 && mp.x < imageSize.width && mp.y < imageSize.height ) | ||
mouseCallback(type, mp.x, mp.y, flags, mouseParam); | ||
if( [event type] == NSEventTypeScrollWheel ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not supported in macOS 10.9 (used in conda-forge)
$BUILD_PREFIX/bin/x86_64-apple-darwin13.4.0-clang++ -DCVAPI_EXPORTS -DENABLE_PLUGINS -DHAVE_COCOA -DHAVE_WEBP -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I$SRC_DIR/build/3rdparty/ippicv/ippicv_mac/icv/include -I$SRC_DIR/build/3rdparty/ippicv/ippicv_mac/iw/include -I$SRC_DIR/build -I$SRC_DIR/modules/highgui/include -I$SRC_DIR/build/modules/highgui -I$SRC_DIR/modules/core/include -I$SRC_DIR/modules/imgproc/include -I$SRC_DIR/modules/imgcodecs/include -I$SRC_DIR/modules/videoio/include -isystem $PREFIX/include/eigen3 -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem $PREFIX/include -fdebug-prefix-map=$SRC_DIR=/usr/local/src/conda/libopencv-4.8.0 -fdebug-prefix-map=$PREFIX=/usr/local/src/conda-prefix -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -Wno-deprecated-declarations -O3 -DNDEBUG -DNDEBUG -std=c++17 -isysroot /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -fPIC -fobjc-exceptions -MD -MT modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_cocoa.mm.o -MF modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_cocoa.mm.o.d -o modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_cocoa.mm.o -c $SRC_DIR/modules/highgui/src/window_cocoa.mm
$SRC_DIR/modules/highgui/src/window_cocoa.mm:902:25: error: use of undeclared identifier 'NSEventTypeScrollWheel'; did you mean 'kCGEventScrollWheel'?
if( [event type] == NSEventTypeScrollWheel ) {
^~~~~~~~~~~~~~~~~~~~~~
kCGEventScrollWheel
/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGEventTypes.h:120:3: note: 'kCGEventScrollWheel' declared here
kCGEventScrollWheel = NX_SCROLLWHEELMOVED,
^
$SRC_DIR/modules/highgui/src/window_cocoa.mm:940:24: error: use of undeclared identifier 'NSEventTypeScrollWheel'; did you mean 'kCGEventScrollWheel'?
if([event type] == NSEventTypeScrollWheel) {[self cvSendMouseEvent:event type:CV_EVENT_MOUSEWHEEL flags:flags ];}
^~~~~~~~~~~~~~~~~~~~~~
kCGEventScrollWheel
/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGEventTypes.h:120:3: note: 'kCGEventScrollWheel' declared here
kCGEventScrollWheel = NX_SCROLLWHEELMOVED,
^
2 errors generated.
[948/1540] $BUILD_PREFIX/bin/x86_64-apple-darwin13.4.0-clang++ -DCVAPI_EXPORTS -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I$SRC_DIR/build/3rdparty/ippicv/ippicv_mac/icv/include -I$SRC_DIR/build/3rdparty/ippicv/ippicv_mac/iw/include -I$SRC_DIR/build -I$SRC_DIR/opencv_contrib/modules/mcc/include -I$SRC_DIR/build/modules/mcc -I$SRC_DIR/modules/core/include -I$SRC_DIR/modules/flann/include -I$SRC_DIR/modules/imgproc/include -I$SRC_DIR/modules/dnn/include -I$SRC_DIR/modules/features2d/include -I$SRC_DIR/modules/calib3d/include -isystem $PREFIX/include/eigen3 -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem $PREFIX/include -fdebug-prefix-map=$SRC_DIR=/usr/local/src/conda/libopencv-4.8.0 -fdebug-prefix-map=$PREFIX=/usr/local/src/conda-prefix -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -O3 -DNDEBUG -DNDEBUG -std=c++17 -isysroot /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -fPIC -MD -MT modules/mcc/CMakeFiles/opencv_mcc.dir/src/bound_min.cpp.o -MF modules/mcc/CMakeFiles/opencv_mcc.dir/src/bound_min.cpp.o.d -o modules/mcc/CMakeFiles/opencv_mcc.dir/src/bound_min.cpp.o -c $SRC_DIR/opencv_contrib/modules/mcc/src/bound_min.cpp
ninja: build stopped: subcommand failed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VadimLevin could you take a look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
macOS 10.9 was released 10 yes from now (October 22, 2013), last security update was 7 years ago...
Do we actually want to keep such compatibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenCV-Python builds use osx 10.16. It's minimal version provided by Github Actions in cloud.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose in conda-forge it can be fixed increasing macOS SDK version to 10.12
conda-forge/opencv-feedstock#371
Add scrollWheel to Cocoa opencv#23394 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
Add scrollWheel to Cocoa opencv#23394 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.