static void fadeFiniDisplay (CompPlugin *p, CompDisplay *d) { FADE_DISPLAY (d); freeScreenPrivateIndex (d, fd->screenPrivateIndex); UNWRAP (fd, d, handleEvent); free (fd); }
static void colorFilterFiniScreen (CompPlugin * p, CompScreen * s) { FILTER_SCREEN (s); freeWindowPrivateIndex (s, cfs->windowPrivateIndex); UNWRAP (cfs, s, drawWindowTexture); unloadFilters (s); free (cfs); }
static void colorFilterFiniCore (CompPlugin *p, CompCore *c) { FILTER_CORE (c); freeDisplayPrivateIndex (displayPrivateIndex); UNWRAP (fc, c, objectAdd); free (fc); }
/* * groupPreparePaintScreen * */ void groupPreparePaintScreen (CompScreen *s, int msSinceLastPaint) { GroupSelection *group, *next; GROUP_SCREEN (s); UNWRAP (gs, s, preparePaintScreen); (*s->preparePaintScreen)(s, msSinceLastPaint); WRAP (gs, s, preparePaintScreen, groupPreparePaintScreen); group = gs->groups; while (group) { GroupTabBar *bar = group->tabBar; if (bar) { groupApplyForces (s, bar, (gs->dragged) ? gs->draggedSlot : NULL); groupApplySpeeds (s, group, msSinceLastPaint); if ((bar->state != PaintOff) && HAS_TOP_WIN (group)) groupHandleHoverDetection (group); if (bar->state == PaintFadeIn || bar->state == PaintFadeOut) groupHandleTabBarFade (group, msSinceLastPaint); if (bar->textLayer) groupHandleTextFade (group, msSinceLastPaint); if (bar->bgAnimation) groupHandleTabBarAnimation (group, msSinceLastPaint); } if (group->changeState != NoTabChange) { group->changeAnimationTime -= msSinceLastPaint; if (group->changeAnimationTime <= 0) groupHandleAnimation (group); } /* groupDrawTabAnimation may delete the group, so better save the pointer to the next chain element */ next = group->next; if (group->tabbingState != NoTabbing) groupDrawTabAnimation (group, msSinceLastPaint); group = next; } }
static void zoomPreparePaintScreen(CompScreen *s, int msSinceLastPaint) { ZOOM_SCREEN(s); if (zs->adjust) { int steps; float amount; amount = msSinceLastPaint * 0.35f * zs->opt[ZOOM_SCREEN_OPTION_SPEED].value.f; steps = amount / (0.5f * zs->opt[ZOOM_SCREEN_OPTION_TIMESTEP].value.f); if (!steps) steps = 1; while (steps--) { if (adjustZoomVelocity(zs)) { BoxPtr pBox = &s->outputDev[zs->zoomOutput].region.extents; zs->scale = 1.0f; zs->velocity = 0.0f; zs->adjust = FALSE; if (zs->current[zs->zoomOutput].x1 == pBox->x1 && zs->current[zs->zoomOutput].y1 == pBox->y1 && zs->current[zs->zoomOutput].x2 == pBox->x2 && zs->current[zs->zoomOutput].y2 == pBox->y2) { zs->zoomed &= ~(1 << zs->zoomOutput); zoomOutEvent(s); } else { zoomInEvent(s); } break; } else { zs->scale += (zs->velocity * msSinceLastPaint) / s->redrawTime; } } } UNWRAP(zs, s, preparePaintScreen); (*s->preparePaintScreen)(s, msSinceLastPaint); WRAP(zs, s, preparePaintScreen, zoomPreparePaintScreen); }
static void notifyFiniCore (CompPlugin *p, CompCore *c) { NOTIFY_CORE (c); UNWRAP (nc, c, logMessage); if (notify_is_initted ()) notify_uninit (); free (nc); }
static void wsnamesDonePaintScreen (CompScreen *s) { WSNAMES_SCREEN (s); /* FIXME: better only damage paint region */ if (ws->timer) damageScreen (s); UNWRAP (ws, s, donePaintScreen); (*s->donePaintScreen) (s); WRAP (ws, s, donePaintScreen, wsnamesDonePaintScreen); }
static void screenSaverFiniDisplay (CompPlugin *p, CompDisplay *d) { SCREENSAVER_DISPLAY (d); screenSaverSetXScreenSaver(d,FALSE); UNWRAP (sd, d, handleEvent); delete sd->effect; freeScreenPrivateIndex (d, sd->screenPrivateIndex); free (sd); }
static void elementsPreparePaintScreen (CompScreen *s, int elapsed) { E_SCREEN (s); if (elementActive(s)) stepPositions (s, elapsed); UNWRAP (eScreen, s, preparePaintScreen); (*s->preparePaintScreen) (s, elapsed); WRAP (eScreen, s, preparePaintScreen, elementsPreparePaintScreen); }
static Bool JPEGFileToImage (CompDisplay *d, const char *path, const char *name, int *width, int *height, int *stride, void **data) { Bool status = FALSE; char *fileName, *extension; JPEG_DISPLAY (d); fileName = createFilename (path, name); if (!fileName) return FALSE; /* Do some testing here to see if it's got a .jpg or .jpeg extension */ extension = strrchr (fileName, '.'); if (extension) { if (strcasecmp (extension, ".jpeg") == 0 || strcasecmp (extension, ".jpg") == 0) { FILE *file; file = fopen (fileName, "rb"); if (file) { status = readJPEGFileToImage (file, width, height, data); fclose (file); if (status) /* Success! */ { free (fileName); *stride = *width * 4; return TRUE; } } } } free (fileName); /* Isn't a JPEG - pass to the next in the chain. */ UNWRAP (jd, d, fileToImage); status = (*d->fileToImage) (d, path, name, width, height, stride, data); WRAP (jd, d, fileToImage, JPEGFileToImage); return status; }
static Bool shotPaintOutput (CompScreen *s, const ScreenPaintAttrib *sAttrib, const CompTransform *transform, Region region, CompOutput *output, unsigned int mask) { Bool status; SHOT_SCREEN (s); UNWRAP (ss, s, paintOutput); status = (*s->paintOutput) (s, sAttrib, transform, region, output, mask); WRAP (ss, s, paintOutput, shotPaintOutput); 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 (); } } return status; }
static void thumbPaintTransformedOutput (CompScreen *s, const ScreenPaintAttrib *sAttrib, const CompTransform *transform, Region region, CompOutput *output, unsigned int mask) { THUMB_SCREEN (s); UNWRAP (ts, s, paintTransformedOutput); (*s->paintTransformedOutput)(s, sAttrib, transform, region, output, mask); WRAP (ts, s, paintTransformedOutput, thumbPaintTransformedOutput); const BananaValue * option_always_on_top = bananaGetOption (bananaIndex, "always_on_top", s->screenNum); if (option_always_on_top->b && ts->x == s->x && ts->y == s->y) { ts->painted = TRUE; if (ts->oldThumb.opacity > 0.0 && ts->oldThumb.win) { CompTransform sTransform = *transform; (*s->applyScreenTransform)(s, sAttrib, output, &sTransform); transformToScreenSpace (s, output, -sAttrib->zTranslate, &sTransform); glPushMatrix (); glLoadMatrixf (sTransform.m); thumbPaintThumb (s, &ts->oldThumb, &sTransform); glPopMatrix (); } if (ts->thumb.opacity > 0.0 && ts->thumb.win) { CompTransform sTransform = *transform; (*s->applyScreenTransform)(s, sAttrib, output, &sTransform); transformToScreenSpace (s, output, -sAttrib->zTranslate, &sTransform); glPushMatrix (); glLoadMatrixf (sTransform.m); thumbPaintThumb (s, &ts->thumb, &sTransform); glPopMatrix (); } } }
static Bool ringPaintOutput (CompScreen *s, const ScreenPaintAttrib *sAttrib, const CompTransform *transform, Region region, CompOutput *output, unsigned int mask) { Bool status; RING_SCREEN (s); if (rs->state != RingStateNone) mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK; UNWRAP (rs, s, paintOutput); status = (*s->paintOutput) (s, sAttrib, transform, region, output, mask); WRAP (rs, s, paintOutput, ringPaintOutput); if (rs->state != RingStateNone) { int i; CompTransform sTransform = *transform; transformToScreenSpace (s, output, -DEFAULT_Z_CAMERA, &sTransform); glPushMatrix (); glLoadMatrixf (sTransform.m); rs->paintingSwitcher = TRUE; for (i = 0; i < rs->nWindows; i++) { if (rs->drawSlots[i].slot && *(rs->drawSlots[i].slot)) { CompWindow *w = rs->drawSlots[i].w; (*s->paintWindow) (w, &w->paint, &sTransform, &infiniteRegion, 0); } } rs->paintingSwitcher = FALSE; if (rs->textData && rs->state != RingStateIn) ringDrawWindowTitle (s); glPopMatrix (); } return status; }
static void fadePreparePaintScreen(CompScreen *s, int msSinceLastPaint) { CompWindow *w; int steps; FADE_SCREEN(s); switch (fs->opt[FADE_SCREEN_OPTION_FADE_MODE].value.i) { case FADE_MODE_CONSTANTSPEED: steps = (msSinceLastPaint * OPAQUE) / fs->fadeTime; if (steps < 12) steps = 12; for (w = s->windows; w; w = w->next) { FadeWindow *fw = GET_FADE_WINDOW(w, fs); fw->steps = steps; fw->fadeTime = 0; } break; case FADE_MODE_CONSTANTTIME: for (w = s->windows; w; w = w->next) { FadeWindow *fw = GET_FADE_WINDOW(w, fs); if (fw->fadeTime) { fw->steps = 1; fw->fadeTime -= msSinceLastPaint; if (fw->fadeTime < 0) fw->fadeTime = 0; } else { fw->steps = 0; } } break; } UNWRAP(fs, s, preparePaintScreen); (*s->preparePaintScreen)(s, msSinceLastPaint); WRAP(fs, s, preparePaintScreen, fadePreparePaintScreen); }
static void cubemodelClearTargetOutput (CompScreen *s, float xRotate, float vRotate) { CUBEMODEL_SCREEN (s); CUBE_SCREEN (s); UNWRAP (cms, cs, clearTargetOutput); (*cs->clearTargetOutput) (s, xRotate, vRotate); WRAP (cms, cs, clearTargetOutput, cubemodelClearTargetOutput); glClear (GL_DEPTH_BUFFER_BIT); }
static void fadePreparePaintScreen (CompScreen *s, int msSinceLastPaint) { FADE_SCREEN (s); fs->steps = (msSinceLastPaint * OPAQUE) / fs->fadeTime; if (fs->steps < 256) fs->steps = 256; UNWRAP (fs, s, preparePaintScreen); (*s->preparePaintScreen) (s, msSinceLastPaint); WRAP (fs, s, preparePaintScreen, fadePreparePaintScreen); }
static void zoomFiniDisplay(CompPlugin *p, CompDisplay *d) { ZOOM_DISPLAY(d); freeScreenPrivateIndex(d, zd->screenPrivateIndex); UNWRAP(zd, d, handleEvent); compFiniDisplayOptions(d, zd->opt, ZOOM_DISPLAY_OPTION_NUM); free(zd); }
/* * Initiate snap, get edges */ static void snapWindowGrabNotify(CompWindow * w, int x, int y, unsigned int state, unsigned int mask) { SNAP_SCREEN(w->screen); SNAP_WINDOW(w); sw->grabbed = (mask & CompWindowGrabResizeMask) ? ResizeGrab : MoveGrab; snapUpdateEdges(w); UNWRAP(ss, w->screen, windowGrabNotify); (*w->screen->windowGrabNotify) (w, x, y, state, mask); WRAP(ss, w->screen, windowGrabNotify, snapWindowGrabNotify); }
static void elementsFiniScreen (CompPlugin *p, CompScreen *s) { int i; E_SCREEN (s); for (i = 0; i < eScreen->numElements; i++) { finiTexture (s, &eScreen->textu[i].tex); glDeleteLists (eScreen->textu[i].dList, 1); } if (eScreen->textu) free (eScreen->textu); UNWRAP (eScreen, s, preparePaintScreen); UNWRAP (eScreen, s, donePaintScreen); UNWRAP (eScreen, s, paintOutput); UNWRAP (eScreen, s, drawWindow); free (eScreen); }
/* * Filter windows when they are open if they match the filtering rules */ static void colorFilterWindowAddNotify (CompWindow *w) { FILTER_SCREEN (w->screen); /* cfw->isFiltered is initialized to FALSE in InitWindow, so we only have to toggle it to TRUE if necessary */ if (cfs->isFiltered && matchEval (&cfs->filter_match, w)) colorFilterToggleWindow (w); UNWRAP (cfs, w->screen, windowAddNotify); (*w->screen->windowAddNotify) (w); WRAP (cfs, w->screen, windowAddNotify, colorFilterWindowAddNotify); }
static void opacifyFiniScreen (CompPlugin *p, CompScreen *s) { OPACIFY_SCREEN (s); UNWRAP (os, s, paintWindow); matchFini (&os->window_match); XDestroyRegion (os->intersect); free (os); }
static void fadeMatchExpHandlerChanged(CompDisplay *d) { CompScreen *s; FADE_DISPLAY(d); for (s = d->screens; s; s = s->next) matchUpdate(d, &GET_FADE_SCREEN(s, fd)->match); UNWRAP(fd, d, matchExpHandlerChanged); (*d->matchExpHandlerChanged)(d); WRAP(fd, d, matchExpHandlerChanged, fadeMatchExpHandlerChanged); }
static void shotHandleEvent (XEvent *event) { CompScreen *s; SHOT_DISPLAY (&display); switch (event->type) { case ButtonPress: if (isButtonPressEvent (event, &initiate_button)) { BananaArgument arg; arg.name = "root"; arg.type = BananaInt; arg.value.i = event->xbutton.root; shotInitiate (&arg, 1); } break; case ButtonRelease: if (initiate_button.button == event->xbutton.button) { BananaArgument arg; arg.name = "root"; arg.type = BananaInt; arg.value.i = event->xbutton.root; shotTerminate (&arg, 1); } break; case MotionNotify: s = findScreenAtDisplay (event->xmotion.root); if (s) shotHandleMotionEvent (s, pointerX, pointerY); break; case EnterNotify: case LeaveNotify: s = findScreenAtDisplay (event->xcrossing.root); if (s) shotHandleMotionEvent (s, pointerX, pointerY); default: break; } UNWRAP (sd, &display, handleEvent); (*display.handleEvent) (event); WRAP (sd, &display, handleEvent, shotHandleEvent); }
static void waterFiniDisplay (CompPlugin *p, CompDisplay *d) { WATER_DISPLAY (d); freeScreenPrivateIndex (d, wd->screenPrivateIndex); UNWRAP (wd, d, handleEvent); compFiniDisplayOptions (d, wd->opt, WATER_DISPLAY_OPTION_NUM); free (wd); }
static void tilePreparePaintScreen (CompScreen *s, int msSinceLastPaint) { TILE_SCREEN (s); // add spent time if (ts->grabIndex) ts->msResizing += msSinceLastPaint; UNWRAP (ts, s, preparePaintScreen); (*s->preparePaintScreen) (s, msSinceLastPaint); WRAP (ts, s, preparePaintScreen, tilePreparePaintScreen); }
static void snowglobeClearTargetOutput (CompScreen *s, float xRotate, float vRotate) { SNOWGLOBE_SCREEN (s); CUBE_SCREEN (s); UNWRAP (as, cs, clearTargetOutput); (*cs->clearTargetOutput) (s, xRotate, vRotate); WRAP (as, cs, clearTargetOutput, snowglobeClearTargetOutput); glClear (GL_DEPTH_BUFFER_BIT); }
static void videoFiniDisplay(CompPlugin *p, CompDisplay *d) { VIDEO_DISPLAY(d); freeScreenPrivateIndex(d, vd->screenPrivateIndex); UNWRAP(vd, d, handleEvent); compFiniDisplayOptions(d, vd->opt, VIDEO_DISPLAY_OPTION_NUM); free(vd); }
static void throwWindowUngrabNotify (CompWindow *w) { CompScreen *s = w->screen; THROW_SCREEN (s); THROW_WINDOW (w); tw->moving = FALSE; UNWRAP (ts, s, windowUngrabNotify); (*s->windowUngrabNotify) (w); WRAP (ts, s, windowUngrabNotify, throwWindowUngrabNotify); }
/* Handle the velocity */ static void throwPreparePaintScreen (CompScreen *s, int ms) { CompWindow *w; THROW_SCREEN (s); for (w = s->windows; w; w = w->next) { THROW_WINDOW (w); if (tw->moving) tw->time += ms; tw->xVelocity /= (1.0 + (throwGetFrictionConstant (s) / 100)); tw->yVelocity /= (1.0 + (throwGetFrictionConstant (s) / 100)); if (!tw->moving && ( (tw->xVelocity < 0.0f || tw->xVelocity > 0.0f) || (tw->yVelocity < 0.0f || tw->yVelocity > 0.0))) { int dx = roundf(tw->xVelocity * (ms / 10) * (throwGetVelocityX (s) / 10)); int dy = roundf (tw->yVelocity * (ms / 10) * (throwGetVelocityY (s) / 10)); if (throwGetConstrainX (s)) { if ((WIN_REAL_X (w) + dx) < 0) dx = 0; else if ((WIN_REAL_X (w) + WIN_REAL_W (w) + dx) > w->screen->width) dx = 0; } if (throwGetConstrainY (s)) { if ((WIN_REAL_Y (w) + dy) < 0) dy = 0; else if ((WIN_REAL_Y (w) + WIN_REAL_H (w) + dy) > w->screen->height) dy = 0; } moveWindow (w, dx, dy, TRUE, FALSE); syncWindowPosition (w); } } UNWRAP (ts, s, preparePaintScreen); (*s->preparePaintScreen) (s, ms); WRAP (ts, s, preparePaintScreen, throwPreparePaintScreen); }
static void tdApplyScreenTransform (CompScreen *s, const ScreenPaintAttrib *sAttrib, CompOutput *output, CompTransform *transform) { TD_SCREEN (s); UNWRAP (tds, s, applyScreenTransform); (*s->applyScreenTransform) (s, sAttrib, output, transform); WRAP (tds, s, applyScreenTransform, tdApplyScreenTransform); matrixScale (transform, tds->currentScale, tds->currentScale, tds->currentScale); }