summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/rotate.c
diff options
context:
space:
mode:
authorkristian <kristian@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-10 15:26:45 +0000
committerkristian <kristian@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-10 15:26:45 +0000
commitd05218c5b36ebae5f23789c20a15ba621593cf9f (patch)
tree19c838874ad8cc1eb200302e4aa8082de6447308 /beryl-plugins/src/rotate.c
parent42aad3a3eb4ee011cff406082108ca4691ebc8ab (diff)
downloadmarex-dev-d05218c5b36ebae5f23789c20a15ba621593cf9f.tar.gz
marex-dev-d05218c5b36ebae5f23789c20a15ba621593cf9f.tar.bz2
Toggle wether the cube transparancy is active/inactive when snapped to top/bottom.
git-svn-id: file:///beryl/trunk@1650 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/rotate.c')
-rw-r--r--beryl-plugins/src/rotate.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/beryl-plugins/src/rotate.c b/beryl-plugins/src/rotate.c
index e249365..59f3055 100644
--- a/beryl-plugins/src/rotate.c
+++ b/beryl-plugins/src/rotate.c
@@ -246,6 +246,7 @@ typedef struct _RotateScreen {
CompWindow *grabWindow;
int previousRotationAtom;
+ int snapTopBottomAtom;
} RotateScreen;
#define GET_ROTATE_DISPLAY(d) \
@@ -510,7 +511,7 @@ static CompOption *rotateGetScreenOptions(CompScreen * screen, int *count)
}
-static int adjustVelocity(RotateScreen * rs, int size)
+static int adjustVelocity(CompScreen *s, RotateScreen * rs, int size)
{
float xrot, yrot, adjust, amount;
@@ -522,6 +523,7 @@ static int adjustVelocity(RotateScreen * rs, int size)
xrot = 360.0f / size + rs->xrot;
else if (rs->xrot > 180.0f / size)
xrot = rs->xrot - 360.0f / size;
+ IPCS_SetBool(IPCS_OBJECT (s), rs->snapTopBottomAtom, TRUE);
}
adjust =
@@ -542,12 +544,13 @@ static int adjustVelocity(RotateScreen * rs, int size)
if (rs->movingVert) {
yrot = rs->moveToY + (rs->yrot + rs->baseYrot);
} else {
- if (rs->snapTop && rs->yrot > 50.0f)
+ if (rs->snapTop && rs->yrot > 50.0f) {
yrot = -(90.f - rs->yrot);
- else if (rs->snapBottom && rs->yrot < -50.0f)
+ } else if (rs->snapBottom && rs->yrot < -50.0f) {
yrot = (90.0f + rs->yrot);
- else
+ } else {
yrot = rs->yrot;
+ }
}
adjust =
@@ -676,7 +679,7 @@ static void rotatePreparePaintScreen(CompScreen * s, int msSinceLastPaint)
rs->xVelocity = 0.0f;
if (fabs(rs->yVelocity) < 0.01f)
rs->yVelocity = 0.0f;
- } else if (adjustVelocity(rs, s->hsize)) {
+ } else if (adjustVelocity(s,rs, s->hsize)) {
rs->xVelocity = 0.0f;
rs->yVelocity = 0.0f;
@@ -977,6 +980,7 @@ rotateInitiate(CompDisplay * d,
s = findScreenAtDisplay(d, xid);
if (s) {
ROTATE_SCREEN(s);
+ IPCS_SetBool(IPCS_OBJECT (s), rs->snapTopBottomAtom, FALSE);
if (s->hsize < 2)
return FALSE;
@@ -1068,7 +1072,6 @@ rotateTerminate(CompDisplay * d,
Window xid;
xid = getIntOptionNamed(option, nOption, "root", 0);
-
for (s = d->screens; s; s = s->next) {
ROTATE_SCREEN(s);
@@ -2622,6 +2625,7 @@ o->shortDesc = str; \
ROTATE_INITIATEDESKTOP_MODIFIERS_DEFAULT;
o->value.action.button.button = ROTATE_INITIATEDESKTOP_BUTTON_DEFAULT;
+
}
static CompOption *rotateGetDisplayOptions(CompDisplay * display,
@@ -2729,6 +2733,8 @@ static Bool rotateInitScreen(CompPlugin * p, CompScreen * s)
rs->previousRotationAtom = IPCS_GetAtom(IPCS_OBJECT(s), IPCS_FLOAT,
"previous_rotation", TRUE);
+ rs->snapTopBottomAtom = IPCS_GetAtom(IPCS_OBJECT(s), IPCS_BOOL,
+ "cube_snap_top_bottom", TRUE);
rotateScreenInitOptions(rs);