summaryrefslogtreecommitdiff
path: root/src/xsane-preview.c
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2014-10-03 16:20:34 +0200
committerMattia Rizzolo <mattia@mapreri.org>2014-10-03 16:20:34 +0200
commit595e641cf7fa72e091aff56f9eab360a9d9b636b (patch)
tree44c530cb010308f37e42fa60622a3ffd1dd80a29 /src/xsane-preview.c
parentf3a24cbe91087e885e469b77fe733d7c83437aa8 (diff)
parent23337be110e44acd2f922fed0c92c5130abc1bba (diff)
Merge tag 'upstream/0.999'
Upstream version 0.999 # gpg: Signature made Fri 03 Oct 2014 04:20:30 PM CEST using RSA key ID B9444540 # gpg: Good signature from "Mattia Rizzolo <mattia@mapreri.org>" # gpg: aka "Mattia Rizzolo <mapreri@ubuntu.com>" # gpg: aka "Mattia Rizzolo <mapreri@ubuntu-it.org>" # gpg: aka "Mattia Rizzolo <mapreri@gmail.com>" # gpg: aka "[jpeg image of size 4456]" # gpg: aka "[jpeg image of size 4218]"
Diffstat (limited to 'src/xsane-preview.c')
-rw-r--r--src/xsane-preview.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/xsane-preview.c b/src/xsane-preview.c
index f089dd1..3eb6479 100644
--- a/src/xsane-preview.c
+++ b/src/xsane-preview.c
@@ -4666,6 +4666,9 @@ void preview_update_surface(Preview *p, int surface_changed)
SANE_Unit unit;
double min, max;
int expand_surface = 0;
+ gint min_width, min_height;
+ GdkScreen *screen;
+ GdkRectangle geometry;
DBG(DBG_proc, "preview_update_surface\n");
@@ -4849,8 +4852,25 @@ void preview_update_surface(Preview *p, int surface_changed)
{
DBG(DBG_info, "preview_update_surface: defining size of preview window\n");
+/*
p->preview_window_width = 0.3 * gdk_screen_width();
p->preview_window_height = 0.5 * gdk_screen_height();
+*/
+ /* ensure preview window fits on displays, account for multi-head */
+ min_width = gdk_screen_width();
+ min_height = gdk_screen_height();
+
+ screen = gdk_screen_get_default();
+ for (i = 0; i < gdk_screen_get_n_monitors(screen); i++)
+ {
+ gdk_screen_get_monitor_geometry(screen, i, &geometry);
+ min_width = MIN(min_width, geometry.width);
+ min_height = MIN(min_height, geometry.height);
+ }
+
+ p->preview_window_width = 0.3 * min_width;
+ p->preview_window_height = 0.5 * min_height;
+
preview_area_correct(p); /* calculate preview_width and height */
gtk_widget_set_size_request(GTK_WIDGET(p->window), p->preview_width, p->preview_height);
}