[HighGUI] Updated mouse wheel delta to reside within the 'flags' variable. Updated...
authorAdi Shavit <adishavit@gmail.com>
Sun, 12 Jan 2014 07:33:08 +0000 (09:33 +0200)
committerAdi Shavit <adishavit@gmail.com>
Tue, 14 Jan 2014 19:33:32 +0000 (21:33 +0200)
modules/highgui/include/opencv2/highgui.hpp
modules/highgui/include/opencv2/highgui/highgui_c.h
modules/highgui/src/window.cpp
modules/highgui/src/window_w32.cpp

index eb4ee8c..00e1ce4 100644 (file)
@@ -76,7 +76,9 @@ enum { EVENT_MOUSEMOVE      = 0,
        EVENT_MBUTTONUP      = 6,
        EVENT_LBUTTONDBLCLK  = 7,
        EVENT_RBUTTONDBLCLK  = 8,
-       EVENT_MBUTTONDBLCLK  = 9
+       EVENT_MBUTTONDBLCLK  =9,
+       EVENT_MOUSEWHEEL     =10,
+       EVENT_MOUSEHWHEEL    =11
      };
 
 enum { EVENT_FLAG_LBUTTON   = 1,
@@ -137,6 +139,8 @@ CV_EXPORTS_W double getWindowProperty(const String& winname, int prop_id);
 //! assigns callback for mouse events
 CV_EXPORTS void setMouseCallback(const String& winname, MouseCallback onMouse, void* userdata = 0);
 
+CV_EXPORTS int getMouseWheelDelta(int flags);
+
 CV_EXPORTS int createTrackbar(const String& trackbarname, const String& winname,
                               int* value, int count,
                               TrackbarCallback onChange = 0,
index d1aa93b..ac12625 100644 (file)
@@ -186,9 +186,7 @@ enum
 };
 
 
-#define CV_GET_WHEEL_DELTA(event) ((short)((event >> 16) & 0xffff)) // upper 16 bits
-#define CV_GET_MOUSEWHEEL_EVENT(event) (event & 0xffff) // lower 16 bits
-
+#define CV_GET_WHEEL_DELTA(flags) ((short)((flags >> 16) & 0xffff)) // upper 16 bits
 
 typedef void (CV_CDECL *CvMouseCallback )(int event, int x, int y, int flags, void* param);
 
index 428ef51..03ff988 100644 (file)
@@ -216,6 +216,11 @@ void cv::setMouseCallback( const String& windowName, MouseCallback onMouse, void
     cvSetMouseCallback(windowName.c_str(), onMouse, param);
 }
 
+int cv::getMouseWheelDelta( int flags )
+{
+    return CV_GET_WHEEL_DELTA(flags);
+}
+
 int cv::startWindowThread()
 {
     return cvStartWindowThread();
index 70a29d4..bb47047 100644 (file)
@@ -1392,7 +1392,7 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
 
           // Set the wheel delta of mouse wheel to be in the upper word of 'event'
           int delta = GET_WHEEL_DELTA_WPARAM(wParam);
-          event |= (delta << 16);
+          flags |= (delta << 16);
 
           POINT pt;
           {