diff options
author | Mattia Rizzolo <mattia@mapreri.org> | 2014-10-03 16:20:28 +0200 |
---|---|---|
committer | Mattia Rizzolo <mattia@mapreri.org> | 2014-10-03 16:20:28 +0200 |
commit | 23337be110e44acd2f922fed0c92c5130abc1bba (patch) | |
tree | 577707fbcd4ffa280c3e1644e4ce48f06de7defd /src/xsane-preview.c | |
parent | ca9f280d0ac4173cdd29f745fd574a3b597969e7 (diff) |
Imported Upstream version 0.999
Diffstat (limited to 'src/xsane-preview.c')
-rw-r--r-- | src/xsane-preview.c | 20 |
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); } |