highgui: change waitKey() default behaviour

The old behaviour is available via waitKeyEx() call or
via setting of OPENCV_LEGACY_WAITKEY environment variable
This commit is contained in:
Alexander Alekhin
2016-12-15 14:17:38 +03:00
parent 36b5abf6b7
commit 4e7b521438
2 changed files with 25 additions and 1 deletions
+16 -1
View File
@@ -201,11 +201,26 @@ double cv::getWindowProperty(const String& winname, int prop_id)
return cvGetWindowProperty(winname.c_str(), prop_id);
}
int cv::waitKey(int delay)
int cv::waitKeyEx(int delay)
{
return cvWaitKey(delay);
}
int cv::waitKey(int delay)
{
int code = waitKeyEx(delay);
#ifndef HAVE_WINRT
static int use_legacy = -1;
if (use_legacy < 0)
{
use_legacy = getenv("OPENCV_LEGACY_WAITKEY") != NULL ? 1 : 0;
}
if (use_legacy > 0)
return code;
#endif
return code & 0xff;
}
int cv::createTrackbar(const String& trackbarName, const String& winName,
int* value, int count, TrackbarCallback callback,
void* userdata)