Closed Bug 968753 Opened 11 years ago Closed 4 years ago

GTK Printing Code should store and keep printer settings by printer and recognize any paper size.

Categories

(Core :: Printing: Setup, defect, P2)

Unspecified
Linux
defect

Tracking

()

RESOLVED FIXED
82 Branch
Tracking Status
firefox82 --- fixed

People

(Reporter: dev_oskar, Assigned: emilio)

Details

(Whiteboard: [print2020_v82])

Attachments

(1 file, 1 obsolete file)

Attached patch StoreGTKPrintSettingsByPrinter.patch (obsolete) (deleted) — Splinter Review
The GTK Printing code didn't support different preferences by printer, neither storing the last used printer. This patch adds the necessary changes to the GTK backend. * Ensures a printer name is set * Allow setting prefs by printer * Removes Postscript fallback pref mangling. * Store Paper sizes by GTK names, while still supporting old names. * Removes nsPaperPS.cpp * Page Setup preselects last used printer NOTE: The GTK PageSetup dialog always resets the paper size when passing a printer, I didn't found a workaround yet. The patch requires applying the patch in Bug 968141 first.
Attachment #8371377 - Flags: feedback?(zackw)
Assignee: nobody → dev_oskar
Comment on attachment 8371377 [details] [diff] [review] StoreGTKPrintSettingsByPrinter.patch This seems like a step in the right direction. Could you please explain: 1) Why do we still need the nsPaperSizePStoGTKList at all? 2) Why do we still need the code to strip "PostScript/" from printer names? (in InitPrintSettingsFromPrinter) 3) What exactly do you mean by "GTK seems to return custom sizes by display name?" (In general, we do not ever want to check in commented-out code; either it shouldn't be there at all or we should make it work correctly.) 4) You removed some #ifndef MOZ_WIDGET_X11 from nsPrintOptions. Does the Gtk back end actually support the code that was disabled for it, now?
Attachment #8371377 - Flags: feedback?(zackw) → feedback+
I try to keep backward interface compatibility, meaning anything which makes sense to keep working. This means even adding some code for better compatibility. 1) Converting paper names. The paper list converts Gecko PS based names like A4 or Letter to PWG names GTK can understand. This means old settings or addons won't break. It would be nice to add js based interface tests for this. I need some help with this. (Technical on Linux you can still call the Printer Settings js api, there you can set a Gecko/PS name and the non writeable margins) 2. Postscript/ and Cups/ Because technical the current code if cups shim won't work or is disabled could return Postscript/ I plan to remove the PostScript CUPS shim and replace it with GTK code. Again if someone has PostScript or passes PostScript based names to the current Interface it shouldn't fail. However this part should be in a different Bug, so if it fails it can be reverted easily. 3. There seems to be a bug with GTK at least on a Ubuntu machine here. It is possible to create new Custom Paper names in the Page Setup UI. However instead of returning a PWG compatible name it returns a user defined Display Name. Anything you write there. This fails with GTKPageSetup horrible. I guess I need to write a platform independent PWG paper name parser and check what the API returns so we don't get zero width pages that makes PrintPreview very very unhappy. (I know your feelings about XUL Dialogs, however if I find more annoying bugs like this, my second strategy is to create the necessary interfaces to support a JS based solution and drive the code for Win32 and Linux with the same code and dialog) 4. Prefs by Printer. Yes, it now actually does. Again I need help with writing tests. The old code simply didn't set the Printer Name when doing Init from Printer. This means a lot of stuff screwed. Again some GTK Bugs are annoying. Specially the Page Setup won't allow to set a Printer and a Paper at the same time. But except more generally testing now the code should work as expected and the ifdef can go, at least from a GTK Linux standpoint. Could be that the OSX code path may not work as expected. But I think that should be fixed in OSX code and not in the platform independent code.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

Shame this wasn't finished off. Emily, you're familiar with Linux. :) Would you be interested in resurecting this and getting it landed?

Flags: needinfo?(emcdonough)

Hiro, after talking to Emily this may be better taken on by you. What do you think?

Flags: needinfo?(emcdonough) → needinfo?(hikezoe.birchill)

Yep, Emily is right. I actually didn't know that there is an open bug for this issue.
I will take a look later (keep NI to me).

Mark, do you need this for the new UI to work properly?

Assignee: dev_oskar → nobody
Status: ASSIGNED → NEW
Flags: needinfo?(mstriemer)
Flags: needinfo?(emilio)
Hardware: x86_64 → Unspecified
Whiteboard: [print2020_v81]
Flags: needinfo?(sfoster)

If this is needed I'm happy to take this.

Flags: needinfo?(emilio)
Priority: -- → P2

(In reply to Jonathan Watt [:jwatt] from comment #7)

Mark, do you need this for the new UI to work properly?

I don't think we need-need it, printing works without its just we have in effect a single global settings store for all printers linux; any changes with one printer selected will appear to get picked up by the other printers when selected, which can lead to confusion. We should just watch out for dupes in the meantime

Flags: needinfo?(sfoster)
Flags: needinfo?(mstriemer)
Whiteboard: [print2020_v81] → [print2020_v83]

I don't see any reason why this shouldn't work off-hand, there's no
gtk globals or such that fundamentally avoid sharing settings.

The PSPrinters stuff is gone so it's not needed to mess up with PS/CUPS
names.

There are some restrictions on what can be set or what not (like, if you
set the paper name that may also override the paper size).

But these are problems that we have when restoring from prefs already,
so there's no reason we shouldn't do this, afaict.

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Whiteboard: [print2020_v83] → [print2020_v82]
Attachment #8371377 - Attachment is obsolete: true
Flags: needinfo?(hikezoe.birchill)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/db9899666fa8 Save per-printer settings on GTK. r=jwatt
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: