summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/wobbly.c
diff options
context:
space:
mode:
authorprofox <profox@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-11-02 23:01:55 +0000
committerprofox <profox@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-11-02 23:01:55 +0000
commit6fb05c9be7da9faeb66157fa060652128e4ad634 (patch)
treef0c8da7215a352510155f7695f8fc8f017bcbcb2 /beryl-plugins/src/wobbly.c
parent0b4458c84bd050fac7cd669fdb662ff31f24040c (diff)
downloadmarex-dev-6fb05c9be7da9faeb66157fa060652128e4ad634.tar.gz
marex-dev-6fb05c9be7da9faeb66157fa060652128e4ad634.tar.bz2
Wobbly: added the option to disable wobbly on window move, but keeping it
available for maximize e.g. and for other plugins (e.g. water wave) git-svn-id: file:///beryl/trunk@977 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/wobbly.c')
-rw-r--r--beryl-plugins/src/wobbly.c186
1 files changed, 100 insertions, 86 deletions
diff --git a/beryl-plugins/src/wobbly.c b/beryl-plugins/src/wobbly.c
index 94c051a..6ad3be6 100644
--- a/beryl-plugins/src/wobbly.c
+++ b/beryl-plugins/src/wobbly.c
@@ -208,6 +208,7 @@ static int ModMask[] = {
#define WOBBLY_SNAP_MODIFIERS_DEFAULT ShiftMask
#define WOBBLY_MAXIMIZE_EFFECT_DEFAULT TRUE
+#define WOBBLY_NOT_ON_WINDOW_MOVE_DEFAULT FALSE
static int displayPrivateIndex;
@@ -229,39 +230,40 @@ typedef struct _WobblyDisplay
Bool snapping;
} WobblyDisplay;
-#define WOBBLY_SCREEN_OPTION_MOVE_FRICTION 0
-#define WOBBLY_SCREEN_OPTION_MOVE_SPRING_K 1
-#define WOBBLY_SCREEN_OPTION_GRID_RESOLUTION 2
-#define WOBBLY_SCREEN_OPTION_MIN_GRID_SIZE 3
-#define WOBBLY_SCREEN_OPTION_MAP_EFFECT 4
-#define WOBBLY_SCREEN_OPTION_FOCUS_EFFECT 5
-#define WOBBLY_SCREEN_OPTION_MAP_WINDOW_TYPE 6
-#define WOBBLY_SCREEN_OPTION_FOCUS_WINDOW_TYPE 7
-#define WOBBLY_SCREEN_OPTION_GRAB_WINDOW_TYPE 8
-#define WOBBLY_SCREEN_OPTION_MOVE_WINDOW_TYPE 9
-#define WOBBLY_SCREEN_OPTION_MAXIMIZE_EFFECT 10
-#define WOBBLY_SCREEN_OPTION_MAP_FRICTION 11
-#define WOBBLY_SCREEN_OPTION_MAP_SPRING_K 12
-#define WOBBLY_SCREEN_OPTION_GRAB_FRICTION 13
-#define WOBBLY_SCREEN_OPTION_GRAB_SPRING_K 14
-#define WOBBLY_SCREEN_OPTION_FOCUS_FRICTION 15
-#define WOBBLY_SCREEN_OPTION_FOCUS_SPRING_K 16
-#define WOBBLY_SCREEN_OPTION_MAXIMIZE_FRICTION 17
-#define WOBBLY_SCREEN_OPTION_MAXIMIZE_SPRING_K 18
-#define WOBBLY_SCREEN_OPTION_BELL_FRICTION 19
-#define WOBBLY_SCREEN_OPTION_BELL_SPRING_K 20
-#define WOBBLY_SCREEN_OPTION_RELEASE_FRICTION 21
-#define WOBBLY_SCREEN_OPTION_RELEASE_SPRING_K 22
-#define WOBBLY_SCREEN_OPTION_USE_RELEASE 23
-#define WOBBLY_SCREEN_OPTION_URGENT_EFFECT 24
-#define WOBBLY_SCREEN_OPTION_URGENT_FRICTION 25
-#define WOBBLY_SCREEN_OPTION_URGENT_SPRING_K 26
-#define WOBBLY_SCREEN_OPTION_URGENT_VELOCITY 27
-#define WOBBLY_SCREEN_OPTION_URGENT_IN 28
-#define WOBBLY_SCREEN_OPTION_URGENT_UNIFORM 29
-#define WOBBLY_SCREEN_OPTION_EDGE_DISTANCE 30
-#define WOBBLY_SCREEN_OPTION_EDGE_VELOCITY 31
-#define WOBBLY_SCREEN_OPTION_NUM 32
+#define WOBBLY_SCREEN_OPTION_MOVE_FRICTION 0
+#define WOBBLY_SCREEN_OPTION_MOVE_SPRING_K 1
+#define WOBBLY_SCREEN_OPTION_GRID_RESOLUTION 2
+#define WOBBLY_SCREEN_OPTION_MIN_GRID_SIZE 3
+#define WOBBLY_SCREEN_OPTION_MAP_EFFECT 4
+#define WOBBLY_SCREEN_OPTION_FOCUS_EFFECT 5
+#define WOBBLY_SCREEN_OPTION_MAP_WINDOW_TYPE 6
+#define WOBBLY_SCREEN_OPTION_FOCUS_WINDOW_TYPE 7
+#define WOBBLY_SCREEN_OPTION_GRAB_WINDOW_TYPE 8
+#define WOBBLY_SCREEN_OPTION_MOVE_WINDOW_TYPE 9
+#define WOBBLY_SCREEN_OPTION_MAXIMIZE_EFFECT 10
+#define WOBBLY_SCREEN_OPTION_NOT_ON_WINDOW_MOVE 11
+#define WOBBLY_SCREEN_OPTION_MAP_FRICTION 12
+#define WOBBLY_SCREEN_OPTION_MAP_SPRING_K 13
+#define WOBBLY_SCREEN_OPTION_GRAB_FRICTION 14
+#define WOBBLY_SCREEN_OPTION_GRAB_SPRING_K 15
+#define WOBBLY_SCREEN_OPTION_FOCUS_FRICTION 16
+#define WOBBLY_SCREEN_OPTION_FOCUS_SPRING_K 17
+#define WOBBLY_SCREEN_OPTION_MAXIMIZE_FRICTION 18
+#define WOBBLY_SCREEN_OPTION_MAXIMIZE_SPRING_K 19
+#define WOBBLY_SCREEN_OPTION_BELL_FRICTION 20
+#define WOBBLY_SCREEN_OPTION_BELL_SPRING_K 21
+#define WOBBLY_SCREEN_OPTION_RELEASE_FRICTION 22
+#define WOBBLY_SCREEN_OPTION_RELEASE_SPRING_K 23
+#define WOBBLY_SCREEN_OPTION_USE_RELEASE 24
+#define WOBBLY_SCREEN_OPTION_URGENT_EFFECT 25
+#define WOBBLY_SCREEN_OPTION_URGENT_FRICTION 26
+#define WOBBLY_SCREEN_OPTION_URGENT_SPRING_K 27
+#define WOBBLY_SCREEN_OPTION_URGENT_VELOCITY 28
+#define WOBBLY_SCREEN_OPTION_URGENT_IN 29
+#define WOBBLY_SCREEN_OPTION_URGENT_UNIFORM 30
+#define WOBBLY_SCREEN_OPTION_EDGE_DISTANCE 31
+#define WOBBLY_SCREEN_OPTION_EDGE_VELOCITY 32
+#define WOBBLY_SCREEN_OPTION_NUM 33
typedef struct _WobblyScreen
{
@@ -443,6 +445,7 @@ wobblySetScreenOption (CompScreen * screen,
}
break;
case WOBBLY_SCREEN_OPTION_MAXIMIZE_EFFECT:
+ case WOBBLY_SCREEN_OPTION_NOT_ON_WINDOW_MOVE:
case WOBBLY_SCREEN_OPTION_USE_RELEASE:
case WOBBLY_SCREEN_OPTION_URGENT_EFFECT:
case WOBBLY_SCREEN_OPTION_URGENT_IN:
@@ -677,6 +680,14 @@ wobblyScreenInitOptions (WobblyScreen * ws)
o->type = CompOptionTypeBool;
o->value.b = WOBBLY_MAXIMIZE_EFFECT_DEFAULT;
+ o = &ws->opt[WOBBLY_SCREEN_OPTION_NOT_ON_WINDOW_MOVE];
+ o->name = "not_on_window_move";
+ o->shortDesc = N_("Don't wobble on window move");
+ o->longDesc =
+ N_("Don't wobble when moving windows");
+ o->type = CompOptionTypeBool;
+ o->value.b = WOBBLY_NOT_ON_WINDOW_MOVE_DEFAULT;
+
o = &ws->opt[WOBBLY_SCREEN_OPTION_BELL_FRICTION];
o->name = "visual_bell_friction";
o->shortDesc = "Visual Bell Friction";
@@ -3230,78 +3241,81 @@ wobblyWindowGrabNotify (CompWindow * w,
ws->grabMask = mask;
ws->grabWindow = w;
- if ((mask & CompWindowGrabButtonMask) &&
- (ws->moveWMask & w->type) && isWobblyWin (w))
+ if (!ws->opt[WOBBLY_SCREEN_OPTION_NOT_ON_WINDOW_MOVE].value.b)
{
- WOBBLY_WINDOW (w);
-
- if (wobblyEnsureModel (w))
+ if ((mask & CompWindowGrabButtonMask) &&
+ (ws->moveWMask & w->type) && isWobblyWin (w))
{
- Spring *s;
- int i;
-
- if (ws->opt[WOBBLY_SCREEN_OPTION_MAXIMIZE_EFFECT].value.b)
+ WOBBLY_WINDOW (w);
+
+ if (wobblyEnsureModel (w))
{
- if (w->state & MAXIMIZE_STATE)
+ Spring *s;
+ int i;
+
+ if (ws->opt[WOBBLY_SCREEN_OPTION_MAXIMIZE_EFFECT].value.b)
{
- modelAddEdgeAnchors (ww->model,
- WIN_X (w), WIN_Y (w),
- WIN_W (w), WIN_H (w));
+ if (w->state & MAXIMIZE_STATE)
+ {
+ modelAddEdgeAnchors (ww->model,
+ WIN_X (w), WIN_Y (w),
+ WIN_W (w), WIN_H (w));
+ }
+ else
+ {
+ modelRemoveEdgeAnchors (ww->model,
+ WIN_X (w), WIN_Y (w),
+ WIN_W (w), WIN_H (w));
+
+ if (ww->model->anchorObject)
+ ww->model->anchorObject->immobile = FALSE;
+ }
}
else
{
- modelRemoveEdgeAnchors (ww->model,
- WIN_X (w), WIN_Y (w),
- WIN_W (w), WIN_H (w));
-
if (ww->model->anchorObject)
ww->model->anchorObject->immobile = FALSE;
}
- }
- else
- {
- if (ww->model->anchorObject)
- ww->model->anchorObject->immobile = FALSE;
- }
- ww->model->anchorObject =
- modelFindNearestObject (ww->model, x, y);
- ww->model->anchorObject->immobile = TRUE;
+ ww->model->anchorObject =
+ modelFindNearestObject (ww->model, x, y);
+ ww->model->anchorObject->immobile = TRUE;
- ww->grabbed = TRUE;
-
- if (mask & CompWindowGrabMoveMask)
- {
- modelDisableSnapping (w, ww->model);
- if (wd->snapping)
- modelUpdateSnapping (w, ww->model);
- }
+ ww->grabbed = TRUE;
- if (ws->grabWMask & w->type)
- {
- for (i = 0; i < ww->model->numSprings; i++)
+ if (mask & CompWindowGrabMoveMask)
{
- s = &ww->model->springs[i];
+ modelDisableSnapping (w, ww->model);
+ if (wd->snapping)
+ modelUpdateSnapping (w, ww->model);
+ }
- if (s->a == ww->model->anchorObject)
- {
- s->b->velocity.x -= s->offset.x * 0.05f;
- s->b->velocity.y -= s->offset.y * 0.05f;
- }
- else if (s->b == ww->model->anchorObject)
+ if (ws->grabWMask & w->type)
+ {
+ for (i = 0; i < ww->model->numSprings; i++)
{
- s->a->velocity.x += s->offset.x * 0.05f;
- s->a->velocity.y += s->offset.y * 0.05f;
+ s = &ww->model->springs[i];
+
+ if (s->a == ww->model->anchorObject)
+ {
+ s->b->velocity.x -= s->offset.x * 0.05f;
+ s->b->velocity.y -= s->offset.y * 0.05f;
+ }
+ else if (s->b == ww->model->anchorObject)
+ {
+ s->a->velocity.x += s->offset.x * 0.05f;
+ s->a->velocity.y += s->offset.y * 0.05f;
+ }
}
- }
- ww->friction =
- ws->opt[WOBBLY_SCREEN_OPTION_GRAB_FRICTION].value.f;
- ww->spring_k =
- ws->opt[WOBBLY_SCREEN_OPTION_GRAB_SPRING_K].value.f;
+ ww->friction =
+ ws->opt[WOBBLY_SCREEN_OPTION_GRAB_FRICTION].value.f;
+ ww->spring_k =
+ ws->opt[WOBBLY_SCREEN_OPTION_GRAB_SPRING_K].value.f;
- ww->wobbly |= WobblyInitial;
- ws->wobblyWindows |= ww->wobbly;
+ ww->wobbly |= WobblyInitial;
+ ws->wobblyWindows |= ww->wobbly;
+ }
}
}
}