Source: firefox-esr Version: 91.7.0esr Severity: normal Tags: patch
Description: <short summary of the patch> TODO: Put a short summary on the line above and replace this paragraph with a longer explanation of this change. Complete the meta-information with other relevant fields (see below for details). To make it easier, the information below has been extracted from the changelog. Adjust it or drop it. . firefox-esr (91.7.0esr-1s2~deb9u1) misc; urgency=medium . * Port to Ordissimo. Author: Thierry HUCHARD <thie...@ordissimo.com>
--- The information above should follow the Patch Tagging Guidelines, please checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here are templates for supplementary fields that you might want to add: Origin: <vendor|upstream|other>, <url of original patch> Bug: <url in upstream bugtracker> Bug-Debian: https://bugs.debian.org/<bugnumber> Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber> Forwarded: <no|not-needed|url proving that it has been forwarded> Reviewed-By: <name and email of someone who approved the patch> Last-Update: 2022-03-23 --- firefox-esr-91.7.0esr.orig/widget/gtk/nsDeviceContextSpecG.cpp +++ firefox-esr-91.7.0esr/widget/gtk/nsDeviceContextSpecG.cpp @@ -294,71 +294,18 @@ gboolean nsDeviceContextSpecGTK::Printer void nsDeviceContextSpecGTK::StartPrintJob() { // When using flatpak, we have to call the Print method of the portal - nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); - bool shouldUsePortal; - giovfs->ShouldUseFlatpakPortal(&shouldUsePortal); - if (shouldUsePortal) { - GError* error = nullptr; - GDBusProxy* dbusProxy = g_dbus_proxy_new_for_bus_sync( - G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, nullptr, - "org.freedesktop.portal.Desktop", "/org/freedesktop/portal/desktop", - "org.freedesktop.portal.Print", nullptr, &error); - if (dbusProxy == nullptr) { - NS_WARNING( - nsPrintfCString("Unable to create dbus proxy: %s", error->message) - .get()); - g_error_free(error); - return; - } - int fd = open(mSpoolName.get(), O_RDONLY | O_CLOEXEC); - if (fd == -1) { - NS_WARNING("Failed to open spool file."); - return; - } - static auto s_g_unix_fd_list_new = reinterpret_cast<GUnixFDList* (*)(void)>( - dlsym(RTLD_DEFAULT, "g_unix_fd_list_new")); - NS_ASSERTION(s_g_unix_fd_list_new, - "Cannot find g_unix_fd_list_new function."); - - GUnixFDList* fd_list = s_g_unix_fd_list_new(); - static auto s_g_unix_fd_list_append = - reinterpret_cast<gint (*)(GUnixFDList*, gint, GError**)>( - dlsym(RTLD_DEFAULT, "g_unix_fd_list_append")); - int idx = s_g_unix_fd_list_append(fd_list, fd, NULL); - close(fd); - - // We'll pass empty options as long as we don't have token from PreparePrint - // dbus call (which we don't use). This unfortunatelly lead to showing - // gtk print dialog and also the duplex or printer specific settings - // is not honored, so this needs to be fixed when the portal provides - // more options. - GVariantBuilder opt_builder; - g_variant_builder_init(&opt_builder, G_VARIANT_TYPE_VARDICT); - - g_dbus_proxy_call_with_unix_fd_list( - dbusProxy, "Print", - g_variant_new("(ssh@a{sv})", "", /* window */ - "Print", /* title */ - idx, g_variant_builder_end(&opt_builder)), - G_DBUS_CALL_FLAGS_NONE, -1, fd_list, NULL, - NULL, // portal result cb function - nullptr); // userdata - g_object_unref(fd_list); - g_object_unref(dbusProxy); - } else { - GtkPrintJob* job = - gtk_print_job_new(mTitle.get(), mPrintSettings->GetGtkPrinter(), - mGtkPrintSettings, mGtkPageSetup); - - if (!gtk_print_job_set_source_file(job, mSpoolName.get(), nullptr)) return; - - // Now gtk owns the print job, and will be released via our callback. - gtk_print_job_send(job, print_callback, mSpoolFile.forget().take(), - [](gpointer aData) { - auto* spoolFile = static_cast<nsIFile*>(aData); - NS_RELEASE(spoolFile); - }); - } + GtkPrintJob* job = + gtk_print_job_new(mTitle.get(), mPrintSettings->GetGtkPrinter(), + mGtkPrintSettings, mGtkPageSetup); + + if (!gtk_print_job_set_source_file(job, mSpoolName.get(), nullptr)) return; + + // Now gtk owns the print job, and will be released via our callback. + gtk_print_job_send(job, print_callback, mSpoolFile.forget().take(), + [](gpointer aData) { + auto* spoolFile = static_cast<nsIFile*>(aData); + NS_RELEASE(spoolFile); + }); } void nsDeviceContextSpecGTK::EnumeratePrinters() { @@ -432,21 +379,6 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::En // different numbers of bits for their permissions) destFile->SetPermissions(0666 & ~(mask)); - // Notify flatpak printing portal that file is completely written - nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); - bool shouldUsePortal; - if (giovfs) { - giovfs->ShouldUseFlatpakPortal(&shouldUsePortal); - if (shouldUsePortal) { - // Use the name of the file for printing to match with - // nsFlatpakPrintPortal - nsCOMPtr<nsIObserverService> os = - mozilla::services::GetObserverService(); - // Pass filename to be sure that observer process the right data - os->NotifyObservers(nullptr, "print-to-file-finished", - targetPath.get()); - } - } } return NS_OK; } --- firefox-esr-91.7.0esr.orig/widget/nsPrinterCUPS.h +++ firefox-esr-91.7.0esr/widget/nsPrinterCUPS.h @@ -135,6 +135,7 @@ class nsPrinterCUPS final : public nsPri macro_("BRMonoColor", "Mono") /* Brother */ \ macro_("BRPrintQuality", "Black") /* Brother */ \ macro_("CNIJGrayScale", "1") /* Canon */ \ + macro_("CNGrayscale", "True") /* Canon */ \ macro_("INK", "MONO") /* Epson */ \ macro_("HPColorMode", "GrayscalePrint") /* HP */ \ macro_("ColorMode", "Mono") /* Samsung */ \