summaryrefslogtreecommitdiff
path: root/gtk/gtkprintoperation-win32.c
diff options
context:
space:
mode:
authorRick Yorgason <rick@firefang.com>2018-11-01 11:31:05 -0700
committerRick Yorgason <rick@firefang.com>2018-11-01 11:31:05 -0700
commit26febcc3a80f3c7ed38b41ad14583929565c03ee (patch)
tree5ee9b4f838384d68d4080c3a40cc31d2f762c909 /gtk/gtkprintoperation-win32.c
parent5dd7f20dab1a7c21a7e5bb52a71618452f266f39 (diff)
downloadgtk+-26febcc3a80f3c7ed38b41ad14583929565c03ee.tar.gz
Fixed win32 printer dialogue not saving devmode->dmDeviceName. Caused the print dialogue to select the wrong printer, and potentially feed bad "extra" data to the default printer.
Diffstat (limited to 'gtk/gtkprintoperation-win32.c')
-rw-r--r--gtk/gtkprintoperation-win32.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gtk/gtkprintoperation-win32.c b/gtk/gtkprintoperation-win32.c
index 147f64a848..13ad11c24c 100644
--- a/gtk/gtkprintoperation-win32.c
+++ b/gtk/gtkprintoperation-win32.c
@@ -709,6 +709,10 @@ devmode_to_settings (GtkPrintSettings *settings,
g_free (extra);
}
+ char *devmode_name = g_utf16_to_utf8 (devmode->dmDeviceName, -1, NULL, NULL, NULL);
+ gtk_print_settings_set (settings, "win32-devmode-name", devmode_name);
+ g_free (devmode_name);
+
if (devmode->dmFields & DM_ORIENTATION)
gtk_print_settings_set_orientation (settings,
orientation_from_win32 (devmode->dmOrientation));
@@ -986,6 +990,11 @@ devmode_from_settings (GtkPrintSettings *settings,
devmode->dmSpecVersion = DM_SPECVERSION;
devmode->dmSize = sizeof (DEVMODEW);
+ gunichar2 *device_name = g_utf8_to_utf16 (gtk_print_settings_get (settings, "win32-devmode-name"), -1, NULL, NULL, NULL);
+ memcpy (devmode->dmDeviceName, device_name, CCHDEVICENAME);
+ g_free (device_name);
+
+
devmode->dmDriverExtra = 0;
if (extras && extras_len > 0)
{