summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/screenshot.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/screenshot.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/screenshot.c')
-rw-r--r--beryl-plugins/src/screenshot.c756
1 files changed, 372 insertions, 384 deletions
diff --git a/beryl-plugins/src/screenshot.c b/beryl-plugins/src/screenshot.c
index c3f7262..3829ad8 100644
--- a/beryl-plugins/src/screenshot.c
+++ b/beryl-plugins/src/screenshot.c
@@ -40,21 +40,19 @@ static int displayPrivateIndex;
#define SHOT_DISPLAY_OPTION_DIR 1
#define SHOT_DISPLAY_OPTION_NUM 2
-typedef struct _ShotDisplay
-{
- int screenPrivateIndex;
- HandleEventProc handleEvent;
+typedef struct _ShotDisplay {
+ int screenPrivateIndex;
+ HandleEventProc handleEvent;
- CompOption opt[SHOT_DISPLAY_OPTION_NUM];
+ CompOption opt[SHOT_DISPLAY_OPTION_NUM];
} ShotDisplay;
-typedef struct _ShotScreen
-{
- PaintScreenProc paintScreen;
- int grabIndex;
+typedef struct _ShotScreen {
+ PaintScreenProc paintScreen;
+ int grabIndex;
- int x1, y1, x2, y2;
- Bool grab;
+ int x1, y1, x2, y2;
+ Bool grab;
} ShotScreen;
#define GET_SHOT_DISPLAY(d) \
@@ -73,483 +71,473 @@ typedef struct _ShotScreen
static Bool
-shotInitiate (CompDisplay * d,
- CompAction * action,
- CompActionState state, CompOption * option, int nOption)
+shotInitiate(CompDisplay * d,
+ CompAction * action,
+ CompActionState state, CompOption * option, int nOption)
{
- CompScreen *s;
- Window xid;
+ CompScreen *s;
+ Window xid;
- xid = getIntOptionNamed (option, nOption, "root", 0);
+ xid = getIntOptionNamed(option, nOption, "root", 0);
- s = findScreenAtDisplay (d, xid);
- if (s)
- {
- SHOT_SCREEN (s);
+ s = findScreenAtDisplay(d, xid);
+ if (s) {
+ SHOT_SCREEN(s);
- if (otherScreenGrabExist (s, "screenshot", 0))
- return FALSE;
+ if (otherScreenGrabExist(s, "screenshot", 0))
+ return FALSE;
- if (!ss->grabIndex)
- ss->grabIndex = pushScreenGrab (s, None, "screenshot");
+ if (!ss->grabIndex)
+ ss->grabIndex =
+ pushScreenGrab(s, None, "screenshot");
- if (state & CompActionStateInitButton)
- action->state |= CompActionStateTermButton;
+ if (state & CompActionStateInitButton)
+ action->state |= CompActionStateTermButton;
- /* start selection screenshot rectangle */
+ /* start selection screenshot rectangle */
- ss->x1 = ss->x2 = d->pointerX;
- ss->y1 = ss->y2 = d->pointerY;
+ ss->x1 = ss->x2 = d->pointerX;
+ ss->y1 = ss->y2 = d->pointerY;
- ss->grab = TRUE;
- }
+ ss->grab = TRUE;
+ }
- return TRUE;
+ return TRUE;
}
static Bool
-shotTerminate (CompDisplay * d,
- CompAction * action,
- CompActionState state, CompOption * option, int nOption)
+shotTerminate(CompDisplay * d,
+ CompAction * action,
+ CompActionState state, CompOption * option, int nOption)
{
- CompScreen *s;
- Window xid;
+ CompScreen *s;
+ Window xid;
- xid = getIntOptionNamed (option, nOption, "root", 0);
+ xid = getIntOptionNamed(option, nOption, "root", 0);
- for (s = d->screens; s; s = s->next)
- {
- SHOT_SCREEN (s);
+ for (s = d->screens; s; s = s->next) {
+ SHOT_SCREEN(s);
- if (xid && s->root != xid)
- continue;
+ if (xid && s->root != xid)
+ continue;
- if (ss->grabIndex)
- {
- removeScreenGrab (s, ss->grabIndex, NULL);
- ss->grabIndex = 0;
+ if (ss->grabIndex) {
+ removeScreenGrab(s, ss->grabIndex, NULL);
+ ss->grabIndex = 0;
- if (ss->x1 != ss->x2 && ss->y1 != ss->y2)
- {
- REGION reg;
+ if (ss->x1 != ss->x2 && ss->y1 != ss->y2) {
+ REGION reg;
- reg.rects = &reg.extents;
- reg.numRects = 1;
+ reg.rects = &reg.extents;
+ reg.numRects = 1;
- reg.extents.x1 = MIN (ss->x1, ss->x2) - 1;
- reg.extents.y1 = MIN (ss->y1, ss->y2) - 1;
- reg.extents.x2 = MAX (ss->x1, ss->x2) + 1;
- reg.extents.y2 = MAX (ss->y1, ss->y2) + 1;
+ reg.extents.x1 = MIN(ss->x1, ss->x2) - 1;
+ reg.extents.y1 = MIN(ss->y1, ss->y2) - 1;
+ reg.extents.x2 = MAX(ss->x1, ss->x2) + 1;
+ reg.extents.y2 = MAX(ss->y1, ss->y2) + 1;
- damageScreenRegion (s, &reg);
- }
- }
- }
+ damageScreenRegion(s, &reg);
+ }
+ }
+ }
- action->state &= ~(CompActionStateTermKey | CompActionStateTermButton);
+ action->state &=
+ ~(CompActionStateTermKey | CompActionStateTermButton);
- return FALSE;
+ return FALSE;
}
-static int
-shotFilter (const struct dirent *d)
+static int shotFilter(const struct dirent *d)
{
- int number;
+ int number;
- if (sscanf (d->d_name, "screenshot%d.png", &number))
- return 1;
+ if (sscanf(d->d_name, "screenshot%d.png", &number))
+ return 1;
- return 0;
+ return 0;
}
-static int
-shotSort (const void *_a,
- const void *_b)
+static int shotSort(const void *_a, const void *_b)
{
- struct dirent **a = (struct dirent **) _a;
- struct dirent **b = (struct dirent **) _b;
- int al = strlen ((*a)->d_name);
- int bl = strlen ((*b)->d_name);
-
- if (al == bl)
- return strcoll ((*a)->d_name, (*b)->d_name);
- else
- return al - bl;
+ struct dirent **a = (struct dirent **) _a;
+ struct dirent **b = (struct dirent **) _b;
+ int al = strlen((*a)->d_name);
+ int bl = strlen((*b)->d_name);
+
+ if (al == bl)
+ return strcoll((*a)->d_name, (*b)->d_name);
+ else
+ return al - bl;
}
static Bool
-shotPaintScreen (CompScreen * s,
- const ScreenPaintAttrib * sAttrib,
- Region region, int output, unsigned int mask)
+shotPaintScreen(CompScreen * s,
+ const ScreenPaintAttrib * sAttrib,
+ Region region, int output, unsigned int mask)
{
- Bool status;
-
- SHOT_SCREEN (s);
-
- UNWRAP (ss, s, paintScreen);
- status = (*s->paintScreen) (s, sAttrib, region, output, mask);
- WRAP (ss, s, paintScreen, shotPaintScreen);
-
- if (status && ss->grab)
- {
- int x1, x2, y1, y2;
-
- x1 = MIN (ss->x1, ss->x2);
- y1 = MIN (ss->y1, ss->y2);
- x2 = MAX (ss->x1, ss->x2);
- y2 = MAX (ss->y1, ss->y2);
-
- if (ss->grabIndex)
- {
- glPushMatrix ();
-
- prepareXCoords (s, output, -DEFAULT_Z_CAMERA);
-
- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
- glEnable (GL_BLEND);
- glColor4us (0x2fff, 0x2fff, 0x4fff, 0x4fff);
- glRecti (x1, y2, x2, y1);
- glColor4us (0x2fff, 0x2fff, 0x4fff, 0x9fff);
- glBegin (GL_LINE_LOOP);
- glVertex2i (x1, y1);
- glVertex2i (x2, y1);
- glVertex2i (x2, y2);
- glVertex2i (x1, y2);
- glEnd ();
- glColor4usv (defaultColor);
- glDisable (GL_BLEND);
- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
- glPopMatrix ();
- }
- else
- {
- int w = x2 - x1;
- int h = y2 - y1;
-
- SHOT_DISPLAY (s->display);
-
- if (w && h)
- {
- GLubyte *buffer;
- char *dir = sd->opt[SHOT_DISPLAY_OPTION_DIR].value.s;
-
- buffer = malloc (sizeof (GLubyte) * w * h * 4);
- if (buffer)
- {
- struct dirent **namelist;
- int n;
-
- glReadPixels (x1, s->height - y2, w, h,
- GL_RGBA, GL_UNSIGNED_BYTE,
- (GLvoid *) buffer);
-
- n = scandir (dir, &namelist, shotFilter, shotSort);
- if (n >= 0)
- {
- char *name;
- int number = 0;
-
- if (n > 0)
- sscanf (namelist[n - 1]->d_name,
- "screenshot%d.png", &number);
-
- number++;
-
- if (n)
- free (namelist);
-
- name = malloc (strlen (dir) + 256);
- if (name)
- {
- sprintf (name, "%s/screenshot%d.png", dir,
- number);
-
- if (!writePngToFile (buffer, name, w, h, w * 4))
- fprintf (stderr, "%s: failed to write "
- "screenshot image", getProgramName());
-
- free (name);
- }
- }
- else
- {
- perror (dir);
- }
-
- free (buffer);
- }
- }
-
- ss->grab = FALSE;
- }
- }
-
- return status;
+ Bool status;
+
+ SHOT_SCREEN(s);
+
+ UNWRAP(ss, s, paintScreen);
+ status = (*s->paintScreen) (s, sAttrib, region, output, mask);
+ WRAP(ss, s, paintScreen, shotPaintScreen);
+
+ if (status && ss->grab) {
+ int x1, x2, y1, y2;
+
+ x1 = MIN(ss->x1, ss->x2);
+ y1 = MIN(ss->y1, ss->y2);
+ x2 = MAX(ss->x1, ss->x2);
+ y2 = MAX(ss->y1, ss->y2);
+
+ if (ss->grabIndex) {
+ glPushMatrix();
+
+ prepareXCoords(s, output, -DEFAULT_Z_CAMERA);
+
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ glEnable(GL_BLEND);
+ glColor4us(0x2fff, 0x2fff, 0x4fff, 0x4fff);
+ glRecti(x1, y2, x2, y1);
+ glColor4us(0x2fff, 0x2fff, 0x4fff, 0x9fff);
+ glBegin(GL_LINE_LOOP);
+ glVertex2i(x1, y1);
+ glVertex2i(x2, y1);
+ glVertex2i(x2, y2);
+ glVertex2i(x1, y2);
+ glEnd();
+ glColor4usv(defaultColor);
+ glDisable(GL_BLEND);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glPopMatrix();
+ } else {
+ int w = x2 - x1;
+ int h = y2 - y1;
+
+ SHOT_DISPLAY(s->display);
+
+ if (w && h) {
+ GLubyte *buffer;
+ char *dir =
+ sd->opt[SHOT_DISPLAY_OPTION_DIR].value.
+ s;
+
+ buffer =
+ malloc(sizeof(GLubyte) * w * h * 4);
+ if (buffer) {
+ struct dirent **namelist;
+ int n;
+
+ glReadPixels(x1, s->height - y2, w,
+ h, GL_RGBA,
+ GL_UNSIGNED_BYTE,
+ (GLvoid *) buffer);
+
+ n = scandir(dir, &namelist,
+ shotFilter, shotSort);
+ if (n >= 0) {
+ char *name;
+ int number = 0;
+
+ if (n > 0)
+ sscanf(namelist
+ [n -
+ 1]->d_name,
+ "screenshot%d.png",
+ &number);
+
+ number++;
+
+ if (n)
+ free(namelist);
+
+ name =
+ malloc(strlen(dir) +
+ 256);
+ if (name) {
+ sprintf(name,
+ "%s/screenshot%d.png",
+ dir,
+ number);
+
+ if (!writePngToFile
+ (buffer, name,
+ w, h, w * 4))
+ fprintf
+ (stderr,
+ "%s: failed to write "
+ "screenshot image",
+ getProgramName
+ ());
+
+ free(name);
+ }
+ } else {
+ perror(dir);
+ }
+
+ free(buffer);
+ }
+ }
+
+ ss->grab = FALSE;
+ }
+ }
+
+ return status;
}
-static void
-shotHandleMotionEvent (CompScreen * s, int xRoot, int yRoot)
+static void shotHandleMotionEvent(CompScreen * s, int xRoot, int yRoot)
{
- SHOT_SCREEN (s);
+ SHOT_SCREEN(s);
- /* update screenshot rectangle size */
+ /* update screenshot rectangle size */
- if (ss->grabIndex)
- {
- REGION reg;
+ if (ss->grabIndex) {
+ REGION reg;
- reg.rects = &reg.extents;
- reg.numRects = 1;
+ reg.rects = &reg.extents;
+ reg.numRects = 1;
- reg.extents.x1 = MIN (ss->x1, ss->x2) - 1;
- reg.extents.y1 = MIN (ss->y1, ss->y2) - 1;
- reg.extents.x2 = MAX (ss->x1, ss->x2) + 1;
- reg.extents.y2 = MAX (ss->y1, ss->y2) + 1;
+ reg.extents.x1 = MIN(ss->x1, ss->x2) - 1;
+ reg.extents.y1 = MIN(ss->y1, ss->y2) - 1;
+ reg.extents.x2 = MAX(ss->x1, ss->x2) + 1;
+ reg.extents.y2 = MAX(ss->y1, ss->y2) + 1;
- damageScreenRegion (s, &reg);
+ damageScreenRegion(s, &reg);
- ss->x2 = xRoot;
- ss->y2 = yRoot;
+ ss->x2 = xRoot;
+ ss->y2 = yRoot;
- reg.extents.x1 = MIN (ss->x1, ss->x2) - 1;
- reg.extents.y1 = MIN (ss->y1, ss->y2) - 1;
- reg.extents.x2 = MAX (ss->x1, ss->x2) + 1;
- reg.extents.y2 = MAX (ss->y1, ss->y2) + 1;
+ reg.extents.x1 = MIN(ss->x1, ss->x2) - 1;
+ reg.extents.y1 = MIN(ss->y1, ss->y2) - 1;
+ reg.extents.x2 = MAX(ss->x1, ss->x2) + 1;
+ reg.extents.y2 = MAX(ss->y1, ss->y2) + 1;
- damageScreenRegion (s, &reg);
+ damageScreenRegion(s, &reg);
- damageScreen (s);
- }
+ damageScreen(s);
+ }
}
-static void
-shotHandleEvent (CompDisplay * d, XEvent * event)
+static void shotHandleEvent(CompDisplay * d, XEvent * event)
{
- CompScreen *s;
-
- SHOT_DISPLAY (d);
-
- switch (event->type)
- {
- case MotionNotify:
- s = findScreenAtDisplay (d, event->xmotion.root);
- if (s)
- shotHandleMotionEvent (s, d->pointerX, d->pointerY);
- break;
- case EnterNotify:
- case LeaveNotify:
- s = findScreenAtDisplay (d, event->xcrossing.root);
- if (s)
- shotHandleMotionEvent (s, d->pointerX, d->pointerY);
- default:
- break;
- }
-
- UNWRAP (sd, d, handleEvent);
- (*d->handleEvent) (d, event);
- WRAP (sd, d, handleEvent, shotHandleEvent);
+ CompScreen *s;
+
+ SHOT_DISPLAY(d);
+
+ switch (event->type) {
+ case MotionNotify:
+ s = findScreenAtDisplay(d, event->xmotion.root);
+ if (s)
+ shotHandleMotionEvent(s, d->pointerX, d->pointerY);
+ break;
+ case EnterNotify:
+ case LeaveNotify:
+ s = findScreenAtDisplay(d, event->xcrossing.root);
+ if (s)
+ shotHandleMotionEvent(s, d->pointerX, d->pointerY);
+ default:
+ break;
+ }
+
+ UNWRAP(sd, d, handleEvent);
+ (*d->handleEvent) (d, event);
+ WRAP(sd, d, handleEvent, shotHandleEvent);
}
-static void
-shotDisplayInitOptions (ShotDisplay * sd)
+static void shotDisplayInitOptions(ShotDisplay * sd)
{
- CompOption *o;
-
- o = &sd->opt[SHOT_DISPLAY_OPTION_INITIATE];
- o->name = "initiate";
- o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Initiate");
- o->longDesc = N_("Initiate rectangle screenshot");
- o->type = CompOptionTypeAction;
- o->value.action.initiate = shotInitiate;
- o->value.action.terminate = shotTerminate;
- o->value.action.bell = FALSE;
- o->value.action.edgeMask = 0;
- o->value.action.type = CompBindingTypeButton;
- o->value.action.state = CompActionStateInitButton;
- o->value.action.button.modifiers = SHOT_INITIATE_BUTTON_MODIFIERS_DEFAULT;
- o->value.action.button.button = SHOT_INITIATE_BUTTON_DEFAULT;
-
- o = &sd->opt[SHOT_DISPLAY_OPTION_DIR];
- o->name = "directory";
- o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="file;directory;";
-o->shortDesc = N_("Directory");
- o->longDesc = N_("Put screenshot images in this directory");
- o->type = CompOptionTypeString;
- o->value.s = strdup (SHOT_DIR_DEFAULT);
- o->rest.s.string = 0;
- o->rest.s.nString = 0;
+ CompOption *o;
+
+ o = &sd->opt[SHOT_DISPLAY_OPTION_INITIATE];
+ o->name = "initiate";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Initiate");
+ o->longDesc = N_("Initiate rectangle screenshot");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = shotInitiate;
+ o->value.action.terminate = shotTerminate;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.type = CompBindingTypeButton;
+ o->value.action.state = CompActionStateInitButton;
+ o->value.action.button.modifiers =
+ SHOT_INITIATE_BUTTON_MODIFIERS_DEFAULT;
+ o->value.action.button.button = SHOT_INITIATE_BUTTON_DEFAULT;
+
+ o = &sd->opt[SHOT_DISPLAY_OPTION_DIR];
+ o->name = "directory";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "file;directory;";
+ o->shortDesc = N_("Directory");
+ o->longDesc = N_("Put screenshot images in this directory");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup(SHOT_DIR_DEFAULT);
+ o->rest.s.string = 0;
+ o->rest.s.nString = 0;
}
-static CompOption *
-shotGetDisplayOptions (CompDisplay * display, int *count)
+static CompOption *shotGetDisplayOptions(CompDisplay * display, int *count)
{
- if (display)
- {
- SHOT_DISPLAY (display);
-
- *count = NUM_OPTIONS (sd);
- return sd->opt;
- }
- else
- {
- ShotDisplay * sd=malloc(sizeof(ShotDisplay));
- shotDisplayInitOptions(sd);
- *count = NUM_OPTIONS (sd);
- return sd->opt;
- }
+ if (display) {
+ SHOT_DISPLAY(display);
+
+ *count = NUM_OPTIONS(sd);
+ return sd->opt;
+ } else {
+ ShotDisplay *sd = malloc(sizeof(ShotDisplay));
+ shotDisplayInitOptions(sd);
+ *count = NUM_OPTIONS(sd);
+ return sd->opt;
+ }
}
static Bool
-shotSetDisplayOption (CompDisplay * display,
- char *name, CompOptionValue * value)
+shotSetDisplayOption(CompDisplay * display,
+ char *name, CompOptionValue * value)
{
- CompOption *o;
- int index;
-
- SHOT_DISPLAY (display);
-
- o = compFindOption (sd->opt, NUM_OPTIONS (sd), name, &index);
- if (!o)
- return FALSE;
-
- switch (index)
- {
- case SHOT_DISPLAY_OPTION_INITIATE:
- if (setDisplayAction (display, o, value))
- return TRUE;
- break;
- case SHOT_DISPLAY_OPTION_DIR:
- if (compSetStringOption (o, value))
- return TRUE;
- default:
- break;
- }
-
- return FALSE;
+ CompOption *o;
+ int index;
+
+ SHOT_DISPLAY(display);
+
+ o = compFindOption(sd->opt, NUM_OPTIONS(sd), name, &index);
+ if (!o)
+ return FALSE;
+
+ switch (index) {
+ case SHOT_DISPLAY_OPTION_INITIATE:
+ if (setDisplayAction(display, o, value))
+ return TRUE;
+ break;
+ case SHOT_DISPLAY_OPTION_DIR:
+ if (compSetStringOption(o, value))
+ return TRUE;
+ default:
+ break;
+ }
+
+ return FALSE;
}
-static Bool
-shotInitDisplay (CompPlugin * p, CompDisplay * d)
+static Bool shotInitDisplay(CompPlugin * p, CompDisplay * d)
{
- ShotDisplay *sd;
+ ShotDisplay *sd;
- sd = malloc (sizeof (ShotDisplay));
- if (!sd)
- return FALSE;
+ sd = malloc(sizeof(ShotDisplay));
+ if (!sd)
+ return FALSE;
- sd->screenPrivateIndex = allocateScreenPrivateIndex (d);
- if (sd->screenPrivateIndex < 0)
- {
- free (sd);
- return FALSE;
- }
+ sd->screenPrivateIndex = allocateScreenPrivateIndex(d);
+ if (sd->screenPrivateIndex < 0) {
+ free(sd);
+ return FALSE;
+ }
- WRAP (sd, d, handleEvent, shotHandleEvent);
+ WRAP(sd, d, handleEvent, shotHandleEvent);
- shotDisplayInitOptions (sd);
+ shotDisplayInitOptions(sd);
- d->privates[displayPrivateIndex].ptr = sd;
+ d->privates[displayPrivateIndex].ptr = sd;
- return TRUE;
+ return TRUE;
}
-static void
-shotFiniDisplay (CompPlugin * p, CompDisplay * d)
+static void shotFiniDisplay(CompPlugin * p, CompDisplay * d)
{
- SHOT_DISPLAY (d);
+ SHOT_DISPLAY(d);
- freeScreenPrivateIndex (d, sd->screenPrivateIndex);
+ freeScreenPrivateIndex(d, sd->screenPrivateIndex);
- UNWRAP (sd, d, handleEvent);
+ UNWRAP(sd, d, handleEvent);
- free (sd);
+ free(sd);
}
-static Bool
-shotInitScreen (CompPlugin * p, CompScreen * s)
+static Bool shotInitScreen(CompPlugin * p, CompScreen * s)
{
- ShotScreen *ss;
+ ShotScreen *ss;
- SHOT_DISPLAY (s->display);
+ SHOT_DISPLAY(s->display);
- ss = malloc (sizeof (ShotScreen));
- if (!ss)
- return FALSE;
+ ss = malloc(sizeof(ShotScreen));
+ if (!ss)
+ return FALSE;
- ss->grabIndex = 0;
- ss->grab = FALSE;
+ ss->grabIndex = 0;
+ ss->grab = FALSE;
- addScreenAction (s, &sd->opt[SHOT_DISPLAY_OPTION_INITIATE].value.action);
+ addScreenAction(s,
+ &sd->opt[SHOT_DISPLAY_OPTION_INITIATE].value.
+ action);
- WRAP (ss, s, paintScreen, shotPaintScreen);
+ WRAP(ss, s, paintScreen, shotPaintScreen);
- s->privates[sd->screenPrivateIndex].ptr = ss;
+ s->privates[sd->screenPrivateIndex].ptr = ss;
- return TRUE;
+ return TRUE;
}
-static void
-shotFiniScreen (CompPlugin * p, CompScreen * s)
+static void shotFiniScreen(CompPlugin * p, CompScreen * s)
{
- SHOT_SCREEN (s);
- SHOT_DISPLAY (s->display);
+ SHOT_SCREEN(s);
+ SHOT_DISPLAY(s->display);
- UNWRAP (ss, s, paintScreen);
+ UNWRAP(ss, s, paintScreen);
- removeScreenAction (s, &sd->opt[SHOT_DISPLAY_OPTION_INITIATE].value.action);
+ removeScreenAction(s,
+ &sd->opt[SHOT_DISPLAY_OPTION_INITIATE].value.
+ action);
- free (ss);
+ free(ss);
}
-static Bool
-shotInit (CompPlugin * p)
+static Bool shotInit(CompPlugin * p)
{
- displayPrivateIndex = allocateDisplayPrivateIndex ();
- if (displayPrivateIndex < 0)
- return FALSE;
+ displayPrivateIndex = allocateDisplayPrivateIndex();
+ if (displayPrivateIndex < 0)
+ return FALSE;
- return TRUE;
+ return TRUE;
}
-static void
-shotFini (CompPlugin * p)
+static void shotFini(CompPlugin * p)
{
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex (displayPrivateIndex);
+ if (displayPrivateIndex >= 0)
+ freeDisplayPrivateIndex(displayPrivateIndex);
}
static CompPluginVTable shotVTable = {
- "screenshot",
- N_("Screenshot"),
- N_("Screenshot plugin"),
- shotInit,
- shotFini,
- shotInitDisplay,
- shotFiniDisplay,
- shotInitScreen,
- shotFiniScreen,
- 0, /* InitWindow */
- 0, /* FiniWindow */
- shotGetDisplayOptions,
- shotSetDisplayOption,
- 0, /* GetScreenOptions */
- 0, /* SetScreenOption */
- NULL,
- 0,
- 0,
- 0,
- BERYL_ABI_INFO,
- "beryl-plugins"
+ "screenshot",
+ N_("Screenshot"),
+ N_("Screenshot plugin"),
+ shotInit,
+ shotFini,
+ shotInitDisplay,
+ shotFiniDisplay,
+ shotInitScreen,
+ shotFiniScreen,
+ 0, /* InitWindow */
+ 0, /* FiniWindow */
+ shotGetDisplayOptions,
+ shotSetDisplayOption,
+ 0, /* GetScreenOptions */
+ 0, /* SetScreenOption */
+ NULL,
+ 0,
+ 0,
+ 0,
+ BERYL_ABI_INFO,
+ "beryl-plugins"
};
-CompPluginVTable *
-getCompPluginInfo (void)
+CompPluginVTable *getCompPluginInfo(void)
{
- return &shotVTable;
+ return &shotVTable;
}