summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-15 13:47:01 +0000
committermaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-15 13:47:01 +0000
commit5323952f9f16b80ac26d4086ce0f52d83301f215 (patch)
tree8e48991e0180b1b943795be06f4534ca125e62a1
parent0670dc3db606709080a998dd75c4a8892f1ae6ec (diff)
downloadmarex-dev-5323952f9f16b80ac26d4086ce0f52d83301f215.tar.gz
marex-dev-5323952f9f16b80ac26d4086ce0f52d83301f215.tar.bz2
wall plugin: added option for allowing wrap-around on viewport switching
git-svn-id: file:///beryl/trunk@4076 d7aaf104-2d23-0410-ae22-9d23157bf5a3
-rw-r--r--beryl-plugins/src/wall.c80
1 files changed, 71 insertions, 9 deletions
diff --git a/beryl-plugins/src/wall.c b/beryl-plugins/src/wall.c
index 94c70e5..296b86f 100644
--- a/beryl-plugins/src/wall.c
+++ b/beryl-plugins/src/wall.c
@@ -88,6 +88,7 @@ Known Bugs:
#define WALL_MIPMAPS_DEFAULT FALSE
#define WALL_ASPECT_DEFAULT 1.0f
#define WALL_MINISCREEN_DEFAULT FALSE
+#define WALL_ALLOW_WRAPAROUND_DEFAULT FALSE
#define WIN_X(w) ((w)->attrib.x - (w)->input.left)
#define WIN_Y(w) ((w)->attrib.y - (w)->input.top)
@@ -119,7 +120,8 @@ static int displayPrivateIndex;
#define WALL_DISPLAY_OPTION_ASPECT 18
#define WALL_DISPLAY_OPTION_MINISCREEN 19
#define WALL_DISPLAY_OPTION_PREVIEW_TIMEOUT 20
-#define WALL_DISPLAY_OPTION_NUM 21
+#define WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND 21
+#define WALL_DISPLAY_OPTION_NUM 22
/* Enums */
enum Direction
@@ -560,7 +562,13 @@ static Bool wallLeft(CompDisplay * d, CompAction * action,
CompActionState state, CompOption * option, int nOption)
{
GET_SCREEN;
- wallMoveViewport(s, 1, 0, None);
+ WALL_DISPLAY(d);
+
+ if (wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND].value.b && (s->x == 0))
+ wallMoveViewport(s, -(s->hsize - 1), 0, None);
+ else
+ wallMoveViewport(s, 1, 0, None);
+
return FALSE;
}
@@ -568,7 +576,13 @@ static Bool wallRight(CompDisplay * d, CompAction * action,
CompActionState state, CompOption * option, int nOption)
{
GET_SCREEN;
- wallMoveViewport(s, -1, 0, None);
+ WALL_DISPLAY(d);
+
+ if (wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND].value.b && (s->x == s->hsize - 1))
+ wallMoveViewport(s, s->hsize - 1, 0, None);
+ else
+ wallMoveViewport(s, -1, 0, None);
+
return FALSE;
}
@@ -576,7 +590,13 @@ static Bool wallUp(CompDisplay * d, CompAction * action,
CompActionState state, CompOption * option, int nOption)
{
GET_SCREEN;
- wallMoveViewport(s, 0, 1, None);
+ WALL_DISPLAY(d);
+
+ if (wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND].value.b && (s->y == 0))
+ wallMoveViewport(s, 0, -(s->vsize - 1), None);
+ else
+ wallMoveViewport(s, 0, 1, None);
+
return FALSE;
}
@@ -584,7 +604,13 @@ static Bool wallDown(CompDisplay * d, CompAction * action,
CompActionState state, CompOption * option, int nOption)
{
GET_SCREEN;
- wallMoveViewport(s, 0, -1, None);
+ WALL_DISPLAY(d);
+
+ if (wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND].value.b && (s->y == s->vsize - 1))
+ wallMoveViewport(s, 0, s->vsize - 1, None);
+ else
+ wallMoveViewport(s, 0, -1, None);
+
return FALSE;
}
@@ -594,7 +620,13 @@ static Bool wallLeftWithWindow (CompDisplay *d, CompAction * action,
{
GET_SCREEN;
Window win = getIntOptionNamed (option, nOption, "window", 0);
- wallMoveViewport (s, 1, 0, win);
+ WALL_DISPLAY(d);
+
+ if (wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND].value.b && (s->x == 0))
+ wallMoveViewport(s, -(s->hsize - 1), 0, win);
+ else
+ wallMoveViewport(s, 1, 0, win);
+
return FALSE;
}
@@ -604,7 +636,13 @@ static Bool wallRightWithWindow (CompDisplay *d, CompAction * action,
{
GET_SCREEN;
Window win = getIntOptionNamed (option, nOption, "window", 0);
- wallMoveViewport (s, -1, 0, win);
+ WALL_DISPLAY(d);
+
+ if (wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND].value.b && (s->x == s->hsize - 1))
+ wallMoveViewport(s, s->hsize - 1, 0, win);
+ else
+ wallMoveViewport(s, -1, 0, win);
+
return FALSE;
}
@@ -614,7 +652,13 @@ static Bool wallUpWithWindow (CompDisplay *d, CompAction * action,
{
GET_SCREEN;
Window win = getIntOptionNamed (option, nOption, "window", 0);
- wallMoveViewport (s, 0, 1, win);
+ WALL_DISPLAY(d);
+
+ if (wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND].value.b && (s->y == 0))
+ wallMoveViewport(s, 0, -(s->vsize - 1), win);
+ else
+ wallMoveViewport(s, 0, 1, win);
+
return FALSE;
}
@@ -624,7 +668,13 @@ static Bool wallDownWithWindow (CompDisplay *d, CompAction * action,
{
GET_SCREEN;
Window win = getIntOptionNamed (option, nOption, "window", 0);
- wallMoveViewport (s, 0, -1, win);
+ WALL_DISPLAY(d);
+
+ if (wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND].value.b && (s->y == s->vsize - 1))
+ wallMoveViewport(s, 0, s->vsize - 1, win);
+ else
+ wallMoveViewport(s, 0, -1, win);
+
return FALSE;
}
@@ -1980,6 +2030,17 @@ static void wallDisplayInitOptions(WallDisplay * wd)
o->rest.f.max = WALL_PREVIEW_TIMEOUT_MAX;
o->rest.f.min = WALL_PREVIEW_TIMEOUT_MIN;
o->rest.f.precision = WALL_PREVIEW_TIMEOUT_PRECISION;
+
+ o = &wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND];
+ o->advanced = False;
+ o->name = "allow_wraparound";
+ o->group = N_("Viewport Switching");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Allow wrap-around");
+ o->longDesc = N_("Allow wrap-around when moving the wall up/down/left/right");
+ o->type = CompOptionTypeBool;
+ o->value.b = WALL_ALLOW_WRAPAROUND_DEFAULT;
}
static CompOption *wallGetDisplayOptions(CompDisplay * d, int *count)
@@ -2035,6 +2096,7 @@ wallSetDisplayOption(CompDisplay * d, char *name, CompOptionValue * value)
case WALL_DISPLAY_OPTION_ROTATE:
case WALL_DISPLAY_OPTION_MIPMAPS:
case WALL_DISPLAY_OPTION_MINISCREEN:
+ case WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND:
if (compSetBoolOption(o, value))
return TRUE;
break;