From 2514945ab3e181f32d0c6495f38f493f4682193c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 16 May 2021 00:49:30 +0200 Subject: [PATCH] Fix retrieving paper size and orientation from GTK print dialog The paper size and orientation in wxPrintData were never updated because we didn't retrieve them from GTK correctly: they need to be extracted from "default-page-setup" property and not the main GtkPrintSettings themselves, at least with GTK 3. --- src/gtk/print.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index a6a3b6a01c..3cc38f6bf0 100644 --- a/src/gtk/print.cpp +++ b/src/gtk/print.cpp @@ -724,6 +724,19 @@ int wxGtkPrintDialog::ShowModal() // Now get the settings and save it. GtkPrintSettings* newSettings = gtk_print_operation_get_print_settings(printOp); + + // When embedding the page setup tab into the dialog, as we do, changes to + // the settings such as the paper size and orientation there are not + // reflected in the print settings, but must be retrieved from the page + // setup struct itself separately. + GtkPageSetup* defPageSetup = NULL; + g_object_get(printOp, "default-page-setup", &defPageSetup, NULL); + if ( defPageSetup ) + { + native->SetPageSetupToSettings(newSettings, defPageSetup); + g_object_unref(defPageSetup); + } + native->SetPrintConfig(newSettings); data.ConvertFromNative();