Fix #6200 - gtk3 - screenshot verison
[app.webkitpdf] / BrowserWindow.vala
index e1f421c..3bd2bcd 100644 (file)
@@ -292,7 +292,8 @@ public class BrowserWindow : Object
                        
         
         #if GTK3
-               print("PNG not supported in webkit2\n");
+               this.printpng();        
+               //print("PNG not supported in webkit2\n");
                return;
         #else
                        
@@ -415,6 +416,16 @@ public class BrowserWindow : Object
         
              print("making screenshot\n");
         #if GTK3
+        GLib.MainLoop mainloop = new GLib.MainLoop();
+          _this.view.el.get_snapshot.begin(WebKit.SnapshotRegion.FULL_DOCUMENT, WebKit.SnapshotOptions.NONE, null, (obj, res) => {
+                        var sf = _this.view.el.get_snapshot.end(res);
+                        sf.write_to_png(webkitpdf.opt_target_png);
+               print("Saved to %s\n", webkitpdf.opt_target_png);
+                        mainloop.quit();
+                        
+          });
+        
+               mainloop.run();
         
         #else     
             // fix vapi - get_snapshot add '?' to all null.
@@ -438,10 +449,12 @@ public class BrowserWindow : Object
         
             //    sf.write_to_png(Browser.opt_target_png);
             //});
+        #endif       
            this.delete_cookiefile(); 
+           
             Gtk.main_quit();
              
-        #endif   
+