Merge branch 'cmake-gtk-printing' of https://github.com/MaartenBent/wxWidgets

CMake: Add GTK Printing support.

And show the extra toolkit options in the CMake summary, fix using
libnotify and gnomevfs with gtk3 and fix some unused parameter warnings
when using gtk2 or gtk3 on Windows.

See #22762.
This commit is contained in:
Vadim Zeitlin 2022-09-02 19:12:46 +02:00
commit d9a78be16c
10 changed files with 81 additions and 5 deletions

View file

@ -515,13 +515,16 @@ if(wxUSE_GUI)
set(wxUSE_LIBSDL OFF)
endif()
if(wxUSE_NOTIFICATION_MESSAGE AND UNIX AND WXGTK2 AND wxUSE_LIBNOTIFY)
if(wxUSE_NOTIFICATION_MESSAGE AND UNIX AND WXGTK AND wxUSE_LIBNOTIFY)
find_package(LIBNOTIFY)
if(NOT LIBNOTIFY_FOUND)
message(WARNING "Libnotify not found, it won't be used for notifications")
wx_option_force_value(wxUSE_LIBNOTIFY OFF)
elseif(NOT LIBNOTIFY_VERSION VERSION_LESS 0.7)
set(wxUSE_LIBNOTIFY_0_7 ON)
else()
if(NOT LIBNOTIFY_VERSION VERSION_LESS 0.7)
set(wxUSE_LIBNOTIFY_0_7 ON)
endif()
list(APPEND wxTOOLKIT_EXTRA "libnotify")
endif()
else()
set(wxUSE_LIBNOTIFY OFF)
@ -561,11 +564,25 @@ if(wxUSE_GUI)
set(wxUSE_LIBMSPACK OFF)
endif()
if(WXGTK2 AND wxUSE_MIMETYPE AND wxUSE_LIBGNOMEVFS)
if(WXGTK AND wxUSE_PRINTING_ARCHITECTURE AND wxUSE_GTKPRINT)
find_package(GTKPRINT ${wxTOOLKIT_VERSION})
if(GTKPRINT_FOUND)
list(APPEND wxTOOLKIT_INCLUDE_DIRS ${GTKPRINT_INCLUDE_DIRS})
list(APPEND wxTOOLKIT_EXTRA "GTK+ printing")
else()
message(STATUS "GTK printing support not found (GTK+ >= 2.10), library will use GNOME printing support or standard PostScript printing")
wx_option_force_value(wxUSE_GTKPRINT OFF)
endif()
else()
set(wxUSE_GTKPRINT OFF)
endif()
if(WXGTK AND wxUSE_MIMETYPE AND wxUSE_LIBGNOMEVFS)
find_package(GNOMEVFS2)
if(GNOMEVFS2_FOUND)
list(APPEND wxTOOLKIT_INCLUDE_DIRS ${GNOMEVFS2_INCLUDE_DIRS})
list(APPEND wxTOOLKIT_LIBRARIES ${GNOMEVFS2_LIBRARIES})
list(APPEND wxTOOLKIT_EXTRA "gnomevfs")
else()
message(STATUS "libgnomevfs not found, library won't be used to associate MIME type")
wx_option_force_value(wxUSE_LIBGNOMEVFS OFF)

View file

