[gnome-screenshot] screenshot: don't set the XID for the sound effect



commit 4ae6c271b53aca75acc1ef8e3bf2e9eaaa3bd707
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Jan 25 14:39:20 2012 -0500

    screenshot: don't set the XID for the sound effect
    
    It's not needed, since the effect doesn't come from that window
    anyway...

 src/gnome-screenshot.c |   42 ------------------------------------------
 src/screenshot-utils.c |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 42 deletions(-)
---
diff --git a/src/gnome-screenshot.c b/src/gnome-screenshot.c
index f4a565c..f8a357f 100644
--- a/src/gnome-screenshot.c
+++ b/src/gnome-screenshot.c
@@ -39,7 +39,6 @@
 #include <gio/gio.h>
 #include <pwd.h>
 #include <X11/Xutil.h>
-#include <canberra-gtk.h>
 
 #include "gnome-screenshot.h"
 #include "screenshot-area-selection.h"
@@ -314,45 +313,6 @@ build_filename_ready_cb (GObject *source,
   g_free (save_uri);
 }
 
-static void
-play_sound_effect (GdkWindow *window)
-{
-  ca_context *c;
-  ca_proplist *p = NULL;
-  int res;
-
-  c = ca_gtk_context_get ();
-
-  res = ca_proplist_create (&p);
-  if (res < 0)
-    goto done;
-
-  res = ca_proplist_sets (p, CA_PROP_EVENT_ID, "screen-capture");
-  if (res < 0)
-    goto done;
-
-  res = ca_proplist_sets (p, CA_PROP_EVENT_DESCRIPTION, _("Screenshot taken"));
-  if (res < 0)
-    goto done;
-
-  if (window != NULL)
-    {
-      res = ca_proplist_setf (p,
-                              CA_PROP_WINDOW_X11_XID,
-                              "%lu",
-                              (unsigned long) GDK_WINDOW_XID (window));
-      if (res < 0)
-        goto done;
-    }
-
-  ca_context_play_full (c, 0, p, NULL, NULL);
-
- done:
-  if (p != NULL)
-    ca_proplist_destroy (p);
-
-}
-
 static gchar *
 get_profile_for_window (GdkWindow *window)
 {
@@ -490,8 +450,6 @@ finish_prepare_screenshot (GdkRectangle *rectangle)
       exit (1);
     }
 
-  play_sound_effect (window);
-
   if (screenshot_config->copy_to_clipboard)
     {
       screenshot_save_to_clipboard ();
diff --git a/src/screenshot-utils.c b/src/screenshot-utils.c
index 32c6ced..0a302fc 100644
--- a/src/screenshot-utils.c
+++ b/src/screenshot-utils.c
@@ -24,6 +24,7 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
+#include <canberra-gtk.h>
 
 #ifdef HAVE_X11_EXTENSIONS_SHAPE_H
 #include <X11/extensions/shape.h>
@@ -356,6 +357,35 @@ screenshot_get_window_rect_coords (GdkWindow *window,
 }
 
 static void
+screenshot_play_sound_effect (void)
+{
+  ca_context *c;
+  ca_proplist *p = NULL;
+  int res;
+
+  c = ca_gtk_context_get ();
+
+  res = ca_proplist_create (&p);
+  if (res < 0)
+    goto done;
+
+  res = ca_proplist_sets (p, CA_PROP_EVENT_ID, "screen-capture");
+  if (res < 0)
+    goto done;
+
+  res = ca_proplist_sets (p, CA_PROP_EVENT_DESCRIPTION, _("Screenshot taken"));
+  if (res < 0)
+    goto done;
+
+  ca_context_play_full (c, 0, p, NULL, NULL);
+
+ done:
+  if (p != NULL)
+    ca_proplist_destroy (p);
+
+}
+
+static void
 screenshot_fallback_fire_flash (GdkWindow *window,
                                 GdkRectangle *rectangle)
 {
@@ -651,6 +681,9 @@ screenshot_get_pixbuf (GdkWindow    *window,
       screenshot = screenshot_get_pixbuf_fallback (window, rectangle);
     }
 
+  if (screenshot != NULL)
+    screenshot_play_sound_effect ();
+
   g_free (path);
   g_free (tmpname);
   g_free (filename);



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