summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Kasik <mkasik@redhat.com>2014-12-18 16:25:50 +0100
committerMarek Kasik <mkasik@redhat.com>2014-12-18 16:29:44 +0100
commit9ac9769f360df4d63b4f6e7cbb572092e263c5ea (patch)
treee8ed8319d62bd7dff69980e9a8a7deb1db3b45ed
parent307ce2f9bd617370ce8a3a62e0b73051de97cbe4 (diff)
downloadgtk+-9ac9769f360df4d63b4f6e7cbb572092e263c5ea.tar.gz
printing: Return correct width and height of page setup
Use correct margins when computing width and height returned by gtk_page_setup_get_page_width() and gtk_page_setup_get_page_height(). https://bugzilla.gnome.org/show_bug.cgi?id=671895
-rw-r--r--gtk/gtkpagesetup.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/gtk/gtkpagesetup.c b/gtk/gtkpagesetup.c
index b0c9ef4a45..aa95703089 100644
--- a/gtk/gtkpagesetup.c
+++ b/gtk/gtkpagesetup.c
@@ -485,10 +485,14 @@ gtk_page_setup_get_page_width (GtkPageSetup *setup,
GtkUnit unit)
{
gdouble width;
-
+
width = gtk_page_setup_get_paper_width (setup, GTK_UNIT_MM);
- width -= setup->left_margin + setup->right_margin;
-
+ if (setup->orientation == GTK_PAGE_ORIENTATION_PORTRAIT ||
+ setup->orientation == GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT)
+ width -= setup->left_margin + setup->right_margin;
+ else
+ width -= setup->top_margin + setup->bottom_margin;
+
return _gtk_print_convert_from_mm (width, unit);
}
@@ -512,10 +516,14 @@ gtk_page_setup_get_page_height (GtkPageSetup *setup,
GtkUnit unit)
{
gdouble height;
-
+
height = gtk_page_setup_get_paper_height (setup, GTK_UNIT_MM);
- height -= setup->top_margin + setup->bottom_margin;
-
+ if (setup->orientation == GTK_PAGE_ORIENTATION_PORTRAIT ||
+ setup->orientation == GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT)
+ height -= setup->top_margin + setup->bottom_margin;
+ else
+ height -= setup->left_margin + setup->right_margin;
+
return _gtk_print_convert_from_mm (height, unit);
}