Skip to content

Try to solve I21853 mouse wheel problem with GTK3#21856

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
LaurentBerger:I21853
Apr 29, 2022
Merged

Try to solve I21853 mouse wheel problem with GTK3#21856
opencv-pushbot merged 1 commit intoopencv:3.4from
LaurentBerger:I21853

Conversation

@LaurentBerger
Copy link
Copy Markdown
Contributor

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • 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

@asmorkalov
Copy link
Copy Markdown
Contributor

#21853

@asmorkalov
Copy link
Copy Markdown
Contributor

@LaurentBerger Thanks for the patch. Unfortunately it's not complete. I do not have mouse with horizontal scroll, but with regular mouse I see this in logs:


  GUI:                           GTK3
    GTK+:                        YES (ver 3.22.30)
      GThread :                  YES (ver 2.56.4)
      GtkGlExt:                  NO
    VTK support:                 NO

....

  Install to:                    /usr/local
-----------------------------------------------------------------


EVENT_LBUTTONDOWN
EVENT_LBUTTONDOWN
EVENT_MOUSEHWHEEL
EVENT_MOUSEWHEEL
EVENT_MOUSEWHEEL
EVENT_MOUSEWHEEL
EVENT_MOUSEWHEEL
EVENT_MOUSEWHEEL
EVENT_MOUSEWHEEL

My code to reproduce the issue:

void onMouse(int event, int x, int y, int flags, void *userdata)
{
    if (event == cv::EVENT_MOUSEWHEEL)
        std::cout << "EVENT_MOUSEWHEEL" << std::endl;
    if (event == cv::EVENT_MOUSEHWHEEL)
        std::cout << "EVENT_MOUSEHWHEEL" << std::endl;
    if (event == cv::EVENT_LBUTTONDOWN)
        std::cout << "EVENT_LBUTTONDOWN" << std::endl;
    if (event == cv::EVENT_RBUTTONDOWN)
        std::cout << "EVENT_MOUSEHWHEEL" << std::endl;

}

int main(int argc, char**argv)
{
    std::cout<< cv::getBuildInformation();
    cv::Mat img = cv::imread("/mnt/projects/Projects/OpenCV/opencv-master/samples/data/lena.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;
}

BTW, if (flags & cv::EVENT_MOUSEWHEEL) is incorrect check in your repro.

@asmorkalov
Copy link
Copy Markdown
Contributor

Platform: ubuntu 18.04 amd64 with KDE, if it's important.

@LaurentBerger
Copy link
Copy Markdown
Contributor Author

LaurentBerger commented Apr 22, 2022

My version is

  GUI:                           GTK3
    GTK+:                        YES (ver 3.24.24)
      GThread :                  YES (ver 2.66.8)
      GtkGlExt:                  NO
    VTK support:                 NO

lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye

uname -srm
Linux 5.10.103-v7+ armv7l

@asmorkalov asmorkalov self-requested a review April 27, 2022 14:34
Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@asmorkalov asmorkalov changed the base branch from 4.x to 3.4 April 29, 2022 06:00
@asmorkalov
Copy link
Copy Markdown
Contributor

@LaurentBerger Thanks a lot for the patch! The same issue is present in 3.4 too. I re-based and re-targeted the PR to 3.4. The fix will appear in 4.x after regular 3.4->4.x merge.

@opencv-pushbot opencv-pushbot added this to the 3.4.18 milestone Apr 29, 2022
@opencv-pushbot opencv-pushbot merged commit 039f3d0 into opencv:3.4 Apr 29, 2022
@opencv-pushbot opencv-pushbot mentioned this pull request Apr 30, 2022
@opencv-pushbot opencv-pushbot linked an issue Apr 30, 2022 that may be closed by this pull request
@alalek alalek mentioned this pull request Aug 21, 2022
@LaurentBerger LaurentBerger deleted the I21853 branch March 31, 2023 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EVENT_MOUSEWHEEL with gtk3

3 participants