Commit 81d6842b authored by Tony's avatar Tony

These changes introduce Gtk3 support into the highgui module.

A new option WITH_GTK3 has been added to the cmake configure system to enable compilation under Gtk version 3.The flag HAVE_GTK3 is also introduced to select the new Gtk3 code in the source files. (Gtk2 is disbled when Gtk3 is selected).

window_gtk.cpp has been modified to remove obsolete (and deleted from libgtk 3) and introduce new Gtk3 code in its place when compiled for Gtk3.

To compile for Gtk2, disable WITH_GTK3 in cmake. To build for Gtk3 both WITH_GTK and WITH_GTK3 must be selected.
parent 97fc1e10
...@@ -120,6 +120,7 @@ OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" ON ...@@ -120,6 +120,7 @@ OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" ON
OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) ) OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_GSTREAMER_1_X "Include Gstreamer 1.x support" OFF) OCV_OPTION(WITH_GSTREAMER_1_X "Include Gstreamer 1.x support" OFF)
OCV_OPTION(WITH_GTK "Include GTK support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) ) OCV_OPTION(WITH_GTK "Include GTK support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_GTK3 "Include GTK3 support" ON IF (UNIX AND WITH_GTK AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_IPP "Include Intel IPP support" OFF IF (MSVC OR X86 OR X86_64) ) OCV_OPTION(WITH_IPP "Include Intel IPP support" OFF IF (MSVC OR X86 OR X86_64) )
OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON IF (NOT IOS) ) OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON IF (NOT IOS) )
OCV_OPTION(WITH_JPEG "Include JPEG support" ON) OCV_OPTION(WITH_JPEG "Include JPEG support" ON)
...@@ -603,6 +604,7 @@ else() ...@@ -603,6 +604,7 @@ else()
endif() endif()
else() else()
status(" GTK+ 2.x:" HAVE_GTK THEN "YES (ver ${ALIASOF_gtk+-2.0_VERSION})" ELSE NO) status(" GTK+ 2.x:" HAVE_GTK THEN "YES (ver ${ALIASOF_gtk+-2.0_VERSION})" ELSE NO)
status(" GTK+ 3.x:" HAVE_GTK3 THEN "YES (ver ${ALIASOF_gtk+-3.0_VERSION})" ELSE NO)
status(" GThread :" HAVE_GTHREAD THEN "YES (ver ${ALIASOF_gthread-2.0_VERSION})" ELSE NO) status(" GThread :" HAVE_GTHREAD THEN "YES (ver ${ALIASOF_gthread-2.0_VERSION})" ELSE NO)
status(" GtkGlExt:" HAVE_GTKGLEXT THEN "YES (ver ${ALIASOF_gtkglext-1.0_VERSION})" ELSE NO) status(" GtkGlExt:" HAVE_GTKGLEXT THEN "YES (ver ${ALIASOF_gtkglext-1.0_VERSION})" ELSE NO)
endif() endif()
......
...@@ -39,9 +39,13 @@ if(WITH_QT) ...@@ -39,9 +39,13 @@ if(WITH_QT)
endif() endif()
# --- GTK --- # --- GTK ---
ocv_clear_vars(HAVE_GTK HAVE_GTHREAD HAVE_GTKGLEXT) ocv_clear_vars(HAVE_GTK HAVE_GTK3 HAVE_GTHREAD HAVE_GTKGLEXT)
if(WITH_GTK AND NOT HAVE_QT) if(WITH_GTK AND NOT HAVE_QT)
CHECK_MODULE(gtk+-2.0 HAVE_GTK) if(WITH_GTK3)
CHECK_MODULE(gtk+-3.0 HAVE_GTK3)
else()
CHECK_MODULE(gtk+-2.0 HAVE_GTK)
endif()
CHECK_MODULE(gthread-2.0 HAVE_GTHREAD) CHECK_MODULE(gthread-2.0 HAVE_GTHREAD)
if(WITH_OPENGL) if(WITH_OPENGL)
CHECK_MODULE(gtkglext-1.0 HAVE_GTKGLEXT) CHECK_MODULE(gtkglext-1.0 HAVE_GTKGLEXT)
......
...@@ -82,6 +82,9 @@ ...@@ -82,6 +82,9 @@
/* GTK+ 2.x toolkit */ /* GTK+ 2.x toolkit */
#cmakedefine HAVE_GTK #cmakedefine HAVE_GTK
/* GTK+ 3.x toolkit */
#cmakedefine HAVE_GTK3
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H 1 #cmakedefine HAVE_INTTYPES_H 1
......
...@@ -106,7 +106,7 @@ elseif(HAVE_QT) ...@@ -106,7 +106,7 @@ elseif(HAVE_QT)
endif() endif()
elseif(HAVE_WIN32UI) elseif(HAVE_WIN32UI)
list(APPEND highgui_srcs src/window_w32.cpp) list(APPEND highgui_srcs src/window_w32.cpp)
elseif(HAVE_GTK) elseif(HAVE_GTK OR HAVE_GTK3)
list(APPEND highgui_srcs src/window_gtk.cpp) list(APPEND highgui_srcs src/window_gtk.cpp)
elseif(HAVE_CARBON) elseif(HAVE_CARBON)
list(APPEND highgui_srcs src/window_carbon.cpp) list(APPEND highgui_srcs src/window_carbon.cpp)
......
...@@ -61,6 +61,8 @@ CV_IMPL void cvSetWindowProperty(const char* name, int prop_id, double prop_valu ...@@ -61,6 +61,8 @@ CV_IMPL void cvSetWindowProperty(const char* name, int prop_id, double prop_valu
cvSetModeWindow_W32(name,prop_value); cvSetModeWindow_W32(name,prop_value);
#elif defined (HAVE_GTK) #elif defined (HAVE_GTK)
cvSetModeWindow_GTK(name,prop_value); cvSetModeWindow_GTK(name,prop_value);
#elif defined (HAVE_GTK3)
cvSetModeWindow_GTK(name,prop_value);
#elif defined (HAVE_CARBON) #elif defined (HAVE_CARBON)
cvSetModeWindow_CARBON(name,prop_value); cvSetModeWindow_CARBON(name,prop_value);
#elif defined (HAVE_COCOA) #elif defined (HAVE_COCOA)
...@@ -100,6 +102,8 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id) ...@@ -100,6 +102,8 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
return cvGetModeWindow_W32(name); return cvGetModeWindow_W32(name);
#elif defined (HAVE_GTK) #elif defined (HAVE_GTK)
return cvGetModeWindow_GTK(name); return cvGetModeWindow_GTK(name);
#elif defined (HAVE_GTK3)
return cvGetModeWindow_GTK(name);
#elif defined (HAVE_CARBON) #elif defined (HAVE_CARBON)
return cvGetModeWindow_CARBON(name); return cvGetModeWindow_CARBON(name);
#elif defined (HAVE_COCOA) #elif defined (HAVE_COCOA)
...@@ -117,6 +121,8 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id) ...@@ -117,6 +121,8 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
return cvGetPropWindowAutoSize_W32(name); return cvGetPropWindowAutoSize_W32(name);
#elif defined (HAVE_GTK) #elif defined (HAVE_GTK)
return cvGetPropWindowAutoSize_GTK(name); return cvGetPropWindowAutoSize_GTK(name);
#elif defined (HAVE_GTK3)
return cvGetPropWindowAutoSize_GTK(name);
#else #else
return -1; return -1;
#endif #endif
...@@ -130,6 +136,8 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id) ...@@ -130,6 +136,8 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
return cvGetRatioWindow_W32(name); return cvGetRatioWindow_W32(name);
#elif defined (HAVE_GTK) #elif defined (HAVE_GTK)
return cvGetRatioWindow_GTK(name); return cvGetRatioWindow_GTK(name);
#elif defined (HAVE_GTK3)
return cvGetRatioWindow_GTK(name);
#else #else
return -1; return -1;
#endif #endif
...@@ -143,6 +151,8 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id) ...@@ -143,6 +151,8 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
return cvGetOpenGlProp_W32(name); return cvGetOpenGlProp_W32(name);
#elif defined (HAVE_GTK) #elif defined (HAVE_GTK)
return cvGetOpenGlProp_GTK(name); return cvGetOpenGlProp_GTK(name);
#elif defined (HAVE_GTK3)
return cvGetOpenGlProp_GTK(name);
#else #else
return -1; return -1;
#endif #endif
...@@ -472,6 +482,7 @@ int cv::createButton(const String&, ButtonCallback, void*, int , bool ) ...@@ -472,6 +482,7 @@ int cv::createButton(const String&, ButtonCallback, void*, int , bool )
#if defined(HAVE_WIN32UI) // see window_w32.cpp #if defined(HAVE_WIN32UI) // see window_w32.cpp
#elif defined (HAVE_GTK) // see window_gtk.cpp #elif defined (HAVE_GTK) // see window_gtk.cpp
#elif defined (HAVE_GTK3) // see window_gtk.cpp
#elif defined (HAVE_COCOA) // see window_carbon.cpp #elif defined (HAVE_COCOA) // see window_carbon.cpp
#elif defined (HAVE_CARBON) #elif defined (HAVE_CARBON)
#elif defined (HAVE_QT) //YV see window_QT.cpp #elif defined (HAVE_QT) //YV see window_QT.cpp
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment