This puts all CUPS data into one structure, refactors the locking of this
data, and and simplifies logic for determining the connection to use in
TryEnsurePrinterInfo.
Differential Revision: https://phabricator.services.mozilla.com/D174925
This accounts for a specific situation where our check for Bug 1691347 was not
quite identical to the code in CUPS.
In httpGetHostname, there are some cases where the result is "localhost" rather
than `http->hostname`:
https://github.com/apple/cups/blob/2201569857f225c9874bfae19713ffb2f4bdfdeb/cups/http-addr.c#L794-L818
We will now assume that if the result is "localhost" then this could have
occurred. This change might block some printers that would otherwise work
properly, but eventually this fix can be placed behind a CUPS version check.
Differential Revision: https://phabricator.services.mozilla.com/D137903
Just make some functions optional and deal with them not being there.
We won't have localized media names and per-printer paper lists, but
that seems fine, it's an obvious improvement over not showing printers.
Also, add some logging so next time we need to debug something like this
we can figure out without having to rebuild.
Differential Revision: https://phabricator.services.mozilla.com/D110032
Mostly for debugging / diagnosing purposes. This is easier than asking
people to try builds from try or building Firefox.
Differential Revision: https://phabricator.services.mozilla.com/D96648
Since we no longer are using the PaperList or CreateDefaultSettings methods on
nsPrinterBase, and we can remove them from nsPrinterBase.
This should dramatically improve latency when the remote printer is not
available, or when the print server is slower. In the best-case scenario it may
increase the latency to displaying the print preview somewhat.
Differential Revision: https://phabricator.services.mozilla.com/D94482
We do it in nsDeviceContextSpecG since that's what actually consumes the
settings. On GTK the options need to be prefixed by cups- for some
reason in order to work, so factor out a macro listing the options and
do the NSString / cups- prefixing in the platform specific places.
Differential Revision: https://phabricator.services.mozilla.com/D94479
This should be able to avoid creating a printer-specific HTTP connection in
nsPrinterCUPS::DefaultSettings when the paper size is a PWG-recognized size.
The current maximum error when comparing paper sizes is 4 points. This may need
to be revised later.
Differential Revision: https://phabricator.services.mozilla.com/D91497
CUPS occasionally returns duplicate paper sizes, especially on
older versions of Ubuntu. This patch utilizes a hash set to
skip over any duplciate paper sizes, ensuring that the final list
contains only unique sizes.
These duplicate checks are currently being done on the front end,
and this patch will allow us to remove them.
Differential Revision: https://phabricator.services.mozilla.com/D91215
- Rename EnsurePrinterInfo to TryEnsurePrinterInfo to reflect the fact that it can fail to populate the printer info.
- Add argument to TryEnsurePrinterInfo to accept a connection other than the default.
- Allow TryEnsurePrinterInfo to try once with the default connection and once with an established connection.
- Use an established connection to retrieve the paper list information.
Differential Revision: https://phabricator.services.mozilla.com/D91193
cupsGetDestMediaDefault seems to not be returning the correct defaults,
so this patch retrieves the default media through the IPP attribute
instead, in hopes that this will provide more accurate defaults.
Differential Revision: https://phabricator.services.mozilla.com/D91376
This also renames nsIPrinterList.getNamedPrinter to nsIPrinter.getPrinterByName
for consistency.
This is cheaper to lookup on platforms that use CUPS and do not show the Unix
name for printers. This only applies to OS X at the present.
Differential Revision: https://phabricator.services.mozilla.com/D90201
Add a separate field to CUPSPrinterInfo to track if we attempted to fetch the
printer info before.
This should be safe, as all the CUPS calls internally check for a null-dinfo
and we will detect the error at that point.
Differential Revision: https://phabricator.services.mozilla.com/D89847
This moves the special cases to the printing platform code instead
(where it belongs).
The SupportsMonochrome() implementation is the only thing that I found
to work for the "Microsoft Print to PDF" driver, but other similar
drivers like XPS still claim to support monochrome (even though it's not
true). This should avoid the UI getting in a bad state as described in
the bug though, so may be better?
Depends on D89306
Differential Revision: https://phabricator.services.mozilla.com/D89312
This patch adds a createDefaultSettings() method to nsIPrinter to
initialize a default print settings object specific to that printer.
It implements the functionality for Linux and macOS but adds only stubs
for Windows.
Differential Revision: https://phabricator.services.mozilla.com/D87125
This patch adds a createDefaultSettings() method to nsIPrinter to
initialize a default print settings object specific to that printer.
It implements the functionality for Linux and macOS but adds only stubs
for Windows.
Differential Revision: https://phabricator.services.mozilla.com/D87125
- Add cupsGetOption function support to CUPSShim
- Improve performance on GetName() function to not copy string twice.
- Unify implementation of `GetDisplayNameForPrinter()`
Differential Revision: https://phabricator.services.mozilla.com/D86114
I intentionally removed the "move the default printer to the front" in
windows because that's not a guarantee that we provide in CUPS, but lmk
if you want it back.
I have zero idea about why the GlobalPrinters code was so ridiculously
complex.
Depends on D86396
Differential Revision: https://phabricator.services.mozilla.com/D86397
This is no worse than what we were doing.
In the future, instead of just querying the margin we may want to query
extra information that requires a DC in windows too or what not, for
example.
Differential Revision: https://phabricator.services.mozilla.com/D85919
Retrieve paper size information directy from CUPS.
- Add unwriteable margins tests.
- Rename nsPaper to nsPaperCUPS.
- Add new functionality to nsCUPSShim.
- Retrieve paper info from CUPS
Differential Revision: https://phabricator.services.mozilla.com/D85211
This leaves the nsPrinter for the time being, as it will also need to be
replaced on GTK before it can be removed.
While messing with widget/moz.build, also move the new printing source to be
controlled by the NS_PRINTING flag.
Differential Revision: https://phabricator.services.mozilla.com/D85092