mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 414314 - "Since landing of bug 193001, I cannot print with HP-Toolbox 2.7.10 or earlier" [p=ventnor.bugzilla@yahoo.com.au (Michael Ventnor) r+sr=roc a=blocking1.9+]
This commit is contained in:
parent
56cd3cc383
commit
abc6f7a377
@ -391,6 +391,16 @@ nsDeviceContextSpecGTK::nsDeviceContextSpecGTK()
|
||||
nsDeviceContextSpecGTK::~nsDeviceContextSpecGTK()
|
||||
{
|
||||
DO_PR_DEBUG_LOG(("nsDeviceContextSpecGTK::~nsDeviceContextSpecGTK()\n"));
|
||||
|
||||
if (mGtkPageSetup) {
|
||||
g_object_unref(mGtkPageSetup);
|
||||
mGtkPageSetup = NULL;
|
||||
}
|
||||
|
||||
if (mGtkPrintSettings) {
|
||||
g_object_unref(mGtkPrintSettings);
|
||||
mGtkPrintSettings = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsDeviceContextSpecGTK,
|
||||
@ -510,6 +520,25 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::Init(nsIWidget *aWidget,
|
||||
mGtkPrintSettings = printSettingsGTK->GetGtkPrintSettings();
|
||||
mGtkPageSetup = printSettingsGTK->GetGtkPageSetup();
|
||||
|
||||
// This is a horrible workaround for some printer driver bugs that treat custom page sizes different
|
||||
// to standard ones. If our paper object matches one of a standard one, use a standard paper size
|
||||
// object instead.
|
||||
GtkPaperSize* geckosHackishPaperSize = gtk_page_setup_get_paper_size(mGtkPageSetup);
|
||||
GtkPaperSize* standardGtkPaperSize = gtk_paper_size_new(gtk_paper_size_get_name(geckosHackishPaperSize));
|
||||
|
||||
mGtkPageSetup = gtk_page_setup_copy(mGtkPageSetup);
|
||||
mGtkPrintSettings = gtk_print_settings_copy(mGtkPrintSettings);
|
||||
|
||||
GtkPaperSize* properPaperSize;
|
||||
if (gtk_paper_size_is_equal(geckosHackishPaperSize, standardGtkPaperSize)) {
|
||||
properPaperSize = standardGtkPaperSize;
|
||||
} else {
|
||||
properPaperSize = geckosHackishPaperSize;
|
||||
gtk_paper_size_free(standardGtkPaperSize);
|
||||
}
|
||||
gtk_print_settings_set_paper_size(mGtkPrintSettings, properPaperSize);
|
||||
gtk_page_setup_set_paper_size_and_default_margins(mGtkPageSetup, properPaperSize);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user