<h5 dir="auto">System information (version)</h5>
<ul dir="auto">
<li>OpenCV =&gt; 4.5.4</li>
<li>Operating System / Platform =&gt; Linux 22.04 LTS 64 Bit</li>
<li>Compiler =&gt; gcc</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">Since at least version 3.3.1, the EVENT_MOUSEWHEEL and EVENT_MOUSEHWHEEL have worked in linux despite the fact the the .h file says they are implemented in Windows Only.</p>
<p dir="auto">With 4.5.4 on a new machine, the MOUSEWHEEL events do not work.</p>
<p dir="auto">I went back to 4.5.1 and they work fine.</p>
<h5 dir="auto">System information (version)</h5>
<ul dir="auto">
<li>OpenCV =&gt;  4.5.5-310-g9aa647068b</li>
<li>Operating System / Platform =&gt; debian bullseye</li>
<li>Compiler =&gt; gcc version 10.2.1 20210110 (Raspbian 10.2.1-6+rpi1)</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">When mouse wheel is used event is wrong :</p>
<p dir="auto">see also <a href="https://forum.opencv.org/t/unable-to-get-following-flags-event-flag-l-r-m-button-event-mousewheel/8261" rel="nofollow">https://forum.opencv.org/t/unable-to-get-following-flags-event-flag-l-r-m-button-event-mousewheel/8261</a></p>
<h5 dir="auto">Steps to reproduce</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#include &lt;opencv2/opencv.hpp&gt;
#include &lt;iostream&gt;


void onMouse(int event, int x, int y, int flags, void *userdata)
{
    if (event&amp;cv::EVENT_MOUSEWHEEL)
    {
        std::cout &lt;&lt; &quot;EVENT_MOUSEWHEEL&quot; &lt;&lt; std::endl;
        std::cout &lt;&lt; event &lt;&lt; std::endl;
        std::cout &lt;&lt; cv::getMouseWheelDelta(flags) &lt;&lt; std::endl;
    }
    if (event == cv::EVENT_MOUSEHWHEEL)
        std::cout &lt;&lt; &quot;EVENT_MOUSEHWHEEL&quot; &lt;&lt; std::endl;
    if (event == cv::EVENT_LBUTTONDOWN)
        std::cout &lt;&lt; &quot;EVENT_LBUTTONDOWN&quot; &lt;&lt; std::endl;
}

int main(int argc, char**argv)
{
    std::cout&lt;&lt; cv::getBuildInformation();
    cv::Mat img = cv::imread(&quot;/home/pi/opencv/samples/data/baboon.jpg&quot;, cv::IMREAD_COLOR);
    char key = 0;
    cv::namedWindow(&quot;Test Event&quot;);
    cv::setMouseCallback(&quot;Test Event&quot;, onMouse);
    while (key != 27)
    {
       if (img.empty())
            return 0;
       cv::imshow(&quot;Test Event&quot;, img);
       key = cv::pollKey();
    }

    return 0;
}
"><pre class="notranslate"><code class="notranslate">#include &lt;opencv2/opencv.hpp&gt;
#include &lt;iostream&gt;


void onMouse(int event, int x, int y, int flags, void *userdata)
{
    if (event&amp;cv::EVENT_MOUSEWHEEL)
    {
        std::cout &lt;&lt; "EVENT_MOUSEWHEEL" &lt;&lt; std::endl;
        std::cout &lt;&lt; event &lt;&lt; std::endl;
        std::cout &lt;&lt; cv::getMouseWheelDelta(flags) &lt;&lt; std::endl;
    }
    if (event == cv::EVENT_MOUSEHWHEEL)
        std::cout &lt;&lt; "EVENT_MOUSEHWHEEL" &lt;&lt; std::endl;
    if (event == cv::EVENT_LBUTTONDOWN)
        std::cout &lt;&lt; "EVENT_LBUTTONDOWN" &lt;&lt; std::endl;
}

int main(int argc, char**argv)
{
    std::cout&lt;&lt; cv::getBuildInformation();
    cv::Mat img = cv::imread("/home/pi/opencv/samples/data/baboon.jpg", cv::IMREAD_COLOR);
    char key = 0;
    cv::namedWindow("Test Event");
    cv::setMouseCallback("Test Event", onMouse);
    while (key != 27)
    {
       if (img.empty())
            return 0;
       cv::imshow("Test Event", img);
       key = cv::pollKey();
    }

    return 0;
}

</code></pre></div>
<p dir="auto">I think this line is <a href="https://github.com/opencv/opencv/blob/4.x/modules/highgui/src/window_gtk.cpp#L1976">wrong </a><br>
cv_event   = (event-&gt;scroll.delta_y!=0) ? CV_EVENT_MOUSEHWHEEL : CV_EVENT_MOUSEWHEEL;</p>
<p dir="auto">May be this is good :<br>
cv_event   = (event-&gt;scroll.delta_y!=0) ? CV_EVENT_MOUSEWHEEL : CV_EVENT_MOUSEHWHEEL;</p>