[gnome-boxes] actions-popover: Add screenshot flash feedback



commit a19745cd4ed15e8499d5fe085367bd53f17977b8
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon Mar 20 13:15:23 2017 +0100

    actions-popover: Add screenshot flash feedback
    
    Currently there's no visual feedback when taking a screenshot.
    
    This patch introduces a css-based visual effect of a camera
    "flash".
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780256

 data/gtk-style.css       |   15 +++++++++++++++
 src/actions-popover.vala |    8 ++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/data/gtk-style.css b/data/gtk-style.css
index ed6b539..ea3cc49 100644
--- a/data/gtk-style.css
+++ b/data/gtk-style.css
@@ -122,3 +122,18 @@
 
 /* Adds a border to the ISOs lists top undershoot */
 .boxes-menu-scrolled.undershoot.top { border-top: 1px solid @borders; }
+
+/* Screenshot flash */
+@keyframes flash_animation {
+    50% {
+        border: 100px solid #FFF;
+        opacity: 0.2;
+    }
+}
+
+.flash {
+    border: 1px solid transparent;
+    animation: flash_animation;
+    animation-duration: 150ms;
+    animation-iteration-count: 1;
+}
diff --git a/src/actions-popover.vala b/src/actions-popover.vala
index b013012..4281b27 100644
--- a/src/actions-popover.vala
+++ b/src/actions-popover.vala
@@ -127,6 +127,14 @@ private class Boxes.ActionsPopover: Gtk.Popover {
         } catch (GLib.Error error) {
             warning (error.message);
         }
+
+        var ctx = window.below_bin.get_style_context ();
+        ctx.add_class ("flash");
+        Timeout.add (200, () => {
+            ctx.remove_class ("flash");
+
+            return false;
+        });
     }
 
     private void pause_activated () {


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