summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Riedi <andrewriedi@gmail.com>2007-07-04 11:19:39 -0700
committerAndrew Riedi <andrewriedi@gmail.com>2007-07-04 11:19:39 -0700
commit8c4bf6293e30fbf1484befa580f7cbaace405c89 (patch)
tree11afe2e82915e175a7115c43a754548e06256921
parent8f33f32bc9be2f497f73e40c521e1b97c8da3d27 (diff)
downloadsound-8c4bf6293e30fbf1484befa580f7cbaace405c89.tar.gz
sound-8c4bf6293e30fbf1484befa580f7cbaace405c89.tar.bz2
Introduce allowMask.
-rw-r--r--soundeffects/soundeffects.c44
1 files changed, 29 insertions, 15 deletions
diff --git a/soundeffects/soundeffects.c b/soundeffects/soundeffects.c
index 52c33be..15fe01b 100644
--- a/soundeffects/soundeffects.c
+++ b/soundeffects/soundeffects.c
@@ -21,9 +21,13 @@
#include <compiz.h>
#include <sound.h>
+#define AllowMove (1 << 0)
+#define AllowResize (1 << 1)
+
static CompMetadata soundeffectsMetadata;
static int displayPrivateIndex;
static int soundDisplayPrivateIndex;
+static unsigned int allowMask = 0;
static void soundeffectsWindowAddNotify( CompWindow *w )
{
@@ -42,8 +46,12 @@ static void soundeffectsWindowResizeNotify( CompWindow *w, int dx, int dy,
{
SOUND_SCREEN( w->screen );
SOUND_DISPLAY( w->screen->display );
-
- (*sd->soundPlayFile) ( w->screen->display, "resize.ogg" );
+
+ if ( allowMask & AllowResize )
+ {
+ (*sd->soundPlayFile) ( w->screen->display, "resize.ogg" );
+ allowMask &= ~AllowResize;
+ }
UNWRAP( ss, w->screen, windowResizeNotify );
(*w->screen->windowResizeNotify) ( w, dx, dy, dwidth, dheight );
@@ -56,19 +64,23 @@ static void soundeffectsWindowMoveNotify( CompWindow *w, int dx, int dy,
SOUND_SCREEN( w->screen );
SOUND_DISPLAY( w->screen->display );
- if ( !immediate && abs( dx ) >= abs( dy ) )
+ if ( allowMask & AllowMove )
{
- if ( dx > 0 )
- (*sd->soundPlayFile) ( w->screen->display, "moveright.ogg" );
+ if ( !immediate && abs( dx ) >= abs( dy ) )
+ {
+ if ( dx > 0 )
+ (*sd->soundPlayFile) ( w->screen->display, "moveright.ogg" );
+ else
+ (*sd->soundPlayFile) ( w->screen->display, "moveleft.ogg" );
+ }
else
- (*sd->soundPlayFile) ( w->screen->display, "moveleft.ogg" );
- }
- else
- {
- if ( dy > 0 )
- (*sd->soundPlayFile) ( w->screen->display, "movedown.ogg" );
- else
- (*sd->soundPlayFile) ( w->screen->display, "moveup.ogg" );
+ {
+ if ( dy > 0 )
+ (*sd->soundPlayFile) ( w->screen->display, "movedown.ogg" );
+ else
+ (*sd->soundPlayFile) ( w->screen->display, "moveup.ogg" );
+ }
+ allowMask &= ~AllowMove;
}
UNWRAP( ss, w->screen, windowMoveNotify );
@@ -81,9 +93,11 @@ static void soundeffectsWindowGrabNotify( CompWindow *w, int x, int y,
unsigned int mask )
{
SOUND_SCREEN( w->screen );
- SOUND_DISPLAY( w->screen->display );
- (*sd->soundPlayFile) ( w->screen->display, "grab.ogg" );
+ if ( mask & CompWindowGrabMoveMask )
+ allowMask |= AllowMove;
+ if ( mask & CompWindowGrabResizeMask )
+ allowMask |= AllowResize;
UNWRAP( ss, w->screen, windowGrabNotify );
(*w->screen->windowGrabNotify) ( w, x, y, state, mask );