[simple-scan/cherry-pick-b7c9b758] During first run create page with correct page size.



commit c23a1da84853eafc4a77b06c7607edd0c6f8277d
Author: Bartosz Kosiorek <gang65 poczta onet pl>
Date:   Sat Apr 18 23:19:00 2020 +0000

    During first run create page with correct page size.
    
    During creation of page, size and DPI is taken from previous page.
    Unfortunately if it is a first page, then the page size is default
    which is 100x100 and 100 DPI.
    
    With this patch the page size/DPI is set correctly after press Scan button.
    
    The issue is reproducible only on real scanner on the first scanned page.
    
    
    (cherry picked from commit b7c9b75860864a68caa28c3e613149e00bd58347)

 src/simple-scan.vala | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/simple-scan.vala b/src/simple-scan.vala
index 1e8fc64..fc9b101 100644
--- a/src/simple-scan.vala
+++ b/src/simple-scan.vala
@@ -1301,7 +1301,7 @@ public class SimpleScan : Gtk.Application
         scanner.authorize (username, password);
     }
 
-    private Page append_page ()
+    private Page append_page (int width = 100, int height = 100, int dpi = 100)
     {
         /* Use current page if not used */
         var page = book.get_page (-1);
@@ -1316,7 +1316,7 @@ public class SimpleScan : Gtk.Application
         var scan_direction = ScanDirection.TOP_TO_BOTTOM;
         bool do_crop = false;
         string named_crop = null;
-        var width = 100, height = 100, dpi = 100, cx = 0, cy = 0, cw = 0, ch = 0;
+        var cx = 0, cy = 0, cw = 0, ch = 0;
         if (page != null)
         {
             scan_direction = page.scan_direction;
@@ -1536,7 +1536,7 @@ public class SimpleScan : Gtk.Application
         debug ("Requesting scan at %d dpi from device '%s'", options.dpi, device);
 
         if (!scanner.is_scanning ())
-            append_page ();
+            append_page (options.paper_width, options.paper_height, options.dpi);
 
         scanner.scan (device, options);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]