Bug 231110 - x11-toolkits/gtk20, x11-toolkits/gtk30: GTK print dialogs falsely believe lpr cannot accept PDF
Summary: x11-toolkits/gtk20, x11-toolkits/gtk30: GTK print dialogs falsely believe lpr...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-ports-bugs mailing list
Depends on:
Reported: 2018-09-03 00:22 UTC by george
Modified: 2018-12-29 17:34 UTC (History)
4 users (show)

See Also:

Patch to tell GTK that lpr accepts PDF output (690 bytes, patch)
2018-09-03 00:22 UTC, george
no flags Details | Diff
Alternate patch to fix GTK (668 bytes, text/plain)
2018-09-09 03:44 UTC, Sean Farley
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description george 2018-09-03 00:22:29 UTC
Created attachment 196805 [details]
Patch to tell GTK that lpr accepts PDF output

The LPR backend for GTK asserts that "lpr" cannot accept PDF files.  Granted, you can't tell in general whether lpr in a given situation will be able to print a PDF or not, but declaring that it can't is needlessly restrictive.  The attached patch (works for both GTK2 and GTK3) adds the "accepts-pdf" property to the lpr backend and fixes the problem.

This patch is suggested as an alternative to the patch from the freebsd-gecko email thread "firefox-60.0_2,1 missing 'Print to LPR'", from May 13, 2018, which circumvents the problem by generating PostScript output instead of PDF.  Fixing the problem in GTK means that other users of GTK won't have to create parallel workarounds.
Comment 1 Jan Beich freebsd_committer 2018-09-03 19:29:25 UTC
Walter, firefox doesn't use gtk20 (except for Adobe Flash plugin) but the patch applies against both gtk20 and gtk30.
Comment 2 george 2018-09-03 23:05:39 UTC
Is it legal to cite two port names in the title of the bug?  The problem (and the patch) apply to both gtk2 and gtk3.
Comment 3 Walter Schwarzenfeld freebsd_triage 2018-09-03 23:08:37 UTC
No problem (was my error with the title).
Comment 4 Sean Farley freebsd_committer 2018-09-09 03:43:20 UTC
I had written a patch, that I had forgotten, that looks similar to yours.  It has a few differences.  I am not the best with GTK code, so I have no idea which is correct between your patch or mine in relation to the backend and is-virtual settings.  I also include accepts-ps in the function call as the lpr filter I am using handles both.
Comment 5 Sean Farley freebsd_committer 2018-09-09 03:44:34 UTC
Created attachment 196976 [details]
Alternate patch to fix GTK
Comment 6 george 2018-09-09 18:42:05 UTC
I know less about GTK probably than anyone else on the project, so someone else should probably choose between these two patches.  But the other backends don't specify "accepts-ps", so I assumed it was the default.  Also, I wrote "GTK_PRINT_BACKEND (backend)" simply because that looked similar to what I saw in the other backends.

But it does seem to me like a very good idea to incorporate one of these patches.
Comment 7 Jan Beich freebsd_committer 2018-09-09 19:16:14 UTC
Have you tried to submit the patch/rationale upstream? gnome@ (downstream) is understaffed and, probably, doesn't have enough expertise to review.
Comment 8 george 2018-09-09 19:38:04 UTC
Offhand, I wouldn't know how to do that ...
Comment 9 Sean Farley freebsd_committer 2018-10-04 21:36:03 UTC
I created an account on Gnome's GitLab server and created an issue for this:  https://gitlab.gnome.org/GNOME/gtk/issues/1385
Comment 10 Sean Farley freebsd_committer 2018-12-29 17:34:31 UTC
I created a pull request in the Gnome repo.  It was marked for GTK4.