Ejemplo n.º 1
0
static void scaleaddonDonePaintScreen(CompScreen * s)
{
	ADDON_SCREEN(s);
	SCALE_SCREEN(s);

	if (ss->state != SCALE_STATE_NONE && as->lastState == SCALE_STATE_NONE) {
		CompWindow *w;

		for (w = s->windows; w; w = w->next)
			scaleaddonRenderWindowTitle(w);
	} else if (ss->state == SCALE_STATE_NONE &&
		   as->lastState != SCALE_STATE_NONE) {
		CompWindow *w;

		for (w = s->windows; w; w = w->next)
			scaleaddonFreeWindowTitle(w);
	}

	if (ss->state == SCALE_STATE_OUT && as->lastState != SCALE_STATE_OUT) {
		ADDON_DISPLAY(s->display);

		ad->lastHighlightedWindow = None;
		scaleaddonCheckWindowHighlight(s);
	}

	as->lastState = ss->state;

	UNWRAP(as, s, donePaintScreen);
	(*s->donePaintScreen) (s);
	WRAP(as, s, donePaintScreen, scaleaddonDonePaintScreen);
}
Ejemplo n.º 2
0
static void scaleaddonFiniWindow(CompPlugin * p, CompWindow * w)
{
	ADDON_WINDOW(w);

	scaleaddonFreeWindowTitle(w);

	free(aw);
}
static void
scaleaddonRenderWindowTitle (CompWindow *w)
{
    CompTextAttrib            attrib;
    float                     scale;
    CompScreen                *s = w->screen;
    ScaleaddonWindowTitleEnum winTitleMode;

    ADDON_DISPLAY (s->display);
    SCALE_SCREEN (s);
    SCALE_WINDOW (w);
    ADDON_WINDOW (w);

    scaleaddonFreeWindowTitle (w);

    if (!ad->textFunc)
        return;

    if (!sw->slot)
        return;

    winTitleMode = scaleaddonGetWindowTitle (s);
    if (winTitleMode == WindowTitleNoDisplay)
        return;

    if (winTitleMode == WindowTitleHighlightedWindowOnly &&
            ad->highlightedWindow != w->id)
    {
        return;
    }

    scale = sw->slot->scale;
    attrib.maxWidth = w->attrib.width * scale;
    attrib.maxHeight = w->attrib.height * scale;

    attrib.family = "Sans";
    attrib.size = scaleaddonGetTitleSize (s);
    attrib.color[0] = scaleaddonGetFontColorRed (s);
    attrib.color[1] = scaleaddonGetFontColorGreen (s);
    attrib.color[2] = scaleaddonGetFontColorBlue (s);
    attrib.color[3] = scaleaddonGetFontColorAlpha (s);

    attrib.flags = CompTextFlagWithBackground | CompTextFlagEllipsized;
    if (scaleaddonGetTitleBold (s))
        attrib.flags |= CompTextFlagStyleBold;

    attrib.bgHMargin = scaleaddonGetBorderSize (s);
    attrib.bgVMargin = scaleaddonGetBorderSize (s);
    attrib.bgColor[0] = scaleaddonGetBackColorRed (s);
    attrib.bgColor[1] = scaleaddonGetBackColorGreen (s);
    attrib.bgColor[2] = scaleaddonGetBackColorBlue (s);
    attrib.bgColor[3] = scaleaddonGetBackColorAlpha (s);

    aw->textData = (ad->textFunc->renderWindowTitle) (s, w->id,
                   ss->type == ScaleTypeAll,
                   &attrib);
}