highgui: cleanup and fixes

This commit is contained in:
Alexander Alekhin 2021-05-28 01:41:20 +00:00
parent 76e81dfbb0
commit fb9a00c36d
5 changed files with 29 additions and 23 deletions

View File

@ -1,5 +1,3 @@
ocv_cmake_dump_vars("" TOFILE "CMakeVars2.txt")
set(OCV_TEST_VAR 123)
add_definitions(-D__OPENCV_BUILD=1)
if(NOT OPENCV_MODULES_PATH)

View File

@ -1,15 +1,16 @@
# --- GTK ---
ocv_clear_vars(HAVE_GTK HAVE_GTK3 HAVE_GTHREAD HAVE_GTKGLEXT)
if(WITH_GTK AND NOT HAVE_QT)
if(WITH_GTK)
if(NOT WITH_GTK_2_X)
ocv_check_modules(GTK3 gtk+-3.0)
if(HAVE_GTK3)
ocv_add_external_target(gtk3 "${GTK3_INCLUDE_DIRS}" "${GTK3_LIBRARIES}" "HAVE_GTK3;HAVE_GTK")
set(HAVE_GTK TRUE)
set(HAVE_GTK3 ${HAVE_GTK3} PARENT_SCOPE)
set(GTK3_VERSION "${GTK3_VERSION}" PARENT_SCOPE) # informational
endif()
endif()
if(TRUE)
if((PROJECT_NAME STREQUAL "OpenCV" AND HIGHGUI_ENABLE_PLUGINS) OR NOT HAVE_GTK3)
ocv_check_modules(GTK2 gtk+-2.0)
if(HAVE_GTK2)
set(MIN_VER_GTK "2.18.0")
@ -18,6 +19,7 @@ if(WITH_GTK AND NOT HAVE_QT)
else()
ocv_add_external_target(gtk2 "${GTK2_INCLUDE_DIRS}" "${GTK2_LIBRARIES}" "HAVE_GTK2;HAVE_GTK")
set(HAVE_GTK TRUE)
set(HAVE_GTK2 ${HAVE_GTK2} PARENT_SCOPE)
set(GTK2_VERSION "${GTK2_VERSION}" PARENT_SCOPE) # informational
endif()
endif()
@ -38,7 +40,8 @@ if(WITH_GTK AND NOT HAVE_QT)
set(GTKGLEXT_VERSION "${GTKGLEXT_VERSION}" PARENT_SCOPE) # informational
endif()
endif()
elseif(HAVE_GTK)
ocv_add_external_target(gtk "${GTK_INCLUDE_DIRS}" "${GTK_LIBRARIES}" "${GTK_DEFINES};HAVE_GTK")
endif()
set(HAVE_GTK ${HAVE_GTK} PARENT_SCOPE)
set(HAVE_GTK3 ${HAVE_GTK3} PARENT_SCOPE)

View File

@ -8,6 +8,10 @@ include("${OpenCV_SOURCE_DIR}/cmake/OpenCVPluginStandalone.cmake")
set(WITH_GTK ON)
include("${OpenCV_SOURCE_DIR}/modules/highgui/cmake/init.cmake")
if(NOT HAVE_GTK)
message(FATAL_ERROR "GTK: NO")
endif()
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-deprecated-declarations)
set(OPENCV_PLUGIN_DEPS core imgproc imgcodecs)
@ -22,23 +26,23 @@ else()
endif()
ocv_create_plugin(highgui "opencv_highgui_gtk" "${__deps}" "GTK" "src/window_gtk.cpp")
message(STATUS "GTK: ${GTK2_VERSION}")
if(HAVE_GTK3)
message(STATUS "GTK+: ver ${GTK3_VERSION}")
elseif(HAVE_GTK)
message(STATUS "GTK+: ver ${GTK2_VERSION}")
message(STATUS "GTK3+: ver ${GTK3_VERSION}")
elseif(HAVE_GTK3)
message(STATUS "GTK2+: ver ${GTK2_VERSION}")
elseif(DEFINED GTK_VERSION)
message(STATUS "GTK+: ver ${GTK_VERSION}")
else()
message(FATAL_ERROR "GTK+: NO")
message(STATUS "GTK+: YES")
endif()
if(HAVE_GTK)
if(HAVE_GTHREAD)
message(STATUS "GThread : YES (ver ${GTHREAD_VERSION})")
else()
message(STATUS "GThread : NO")
endif()
if(HAVE_GTKGLEXT)
message(STATUS "GtkGlExt: YES (ver ${GTKGLEXT_VERSION})")
else()
message(STATUS "GtkGlExt: NO")
endif()
if(HAVE_GTHREAD)
message(STATUS "GThread : YES (ver ${GTHREAD_VERSION})")
else()
message(STATUS "GThread : NO")
endif()
if(HAVE_GTKGLEXT)
message(STATUS "GtkGlExt: YES (ver ${GTKGLEXT_VERSION})")
else()
message(STATUS "GtkGlExt: NO")
endif()

View File

@ -40,7 +40,8 @@ protected:
CV_LOG_INFO(NULL, "UI: plugin is incompatible (can't be initialized): " << lib_->getName());
return;
}
if (!checkCompatibility(plugin_api_->api_header, ABI_VERSION, API_VERSION, false))
// NB: force strict minor version check (ABI is not preserved for now)
if (!checkCompatibility(plugin_api_->api_header, ABI_VERSION, API_VERSION, true))
{
plugin_api_ = NULL;
return;

View File

@ -198,7 +198,7 @@ CV_IMPL void cvSetWindowProperty(const char* name, int prop_id, double prop_valu
//change between fullscreen or not.
case CV_WND_PROP_FULLSCREEN:
if (!name || (prop_value!=CV_WINDOW_NORMAL && prop_value!=CV_WINDOW_FULLSCREEN))//bad argument
if (prop_value != CV_WINDOW_NORMAL && prop_value != CV_WINDOW_FULLSCREEN) // bad argument
break;
#if defined (HAVE_QT)