Add _gtk_printer_get_hard_margins_for_paper_size()

to retreive paper size specific hard margins and use this
to set the hard margins in the print context.
(modified by Marek Kasik <mkasik@redhat.com>)

https://bugzilla.gnome.org/show_bug.cgi?id=686109
This commit is contained in:
Adrian Johnson
2018-04-16 13:53:44 +02:00
committed by Marek Kasik
parent d20101e878
commit fff08fa319
6 changed files with 95 additions and 2 deletions

View File

@ -32,6 +32,7 @@
#include "gtkprintoperation-private.h"
#include "gtkprintoperation-portal.h"
#include "gtkmessagedialog.h"
#include "gtkprinter-private.h"
#include <cairo-pdf.h>
#include <cairo-ps.h>
@ -536,7 +537,8 @@ finish_print (PrintResponseData *rdata,
if (gtk_print_settings_get_number_up (settings) < 2)
{
if (printer && gtk_printer_get_hard_margins (printer, &top, &bottom, &left, &right))
if (printer && (_gtk_printer_get_hard_margins_for_paper_size (printer, gtk_page_setup_get_paper_size (page_setup), &top, &bottom, &left, &right) ||
gtk_printer_get_hard_margins (printer, &top, &bottom, &left, &right)))
_gtk_print_context_set_hard_margins (priv->print_context, top, bottom, left, right);
}
else