void Quit(int code) { delete Engine::instance(); delete ImgBase::instance(); SDL_FreeSurface(getWindowIcon()); TTF_Quit(); SDL_Quit(); }
static void scalePaintDecoration (CompWindow *w, const WindowPaintAttrib *attrib, const CompTransform *transform, Region region, unsigned int mask) { CompScreen *s = w->screen; SCALE_SCREEN (s); if (ss->opt[SCALE_SCREEN_OPTION_ICON].value.i != SCALE_ICON_NONE) { WindowPaintAttrib sAttrib = *attrib; CompIcon *icon; SCALE_WINDOW (w); icon = getWindowIcon (w, 96, 96); if (!icon) icon = w->screen->defaultIcon; if (icon && (icon->texture.name || iconToTexture (w->screen, icon))) { REGION iconReg; float scale; float x, y; int width, height; int scaledWinWidth, scaledWinHeight; float ds; scaledWinWidth = w->width * sw->scale; scaledWinHeight = w->height * sw->scale; switch (ss->opt[SCALE_SCREEN_OPTION_ICON].value.i) { case SCALE_ICON_NONE: case SCALE_ICON_EMBLEM: scale = 1.0f; break; case SCALE_ICON_BIG: default: sAttrib.opacity /= 3; scale = MIN (((float) scaledWinWidth / icon->width), ((float) scaledWinHeight / icon->height)); break; } width = icon->width * scale; height = icon->height * scale; switch (ss->opt[SCALE_SCREEN_OPTION_ICON].value.i) { case SCALE_ICON_NONE: case SCALE_ICON_EMBLEM: x = w->attrib.x + scaledWinWidth - icon->width; y = w->attrib.y + scaledWinHeight - icon->height; break; case SCALE_ICON_BIG: default: x = w->attrib.x + scaledWinWidth / 2 - width / 2; y = w->attrib.y + scaledWinHeight / 2 - height / 2; break; } x += sw->tx; y += sw->ty; if (sw->slot) { sw->delta = fabs (sw->slot->x1 - w->attrib.x) + fabs (sw->slot->y1 - w->attrib.y) + fabs (1.0f - sw->slot->scale) * 500.0f; } if (sw->delta) { float o; ds = fabs (sw->tx) + fabs (sw->ty) + fabs (1.0f - sw->scale) * 500.0f; if (ds > sw->delta) ds = sw->delta; o = ds / sw->delta; if (sw->slot) { if (o < sw->lastThumbOpacity) o = sw->lastThumbOpacity; } else { if (o > sw->lastThumbOpacity) o = 0.0f; } sw->lastThumbOpacity = o; sAttrib.opacity = sAttrib.opacity * o; } mask |= PAINT_WINDOW_BLEND_MASK; iconReg.rects = &iconReg.extents; iconReg.numRects = 1; iconReg.extents.x1 = 0; iconReg.extents.y1 = 0; iconReg.extents.x2 = iconReg.extents.x1 + width; iconReg.extents.y2 = iconReg.extents.y1 + height; w->vCount = w->indexCount = 0; if (iconReg.extents.x1 < iconReg.extents.x2 && iconReg.extents.y1 < iconReg.extents.y2) (*w->screen->addWindowGeometry) (w, &icon->texture.matrix, 1, &iconReg, &iconReg); if (w->vCount) { FragmentAttrib fragment; CompTransform wTransform = *transform; initFragmentAttrib (&fragment, &sAttrib); matrixScale (&wTransform, scale, scale, 1.0f); matrixTranslate (&wTransform, x / scale, y / scale, 0.0f); glPushMatrix (); glLoadMatrixf (wTransform.m); (*w->screen->drawWindowTexture) (w, &icon->texture, &fragment, mask); glPopMatrix (); } } } }
static Bool ringPaintWindow (CompWindow *w, const WindowPaintAttrib *attrib, const CompTransform *transform, Region region, unsigned int mask) { CompScreen *s = w->screen; Bool status; RING_SCREEN (s); if (rs->state != RingStateNone) { WindowPaintAttrib sAttrib = *attrib; Bool scaled = FALSE; RING_WINDOW (w); if (w->mapNum) { if (!w->texture->pixmap && !w->bindFailed) bindWindow (w); } if (rw->adjust || rw->slot) { scaled = rw->adjust || (rw->slot && rs->paintingSwitcher); mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK; } else if (rs->state != RingStateIn) { if (ringGetDarkenBack (s)) { /* modify brightness of the other windows */ sAttrib.brightness = sAttrib.brightness / 2; } } UNWRAP (rs, s, paintWindow); status = (*s->paintWindow) (w, &sAttrib, transform, region, mask); WRAP (rs, s, paintWindow, ringPaintWindow); if (scaled && w->texture->pixmap) { FragmentAttrib fragment; CompTransform wTransform = *transform; if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK) return FALSE; initFragmentAttrib (&fragment, &w->lastPaint); if (rw->slot) { fragment.brightness = (float) fragment.brightness * rw->slot->depthBrightness; if (w != rs->selectedWindow) fragment.opacity = (float)fragment.opacity * ringGetInactiveOpacity (s) / 100; } if (w->alpha || fragment.opacity != OPAQUE) mask |= PAINT_WINDOW_TRANSLUCENT_MASK; matrixTranslate (&wTransform, w->attrib.x, w->attrib.y, 0.0f); matrixScale (&wTransform, rw->scale, rw->scale, 1.0f); matrixTranslate (&wTransform, rw->tx / rw->scale - w->attrib.x, rw->ty / rw->scale - w->attrib.y, 0.0f); glPushMatrix (); glLoadMatrixf (wTransform.m); (*s->drawWindow) (w, &wTransform, &fragment, region, mask | PAINT_WINDOW_TRANSFORMED_MASK); glPopMatrix (); } if (scaled && (rs->state != RingStateIn) && ((ringGetOverlayIcon (s) != OverlayIconNone) || !w->texture->pixmap)) { CompIcon *icon; icon = getWindowIcon (w, MAX_ICON_SIZE, MAX_ICON_SIZE); if (!icon) icon = w->screen->defaultIcon; if (icon && (icon->texture.name || iconToTexture (w->screen, icon))) { REGION iconReg; CompMatrix matrix; float scale; float x, y; int width, height; int scaledWinWidth, scaledWinHeight; RingOverlayIconEnum iconOverlay; scaledWinWidth = w->attrib.width * rw->scale; scaledWinHeight = w->attrib.height * rw->scale; if (!w->texture->pixmap) iconOverlay = OverlayIconBig; else iconOverlay = ringGetOverlayIcon (s); switch (iconOverlay) { case OverlayIconNone: case OverlayIconEmblem: scale = (rw->slot) ? rw->slot->depthScale : 1.0f; scale = MIN ((scale * ICON_SIZE / icon->width), (scale * ICON_SIZE / icon->height)); break; case OverlayIconBig: default: if (w->texture->pixmap) { /* only change opacity if not painting an icon for a minimized window */ sAttrib.opacity /= 3; scale = MIN (((float) scaledWinWidth / icon->width), ((float) scaledWinHeight / icon->height)); } else { scale = 0.8f * ((rw->slot) ? rw->slot->depthScale : 1.0f); scale = MIN ((scale * ringGetThumbWidth (s) / icon->width), (scale * ringGetThumbHeight (s) / icon->height)); } break; } width = icon->width * scale; height = icon->height * scale; switch (iconOverlay) { case OverlayIconNone: case OverlayIconEmblem: x = w->attrib.x + scaledWinWidth - width; y = w->attrib.y + scaledWinHeight - height; break; case OverlayIconBig: default: x = w->attrib.x + scaledWinWidth / 2 - width / 2; y = w->attrib.y + scaledWinHeight / 2 - height / 2; break; } x += rw->tx; y += rw->ty; mask |= PAINT_WINDOW_BLEND_MASK | PAINT_WINDOW_TRANSFORMED_MASK; iconReg.rects = &iconReg.extents; iconReg.numRects = 1; iconReg.extents.x1 = w->attrib.x; iconReg.extents.y1 = w->attrib.y; iconReg.extents.x2 = w->attrib.x + icon->width; iconReg.extents.y2 = w->attrib.y + icon->height; matrix = icon->texture.matrix; matrix.x0 -= (w->attrib.x * icon->texture.matrix.xx); matrix.y0 -= (w->attrib.y * icon->texture.matrix.yy); w->vCount = w->indexCount = 0; (*w->screen->addWindowGeometry) (w, &matrix, 1, &iconReg, &infiniteRegion); if (w->vCount) { FragmentAttrib fragment; CompTransform wTransform = *transform; if (!w->texture->pixmap) sAttrib.opacity = w->paint.opacity; initFragmentAttrib (&fragment, &sAttrib); if (rw->slot) fragment.brightness = (float) fragment.brightness * rw->slot->depthBrightness; matrixTranslate (&wTransform, w->attrib.x, w->attrib.y, 0.0f); matrixScale (&wTransform, scale, scale, 1.0f); matrixTranslate (&wTransform, (x - w->attrib.x) / scale - w->attrib.x, (y - w->attrib.y) / scale - w->attrib.y, 0.0f); glPushMatrix (); glLoadMatrixf (wTransform.m); (*w->screen->drawWindowTexture) (w, &icon->texture, &fragment, mask); glPopMatrix (); } } } } else { UNWRAP (rs, s, paintWindow); status = (*s->paintWindow) (w, attrib, transform, region, mask); WRAP (rs, s, paintWindow, ringPaintWindow); } return status; }