summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/inputzoom.c
diff options
context:
space:
mode:
authorkristian <kristian@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-02 16:26:33 +0000
committerkristian <kristian@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-02 16:26:33 +0000
commitc31c5e2d5c6b525350c2f807095f8b2819a59bd5 (patch)
treead9bf35f3a435cdb444fff636424005fb608b4ce /beryl-plugins/src/inputzoom.c
parentd85d0131318217e03b20d15639fced7af7957eb5 (diff)
downloadmarex-dev-c31c5e2d5c6b525350c2f807095f8b2819a59bd5.tar.gz
marex-dev-c31c5e2d5c6b525350c2f807095f8b2819a59bd5.tar.bz2
indent -i8 -kr . All whitespace-changes.
See man indent for details of what -kr does. git-svn-id: file:///beryl/trunk@1499 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/inputzoom.c')
-rw-r--r--beryl-plugins/src/inputzoom.c1270
1 files changed, 622 insertions, 648 deletions
diff --git a/beryl-plugins/src/inputzoom.c b/beryl-plugins/src/inputzoom.c
index 5f828d1..d9ca8e4 100644
--- a/beryl-plugins/src/inputzoom.c
+++ b/beryl-plugins/src/inputzoom.c
@@ -68,17 +68,16 @@ static int displayPrivateIndex;
#define ZOOM_DISPLAY_OPTION_OUT 1
#define ZOOM_DISPLAY_OPTION_NUM 2
-typedef struct _ZoomDisplay
-{
- int screenPrivateIndex;
- HandleEventProc handleEvent;
+typedef struct _ZoomDisplay {
+ int screenPrivateIndex;
+ HandleEventProc handleEvent;
Bool fixesSupported;
int fixesEventBase;
int fixesErrorBase;
Bool canHideCursor;
- CompOption opt[ZOOM_DISPLAY_OPTION_NUM];
+ CompOption opt[ZOOM_DISPLAY_OPTION_NUM];
} ZoomDisplay;
#define ZOOM_SCREEN_OPTION_SPEED 0
@@ -90,8 +89,7 @@ typedef struct _ZoomDisplay
#define ZOOM_SCREEN_OPTION_SHOW_SCALED_CURSOR 6
#define ZOOM_SCREEN_OPTION_NUM 7
-typedef struct _CursorTexture
-{
+typedef struct _CursorTexture {
Bool isSet;
GLuint texture;
int width;
@@ -100,31 +98,30 @@ typedef struct _CursorTexture
int hotY;
} CursorTexture;
-typedef struct _ZoomScreen
-{
- PreparePaintScreenProc preparePaintScreen;
- DonePaintScreenProc donePaintScreen;
- PaintScreenProc paintScreen;
- PaintTransformedScreenProc paintTransformedScreen;
- SetScreenOptionForPluginProc setScreenOptionForPlugin;
+typedef struct _ZoomScreen {
+ PreparePaintScreenProc preparePaintScreen;
+ DonePaintScreenProc donePaintScreen;
+ PaintScreenProc paintScreen;
+ PaintTransformedScreenProc paintTransformedScreen;
+ SetScreenOptionForPluginProc setScreenOptionForPlugin;
ApplyScreenTransformProc applyScreenTransform;
- CompOption opt[ZOOM_SCREEN_OPTION_NUM];
+ CompOption opt[ZOOM_SCREEN_OPTION_NUM];
- float speed;
- float step;
- float timestep;
- float maxScale;
+ float speed;
+ float step;
+ float timestep;
+ float maxScale;
- GLfloat currentScale;
- GLfloat newScale;
+ GLfloat currentScale;
+ GLfloat newScale;
- GLfloat zVelocity;
+ GLfloat zVelocity;
GLfloat xscale;
GLfloat yscale;
- Bool active;
+ Bool active;
CursorTexture cursor;
int mouseX;
@@ -134,7 +131,7 @@ typedef struct _ZoomScreen
Bool showScaled;
Bool hideNormal;
- float maxTranslate;
+ float maxTranslate;
} ZoomScreen;
#define GET_ZOOM_DISPLAY(d) \
@@ -151,24 +148,24 @@ typedef struct _ZoomScreen
#define NUM_OPTIONS(s) (sizeof ((s)->opt) / sizeof (CompOption))
-static void
-updateCursor (Display *dpy,CursorTexture * cursor)
+static void updateCursor(Display * dpy, CursorTexture * cursor)
{
- glEnable (GL_TEXTURE_RECTANGLE_ARB);
- if (!cursor->isSet)
- {
+ glEnable(GL_TEXTURE_RECTANGLE_ARB);
+ if (!cursor->isSet) {
cursor->isSet = TRUE;
- glGenTextures (1, &cursor->texture);
- glBindTexture (GL_TEXTURE_RECTANGLE_ARB, cursor->texture);
- glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER,
- GL_LINEAR);
- glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER,
- GL_LINEAR);
- glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP);
- glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP);
+ glGenTextures(1, &cursor->texture);
+ glBindTexture(GL_TEXTURE_RECTANGLE_ARB, cursor->texture);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,
+ GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,
+ GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,
+ GL_TEXTURE_WRAP_S, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,
+ GL_TEXTURE_WRAP_T, GL_CLAMP);
}
- XFixesCursorImage * ci = XFixesGetCursorImage(dpy);
+ XFixesCursorImage *ci = XFixesGetCursorImage(dpy);
cursor->width = ci->width;
cursor->height = ci->height;
cursor->hotX = ci->xhot;
@@ -176,8 +173,7 @@ updateCursor (Display *dpy,CursorTexture * cursor)
unsigned char *pixels = malloc(ci->width * ci->height * 4);
int i;
- for (i = 0; i < ci->width * ci->height; i++)
- {
+ for (i = 0; i < ci->width * ci->height; i++) {
unsigned long pix = ci->pixels[i];
pixels[i * 4] = pix & 0xff;
pixels[(i * 4) + 1] = (pix >> 8) & 0xff;
@@ -185,767 +181,746 @@ updateCursor (Display *dpy,CursorTexture * cursor)
pixels[(i * 4) + 3] = (pix >> 24) & 0xff;
}
- glBindTexture (GL_TEXTURE_RECTANGLE_ARB, cursor->texture);
- glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0 , GL_RGBA, cursor->width, cursor->height,
- 0, GL_BGRA, GL_UNSIGNED_BYTE, pixels);
- glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
- glDisable (GL_TEXTURE_RECTANGLE_ARB);
- XFree (ci);
- free (pixels);
+ glBindTexture(GL_TEXTURE_RECTANGLE_ARB, cursor->texture);
+ glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, cursor->width,
+ cursor->height, 0, GL_BGRA, GL_UNSIGNED_BYTE, pixels);
+ glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
+ glDisable(GL_TEXTURE_RECTANGLE_ARB);
+ XFree(ci);
+ free(pixels);
}
-static void
-freeCursor (CursorTexture * cursor)
+static void freeCursor(CursorTexture * cursor)
{
if (!cursor->isSet)
return;
cursor->isSet = FALSE;
- glDeleteTextures (1, &cursor->texture);
+ glDeleteTextures(1, &cursor->texture);
cursor->texture = 0;
}
-static void
-zoomHandleEvent (CompDisplay * d, XEvent * event)
+static void zoomHandleEvent(CompDisplay * d, XEvent * event)
{
- CompScreen *s;
+ CompScreen *s;
- ZOOM_DISPLAY (d);
+ ZOOM_DISPLAY(d);
- if (event->type == zd->fixesEventBase + XFixesCursorNotify)
- {
- XFixesCursorNotifyEvent *cev = (XFixesCursorNotifyEvent *) event;
- s = findScreenAtDisplay (d, cev->window);
- if (s)
- {
+ if (event->type == zd->fixesEventBase + XFixesCursorNotify) {
+ XFixesCursorNotifyEvent *cev =
+ (XFixesCursorNotifyEvent *) event;
+ s = findScreenAtDisplay(d, cev->window);
+ if (s) {
ZOOM_SCREEN(s);
if (zs->cursor.isSet)
- updateCursor (d->display, &zs->cursor);
+ updateCursor(d->display, &zs->cursor);
}
}
- UNWRAP (zd, d, handleEvent);
- (*d->handleEvent) (d, event);
- WRAP (zd, d, handleEvent, zoomHandleEvent);
+ UNWRAP(zd, d, handleEvent);
+ (*d->handleEvent) (d, event);
+ WRAP(zd, d, handleEvent, zoomHandleEvent);
}
static Bool
-zoomSetScreenOption (CompScreen * screen, char *name, CompOptionValue * value)
+zoomSetScreenOption(CompScreen * screen, char *name,
+ CompOptionValue * value)
{
- CompOption *o;
- int index;
+ CompOption *o;
+ int index;
- ZOOM_SCREEN (screen);
+ ZOOM_SCREEN(screen);
- o = compFindOption (zs->opt, NUM_OPTIONS (zs), name, &index);
- if (!o)
- return FALSE;
+ o = compFindOption(zs->opt, NUM_OPTIONS(zs), name, &index);
+ if (!o)
+ return FALSE;
- switch (index)
- {
+ switch (index) {
case ZOOM_SCREEN_OPTION_STEP:
- if (compSetFloatOption (o, value))
- {
- zs->step = o->value.f;
- return TRUE;
- }
- break;
- case ZOOM_SCREEN_OPTION_MAX_FACTOR:
- if (compSetFloatOption (o, value))
- {
- zs->maxScale = o->value.f;
- return TRUE;
- }
- break;
- case ZOOM_SCREEN_OPTION_SPEED:
- if (compSetFloatOption (o, value))
- {
- zs->speed = o->value.f;
- return TRUE;
- }
- break;
- case ZOOM_SCREEN_OPTION_TIMESTEP:
- if (compSetFloatOption (o, value))
- {
- zs->timestep = o->value.f;
- return TRUE;
- }
- break;
- case ZOOM_SCREEN_OPTION_FILTER_LINEAR:
- if (compSetBoolOption (o, value))
- return TRUE;
+ if (compSetFloatOption(o, value)) {
+ zs->step = o->value.f;
+ return TRUE;
+ }
+ break;
+ case ZOOM_SCREEN_OPTION_MAX_FACTOR:
+ if (compSetFloatOption(o, value)) {
+ zs->maxScale = o->value.f;
+ return TRUE;
+ }
+ break;
+ case ZOOM_SCREEN_OPTION_SPEED:
+ if (compSetFloatOption(o, value)) {
+ zs->speed = o->value.f;
+ return TRUE;
+ }
+ break;
+ case ZOOM_SCREEN_OPTION_TIMESTEP:
+ if (compSetFloatOption(o, value)) {
+ zs->timestep = o->value.f;
+ return TRUE;
+ }
+ break;
+ case ZOOM_SCREEN_OPTION_FILTER_LINEAR:
+ if (compSetBoolOption(o, value))
+ return TRUE;
case ZOOM_SCREEN_OPTION_HIDE_NORMAL_CURSOR:
- if (compSetBoolOption (o, value))
- {
- zs->hideNormal = o->value.b;
- return TRUE;
- }
- break;
+ if (compSetBoolOption(o, value)) {
+ zs->hideNormal = o->value.b;
+ return TRUE;
+ }
+ break;
case ZOOM_SCREEN_OPTION_SHOW_SCALED_CURSOR:
- if (compSetBoolOption (o, value))
- {
- zs->showScaled = o->value.b;
- return TRUE;
- }
- break;
- default:
- break;
- }
-
- return FALSE;
+ if (compSetBoolOption(o, value)) {
+ zs->showScaled = o->value.b;
+ return TRUE;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return FALSE;
}
-static void
-zoomScreenInitOptions (ZoomScreen * zs)
+static void zoomScreenInitOptions(ZoomScreen * zs)
{
- CompOption *o;
-
- o = &zs->opt[ZOOM_SCREEN_OPTION_SPEED];
- o->name = "speed";
- o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Speed");
- o->longDesc = N_("Zoom Speed");
- o->type = CompOptionTypeFloat;
- o->value.f = ZOOM_SPEED_DEFAULT;
- o->rest.f.min = ZOOM_SPEED_MIN;
- o->rest.f.max = ZOOM_SPEED_MAX;
- o->rest.f.precision = ZOOM_SPEED_PRECISION;
-
- o = &zs->opt[ZOOM_SCREEN_OPTION_STEP];
- o->name = "step";
- o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Step");
- o->longDesc =
- N_
- ("Zoomfactor multiplicator for amount of zooming in each zoomIn / zoomOut");
- o->type = CompOptionTypeFloat;
- o->value.f = ZOOM_STEP_DEFAULT;
- o->rest.f.min = ZOOM_STEP_MIN;
- o->rest.f.max = ZOOM_STEP_MAX;
- o->rest.f.precision = ZOOM_STEP_PRECISION;
-
- o = &zs->opt[ZOOM_SCREEN_OPTION_MAX_FACTOR];
- o->name = "max";
- o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Maximum Zoom");
- o->longDesc = N_("Maximum Zoom Factor");
- o->type = CompOptionTypeFloat;
- o->value.f = ZOOM_MAX_FACTOR_DEFAULT;
- o->rest.f.min = ZOOM_MAX_FACTOR_MIN;
- o->rest.f.max = ZOOM_MAX_FACTOR_MAX;
- o->rest.f.precision = ZOOM_MAX_FACTOR_PRECISION;
-
- o = &zs->opt[ZOOM_SCREEN_OPTION_TIMESTEP];
- o->name = "timestep";
- o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Timestep");
- o->longDesc = N_("Zoom Timestep");
- o->type = CompOptionTypeFloat;
- o->value.f = ZOOM_TIMESTEP_DEFAULT;
- o->rest.f.min = ZOOM_TIMESTEP_MIN;
- o->rest.f.max = ZOOM_TIMESTEP_MAX;
- o->rest.f.precision = ZOOM_TIMESTEP_PRECISION;
-
- o = &zs->opt[ZOOM_SCREEN_OPTION_FILTER_LINEAR];
- o->name = "filter_linear";
- o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Filter Linear");
- o->longDesc = N_("Use linear filter when zoomed in");
- o->type = CompOptionTypeBool;
- o->value.b = ZOOM_FILTER_LINEAR_DEFAULT;
+ CompOption *o;
+
+ o = &zs->opt[ZOOM_SCREEN_OPTION_SPEED];
+ o->name = "speed";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Speed");
+ o->longDesc = N_("Zoom Speed");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ZOOM_SPEED_DEFAULT;
+ o->rest.f.min = ZOOM_SPEED_MIN;
+ o->rest.f.max = ZOOM_SPEED_MAX;
+ o->rest.f.precision = ZOOM_SPEED_PRECISION;
+
+ o = &zs->opt[ZOOM_SCREEN_OPTION_STEP];
+ o->name = "step";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Step");
+ o->longDesc =
+ N_
+ ("Zoomfactor multiplicator for amount of zooming in each zoomIn / zoomOut");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ZOOM_STEP_DEFAULT;
+ o->rest.f.min = ZOOM_STEP_MIN;
+ o->rest.f.max = ZOOM_STEP_MAX;
+ o->rest.f.precision = ZOOM_STEP_PRECISION;
+
+ o = &zs->opt[ZOOM_SCREEN_OPTION_MAX_FACTOR];
+ o->name = "max";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Maximum Zoom");
+ o->longDesc = N_("Maximum Zoom Factor");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ZOOM_MAX_FACTOR_DEFAULT;
+ o->rest.f.min = ZOOM_MAX_FACTOR_MIN;
+ o->rest.f.max = ZOOM_MAX_FACTOR_MAX;
+ o->rest.f.precision = ZOOM_MAX_FACTOR_PRECISION;
+
+ o = &zs->opt[ZOOM_SCREEN_OPTION_TIMESTEP];
+ o->name = "timestep";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Timestep");
+ o->longDesc = N_("Zoom Timestep");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ZOOM_TIMESTEP_DEFAULT;
+ o->rest.f.min = ZOOM_TIMESTEP_MIN;
+ o->rest.f.max = ZOOM_TIMESTEP_MAX;
+ o->rest.f.precision = ZOOM_TIMESTEP_PRECISION;
+
+ o = &zs->opt[ZOOM_SCREEN_OPTION_FILTER_LINEAR];
+ o->name = "filter_linear";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Filter Linear");
+ o->longDesc = N_("Use linear filter when zoomed in");
+ o->type = CompOptionTypeBool;
+ o->value.b = ZOOM_FILTER_LINEAR_DEFAULT;
o = &zs->opt[ZOOM_SCREEN_OPTION_HIDE_NORMAL_CURSOR];
- o->name = "hide_normal";
- o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Hide normal cursor");
- o->longDesc = N_("Hide normal cursor during zoom");
- o->type = CompOptionTypeBool;
- o->value.b = ZOOM_HIDE_NORMAL_CURSOR_DEFAULT;
+ o->name = "hide_normal";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Hide normal cursor");
+ o->longDesc = N_("Hide normal cursor during zoom");
+ o->type = CompOptionTypeBool;
+ o->value.b = ZOOM_HIDE_NORMAL_CURSOR_DEFAULT;
o = &zs->opt[ZOOM_SCREEN_OPTION_SHOW_SCALED_CURSOR];
- o->name = "show_scaled";
- o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Show scaled cursor");
- o->longDesc = N_("Show scaled cursor during zoom");
- o->type = CompOptionTypeBool;
- o->value.b = ZOOM_SHOW_SCALED_CURSOR_DEFAULT;
+ o->name = "show_scaled";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Show scaled cursor");
+ o->longDesc = N_("Show scaled cursor during zoom");
+ o->type = CompOptionTypeBool;
+ o->value.b = ZOOM_SHOW_SCALED_CURSOR_DEFAULT;
}
-static CompOption *
-zoomGetScreenOptions (CompScreen * screen, int *count)
+static CompOption *zoomGetScreenOptions(CompScreen * screen, int *count)
{
- if (screen)
- {
- ZOOM_SCREEN (screen);
-
- *count = NUM_OPTIONS (zs);
- return zs->opt;
- }
- else
- {
- ZoomScreen * zs = malloc(sizeof(ZoomScreen));
- zoomScreenInitOptions(zs);
- *count = NUM_OPTIONS (zs);
- return zs->opt;
- }
+ if (screen) {
+ ZOOM_SCREEN(screen);
+
+ *count = NUM_OPTIONS(zs);
+ return zs->opt;
+ } else {
+ ZoomScreen *zs = malloc(sizeof(ZoomScreen));
+ zoomScreenInitOptions(zs);
+ *count = NUM_OPTIONS(zs);
+ return zs->opt;
+ }
}
-static int
-adjustZoomVelocity (ZoomScreen * zs)
+static int adjustZoomVelocity(ZoomScreen * zs)
{
- float d, adjust, amount;
+ float d, adjust, amount;
- d = (zs->newScale - zs->currentScale) * 75.0f;
+ d = (zs->newScale - zs->currentScale) * 75.0f;
- adjust = d * 0.002f;
- amount = fabs (d);
- if (amount < 1.0f)
- amount = 1.0f;
- else if (amount > 5.0f)
- amount = 5.0f;
+ adjust = d * 0.002f;
+ amount = fabs(d);
+ if (amount < 1.0f)
+ amount = 1.0f;
+ else if (amount > 5.0f)
+ amount = 5.0f;
- zs->zVelocity = (amount * zs->zVelocity + adjust) / (amount + 1.0f);
+ zs->zVelocity =
+ (amount * zs->zVelocity + adjust) / (amount + 1.0f);
- return (fabs (d) < 0.1f && fabs (zs->zVelocity) < 0.005f);
+ return (fabs(d) < 0.1f && fabs(zs->zVelocity) < 0.005f);
}
static void
-zoomApplyScreenTransform (CompScreen *s,
- const ScreenPaintAttrib *sAttrib,
- int output)
+zoomApplyScreenTransform(CompScreen * s,
+ const ScreenPaintAttrib * sAttrib, int output)
{
- ZOOM_SCREEN (s);
-
- UNWRAP (zs, s, applyScreenTransform);
- (*s->applyScreenTransform) (s, sAttrib, output);
- WRAP (zs, s, applyScreenTransform, zoomApplyScreenTransform);
-
- Bool *pCaps = (Bool *) IPCS_GetVPtrND (IPCS_OBJECT(s),
- "cube_painting_caps_bool_ptr", NULL);
- if (zs->active && (!pCaps || !(*pCaps)))
- {
- float tx = zs->mouseX - (s->outputDev[output].region.extents.x1 +
- (s->outputDev[output].width / 2.0));
- float ty = zs->mouseY - (s->outputDev[output].region.extents.y1 +
- (s->outputDev[output].height / 2.0));
+ ZOOM_SCREEN(s);
+
+ UNWRAP(zs, s, applyScreenTransform);
+ (*s->applyScreenTransform) (s, sAttrib, output);
+ WRAP(zs, s, applyScreenTransform, zoomApplyScreenTransform);
+
+ Bool *pCaps = (Bool *) IPCS_GetVPtrND(IPCS_OBJECT(s),
+ "cube_painting_caps_bool_ptr",
+ NULL);
+ if (zs->active && (!pCaps || !(*pCaps))) {
+ float tx =
+ zs->mouseX - (s->outputDev[output].region.extents.x1 +
+ (s->outputDev[output].width / 2.0));
+ float ty =
+ zs->mouseY - (s->outputDev[output].region.extents.y1 +
+ (s->outputDev[output].height / 2.0));
tx /= s->outputDev[output].width;
tx = -(tx * (zs->xscale - 1));
ty /= s->outputDev[output].height;
ty = ty * (zs->yscale - 1);
- glTranslatef (tx, ty, 0.0f);
- glScalef ( zs->xscale, zs->yscale, 1.0f);
+ glTranslatef(tx, ty, 0.0f);
+ glScalef(zs->xscale, zs->yscale, 1.0f);
}
}
-static void
-zoomPreparePaintScreen (CompScreen * s, int msSinceLastPaint)
+static void zoomPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
{
- ZOOM_SCREEN (s);
- ZOOM_DISPLAY (s->display);
-
- if (zs->active)
- {
- int steps;
- float amount, chunk;
-
- amount = msSinceLastPaint * 0.05f * zs->speed;
- steps = amount / (0.5f * zs->timestep);
- if (!steps)
- steps = 1;
- chunk = amount / (float)steps;
-
- while (steps--)
- {
-
- if (adjustZoomVelocity (zs))
- {
- zs->currentScale = zs->newScale;
- zs->zVelocity = 0.0f;
- }
- else
- {
- zs->currentScale += (zs->zVelocity * msSinceLastPaint) /
- s->redrawTime;
- }
+ ZOOM_SCREEN(s);
+ ZOOM_DISPLAY(s->display);
+
+ if (zs->active) {
+ int steps;
+ float amount, chunk;
+
+ amount = msSinceLastPaint * 0.05f * zs->speed;
+ steps = amount / (0.5f * zs->timestep);
+ if (!steps)
+ steps = 1;
+ chunk = amount / (float) steps;
+
+ while (steps--) {
+
+ if (adjustZoomVelocity(zs)) {
+ zs->currentScale = zs->newScale;
+ zs->zVelocity = 0.0f;
+ } else {
+ zs->currentScale +=
+ (zs->zVelocity * msSinceLastPaint) /
+ s->redrawTime;
+ }
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->active = FALSE;
break;
- }
+ }
- }
- int winX,winY;
+ }
+ int winX, winY;
unsigned int mask_return;
Window root_return;
Window child_return;
- if (!otherScreenGrabExist (s, "scale", "switcher", "move", "resize", 0))
- {
- XQueryPointer(s->display->display, s->root, &root_return,
- &child_return, &zs->mouseX, &zs->mouseY, &winX, &winY,
- &mask_return);
+ if (!otherScreenGrabExist
+ (s, "scale", "switcher", "move", "resize", 0)) {
+ XQueryPointer(s->display->display, s->root,
+ &root_return, &child_return,
+ &zs->mouseX, &zs->mouseY, &winX,
+ &winY, &mask_return);
}
- if (zs->currentScale == 1.0f && zs->zVelocity == 0.0f)
- {
+ if (zs->currentScale == 1.0f && zs->zVelocity == 0.0f) {
zs->active = FALSE;
- }
- }
+ }
+ }
- if (!zs->active && zd->fixesSupported && zs->cursorInfoSelected)
- {
+ if (!zs->active && zd->fixesSupported && zs->cursorInfoSelected) {
zs->cursorInfoSelected = FALSE;
- XFixesSelectCursorInput (s->display->display,s->root,0);
+ XFixesSelectCursorInput(s->display->display, s->root, 0);
}
- if (!zs->active && zs->cursor.isSet)
- {
- freeCursor (&zs->cursor);
+ if (!zs->active && zs->cursor.isSet) {
+ freeCursor(&zs->cursor);
}
- if (zd->canHideCursor && !zs->active && zs->cursorHidden)
- {
+ if (zd->canHideCursor && !zs->active && zs->cursorHidden) {
zs->cursorHidden = FALSE;
- XFixesShowCursor (s->display->display, s->root);
+ XFixesShowCursor(s->display->display, s->root);
}
- UNWRAP (zs, s, preparePaintScreen);
- (*s->preparePaintScreen) (s, msSinceLastPaint);
- WRAP (zs, s, preparePaintScreen, zoomPreparePaintScreen);
+ UNWRAP(zs, s, preparePaintScreen);
+ (*s->preparePaintScreen) (s, msSinceLastPaint);
+ WRAP(zs, s, preparePaintScreen, zoomPreparePaintScreen);
}
-static void
-zoomDonePaintScreen (CompScreen * s)
+static void zoomDonePaintScreen(CompScreen * s)
{
- ZOOM_SCREEN (s);
+ ZOOM_SCREEN(s);
- if (zs->active)
- {
- damageScreen (s);
- }
+ if (zs->active) {
+ damageScreen(s);
+ }
- UNWRAP (zs, s, donePaintScreen);
- (*s->donePaintScreen) (s);
- WRAP (zs, s, donePaintScreen, zoomDonePaintScreen);
+ UNWRAP(zs, s, donePaintScreen);
+ (*s->donePaintScreen) (s);
+ WRAP(zs, s, donePaintScreen, zoomDonePaintScreen);
}
static Bool
-zoomPaintScreen (CompScreen * s,
- const ScreenPaintAttrib * sAttrib,
- Region region, int output, unsigned int mask)
+zoomPaintScreen(CompScreen * s,
+ const ScreenPaintAttrib * sAttrib,
+ Region region, int output, unsigned int mask)
{
- Bool status;
-
- ZOOM_SCREEN (s);
-
- if (zs->active)
- {
- mask &= ~PAINT_SCREEN_REGION_MASK;
- mask |= PAINT_SCREEN_TRANSFORMED_MASK | PAINT_SCREEN_CLEAR_MASK;
-
- int saveFilter = s->filter[SCREEN_TRANS_FILTER];
-
- if (zs->opt[ZOOM_SCREEN_OPTION_FILTER_LINEAR].value.b ||
- zs->zVelocity != 0.0f)
- s->filter[SCREEN_TRANS_FILTER] = COMP_TEXTURE_FILTER_GOOD;
- else
- s->filter[SCREEN_TRANS_FILTER] = COMP_TEXTURE_FILTER_FAST;
-
- UNWRAP (zs, s, paintScreen);
- status = (*s->paintScreen) (s, sAttrib, region, output, mask);
- WRAP (zs, s, paintScreen, zoomPaintScreen);
-
- s->filter[SCREEN_TRANS_FILTER] = saveFilter;
- }
- else
- {
- UNWRAP (zs, s, paintScreen);
- status = (*s->paintScreen) (s, sAttrib, region, output, mask);
- WRAP (zs, s, paintScreen, zoomPaintScreen);
- }
+ Bool status;
+
+ ZOOM_SCREEN(s);
+
+ if (zs->active) {
+ mask &= ~PAINT_SCREEN_REGION_MASK;
+ mask |=
+ PAINT_SCREEN_TRANSFORMED_MASK |
+ PAINT_SCREEN_CLEAR_MASK;
+
+ int saveFilter = s->filter[SCREEN_TRANS_FILTER];
+
+ if (zs->opt[ZOOM_SCREEN_OPTION_FILTER_LINEAR].value.b ||
+ zs->zVelocity != 0.0f)
+ s->filter[SCREEN_TRANS_FILTER] =
+ COMP_TEXTURE_FILTER_GOOD;
+ else
+ s->filter[SCREEN_TRANS_FILTER] =
+ COMP_TEXTURE_FILTER_FAST;
+
+ UNWRAP(zs, s, paintScreen);
+ status =
+ (*s->paintScreen) (s, sAttrib, region, output, mask);
+ WRAP(zs, s, paintScreen, zoomPaintScreen);
+
+ s->filter[SCREEN_TRANS_FILTER] = saveFilter;
+ } else {
+ UNWRAP(zs, s, paintScreen);
+ status =
+ (*s->paintScreen) (s, sAttrib, region, output, mask);
+ WRAP(zs, s, paintScreen, zoomPaintScreen);
+ }
- return status;
+ return status;
}
static void
-zoomPaintTransformedScreen (CompScreen * s, const ScreenPaintAttrib * sa,
- Region region, int output, unsigned int mask)
+zoomPaintTransformedScreen(CompScreen * s, const ScreenPaintAttrib * sa,
+ Region region, int output, unsigned int mask)
{
- ZOOM_SCREEN (s);
- if (zs->active)
- {
+ ZOOM_SCREEN(s);
+ if (zs->active) {
REGION r;
r.rects = &r.extents;
r.numRects = 1;
r.extents.x1 = zs->mouseX - (zs->mouseX / zs->xscale) +
- (s->outputDev[output].region.extents.x1 / zs->xscale) - 2;
- r.extents.y1 = zs->mouseY - (zs->mouseY / zs->yscale) +
- (s->outputDev[output].region.extents.y1 / zs->yscale) - 2;
- r.extents.x2 = r.extents.x1 + s->outputDev[output].width / zs->xscale + 4;
- r.extents.y2 = r.extents.y1 + s->outputDev[output].height / zs->yscale + 4;
-
- UNWRAP (zs, s, paintTransformedScreen);
+ (s->outputDev[output].region.extents.x1 / zs->xscale) -
+ 2;
+ r.extents.y1 =
+ zs->mouseY - (zs->mouseY / zs->yscale) +
+ (s->outputDev[output].region.extents.y1 / zs->yscale) -
+ 2;
+ r.extents.x2 =
+ r.extents.x1 +
+ s->outputDev[output].width / zs->xscale + 4;
+ r.extents.y2 =
+ r.extents.y1 +
+ s->outputDev[output].height / zs->yscale + 4;
+
+ UNWRAP(zs, s, paintTransformedScreen);
(*s->paintTransformedScreen) (s, sa, &r, output, mask);
- WRAP (zs, s, paintTransformedScreen, zoomPaintTransformedScreen);
-
- if (zs->cursor.isSet)
- {
- glPushMatrix ();
- glLoadIdentity ();
- prepareXCoords (s, output, -DEFAULT_Z_CAMERA);
-
- glTranslatef (zs->mouseX, zs->mouseY, 0.0);
- glScalef (zs->xscale, zs->yscale, 1.0f);
- int x = - zs->cursor.hotX;
- int y = - zs->cursor.hotY;
- glEnable (GL_BLEND);
- glBindTexture (GL_TEXTURE_RECTANGLE_ARB, zs->cursor.texture);
- glEnable (GL_TEXTURE_RECTANGLE_ARB);
-
- glBegin (GL_QUADS);
- glTexCoord2d(0,0);
- glVertex2f(x,y);
+ WRAP(zs, s, paintTransformedScreen,
+ zoomPaintTransformedScreen);
+
+ if (zs->cursor.isSet) {
+ glPushMatrix();
+ glLoadIdentity();
+ prepareXCoords(s, output, -DEFAULT_Z_CAMERA);
+
+ glTranslatef(zs->mouseX, zs->mouseY, 0.0);
+ glScalef(zs->xscale, zs->yscale, 1.0f);
+ int x = -zs->cursor.hotX;
+ int y = -zs->cursor.hotY;
+ glEnable(GL_BLEND);
+ glBindTexture(GL_TEXTURE_RECTANGLE_ARB,
+ zs->cursor.texture);
+ glEnable(GL_TEXTURE_RECTANGLE_ARB);
+
+ glBegin(GL_QUADS);
+ glTexCoord2d(0, 0);
+ glVertex2f(x, y);
glTexCoord2d(0, zs->cursor.height);
- glVertex2f(x,y + zs->cursor.height);
+ glVertex2f(x, y + zs->cursor.height);
glTexCoord2d(zs->cursor.width, zs->cursor.height);
- glVertex2f(x + zs->cursor.width, y + zs->cursor.height);
+ glVertex2f(x + zs->cursor.width,
+ y + zs->cursor.height);
glTexCoord2d(zs->cursor.width, 0);
- glVertex2f(x + zs->cursor.width,y);
- glEnd ();
+ glVertex2f(x + zs->cursor.width, y);
+ glEnd();
- glDisable (GL_BLEND);
+ glDisable(GL_BLEND);
- glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
- glDisable (GL_TEXTURE_RECTANGLE_ARB);
- glPopMatrix ();
+ glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
+ glDisable(GL_TEXTURE_RECTANGLE_ARB);
+ glPopMatrix();
}
- }
- else
- {
- UNWRAP (zs, s, paintTransformedScreen);
+ } else {
+ UNWRAP(zs, s, paintTransformedScreen);
(*s->paintTransformedScreen) (s, sa, region, output, mask);
- WRAP (zs, s, paintTransformedScreen, zoomPaintTransformedScreen);
+ WRAP(zs, s, paintTransformedScreen,
+ zoomPaintTransformedScreen);
}
}
static Bool
-zoomIn (CompDisplay * d,
- CompAction * action,
- CompActionState state, CompOption * option, int nOption)
+zoomIn(CompDisplay * d,
+ CompAction * action,
+ CompActionState state, CompOption * option, int nOption)
{
- CompScreen *s;
- Window xid;
+ CompScreen *s;
+ Window xid;
- ZOOM_DISPLAY (d);
+ ZOOM_DISPLAY(d);
- xid = getIntOptionNamed (option, nOption, "root", 0);
+ xid = getIntOptionNamed(option, nOption, "root", 0);
- s = findScreenAtDisplay (d, xid);
- if (s)
- {
- ZOOM_SCREEN (s);
+ s = findScreenAtDisplay(d, xid);
+ if (s) {
+ ZOOM_SCREEN(s);
zs->active = TRUE;
- if (zd->fixesSupported && !zs->cursorInfoSelected && zs->showScaled)
- {
+ if (zd->fixesSupported && !zs->cursorInfoSelected
+ && zs->showScaled) {
zs->cursorInfoSelected = TRUE;
- XFixesSelectCursorInput (s->display->display,s->root,XFixesDisplayCursorNotifyMask);
- updateCursor (d->display, &zs->cursor);
+ XFixesSelectCursorInput(s->display->display,
+ s->root,
+ XFixesDisplayCursorNotifyMask);
+ updateCursor(d->display, &zs->cursor);
}
- if (zd->canHideCursor && !zs->cursorHidden && zs->hideNormal)
- {
+ if (zd->canHideCursor && !zs->cursorHidden
+ && zs->hideNormal) {
zs->cursorHidden = TRUE;
- XFixesHideCursor (d->display, s->root);
+ XFixesHideCursor(d->display, s->root);
}
zs->newScale *= zs->step;
if (zs->newScale > zs->maxScale)
zs->newScale = zs->maxScale;
- damageScreen (s);
- }
+ damageScreen(s);
+ }
- return TRUE;
+ return TRUE;
}
static Bool
-zoomOut (CompDisplay * d,
- CompAction * action,
- CompActionState state, CompOption * option, int nOption)
+zoomOut(CompDisplay * d,
+ CompAction * action,
+ CompActionState state, CompOption * option, int nOption)
{
- CompScreen *s;
- Window xid;
+ CompScreen *s;
+ Window xid;
- ZOOM_DISPLAY (d);
+ ZOOM_DISPLAY(d);
- xid = getIntOptionNamed (option, nOption, "root", 0);
+ xid = getIntOptionNamed(option, nOption, "root", 0);
- s = findScreenAtDisplay (d, xid);
- if (s)
- {
- ZOOM_SCREEN (s);
+ s = findScreenAtDisplay(d, xid);
+ if (s) {
+ ZOOM_SCREEN(s);
zs->active = TRUE;
- if (zd->fixesSupported && !zs->cursorInfoSelected && zs->showScaled)
- {
+ if (zd->fixesSupported && !zs->cursorInfoSelected
+ && zs->showScaled) {
zs->cursorInfoSelected = TRUE;
- XFixesSelectCursorInput (s->display->display,s->root,XFixesDisplayCursorNotifyMask);
- updateCursor (d->display, &zs->cursor);
+ XFixesSelectCursorInput(s->display->display,
+ s->root,
+ XFixesDisplayCursorNotifyMask);
+ updateCursor(d->display, &zs->cursor);
}
- if (zd->canHideCursor && !zs->cursorHidden && zs->hideNormal)
- {
+ if (zd->canHideCursor && !zs->cursorHidden
+ && zs->hideNormal) {
zs->cursorHidden = TRUE;
- XFixesHideCursor (d->display, s->root);
+ XFixesHideCursor(d->display, s->root);
}
zs->newScale /= zs->step;
if (zs->newScale < 1.0)
zs->newScale = 1.0;
- damageScreen (s);
- }
+ damageScreen(s);
+ }
- return TRUE;
+ return TRUE;
}
-static void
-zoomUpdateCubeOptions (CompScreen * s)
+static void zoomUpdateCubeOptions(CompScreen * s)
{
- CompPlugin *p;
-
- ZOOM_SCREEN (s);
-
- p = findActivePlugin ("cube");
- if (p && p->vTable->getScreenOptions)
- {
- CompOption *options, *option;
- int nOptions;
-
- options = (*p->vTable->getScreenOptions) (s, &nOptions);
- option = compFindOption (options, nOptions, "in", 0);
- if (option)
- zs->maxTranslate = option->value.b ? 0.85f : 1.5f;
- }
- else
- {
- zs->maxTranslate = 1.5f;
- }
+ CompPlugin *p;
+
+ ZOOM_SCREEN(s);
+
+ p = findActivePlugin("cube");
+ if (p && p->vTable->getScreenOptions) {
+ CompOption *options, *option;
+ int nOptions;
+
+ options = (*p->vTable->getScreenOptions) (s, &nOptions);
+ option = compFindOption(options, nOptions, "in", 0);
+ if (option)
+ zs->maxTranslate = option->value.b ? 0.85f : 1.5f;
+ } else {
+ zs->maxTranslate = 1.5f;
+ }
}
static Bool
-zoomSetScreenOptionForPlugin (CompScreen * s,
- char *plugin,
- char *name, CompOptionValue * value)
+zoomSetScreenOptionForPlugin(CompScreen * s,
+ char *plugin,
+ char *name, CompOptionValue * value)
{
- Bool status;
+ Bool status;
- ZOOM_SCREEN (s);
+ ZOOM_SCREEN(s);
- UNWRAP (zs, s, setScreenOptionForPlugin);
- status = (*s->setScreenOptionForPlugin) (s, plugin, name, value);
- WRAP (zs, s, setScreenOptionForPlugin, zoomSetScreenOptionForPlugin);
+ UNWRAP(zs, s, setScreenOptionForPlugin);
+ status = (*s->setScreenOptionForPlugin) (s, plugin, name, value);
+ WRAP(zs, s, setScreenOptionForPlugin,
+ zoomSetScreenOptionForPlugin);
- if (status && strcmp (plugin, "cube") == 0)
- zoomUpdateCubeOptions (s);
+ if (status && strcmp(plugin, "cube") == 0)
+ zoomUpdateCubeOptions(s);
- return status;
+ return status;
}
static Bool
-zoomSetDisplayOption (CompDisplay * display,
- char *name, CompOptionValue * value)
+zoomSetDisplayOption(CompDisplay * display,
+ char *name, CompOptionValue * value)
{
- CompOption *o;
- int index;
-
- ZOOM_DISPLAY (display);
-
- o = compFindOption (zd->opt, NUM_OPTIONS (zd), name, &index);
- if (!o)
- return FALSE;
-
- switch (index)
- {
- case ZOOM_DISPLAY_OPTION_IN:
- case ZOOM_DISPLAY_OPTION_OUT:
- if (setDisplayAction (display, o, value))
- return TRUE;
- default:
- break;
- }
-
- return FALSE;
+ CompOption *o;
+ int index;
+
+ ZOOM_DISPLAY(display);
+
+ o = compFindOption(zd->opt, NUM_OPTIONS(zd), name, &index);
+ if (!o)
+ return FALSE;
+
+ switch (index) {
+ case ZOOM_DISPLAY_OPTION_IN:
+ case ZOOM_DISPLAY_OPTION_OUT:
+ if (setDisplayAction(display, o, value))
+ return TRUE;
+ default:
+ break;
+ }
+
+ return FALSE;
}
-static void
-zoomDisplayInitOptions (ZoomDisplay * zd)
+static void zoomDisplayInitOptions(ZoomDisplay * zd)
{
- CompOption *o;
-
- o = &zd->opt[ZOOM_DISPLAY_OPTION_IN];
- o->name = "zoom_in";
- o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Zoom In");
- o->longDesc = N_("Zoom In");
- o->type = CompOptionTypeAction;
- o->value.action.initiate = zoomIn;
- o->value.action.terminate = 0;
- o->value.action.bell = FALSE;
- o->value.action.edgeMask = 0;
- o->value.action.state = CompActionStateInitKey;
- o->value.action.state |= CompActionStateInitButton;
- o->value.action.type = CompBindingTypeButton;
- o->value.action.button.modifiers = ZOOM_IN_MODIFIERS_DEFAULT;
- o->value.action.button.button = ZOOM_IN_BUTTON_DEFAULT;
-
- o = &zd->opt[ZOOM_DISPLAY_OPTION_OUT];
- o->name = "zoom_out";
- o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Zoom Out");
- o->longDesc = N_("Zoom Out");
- o->type = CompOptionTypeAction;
- o->value.action.initiate = zoomOut;
- o->value.action.terminate = 0;
- o->value.action.bell = FALSE;
- o->value.action.edgeMask = 0;
- o->value.action.state = CompActionStateInitKey;
- o->value.action.state |= CompActionStateInitButton;
- o->value.action.type = CompBindingTypeButton;
- o->value.action.button.modifiers = ZOOM_OUT_MODIFIERS_DEFAULT;
- o->value.action.button.button = ZOOM_OUT_BUTTON_DEFAULT;
+ CompOption *o;
+
+ o = &zd->opt[ZOOM_DISPLAY_OPTION_IN];
+ o->name = "zoom_in";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Zoom In");
+ o->longDesc = N_("Zoom In");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = zoomIn;
+ o->value.action.terminate = 0;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.state = CompActionStateInitKey;
+ o->value.action.state |= CompActionStateInitButton;
+ o->value.action.type = CompBindingTypeButton;
+ o->value.action.button.modifiers = ZOOM_IN_MODIFIERS_DEFAULT;
+ o->value.action.button.button = ZOOM_IN_BUTTON_DEFAULT;
+
+ o = &zd->opt[ZOOM_DISPLAY_OPTION_OUT];
+ o->name = "zoom_out";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Zoom Out");
+ o->longDesc = N_("Zoom Out");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = zoomOut;
+ o->value.action.terminate = 0;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.state = CompActionStateInitKey;
+ o->value.action.state |= CompActionStateInitButton;
+ o->value.action.type = CompBindingTypeButton;
+ o->value.action.button.modifiers = ZOOM_OUT_MODIFIERS_DEFAULT;
+ o->value.action.button.button = ZOOM_OUT_BUTTON_DEFAULT;
}
-static CompOption *
-zoomGetDisplayOptions (CompDisplay * display, int *count)
+static CompOption *zoomGetDisplayOptions(CompDisplay * display, int *count)
{
- if (display)
- {
- ZOOM_DISPLAY (display);
-
- *count = NUM_OPTIONS (zd);
- return zd->opt;
- }
- else
- {
- ZoomDisplay * zd = malloc(sizeof(ZoomDisplay));
- zoomDisplayInitOptions(zd);
- *count = NUM_OPTIONS (zd);
- return zd->opt;
- }
+ if (display) {
+ ZOOM_DISPLAY(display);
+
+ *count = NUM_OPTIONS(zd);
+ return zd->opt;
+ } else {
+ ZoomDisplay *zd = malloc(sizeof(ZoomDisplay));
+ zoomDisplayInitOptions(zd);
+ *count = NUM_OPTIONS(zd);
+ return zd->opt;
+ }
}
-static Bool
-zoomInitDisplay (CompPlugin * p, CompDisplay * d)
+static Bool zoomInitDisplay(CompPlugin * p, CompDisplay * d)
{
- ZoomDisplay *zd;
+ ZoomDisplay *zd;
- zd = malloc (sizeof (ZoomDisplay));
- if (!zd)
- return FALSE;
+ zd = malloc(sizeof(ZoomDisplay));
+ if (!zd)
+ return FALSE;
- zd->screenPrivateIndex = allocateScreenPrivateIndex (d);
- if (zd->screenPrivateIndex < 0)
- {
- free (zd);
- return FALSE;
- }
+ zd->screenPrivateIndex = allocateScreenPrivateIndex(d);
+ if (zd->screenPrivateIndex < 0) {
+ free(zd);
+ return FALSE;
+ }
- zoomDisplayInitOptions (zd);
+ zoomDisplayInitOptions(zd);
- WRAP (zd, d, handleEvent, zoomHandleEvent);
+ WRAP(zd, d, handleEvent, zoomHandleEvent);
- d->privates[displayPrivateIndex].ptr = zd;
+ d->privates[displayPrivateIndex].ptr = zd;
- zd->fixesSupported = XFixesQueryExtension (d->display, &zd->fixesEventBase, &zd->fixesErrorBase);
+ zd->fixesSupported =
+ XFixesQueryExtension(d->display, &zd->fixesEventBase,
+ &zd->fixesErrorBase);
- int minor,major;
+ int minor, major;
- XFixesQueryVersion (d->display, &major, &minor);
+ XFixesQueryVersion(d->display, &major, &minor);
if (major >= 4)
zd->canHideCursor = TRUE;
else
zd->canHideCursor = FALSE;
- return TRUE;
+ return TRUE;
}
-static void
-zoomFiniDisplay (CompPlugin * p, CompDisplay * d)
+static void zoomFiniDisplay(CompPlugin * p, CompDisplay * d)
{
- ZOOM_DISPLAY (d);
+ ZOOM_DISPLAY(d);
- UNWRAP (zd, d, handleEvent);
- freeScreenPrivateIndex (d, zd->screenPrivateIndex);
+ UNWRAP(zd, d, handleEvent);
+ freeScreenPrivateIndex(d, zd->screenPrivateIndex);
- free (zd);
+ free(zd);
}
-static Bool
-zoomInitScreen (CompPlugin * p, CompScreen * s)
+static Bool zoomInitScreen(CompPlugin * p, CompScreen * s)
{
- ZoomScreen *zs;
+ ZoomScreen *zs;
- ZOOM_DISPLAY (s->display);
+ ZOOM_DISPLAY(s->display);
- zs = malloc (sizeof (ZoomScreen));
- if (!zs)
- return FALSE;
+ zs = malloc(sizeof(ZoomScreen));
+ if (!zs)
+ return FALSE;
- zs->active = FALSE;
+ zs->active = FALSE;
- zs->currentScale = 1.0f;
- zs->newScale = 1.0f;
+ zs->currentScale = 1.0f;
+ zs->newScale = 1.0f;
- zs->zVelocity = 0.0f;
+ zs->zVelocity = 0.0f;
- zs->maxTranslate = 0.85f;
+ zs->maxTranslate = 0.85f;
- zs->speed = ZOOM_SPEED_DEFAULT;
- zs->step = ZOOM_STEP_DEFAULT;
- zs->maxScale = ZOOM_MAX_FACTOR_DEFAULT;
- zs->timestep = ZOOM_TIMESTEP_DEFAULT;
+ zs->speed = ZOOM_SPEED_DEFAULT;
+ zs->step = ZOOM_STEP_DEFAULT;
+ zs->maxScale = ZOOM_MAX_FACTOR_DEFAULT;
+ zs->timestep = ZOOM_TIMESTEP_DEFAULT;
- zoomScreenInitOptions (zs);
+ zoomScreenInitOptions(zs);
- addScreenAction (s, &zd->opt[ZOOM_DISPLAY_OPTION_IN].value.action);
- addScreenAction (s, &zd->opt[ZOOM_DISPLAY_OPTION_OUT].value.action);
+ addScreenAction(s, &zd->opt[ZOOM_DISPLAY_OPTION_IN].value.action);
+ addScreenAction(s, &zd->opt[ZOOM_DISPLAY_OPTION_OUT].value.action);
- WRAP (zs, s, preparePaintScreen, zoomPreparePaintScreen);
- WRAP (zs, s, donePaintScreen, zoomDonePaintScreen);
- WRAP (zs, s, paintScreen, zoomPaintScreen);
- WRAP (zs, s, paintTransformedScreen, zoomPaintTransformedScreen);
- WRAP (zs, s, setScreenOptionForPlugin, zoomSetScreenOptionForPlugin);
- WRAP (zs, s, applyScreenTransform, zoomApplyScreenTransform);
+ WRAP(zs, s, preparePaintScreen, zoomPreparePaintScreen);
+ WRAP(zs, s, donePaintScreen, zoomDonePaintScreen);
+ WRAP(zs, s, paintScreen, zoomPaintScreen);
+ WRAP(zs, s, paintTransformedScreen, zoomPaintTransformedScreen);
+ WRAP(zs, s, setScreenOptionForPlugin,
+ zoomSetScreenOptionForPlugin);
+ WRAP(zs, s, applyScreenTransform, zoomApplyScreenTransform);
- s->privates[zd->screenPrivateIndex].ptr = zs;
+ s->privates[zd->screenPrivateIndex].ptr = zs;
- zoomUpdateCubeOptions (s);
+ zoomUpdateCubeOptions(s);
zs->cursor.isSet = FALSE;
zs->cursorHidden = FALSE;
@@ -954,80 +929,79 @@ zoomInitScreen (CompPlugin * p, CompScreen * s)
zs->showScaled = ZOOM_SHOW_SCALED_CURSOR_DEFAULT;
zs->hideNormal = ZOOM_HIDE_NORMAL_CURSOR_DEFAULT;
- return TRUE;
+ return TRUE;
}
-static void
-zoomFiniScreen (CompPlugin * p, CompScreen * s)
+static void zoomFiniScreen(CompPlugin * p, CompScreen * s)
{
- ZOOM_SCREEN (s);
- ZOOM_DISPLAY (s->display);
-
- UNWRAP (zs, s, preparePaintScreen);
- UNWRAP (zs, s, donePaintScreen);
- UNWRAP (zs, s, paintScreen);
- UNWRAP (zs, s, paintTransformedScreen);
- UNWRAP (zs, s, setScreenOptionForPlugin);
- UNWRAP (zs, s, applyScreenTransform);
-
- removeScreenAction (s, &zd->opt[ZOOM_DISPLAY_OPTION_IN].value.action);
- removeScreenAction (s, &zd->opt[ZOOM_DISPLAY_OPTION_OUT].value.action);
-
- free (zs);
+ ZOOM_SCREEN(s);
+ ZOOM_DISPLAY(s->display);
+
+ UNWRAP(zs, s, preparePaintScreen);
+ UNWRAP(zs, s, donePaintScreen);
+ UNWRAP(zs, s, paintScreen);
+ UNWRAP(zs, s, paintTransformedScreen);
+ UNWRAP(zs, s, setScreenOptionForPlugin);
+ UNWRAP(zs, s, applyScreenTransform);
+
+ removeScreenAction(s,
+ &zd->opt[ZOOM_DISPLAY_OPTION_IN].value.action);
+ removeScreenAction(s,
+ &zd->opt[ZOOM_DISPLAY_OPTION_OUT].value.action);
+
+ free(zs);
}
-static Bool
-zoomInit (CompPlugin * p)
+static Bool zoomInit(CompPlugin * p)
{
- displayPrivateIndex = allocateDisplayPrivateIndex ();
- if (displayPrivateIndex < 0)
- return FALSE;
+ displayPrivateIndex = allocateDisplayPrivateIndex();
+ if (displayPrivateIndex < 0)
+ return FALSE;
- return TRUE;
+ return TRUE;
}
-static void
-zoomFini (CompPlugin * p)
+static void zoomFini(CompPlugin * p)
{
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex (displayPrivateIndex);
+ if (displayPrivateIndex >= 0)
+ freeDisplayPrivateIndex(displayPrivateIndex);
}
CompPluginDep zoomDeps[] = {
- {CompPluginRuleBefore, "cube"},
+ {CompPluginRuleBefore, "cube"}
+ ,
};
CompPluginFeature zoomFeatures[] = {
- {"zoom"}
+ {"zoom"}
};
CompPluginVTable zoomVTable = {
- "inputzoom",
- N_("Input enabled Zoom"),
- N_("Input Enabled Zoom"),
- zoomInit,
- zoomFini,
- zoomInitDisplay,
- zoomFiniDisplay,
- zoomInitScreen,
- zoomFiniScreen,
- 0,
- 0,
- zoomGetDisplayOptions,
- zoomSetDisplayOption,
- zoomGetScreenOptions,
- zoomSetScreenOption,
- zoomDeps,
- sizeof (zoomDeps) / sizeof (zoomDeps[0]),
- zoomFeatures,
- sizeof (zoomFeatures) / sizeof (zoomFeatures[0]),
- BERYL_ABI_INFO,
- "beryl-plugins"
+ "inputzoom",
+ N_("Input enabled Zoom"),
+ N_("Input Enabled Zoom"),
+ zoomInit,
+ zoomFini,
+ zoomInitDisplay,
+ zoomFiniDisplay,
+ zoomInitScreen,
+ zoomFiniScreen,
+ 0,
+ 0,
+ zoomGetDisplayOptions,
+ zoomSetDisplayOption,
+ zoomGetScreenOptions,
+ zoomSetScreenOption,
+ zoomDeps,
+ sizeof(zoomDeps) / sizeof(zoomDeps[0]),
+ zoomFeatures,
+ sizeof(zoomFeatures) / sizeof(zoomFeatures[0]),
+ BERYL_ABI_INFO,
+ "beryl-plugins"
};
-CompPluginVTable *
-getCompPluginInfo (void)
+CompPluginVTable *getCompPluginInfo(void)
{
- return &zoomVTable;
+ return &zoomVTable;
}