summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/move.c
diff options
context:
space:
mode:
authormaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-11-07 12:13:34 +0000
committermaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-11-07 12:13:34 +0000
commitcca73223130b02296990bd3e66339abb7f425a82 (patch)
treead378efaa2b72e0ad7004d274a27526e16c18b95 /beryl-plugins/src/move.c
parent7bd7edd46b665cc7cf5f7c9cd281b62514593466 (diff)
downloadmarex-dev-cca73223130b02296990bd3e66339abb7f425a82.tar.gz
marex-dev-cca73223130b02296990bd3e66339abb7f425a82.tar.bz2
move plugin:
- made options for snapoff and snapback distance - remove some unneeded code git-svn-id: file:///beryl/trunk@1068 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/move.c')
-rw-r--r--beryl-plugins/src/move.c57
1 files changed, 41 insertions, 16 deletions
diff --git a/beryl-plugins/src/move.c b/beryl-plugins/src/move.c
index fa29f0a..040c937 100644
--- a/beryl-plugins/src/move.c
+++ b/beryl-plugins/src/move.c
@@ -50,6 +50,14 @@
#define MOVE_OPACIFY_MIN_OPACITY_MIN 1
#define MOVE_OPACIFY_MIN_OPACITY_MAX 100
+#define MOVE_SNAPOFF_DISTANCE_DEFAULT 100
+#define MOVE_SNAPOFF_DISTANCE_MIN 1
+#define MOVE_SNAPOFF_DISTANCE_MAX 300
+
+#define MOVE_SNAPBACK_DISTANCE_DEFAULT 20
+#define MOVE_SNAPBACK_DISTANCE_MIN 1
+#define MOVE_SNAPBACK_DISTANCE_MAX 100
+
struct _MoveKeys
{
char *name;
@@ -71,9 +79,6 @@ struct _MoveKeys
#define KEY_MOVE_INC 24
-#define SNAP_BACK 20
-#define SNAP_OFF 100
-
static int displayPrivateIndex;
#define MOVE_DISPLAY_OPTION_INITIATE 0
@@ -82,7 +87,9 @@ static int displayPrivateIndex;
#define MOVE_DISPLAY_OPTION_CONSTRAIN_Y_BOTTOM 3
#define MOVE_DISPLAY_OPTION_SNAPOFF_MAXIMIZED 4
#define MOVE_DISPLAY_OPTION_OPACIFY_MIN_OPACITY 5
-#define MOVE_DISPLAY_OPTION_NUM 6
+#define MOVE_DISPLAY_OPTION_SNAPOFF_DISTANCE 6
+#define MOVE_DISPLAY_OPTION_SNAPBACK_DISTANCE 7
+#define MOVE_DISPLAY_OPTION_NUM 8
typedef struct _MoveDisplay
{
@@ -174,9 +181,6 @@ moveInitiate (CompDisplay * d,
md->x = 0;
md->y = 0;
- d->lastPointerX = x;
- d->lastPointerY = y;
-
ms->origState = w->state;
ms->snapBackY = w->serverY;
@@ -286,7 +290,6 @@ moveHandleMotionEvent (CompScreen * s, int xRoot, int yRoot)
if (w->attrib.y + dy > max)
dy = max - w->attrib.y;
}
- /*if (md->opt[MOVE_DISPLAY_OPTION_CONSTRAIN_Y_BOTTOM].value.b)*/
if (!w->shaded && md->opt[MOVE_DISPLAY_OPTION_CONSTRAIN_Y_BOTTOM].value.b)
{
if (w->attrib.y + dy + w->serverHeight > max)
@@ -297,7 +300,8 @@ moveHandleMotionEvent (CompScreen * s, int xRoot, int yRoot)
{
if (w->state & CompWindowStateMaximizedVertMask)
{
- if (yRoot - ms->snapOffY >= SNAP_OFF)
+ if (yRoot - ms->snapOffY >=
+ md->opt[MOVE_DISPLAY_OPTION_SNAPOFF_DISTANCE].value.i)
{
int width = w->serverWidth;
@@ -320,7 +324,8 @@ moveHandleMotionEvent (CompScreen * s, int xRoot, int yRoot)
}
else if (ms->origState & CompWindowStateMaximizedVertMask)
{
- if (yRoot - ms->snapBackY < SNAP_BACK)
+ if (yRoot - ms->snapBackY <
+ md->opt[MOVE_DISPLAY_OPTION_SNAPBACK_DISTANCE].value.i)
{
if (!otherScreenGrabExist (s, "move", 0))
{
@@ -622,6 +627,26 @@ moveDisplayInitOptions (MoveDisplay * md)
"when dragging");
o->type = CompOptionTypeBool;
o->value.b = MOVE_SNAPOFF_MAXIMIZED_DEFAULT;
+
+ o = &md->opt[MOVE_DISPLAY_OPTION_SNAPOFF_DISTANCE];
+ o->name = "snapoff_distance";
+ o->shortDesc = N_("Snapoff distance");
+ o->longDesc =
+ N_("Pointer movement distance after which window is snapped off");
+ o->type = CompOptionTypeInt;
+ o->value.i = MOVE_SNAPOFF_DISTANCE_DEFAULT;
+ o->rest.i.min = MOVE_SNAPOFF_DISTANCE_MIN;
+ o->rest.i.max = MOVE_SNAPOFF_DISTANCE_MAX;
+
+ o = &md->opt[MOVE_DISPLAY_OPTION_SNAPBACK_DISTANCE];
+ o->name = "snapback_distance";
+ o->shortDesc = N_("Snapback distance");
+ o->longDesc =
+ N_("Pointer movement distance to snap window back");
+ o->type = CompOptionTypeInt;
+ o->value.i = MOVE_SNAPBACK_DISTANCE_DEFAULT;
+ o->rest.i.min = MOVE_SNAPBACK_DISTANCE_MIN;
+ o->rest.i.max = MOVE_SNAPBACK_DISTANCE_MAX;
}
static CompOption *
@@ -676,17 +701,17 @@ moveSetDisplayOption (CompDisplay * display,
return TRUE;
}
break;
+ case MOVE_DISPLAY_OPTION_SNAPOFF_DISTANCE:
+ case MOVE_DISPLAY_OPTION_SNAPBACK_DISTANCE:
+ if (compSetIntOption (o, value))
+ return TRUE;
+ break;
case MOVE_DISPLAY_OPTION_CONSTRAIN_Y_TOP:
- if (compSetBoolOption (o, value))
- return TRUE;
- break;
case MOVE_DISPLAY_OPTION_CONSTRAIN_Y_BOTTOM:
- if (compSetBoolOption (o, value))
- return TRUE;
- break;
case MOVE_DISPLAY_OPTION_SNAPOFF_MAXIMIZED:
if (compSetBoolOption (o, value))
return TRUE;
+ break;
default:
break;
}