From d015b55e6bdd5fb923acbd6d5f868be22c8e91d5 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 28 Dec 2016 13:06:28 +0300 Subject: [PATCH] highgui: preserve waitKey -1 return value --- modules/highgui/src/window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/highgui/src/window.cpp b/modules/highgui/src/window.cpp index 9306f8ef5e..35ce8ca265 100644 --- a/modules/highgui/src/window.cpp +++ b/modules/highgui/src/window.cpp @@ -218,7 +218,7 @@ int cv::waitKey(int delay) if (use_legacy > 0) return code; #endif - return code & 0xff; + return (code != -1) ? (code & 0xff) : -1; } int cv::createTrackbar(const String& trackbarName, const String& winName,