From owner-freebsd-gecko@freebsd.org Sun May 13 04:38:39 2018 Return-Path: Delivered-To: freebsd-gecko@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 816E2FB461B for ; Sun, 13 May 2018 04:38:39 +0000 (UTC) (envelope-from jbeich@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 183EB70A14 for ; Sun, 13 May 2018 04:38:39 +0000 (UTC) (envelope-from jbeich@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id CC876FB4619; Sun, 13 May 2018 04:38:38 +0000 (UTC) Delivered-To: gecko@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92322FB4617; Sun, 13 May 2018 04:38:38 +0000 (UTC) (envelope-from jbeich@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D08670A13; Sun, 13 May 2018 04:38:38 +0000 (UTC) (envelope-from jbeich@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1354) id 2A168460; Sun, 13 May 2018 04:38:38 +0000 (UTC) From: Jan Beich To: Stephen Gunn Cc: gecko@FreeBSD.org, ports@FreeBSD.org Subject: Re: FreeBSD Port: firefox-60.0_2,1 missing 'Print to LPR' References: Date: Sun, 13 May 2018 06:38:34 +0200 In-Reply-To: (Stephen Gunn's message of "Sat, 12 May 2018 16:23:21 -0500") Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: freebsd-gecko@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Gecko Rendering Engine issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 May 2018 04:38:39 -0000 --=-=-= Content-Type: text/plain Stephen Gunn 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 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 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? --=-=-=--