aboutsummaryrefslogtreecommitdiff
path: root/src/main-window.vala
diff options
context:
space:
mode:
authorleigh123linux <leigh123linux@googlemail.com>2017-06-20 15:33:20 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-06-20 15:33:20 +0200
commitb37ceae7c7a8dbbaa76c74a7720f9d77b2aebcd9 (patch)
treeb91e13aaa51b9e8220075c81e123b8e8ebc413f9 /src/main-window.vala
parent54ff85c43d86c3ec4c02734d7487f2737f03f7ab (diff)
downloadarctica-greeter-b37ceae7c7a8dbbaa76c74a7720f9d77b2aebcd9.tar.gz
arctica-greeter-b37ceae7c7a8dbbaa76c74a7720f9d77b2aebcd9.tar.bz2
arctica-greeter-b37ceae7c7a8dbbaa76c74a7720f9d77b2aebcd9.zip
Add basic screenshot capability. Ported from slick-greeter.
Diffstat (limited to 'src/main-window.vala')
-rw-r--r--src/main-window.vala13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main-window.vala b/src/main-window.vala
index b5252ad..ac87200 100644
--- a/src/main-window.vala
+++ b/src/main-window.vala
@@ -384,6 +384,19 @@ public class MainWindow : Gtk.Window
case Gdk.Key.PowerOff:
show_shutdown_dialog (ShutdownDialogType.SHUTDOWN);
return true;
+ case Gdk.Key.Print:
+ debug ("Taking screenshot");
+ var root = Gdk.get_default_root_window ();
+ var screenshot = Gdk.pixbuf_get_from_window (root, 0, 0, root.get_width (), root.get_height ());
+ try
+ {
+ screenshot.save ("Screenshot.png", "png", null);
+ }
+ catch (Error e)
+ {
+ warning ("Failed to save screenshot: %s", e.message);
+ }
+ return true;
case Gdk.Key.z:
if (ArcticaGreeter.singleton.test_mode && (event.state & Gdk.ModifierType.MOD1_MASK) != 0)
{