summaryrefslogtreecommitdiff
path: root/debian/patches/04_print_settings_corruption.dpatch
blob: 9b051b6537f1f176e0da88e2fa8fe4f188d7387f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#! /bin/sh /usr/share/dpatch/dpatch-run
## 04_print_settings_corruption.dpatch by  <rleigh@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Correctly initialise printable area variables before using them

@DPATCH@

diff -urN gutenprint-4.3.99+cvs20050813/src/gutenprintui/panel.c gutenprint-4.3.99+cvs20050813.original/src/gutenprintui/panel.c
--- gutenprint-4.3.99+cvs20050813/src/gutenprintui/panel.c	2005-08-14 16:11:39.274887408 +0100
+++ gutenprint-4.3.99+cvs20050813.original/src/gutenprintui/panel.c	2005-08-14 16:12:13.729649488 +0100
@@ -2617,8 +2617,18 @@
 }
 
 static void
+compute_printable_region(void)
+{
+  stp_get_media_size(pv->v, &paper_width, &paper_height);
+  stp_get_imageable_area(pv->v, &left, &right, &bottom, &top);
+  printable_width  = right - left;
+  printable_height = bottom - top;
+}  
+
+static void
 set_orientation(int orientation)
 {
+  compute_printable_region();
   pv->orientation = orientation;
   if (orientation == ORIENT_AUTO)
     orientation = stpui_compute_orientation();
@@ -4424,12 +4434,7 @@
   gdouble min_ppi_scaling;   /* Minimum PPI for current page size */
 
   suppress_preview_update++;
-  stp_get_media_size(pv->v, &paper_width, &paper_height);
-
-  stp_get_imageable_area(pv->v, &left, &right, &bottom, &top);
-
-  printable_width  = right - left;
-  printable_height = bottom - top;
+  compute_printable_region();
 
   if (pv->scaling < 0)
     {
diff -urN gutenprint-4.3.99+cvs20050813/src/gutenprintui2/panel.c gutenprint-4.3.99+cvs20050813.original/src/gutenprintui2/panel.c
--- gutenprint-4.3.99+cvs20050813/src/gutenprintui2/panel.c	2005-08-14 16:11:39.297883912 +0100
+++ gutenprint-4.3.99+cvs20050813.original/src/gutenprintui2/panel.c	2005-08-14 16:12:13.732649032 +0100
@@ -2641,8 +2641,18 @@
 }
 
 static void
+compute_printable_region(void)
+{
+  stp_get_media_size(pv->v, &paper_width, &paper_height);
+  stp_get_imageable_area(pv->v, &left, &right, &bottom, &top);
+  printable_width  = right - left;
+  printable_height = bottom - top;
+}  
+
+static void
 set_orientation(int orientation)
 {
+  compute_printable_region();
   pv->orientation = orientation;
   if (orientation == ORIENT_AUTO)
     orientation = stpui_compute_orientation();
@@ -4463,12 +4473,7 @@
   gdouble min_ppi_scaling;   /* Minimum PPI for current page size */
 
   suppress_preview_update++;
-  stp_get_media_size(pv->v, &paper_width, &paper_height);
-
-  stp_get_imageable_area(pv->v, &left, &right, &bottom, &top);
-
-  printable_width  = right - left;
-  printable_height = bottom - top;
+  compute_printable_region();
 
   if (pv->scaling < 0)
     {