Date: Sun, 13 May 2018 06:38:34 +0200 From: Jan Beich <jbeich@FreeBSD.org> To: Stephen Gunn <stephen@dreamaway.org> Cc: gecko@FreeBSD.org, ports@FreeBSD.org Subject: Re: FreeBSD Port: firefox-60.0_2,1 missing 'Print to LPR' Message-ID: <efig-maph-wny@FreeBSD.org> In-Reply-To: <f3a5514e-6c34-7227-8705-7112f6a20a74@dreamaway.org> (Stephen Gunn's message of "Sat, 12 May 2018 16:23:21 -0500") References: <f3a5514e-6c34-7227-8705-7112f6a20a74@dreamaway.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-= Content-Type: text/plain Stephen Gunn <stephen@dreamaway.org> writes: > I'm running Firefox 60.0_2,1 on 11.1-RELEASE-p10. In the print > dialog, the option 'Print to LPR' no longer shows up, only 'Print to > File'. If I install firefox-esr, then 'Print to LPR' is again > present. LPR backend doesn't support PDF, so 'Print to LPR' disappeared after Firefox 59 removed GTK_PRINT_CAPABILITY_GENERATE_PS. Try the attached patch to confirm. https://bugzilla.mozilla.org/show_bug.cgi?id=1425188 https://bugzilla.mozilla.org/show_bug.cgi?id=1322653 --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=patch-revert-bug1425188 Content-Description: A patch to revert bug 1425188. Put under /usr/ports/www/firefox/files/ Revert bug 1425188 in order to restore 'Print to LPR' option. diff --git widget/gtk/nsDeviceContextSpecG.cpp widget/gtk/nsDeviceContextSpecG.cpp index a90f13b43b006..ca2449aa766f5 100644 --- widget/gtk/nsDeviceContextSpecG.cpp +++ widget/gtk/nsDeviceContextSpecG.cpp @@ -150,8 +150,8 @@ already_AddRefed<PrintTarget> nsDeviceContextSpecGTK::MakePrintTarget() // Determine the real format with some GTK magic if (format == nsIPrintSettings::kOutputFormatNative) { if (mIsPPreview) { - // There is nothing to detect on Print Preview, use PDF. - format = nsIPrintSettings::kOutputFormatPDF; + // There is nothing to detect on Print Preview, use PS. + format = nsIPrintSettings::kOutputFormatPS; } else { return nullptr; } diff --git widget/gtk/nsPrintDialogGTK.cpp widget/gtk/nsPrintDialogGTK.cpp index d499fd2f37729..75ec90c2f9c9a 100644 --- widget/gtk/nsPrintDialogGTK.cpp +++ widget/gtk/nsPrintDialogGTK.cpp @@ -180,6 +180,7 @@ nsPrintDialogWidgetGTK::nsPrintDialogWidgetGTK(nsPIDOMWindowOuter *aParent, | GTK_PRINT_CAPABILITY_REVERSE | GTK_PRINT_CAPABILITY_SCALE | GTK_PRINT_CAPABILITY_GENERATE_PDF + | GTK_PRINT_CAPABILITY_GENERATE_PS ) ); diff --git widget/gtk/nsPrintSettingsGTK.cpp widget/gtk/nsPrintSettingsGTK.cpp index 44dc63375a598..dafab1795d943 100644 --- widget/gtk/nsPrintSettingsGTK.cpp +++ widget/gtk/nsPrintSettingsGTK.cpp @@ -214,12 +214,22 @@ NS_IMETHODIMP nsPrintSettingsGTK::GetOutputFormat(int16_t *aOutputFormat) return rv; } - if (format == nsIPrintSettings::kOutputFormatNative && - GTK_IS_PRINTER(mGTKPrinter)) { - if (gtk_printer_accepts_pdf(mGTKPrinter)) { - format = nsIPrintSettings::kOutputFormatPDF; - } else { - format = nsIPrintSettings::kOutputFormatPS; + if (format == nsIPrintSettings::kOutputFormatNative) { + const gchar* fmtGTK = + gtk_print_settings_get(mPrintSettings, + GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT); + if (fmtGTK) { + if (nsDependentCString(fmtGTK).EqualsIgnoreCase("pdf")) { + format = nsIPrintSettings::kOutputFormatPDF; + } else { + format = nsIPrintSettings::kOutputFormatPS; + } + } else if (GTK_IS_PRINTER(mGTKPrinter)) { + if (gtk_printer_accepts_pdf(mGTKPrinter)) { + format = nsIPrintSettings::kOutputFormatPDF; + } else { + format = nsIPrintSettings::kOutputFormatPS; + } } } @@ -424,7 +434,11 @@ nsPrintSettingsGTK::SetToFileName(const nsAString& aToFileName) return NS_OK; } - gtk_print_settings_set(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "pdf"); + if (StringEndsWith(aToFileName, NS_LITERAL_STRING(".ps"))) { + gtk_print_settings_set(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "ps"); + } else { + gtk_print_settings_set(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "pdf"); + } nsCOMPtr<nsIFile> file; nsresult rv = NS_NewLocalFile(aToFileName, true, getter_AddRefs(file)); diff --git widget/nsPrintSettingsService.cpp widget/nsPrintSettingsService.cpp index ad50088a48082..df1879ecdbf39 100644 --- widget/nsPrintSettingsService.cpp +++ widget/nsPrintSettingsService.cpp @@ -612,14 +612,6 @@ nsPrintSettingsService::ReadPrefs(nsIPrintSettings* aPS, if (aFlags & nsIPrintSettings::kInitSaveToFileName) { if (GETSTRPREF(kPrintToFileName, str)) { - if (StringEndsWith(str, NS_LITERAL_STRING(".ps"))) { - // We only support PDF since bug 1425188 landed. Users may still have - // prefs with .ps filenames if they last saved a file as Postscript - // though, so we fix that up here. (The pref values will be - // overwritten the next time they save to file as a PDF.) - str.Truncate(str.Length() - 2); - str.AppendLiteral("pdf"); - } aPS->SetToFileName(str); DUMP_STR(kReadStr, kPrintToFileName, str.get()); } --=-=-= Content-Type: text/plain > I strongly suspect it's related to a switch to gtk-3.0 in the most > recent versions of Firefox. I think gtk3 by default expects CUPS > printing, but I'm using LPD. There is supposed to be a way to specify > that you still want printing in the gtk3 settings.ini file, by setting > gtk-print-backends = "lpr, file", but it doesn't work. Upstream appears to only test "cups" and "file". CUPS option is enabled by default in x11-toolkits/gtk30 and x11-toolkits/gtk20. Did /usr/bin/lpr (not /usr/local/bin/lpr from CUPS) really work with your printer? --=-=-=--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?efig-maph-wny>