summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/inputzoom.c
diff options
context:
space:
mode:
authoronestone <onestone@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-01-23 17:35:15 +0000
committeronestone <onestone@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-01-23 17:35:15 +0000
commit0b79d8013c347bd8a35a12e0b58d22186b666b56 (patch)
tree894334192954324744ba1f9345963b8952ce6687 /beryl-plugins/src/inputzoom.c
parent8f954c2a70edefd22e05aea2ce8fa8d7b00beb29 (diff)
downloadmarex-dev-0b79d8013c347bd8a35a12e0b58d22186b666b56.tar.gz
marex-dev-0b79d8013c347bd8a35a12e0b58d22186b666b56.tar.bz2
beryl-plugins: inputzoom:
- added zoom out on rotate/cube - fixed multiscreen issues git-svn-id: file:///beryl/trunk@3049 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/inputzoom.c')
-rw-r--r--beryl-plugins/src/inputzoom.c72
1 files changed, 53 insertions, 19 deletions
diff --git a/beryl-plugins/src/inputzoom.c b/beryl-plugins/src/inputzoom.c
index a04b1f9..ee2919b 100644
--- a/beryl-plugins/src/inputzoom.c
+++ b/beryl-plugins/src/inputzoom.c
@@ -66,6 +66,8 @@
#define ZOOM_HIDE_NORMAL_CURSOR_DEFAULT FALSE
#define ZOOM_SHOW_SCALED_CURSOR_DEFAULT TRUE
+#define ZOOM_OUT_ON_CUBE_DEFAULT FALSE
+
static int displayPrivateIndex;
#define ZOOM_DISPLAY_OPTION_IN 0
@@ -93,7 +95,8 @@ typedef struct _ZoomDisplay
#define ZOOM_SCREEN_OPTION_HIDE_NORMAL_CURSOR 5
#define ZOOM_SCREEN_OPTION_SHOW_SCALED_CURSOR 6
#define ZOOM_SCREEN_OPTION_MOUSE_UPDATE 7
-#define ZOOM_SCREEN_OPTION_NUM 8
+#define ZOOM_SCREEN_OPTION_OUT_ON_CUBE 8
+#define ZOOM_SCREEN_OPTION_NUM 9
typedef struct _CursorTexture
@@ -126,6 +129,7 @@ typedef struct _ZoomScreen
GLfloat currentScale;
GLfloat newScale;
+ GLfloat toScale;
GLfloat zVelocity;
@@ -143,8 +147,6 @@ typedef struct _ZoomScreen
Bool hideNormal;
float maxTranslate;
-
- int zoomLevelAtom;
} ZoomScreen;
#define GET_ZOOM_DISPLAY(d) \
@@ -305,6 +307,13 @@ zoomSetScreenOption(CompScreen * screen, char *name, CompOptionValue * value)
{
return TRUE;
}
+ break;
+ case ZOOM_SCREEN_OPTION_OUT_ON_CUBE:
+ if (compSetBoolOption(o, value))
+ {
+ return TRUE;
+ }
+ break;
default:
break;
}
@@ -420,6 +429,16 @@ static void zoomScreenInitOptions(ZoomScreen * zs)
o->rest.i.min = ZOOM_MOUSE_UPDATE_MIN;
o->rest.i.max = ZOOM_MOUSE_UPDATE_MAX;
+ o = &zs->opt[ZOOM_SCREEN_OPTION_OUT_ON_CUBE];
+ o->advanced = False;
+ o->name = "zoomout_on_cube";
+ o->group = N_("Misc. options");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Zoom out on cube");
+ o->longDesc = N_("Zoom out if the cube gets activated");
+ o->type = CompOptionTypeBool;
+ o->value.b = ZOOM_OUT_ON_CUBE_DEFAULT;
}
static CompOption *zoomGetScreenOptions(CompScreen * screen, int *count)
{
@@ -445,7 +464,7 @@ static int adjustZoomVelocity(ZoomScreen * zs)
{
float d, adjust, amount;
- d = (zs->newScale - zs->currentScale) * 75.0f;
+ d = (zs->toScale - zs->currentScale) * 75.0f;
adjust = d * 0.002f;
amount = fabs(d);
@@ -546,7 +565,11 @@ static void zoomPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
ZOOM_SCREEN(s);
ZOOM_DISPLAY(s->display);
- IPCS_SetFloat(IPCS_OBJECT(s),zs->zoomLevelAtom,zs->currentScale);
+ if (screenGrabExist (s, "rotate","cube",0) &&
+ zs->opt[ZOOM_SCREEN_OPTION_OUT_ON_CUBE].value.b)
+ zs->toScale = 1.0f;
+ else
+ zs->toScale = zs->newScale;
if (zs->active)
{
@@ -564,7 +587,7 @@ static void zoomPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
if (adjustZoomVelocity(zs))
{
- zs->currentScale = zs->newScale;
+ zs->currentScale = zs->toScale;
zs->zVelocity = 0.0f;
}
else
@@ -576,7 +599,8 @@ static void zoomPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
zs->xscale = zs->currentScale;
zs->yscale = zs->currentScale;
- if (zs->currentScale == 1.0f && zs->zVelocity == 0.0f)
+ if (zs->currentScale == 1.0f && zs->zVelocity == 0.0f &&
+ zs->newScale == 1.0)
{
zs->active = FALSE;
if (zs->mouseTimeout)
@@ -589,7 +613,8 @@ static void zoomPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
}
- if (zs->currentScale == 1.0f && zs->zVelocity == 0.0f)
+ if (zs->currentScale == 1.0f && zs->zVelocity == 0.0f &&
+ zs->newScale == 1.0)
{
zs->active = FALSE;
if (zs->mouseTimeout)
@@ -683,15 +708,26 @@ zoomPaintTransformedScreen(CompScreen * s, const ScreenPaintAttrib * sa,
r.rects = &r.extents;
r.numRects = 1;
- r.extents.x1 = zs->mouseX - (zs->mouseX / zs->xscale) +
- (s->outputDev[output].region.extents.x1 / zs->xscale);
- r.extents.y1 =
- zs->mouseY - (zs->mouseY / zs->yscale) +
- (s->outputDev[output].region.extents.y1 / zs->yscale);
- r.extents.x2 =
- r.extents.x1 + ceil(s->outputDev[output].width / zs->xscale) + 1;
- r.extents.y2 =
- r.extents.y1 + ceil(s->outputDev[output].height / zs->yscale) + 1;
+
+ if (screenGrabExist (s, "rotate","cube",0))
+ {
+ r.extents.x1 = zs->mouseX - (zs->mouseX / zs->xscale);
+ r.extents.y1 = zs->mouseY - (zs->mouseY / zs->yscale);
+ r.extents.x2 = r.extents.x1 + ceil(s->width / zs->xscale) + 1;
+ r.extents.y2 = r.extents.y1 + ceil(s->height / zs->yscale) + 1;
+ }
+ else
+ {
+ r.extents.x1 = zs->mouseX - (zs->mouseX / zs->xscale) +
+ (s->outputDev[output].region.extents.x1 / zs->xscale);
+ r.extents.y1 = zs->mouseY - (zs->mouseY / zs->yscale) +
+ (s->outputDev[output].region.extents.y1 / zs->yscale);
+ r.extents.x2 = r.extents.x1 +
+ ceil(s->outputDev[output].width / zs->xscale) + 1;
+ r.extents.y2 = r.extents.y1 +
+ ceil(s->outputDev[output].height / zs->yscale) + 1;
+ }
+
r.extents.x1 = MAX(0,r.extents.x1);
r.extents.y1 = MAX(0,r.extents.y1);
@@ -1064,8 +1100,6 @@ static Bool zoomInitScreen(CompPlugin * p, CompScreen * s)
zs->showScaled = ZOOM_SHOW_SCALED_CURSOR_DEFAULT;
zs->hideNormal = ZOOM_HIDE_NORMAL_CURSOR_DEFAULT;
- zs->zoomLevelAtom = IPCS_GetAtom(IPCS_OBJECT(s),IPCS_FLOAT,"ZOOM_LEVEL",TRUE);
-
return TRUE;
}