[metacity] workspace: fix build with --disable-canberra



commit 9a11f30a7e712c7002aa4fd4cf219166fb4cde9e
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Sep 20 20:03:43 2015 +0300

    workspace: fix build with --disable-canberra

 src/core/workspace.c |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/src/core/workspace.c b/src/core/workspace.c
index c97b6e1..88619ea 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -313,7 +313,6 @@ static void workspace_switch_sound(MetaWorkspace *from,
 
   MetaWorkspaceLayout layout;
   int i, nw, x, y, fi, ti;
-  const char *e;
 
   nw = meta_screen_get_n_workspaces(from->screen);
   fi = meta_workspace_index(from);
@@ -343,25 +342,30 @@ static void workspace_switch_sound(MetaWorkspace *from,
      spatial "Woosh!" effects will easily be able to encode horizontal
      movement but not such much vertical movement. */
 
-  if (x < layout.current_col)
-    e = "desktop-switch-left";
-  else if (x > layout.current_col)
-    e = "desktop-switch-right";
-  else if (y < layout.current_row)
-    e = "desktop-switch-up";
-  else if (y > layout.current_row)
-    e = "desktop-switch-down";
-  else {
+  if (x == layout.current_col && y == layout.current_row) {
     meta_bug("Uh, origin and destination workspace at same logic position!\n");
     goto finish;
   }
 
 #ifdef HAVE_CANBERRA
-  ca_context_play(ca_gtk_context_get(), 1,
+  {
+    const char *e;
+
+    if (x < layout.current_col)
+      e = "desktop-switch-left";
+    else if (x > layout.current_col)
+      e = "desktop-switch-right";
+    else if (y < layout.current_row)
+      e = "desktop-switch-up";
+    else if (y > layout.current_row)
+      e = "desktop-switch-down";
+
+    ca_context_play(ca_gtk_context_get(), 1,
                   CA_PROP_EVENT_ID, e,
                   CA_PROP_EVENT_DESCRIPTION, "Desktop switched",
                   CA_PROP_CANBERRA_CACHE_CONTROL, "permanent",
                   NULL);
+  }
 #endif
 
  finish:


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