From 6cb97e220835e456747c175682a189cc70740577 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 30 Aug 2022 23:05:17 +0200 Subject: [PATCH 1/4] CMake: show extra toolkit options in summary Just like configure does. --- build/cmake/init.cmake | 8 ++++++-- build/cmake/main.cmake | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 510c7f8847..0a894335f2 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -520,8 +520,11 @@ if(wxUSE_GUI) 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) @@ -566,6 +569,7 @@ if(wxUSE_GUI) 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) diff --git a/build/cmake/main.cmake b/build/cmake/main.cmake index c0babe9d86..a87aeeeab1 100644 --- a/build/cmake/main.cmake +++ b/build/cmake/main.cmake @@ -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} From 43aae40a1154a0804c02c4de3be8026b02c04877 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 30 Aug 2022 23:10:14 +0200 Subject: [PATCH 2/4] CMake: Enable libnotify and gnomevfs for gtk3 Unlike configure, WXGTK2 is not defined internally when WXGTK3 is used. --- build/cmake/init.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 0a894335f2..ae6fab7206 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -515,7 +515,7 @@ 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") @@ -564,7 +564,7 @@ if(wxUSE_GUI) set(wxUSE_LIBMSPACK OFF) endif() - if(WXGTK2 AND wxUSE_MIMETYPE AND wxUSE_LIBGNOMEVFS) + if(WXGTK AND wxUSE_MIMETYPE AND wxUSE_LIBGNOMEVFS) find_package(GNOMEVFS2) if(GNOMEVFS2_FOUND) list(APPEND wxTOOLKIT_INCLUDE_DIRS ${GNOMEVFS2_INCLUDE_DIRS}) From 7f8cca924506202f4168e10b7ef8a9e8860a2093 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 30 Aug 2022 23:12:12 +0200 Subject: [PATCH 3/4] CMake: Add GTK Printing support See #22745 --- build/cmake/init.cmake | 13 ++++++++++ build/cmake/modules/FindGTKPRINT.cmake | 33 ++++++++++++++++++++++++++ build/cmake/options.cmake | 1 + 3 files changed, 47 insertions(+) create mode 100644 build/cmake/modules/FindGTKPRINT.cmake diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index ae6fab7206..9a6dc6a59f 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -564,6 +564,19 @@ if(wxUSE_GUI) set(wxUSE_LIBMSPACK OFF) endif() + 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) diff --git a/build/cmake/modules/FindGTKPRINT.cmake b/build/cmake/modules/FindGTKPRINT.cmake new file mode 100644 index 0000000000..9a2b8138dd --- /dev/null +++ b/build/cmake/modules/FindGTKPRINT.cmake @@ -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) diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index 64ee4a3422..82816793cb 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -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") From 789d6d70d494bbd083297817c2b3472556e682d2 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 30 Aug 2022 23:39:23 +0200 Subject: [PATCH 4/4] Fix unused parameter warnings in Windows GTK build --- src/common/iconbndl.cpp | 2 ++ src/gtk/eggtrayicon.c | 4 ++++ src/gtk/nativewin.cpp | 1 + src/gtk/toplevel.cpp | 8 ++++++++ src/gtk/window.cpp | 3 +++ src/msw/main.cpp | 2 ++ 6 files changed, 20 insertions(+) diff --git a/src/common/iconbndl.cpp b/src/common/iconbndl.cpp index 077f09fd56..0cc99f5104 100644 --- a/src/common/iconbndl.cpp +++ b/src/common/iconbndl.cpp @@ -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 } diff --git a/src/gtk/eggtrayicon.c b/src/gtk/eggtrayicon.c index c66ce60260..931f58b4b0 100644 --- a/src/gtk/eggtrayicon.c +++ b/src/gtk/eggtrayicon.c @@ -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 } diff --git a/src/gtk/nativewin.cpp b/src/gtk/nativewin.cpp index 6e50a3b297..678b8f4023 100644 --- a/src/gtk/nativewin.cpp +++ b/src/gtk/nativewin.cpp @@ -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 diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 0a14d0ea22..afad23a577 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -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 } diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 69110f5895..c0cdea63d2 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -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 } diff --git a/src/msw/main.cpp b/src/msw/main.cpp index c4a441cc67..7a1b0d9433 100644 --- a/src/msw/main.cpp +++ b/src/msw/main.cpp @@ -267,6 +267,8 @@ wxMSWEntryCommon(HINSTANCE hInstance, int nCmdShow) wxSetInstance(hInstance); #ifdef __WXMSW__ wxApp::m_nCmdShow = nCmdShow; +#else + wxUnusedVar(nCmdShow); #endif wxArgs.Init();