@ -77,9 +77,14 @@ endif()
# Print configuration summary
wx_print_thirdparty_library_summary()
if(wxTOOLKIT_EXTRA)
string(REPLACE ";" ", " wxTOOLKIT_DESC "${wxTOOLKIT_EXTRA}")
set(wxTOOLKIT_DESC "with support for: ${wxTOOLKIT_DESC}")
endif()
message(STATUS "Configured wxWidgets ${wxVERSION} for ${CMAKE_SYSTEM}
Min OS Version required at runtime: ${wxREQUIRED_OS_DESC}
Which GUI toolkit should wxWidgets use? ${wxBUILD_TOOLKIT} ${wxTOOLKIT_VERSION}
Which GUI toolkit should wxWidgets use? ${wxBUILD_TOOLKIT} ${wxTOOLKIT_VERSION} ${wxTOOLKIT_DESC}
Should wxWidgets be compiled into single library? ${wxBUILD_MONOLITHIC}
Should wxWidgets be linked as a shared library? ${wxBUILD_SHARED}
Should wxWidgets support Unicode? ${wxUSE_UNICODE}

View file

@ -0,0 +1,33 @@
# - Try to find GTK Print
# Provide the GTK version as argument
# Once done this will define
#
# GTKPRINT_FOUND - system has GTK Print
# GTKPRINT_INCLUDE_DIRS - The include directory to use for the GTK Print headers
if(NOT GTKPRINT_FIND_VERSION EQUAL GTKPRINT_FIND_VERSION_USED)
unset(GTKPRINT_FOUND CACHE)
unset(GTKPRINT_INCLUDE_DIRS CACHE)
unset(GTKPRINT_FIND_VERSION_USED CACHE)
endif()
set(GTKPRINT_FIND_VERSION_USED "${GTKPRINT_FIND_VERSION}" CACHE INTERNAL "")
if(GTKPRINT_FIND_VERSION VERSION_LESS 3.0)
set(GTKPRINT_LIB_NAME "gtk+-unix-print-2.0")
else()
set(GTKPRINT_LIB_NAME "gtk+-unix-print-3.0")
endif()
find_package(PkgConfig)
pkg_check_modules(PC_GTKPRINT QUIET ${GTKPRINT_LIB_NAME})
find_path(GTKPRINT_INCLUDE_DIRS
NAMES gtk/gtkunixprint.h
HINTS ${PC_GTKPRINT_INCLUDEDIR}
${PC_GTKPRINT_INCLUDE_DIRS}
)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTKPRINT DEFAULT_MSG GTKPRINT_INCLUDE_DIRS)
mark_as_advanced(GTKPRINT_INCLUDE_DIRS)

View file

@ -127,6 +127,7 @@ if(UNIX)
wx_option(wxUSE_LIBNOTIFY "use libnotify for notifications")
wx_option(wxUSE_XTEST "use XTest extension")
wx_option(wxUSE_LIBMSPACK "use libmspack (CHM help files loading)")
wx_option(wxUSE_GTKPRINT "use GTK printing support")
wx_option(wxUSE_LIBGNOMEVFS "use GNOME VFS for associating MIME types")
wx_option(wxUSE_GLCANVAS_EGL "use EGL backend for wxGLCanvas")

View file

@ -249,6 +249,8 @@ void wxIconBundle::AddIcon(const wxString& resourceName, WXHINSTANCE module)
}
}
#else
wxUnusedVar(resourceName);
wxUnusedVar(module);
wxLogError(wxS("Loading icons from resources isn't implemented in this toolkit port yet."));
#endif
}

View file

@ -346,6 +346,8 @@ egg_tray_icon_unrealize (GtkWidget *widget)
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
#else
wxUnusedVar(widget);
#endif
}
@ -528,6 +530,8 @@ egg_tray_icon_realize (GtkWidget *widget)
/* Add a root window filter so that we get changes on MANAGER */
gdk_window_add_filter (root_window,
egg_tray_icon_manager_filter, icon);
#else
wxUnusedVar(widget);
#endif
}

View file

@ -138,6 +138,7 @@ bool wxNativeContainerWindow::Create(wxNativeContainerWindowId anid)
#ifdef GDK_WINDOWING_X11
GdkWindow * const win = gdk_x11_window_foreign_new_for_display(gdk_display_get_default(), anid);
#else
wxUnusedVar(anid);
GdkWindow * const win = NULL;
#endif
#else

View file

@ -329,6 +329,9 @@ void wxTopLevelWindowGTK::GTKConfigureEvent(int x, int y)
point.y = y - decorSize.top;
}
else
#else
wxUnusedVar(x);
wxUnusedVar(y);
#endif
{
gtk_window_get_position(GTK_WINDOW(m_widget), &point.x, &point.y);
@ -541,6 +544,11 @@ bool wxGetFrameExtents(GdkWindow* window, int* left, int* right, int* top, int*
XFree(data);
return success;
#else
wxUnusedVar(window);
wxUnusedVar(left);
wxUnusedVar(right);
wxUnusedVar(top);
wxUnusedVar(bottom);
return false;
#endif
}

View file

@ -5111,6 +5111,9 @@ void wxWindowGTK::WarpPointer( int x, int y )
None,
GDK_WINDOW_XID(gdk_screen_get_root_window(screen)),
0, 0, 0, 0, x, y);
#else
wxUnusedVar(display);
wxUnusedVar(screen);
#endif
#endif
}

View file

@ -267,6 +267,8 @@ wxMSWEntryCommon(HINSTANCE hInstance, int nCmdShow)
wxSetInstance(hInstance);
#ifdef __WXMSW__
wxApp::m_nCmdShow = nCmdShow;
#else
wxUnusedVar(nCmdShow);
#endif
wxArgs.Init();