**File:** modules/highgui/src/window_cocoa.mm
**Change Type:** modified
**Context:** PR #23394: add scrollWheel to Cocoa
**Review Line:** 902

**Code Changes:**
```diff
     mp.y *= (imageSize.height / std::max(viewSize.height, 1.));
     mp.x *= (imageSize.width / std::max(viewSize.width, 1.));
 
-    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 ) {
+      if( event.hasPreciseScrollingDeltas ) {
+        mp.x = int(event.scrollingDeltaX);
+        mp.y = int(event.scrollingDeltaY);
+      } else {
+        mp.x = int(event.scrollingDeltaX / 0.100006);
```

Review comment:
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. ```