mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #22102 from jwinarske:jw/xdg_shell
This commit is contained in:
@@ -146,6 +146,7 @@ ocv_create_module(${extra_libs})
|
||||
ocv_target_link_libraries(${the_module} PRIVATE
|
||||
"${ZLIB_LIBRARIES}" "${OPENCL_LIBRARIES}" "${VA_LIBRARIES}"
|
||||
"${OPENGL_LIBRARIES}"
|
||||
"${GLX_LIBRARIES}"
|
||||
"${LAPACK_LIBRARIES}" "${CPUFEATURES_LIBRARIES}" "${HALIDE_LIBRARIES}"
|
||||
"${ITT_LIBRARIES}"
|
||||
"${OPENCV_HAL_LINKER_LIBS}"
|
||||
|
||||
@@ -49,7 +49,31 @@ list(REMOVE_ITEM highgui_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${n
|
||||
|
||||
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "")
|
||||
|
||||
if(HAVE_QT)
|
||||
if(WITH_WAYLAND AND HAVE_WAYLAND)
|
||||
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "Wayland")
|
||||
add_definitions(-DHAVE_WAYLAND)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
if (HAVE_WAYLAND_PROTOCOLS)
|
||||
ocv_wayland_generate(
|
||||
${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
|
||||
xdg-shell-client-protocol)
|
||||
endif()
|
||||
|
||||
list(APPEND highgui_srcs
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/window_wayland.cpp
|
||||
${WAYLAND_PROTOCOL_SOURCES}
|
||||
)
|
||||
list(APPEND HIGHGUI_LIBRARIES "${WAYLAND_CLIENT_LINK_LIBRARIES};${WAYLAND_CURSOR_LINK_LIBRARIES};${XKBCOMMON_LINK_LIBRARIES}")
|
||||
|
||||
if(HAVE_WAYLAND_EGL)
|
||||
if(WAYLAND_EGL_LIBRARIES)
|
||||
list(APPEND HIGHGUI_LIBRARIES "${WAYLAND_EGL_LIBRARIES}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
elseif(HAVE_QT)
|
||||
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "QT${QT_VERSION_MAJOR}")
|
||||
add_definitions(-DHAVE_QT)
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# --- Wayland ---
|
||||
macro(ocv_wayland_generate protocol_file output_file)
|
||||
add_custom_command(OUTPUT ${output_file}.h
|
||||
COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header < ${protocol_file} > ${output_file}.h
|
||||
DEPENDS ${protocol_file})
|
||||
add_custom_command(OUTPUT ${output_file}.c
|
||||
COMMAND ${WAYLAND_SCANNER_EXECUTABLE} private-code < ${protocol_file} > ${output_file}.c
|
||||
DEPENDS ${protocol_file})
|
||||
list(APPEND WAYLAND_PROTOCOL_SOURCES ${output_file}.h ${output_file}.c)
|
||||
endmacro()
|
||||
|
||||
ocv_clear_vars(HAVE_WAYLAND_CLIENT HAVE_WAYLAND_CURSOR HAVE_XKBCOMMON HAVE_WAYLAND_PROTOCOLS)
|
||||
if(WITH_WAYLAND)
|
||||
ocv_check_modules(WAYLAND_CLIENT wayland-client)
|
||||
if(WAYLAND_CLIENT_FOUND)
|
||||
set(HAVE_WAYLAND_CLIENT ON)
|
||||
endif()
|
||||
ocv_check_modules(WAYLAND_CURSOR wayland-cursor)
|
||||
if(WAYLAND_CURSOR_FOUND)
|
||||
set(HAVE_WAYLAND_CURSOR ON)
|
||||
endif()
|
||||
ocv_check_modules(XKBCOMMON xkbcommon)
|
||||
if(XKBCOMMON_FOUND)
|
||||
set(HAVE_XKBCOMMON ON)
|
||||
endif()
|
||||
ocv_check_modules(WAYLAND_PROTOCOLS wayland-protocols>=1.13)
|
||||
if(HAVE_WAYLAND_PROTOCOLS)
|
||||
pkg_get_variable(WAYLAND_PROTOCOLS_BASE wayland-protocols pkgdatadir)
|
||||
find_host_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner REQUIRED)
|
||||
endif()
|
||||
|
||||
if(HAVE_WAYLAND_CLIENT AND HAVE_WAYLAND_CURSOR AND HAVE_XKBCOMMON AND HAVE_WAYLAND_PROTOCOLS)
|
||||
set(HAVE_WAYLAND TRUE)
|
||||
endif()
|
||||
endif()
|
||||
@@ -38,6 +38,7 @@ endmacro()
|
||||
|
||||
add_backend("gtk" WITH_GTK)
|
||||
add_backend("win32ui" WITH_WIN32UI)
|
||||
add_backend("wayland" WITH_WAYLAND)
|
||||
# TODO cocoa
|
||||
# TODO qt
|
||||
# TODO opengl
|
||||
|
||||
@@ -130,6 +130,7 @@ void setWindowTitle_W32(const cv::String& name, const cv::String& title);
|
||||
void setWindowTitle_GTK(const cv::String& name, const cv::String& title);
|
||||
void setWindowTitle_QT(const cv::String& name, const cv::String& title);
|
||||
void setWindowTitle_COCOA(const cv::String& name, const cv::String& title);
|
||||
void setWindowTitle_WAYLAND(const cv::String& name, const cv::String& title);
|
||||
|
||||
int pollKey_W32();
|
||||
|
||||
|
||||
@@ -613,6 +613,8 @@ void cv::setWindowTitle(const String& winname, const String& title)
|
||||
return setWindowTitle_QT(winname, title);
|
||||
#elif defined (HAVE_COCOA)
|
||||
return setWindowTitle_COCOA(winname, title);
|
||||
#elif defined (HAVE_WAYLAND)
|
||||
return setWindowTitle_WAYLAND(winname, title);
|
||||
#else
|
||||
CV_Error(Error::StsNotImplemented, "The function is not implemented. "
|
||||
"Rebuild the library with Windows, GTK+ 2.x or Cocoa support. "
|
||||
@@ -1226,6 +1228,7 @@ int cv::createButton(const String&, ButtonCallback, void*, int , bool )
|
||||
#elif defined (HAVE_GTK) // see window_gtk.cpp
|
||||
#elif defined (HAVE_COCOA) // see window_cocoa.mm
|
||||
#elif defined (HAVE_QT) // see window_QT.cpp
|
||||
#elif defined (HAVE_WAYLAND) // see window_wayland.cpp
|
||||
#elif defined (WINRT) && !defined (WINRT_8_0) // see window_winrt.cpp
|
||||
|
||||
#else
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -58,6 +58,7 @@ inline void verify_size(const std::string &nm, const cv::Mat &img)
|
||||
&& !defined HAVE_QT \
|
||||
&& !defined HAVE_WIN32UI \
|
||||
&& !defined HAVE_COCOA \
|
||||
&& !defined HAVE_WAYLAND \
|
||||
)
|
||||
TEST(Highgui_GUI, DISABLED_regression)
|
||||
#else
|
||||
@@ -135,6 +136,7 @@ static void Foo(int, void* counter)
|
||||
&& !defined HAVE_GTK \
|
||||
&& !defined HAVE_QT \
|
||||
&& !defined HAVE_WIN32UI \
|
||||
&& !defined HAVE_WAYLAND \
|
||||
) \
|
||||
|| defined(__APPLE__) // test fails on Mac (cocoa)
|
||||
TEST(Highgui_GUI, DISABLED_trackbar_unsafe)
|
||||
@@ -174,6 +176,7 @@ void testTrackbarCallback(int pos, void* param)
|
||||
&& !defined HAVE_GTK \
|
||||
&& !defined HAVE_QT \
|
||||
&& !defined HAVE_WIN32UI \
|
||||
&& !defined HAVE_WAYLAND \
|
||||
) \
|
||||
|| defined(__APPLE__) // test fails on Mac (cocoa)
|
||||
TEST(Highgui_GUI, DISABLED_trackbar)
|
||||
|
||||
Reference in New Issue
Block a user