コード例 #1
0
static void
ringFiniScreen (CompPlugin *p,
		CompScreen *s)
{
    RING_SCREEN (s);

    freeWindowPrivateIndex (s, rs->windowPrivateIndex);

    UNWRAP (rs, s, preparePaintScreen);
    UNWRAP (rs, s, donePaintScreen);
    UNWRAP (rs, s, paintOutput);
    UNWRAP (rs, s, paintWindow);
    UNWRAP (rs, s, damageWindowRect);

    matchFini (&rs->match);

    ringFreeWindowTitle (s);

    if (rs->windows)
	free (rs->windows);

    if (rs->drawSlots)
	free (rs->drawSlots);

    free (rs);
}
コード例 #2
0
ファイル: minimize.c プロジェクト: jordigh/fusilli
static void
minChangeNotify (const char        *optionName,
                 BananaType        optionType,
                 const BananaValue *optionValue,
                 int               screenNum)
{
	CompScreen *screen = getScreenFromScreenNum (screenNum);

	MIN_SCREEN (screen);

	if (strcasecmp (optionName, "shade_resistance") == 0)
	{
		if (optionValue->i)
			ms->shadeStep = 100 - optionValue->i + 1;
		else
			ms->shadeStep = 0;
	}
	else if (strcasecmp (optionName, "window_match") == 0)
	{
		matchFini (&ms->match);
		matchInit (&ms->match);
		matchAddFromString (&ms->match, optionValue->s);
		matchUpdate (&ms->match);
	}
}
コード例 #3
0
ファイル: scalefilter.c プロジェクト: Elive/ecomp
static void
scalefilterUpdateFilter (CompScreen *s,
	   		 CompMatch  *match)
{
    char         filterMatch[2 * MAX_FILTER_TEXT_LEN];
    unsigned int offset;

    FILTER_SCREEN (s);

    matchFini (match);
    matchInit (match);

    if (scalefilterGetFilterCaseInsensitive (s))
    {
	strncpy (filterMatch, "ititle=", MAX_FILTER_TEXT_LEN);
	offset = 7;
    }
    else
    {
    	strncpy (filterMatch, "title=", MAX_FILTER_TEXT_LEN);
	offset = 6;
    }

    wcstombs (filterMatch + offset, fs->filterInfo->filterString,
	      MAX_FILTER_STRING_LEN);
    matchAddExp (match, 0, filterMatch);
    matchAddGroup (match, MATCH_OP_AND_MASK, &fs->scaleMatch);
    matchUpdate (s->display, match);
}
コード例 #4
0
ファイル: opacify.c プロジェクト: jordigh/fusilli
static void
opacifyChangeNotify (const char        *optionName,
                     BananaType        optionType,
                     const BananaValue *optionValue,
                     int               screenNum)
{
	OPACIFY_DISPLAY (&display);

	if (strcasecmp (optionName, "toggle_key") == 0)
		updateKey (optionValue->s, &od->toggle_key);

	else if (strcasecmp (optionName, "init_toggle") == 0)
		od->toggle = optionValue->b;

	else if (strcasecmp (optionName, "window_match") == 0)
	{
		CompScreen *s = getScreenFromScreenNum (screenNum);
		OPACIFY_SCREEN (s);

		matchFini (&os->window_match);
		matchInit (&os->window_match);
		matchAddFromString (&os->window_match, optionValue->s);
		matchUpdate (&os->window_match);
	}
}
コード例 #5
0
ファイル: fade.c プロジェクト: zmike/compiz
static void
fadeUpdateWindowFadeMatch(CompDisplay *display,
                          CompOptionValue *value,
                          CompMatch *match)
{
   matchFini(match);
   matchInit(match);
   matchAddFromString(match, "!type=desktop");
   matchAddGroup(match, MATCH_OP_AND_MASK, &value->match);
   matchUpdate(display, match);
}
コード例 #6
0
ファイル: opacify.c プロジェクト: jordigh/fusilli
static void
opacifyFiniScreen (CompPlugin *p,
                   CompScreen *s)
{
	OPACIFY_SCREEN (s);

	UNWRAP (os, s, paintWindow);

	matchFini (&os->window_match);

	XDestroyRegion (os->intersect);

	free (os);
}
コード例 #7
0
ファイル: fade.c プロジェクト: zmike/compiz
static void
fadeFiniDisplay(CompPlugin *p,
                CompDisplay *d)
{
   FADE_DISPLAY(d);

   freeScreenPrivateIndex(d, fd->screenPrivateIndex);

   matchFini(&fd->alwaysFadeWindowMatch);

   UNWRAP(fd, d, handleEvent);
   UNWRAP(fd, d, matchExpHandlerChanged);

   free(fd);
}
コード例 #8
0
ファイル: scalefilter.c プロジェクト: Elive/ecomp
static void
scalefilterFiniFilterInfo (CompScreen *s,
			   Bool freeTimeout)
{
    FILTER_SCREEN (s);

    scalefilterFreeFilterText (s);

    matchFini (&fs->filterInfo->match);

    if (freeTimeout && fs->filterInfo->timeoutHandle)
	compRemoveTimeout (fs->filterInfo->timeoutHandle);

    free (fs->filterInfo);
    fs->filterInfo = NULL;
}
コード例 #9
0
ファイル: scalefilter.c プロジェクト: Elive/ecomp
static void
scalefilterHandleEcompEvent (CompDisplay *d,
	 		      char        *pluginName,
	 		      char        *eventName,
	 		      CompOption  *option,
	 		      int         nOption)
{
    FILTER_DISPLAY (d);

    UNWRAP (fd, d, handleEcompEvent);
    (*d->handleEcompEvent) (d, pluginName, eventName, option, nOption);
    WRAP (fd, d, handleEcompEvent, scalefilterHandleEcompEvent);

    if ((strcmp (pluginName, "scale") == 0) &&
	(strcmp (eventName, "activate") == 0))
    {
	Window xid = getIntOptionNamed (option, nOption, "root", 0);
	Bool activated = getBoolOptionNamed (option, nOption, "active", FALSE);
	CompScreen *s = findScreenAtDisplay (d, xid);

	if (s)
	{
	    FILTER_SCREEN (s);
	    SCALE_SCREEN (s);

	    if (activated)
	    {
		matchFini (&fs->scaleMatch);
		matchInit (&fs->scaleMatch);
		matchCopy (&fs->scaleMatch, ss->currentMatch);
		matchUpdate (d, &fs->scaleMatch);
		fs->matchApplied = FALSE;
	    }

	    if (!activated)
	    {
		if (fs->filterInfo)
		{
		    ss->currentMatch = fs->filterInfo->origMatch;
		    scalefilterFiniFilterInfo (s, TRUE);
		}
		fs->matchApplied = FALSE;
	    }
	}
    }
}
コード例 #10
0
ファイル: minimize.c プロジェクト: jordigh/fusilli
static void
minFiniScreen (CompPlugin *p,
               CompScreen *s)
{
	MIN_SCREEN (s);

	matchFini (&ms->match);
	freeWindowPrivateIndex (s, ms->windowPrivateIndex);

	UNWRAP (ms, s, preparePaintScreen);
	UNWRAP (ms, s, donePaintScreen);
	UNWRAP (ms, s, paintOutput);
	UNWRAP (ms, s, paintWindow);
	UNWRAP (ms, s, damageWindowRect);
	UNWRAP (ms, s, focusWindow);

	free (ms);
}
コード例 #11
0
ファイル: fade.c プロジェクト: zmike/compiz
static void
fadeFiniScreen(CompPlugin *p,
               CompScreen *s)
{
   FADE_SCREEN(s);

   matchFini(&fs->match);

   freeWindowPrivateIndex(s, fs->windowPrivateIndex);

   UNWRAP(fs, s, preparePaintScreen);
   UNWRAP(fs, s, paintWindow);
   UNWRAP(fs, s, damageWindowRect);
   UNWRAP(fs, s, focusWindow);
   UNWRAP(fs, s, windowResizeNotify);

   compFiniScreenOptions(s, fs->opt, FADE_SCREEN_OPTION_NUM);

   free(fs);
}
コード例 #12
0
ファイル: option.c プロジェクト: AtheistSpacePirate/compiz
Bool compSetMatchOption(CompOption * option, CompOptionValue * value)
{
	CompDisplay *display = option->value.match.display;
	CompMatch match;

	if (matchEqual(&option->value.match, &value->match))
		return FALSE;

	if (!matchCopy(&match, &value->match))
		return FALSE;

	matchFini(&option->value.match);

	option->value.match.op = match.op;
	option->value.match.nOp = match.nOp;

	if (display)
		matchUpdate(display, &option->value.match);

	return TRUE;
}
コード例 #13
0
ファイル: option.c プロジェクト: AtheistSpacePirate/compiz
void compFiniOptionValue(CompOptionValue * v, CompOptionType type)
{
	int i;

	switch (type) {
	case CompOptionTypeString:
		if (v->s)
			free(v->s);
		break;
	case CompOptionTypeMatch:
		matchFini(&v->match);
		break;
	case CompOptionTypeList:
		for (i = 0; i < v->list.nValue; i++)
			compFiniOptionValue(&v->list.value[i], v->list.type);

		if (v->list.value)
			free(v->list.value);
		break;
	default:
		break;
	}
}
コード例 #14
0
static Bool
ringInitiate (CompScreen      *s,
 	      CompAction      *action,
	      CompActionState state,
	      CompOption      *option,
	      int	      nOption)
{
    CompMatch *match;
    int       count; 

    RING_SCREEN (s);

    if (otherScreenGrabExist (s, "ring", NULL))
	return FALSE;
	   
    rs->currentMatch = ringGetWindowMatch (s);

    match = getMatchOptionNamed (option, nOption, "match", NULL);
    if (match)
    {
	matchFini (&rs->match);
	matchInit (&rs->match);
	if (matchCopy (&rs->match, match))
	{
	    matchUpdate (s->display, &rs->match);
	    rs->currentMatch = &rs->match;
	}
    }

    count = ringCountWindows (s);

    if (count < 1)
	return FALSE;

    if (!rs->grabIndex)
    {
	if (ringGetSelectWithMouse (s))
	    rs->grabIndex = pushScreenGrab (s, s->normalCursor, "ring");
	else
	    rs->grabIndex = pushScreenGrab (s, s->invisibleCursor, "ring");
    }

    if (rs->grabIndex)
    {
	rs->state = RingStateOut;

	if (!ringCreateWindowList (s))
	    return FALSE;

	rs->selectedWindow = rs->windows[0];
	ringRenderWindowTitle (s);
	rs->rotTarget = 0;

    	rs->moreAdjust = TRUE;
	damageScreen (s);

	switchActivateEvent (s, TRUE);
    }

    return TRUE;
}
コード例 #15
0
static Bool
decorSetDisplayOption (CompPlugin      *plugin,
		       CompDisplay     *display,
		       const char      *name,
		       CompOptionValue *value)
{
    CompOption *o;
    int	       index;

    DECOR_DISPLAY (display);

    o = compFindOption (dd->opt, NUM_OPTIONS (dd), name, &index);
    if (!o)
	return FALSE;

    switch (index) {
    case DECOR_DISPLAY_OPTION_COMMAND:
	if (compSetStringOption (o, value))
	{
	    CompScreen *s;

	    for (s = display->screens; s; s = s->next)
	    {
		DECOR_SCREEN (s);

		if (!ds->dmWin)
		    runCommand (s, o->value.s);
	    }

	    return TRUE;
	}
	break;
    case DECOR_DISPLAY_OPTION_SHADOW_MATCH:
	{
	    char *matchString;

	    /*
	       Make sure RGBA matching is always present and disable shadows
	       for RGBA windows by default if the user didn't specify an
	       RGBA match.
	       Reasoning for that is that shadows are desired for some RGBA
	       windows (e.g. rectangular windows that just happen to have an
	       RGBA colormap), while it's absolutely undesired for others
	       (especially shaped ones) ... by enforcing no shadows for RGBA
	       windows by default, we are flexible to user desires while still
	       making sure we don't show ugliness by default
	     */

	    matchString = matchToString (&value->match);
	    if (matchString)
	    {
		if (!strstr (matchString, "rgba="))
		{
		    CompMatch rgbaMatch;

		    matchInit (&rgbaMatch);
		    matchAddFromString (&rgbaMatch, "rgba=0");
		    matchAddGroup (&value->match, MATCH_OP_AND_MASK,
				   &rgbaMatch);
		    matchFini (&rgbaMatch);
		}
		free (matchString);
	    }
	}
	/* fall-through intended */
    case DECOR_DISPLAY_OPTION_DECOR_MATCH:
	if (compSetMatchOption (o, value))
	{
	    CompScreen *s;
	    CompWindow *w;

	    for (s = display->screens; s; s = s->next)
		for (w = s->windows; w; w = w->next)
		    decorWindowUpdate (w, TRUE);
	}
	break;
    default:
	if (compSetOption (o, value))
	    return TRUE;
	break;
    }

    return FALSE;
}
コード例 #16
0
ファイル: option.c プロジェクト: AtheistSpacePirate/compiz
Bool compSetOptionList(CompOption * option, CompOptionValue * value)
{
	CompOption o;
	Bool status = FALSE;
	int i, min;

	if (value->list.nValue != option->value.list.nValue) {
		CompOptionValue *v;

		v = malloc(sizeof(CompOptionValue) * value->list.nValue);
		if (!v)
			return FALSE;

		min = MIN(value->list.nValue, option->value.list.nValue);

		for (i = min; i < option->value.list.nValue; i++) {
			switch (option->value.list.type) {
			case CompOptionTypeString:
				if (option->value.list.value[i].s)
					free(option->value.list.value[i].s);
				break;
			case CompOptionTypeMatch:
				matchFini(&option->value.list.value[i].match);
			default:
				break;
			}
		}

		memset(v, 0, sizeof(CompOptionValue) * value->list.nValue);

		if (min)
			memcpy(v, option->value.list.value,
			       sizeof(CompOptionValue) * min);

		if (option->value.list.value)
			free(option->value.list.value);

		option->value.list.value = v;
		option->value.list.nValue = value->list.nValue;

		status = TRUE;
	}

	o = *option;
	o.type = option->value.list.type;

	for (i = 0; i < value->list.nValue; i++) {
		o.value = option->value.list.value[i];

		switch (o.type) {
		case CompOptionTypeBool:
			status |= compSetBoolOption(&o, &value->list.value[i]);
			break;
		case CompOptionTypeInt:
			status |= compSetIntOption(&o, &value->list.value[i]);
			break;
		case CompOptionTypeFloat:
			status |= compSetFloatOption(&o, &value->list.value[i]);
			break;
		case CompOptionTypeString:
			status |=
			    compSetStringOption(&o, &value->list.value[i]);
			break;
		case CompOptionTypeColor:
			status |= compSetColorOption(&o, &value->list.value[i]);
			break;
		case CompOptionTypeMatch:
			status |= compSetMatchOption(&o, &value->list.value[i]);
		default:
			break;
		}

		option->value.list.value[i] = o.value;
	}

	return status;
}
コード例 #17
0
ファイル: match.c プロジェクト: SubwayDesktop/compiz-stable
/*
  Add match expressions from string. Special characters are
  '(', ')', '!', '&', '|'. Escape character is '\'.

  Example:

  "type=desktop | !type=dock"
  "!type=dock & (state=fullscreen | state=shaded)"
*/
void
matchAddFromString (CompMatch  *match,
		    const char *str)
{
    char *value;
    int	 j, i = 0;
    int	 flags = 0;

    while (str[i] != '\0')
    {
	while (str[i] == ' ')
	    i++;

	if (str[i] == '!')
	{
	    flags |= MATCH_OP_NOT_MASK;

	    i++;
	    while (str[i] == ' ')
		i++;
	}

	if (str[i] == '(')
	{
	    int	level = 1;
	    int length;

	    j = ++i;

	    while (str[j] != '\0')
	    {
		if (str[j] == '(')
		{
		    level++;
		}
		else if (str[j] == ')')
		{
		    level--;
		    if (level == 0)
			break;
		}

		j = nextIndex (str, ++j);
	    }

	    length = j - i;

	    value = malloc (sizeof (char) * (length + 1));
	    if (value)
	    {
		CompMatch group;

		strncpy (value, &str[i], length);
		value[length] = '\0';

		matchInit (&group);
		matchAddFromString (&group, value);
		matchAddGroup (match, flags, &group);
		matchFini (&group);

		free (value);
	    }

	    while (str[j] != '\0' && str[j] != '|' && str[j] != '&')
		j++;
	}
	else
	{
	    j = i;

	    while (str[j] != '\0' && str[j] != '|' && str[j] != '&')
		j = nextIndex (str, ++j);

	    value = strndupValue (&str[i], j - i);
	    if (value)
	    {
		matchAddExp (match, flags, value);

		free (value);
	    }
	}

	i = j;

	if (str[i] != '\0')
	{
	    if (str[i] == '&')
		flags = MATCH_OP_AND_MASK;

	    i++;
	}
    }
}
コード例 #18
0
ファイル: ini.c プロジェクト: SubwayDesktop/compiz-stable
static Bool
iniLoadOptionsFromFile (FILE       *optionFile,
			CompObject *object,
			const char *plugin,
			Bool       *reSave)
{
    CompOption      *option = NULL, *o;
    CompPlugin      *p = NULL;
    CompOptionValue value;
    char            *optionName = NULL, *optionValue = NULL;
    char            tmp[MAX_OPTION_LENGTH];
    int             nOption, nOptionRead = 0;
    Bool            status = FALSE, hasValue = FALSE;

    if (plugin)
    {
	p = findActivePlugin (plugin);
	if (!p)
	{
	    compLogMessage ("ini", CompLogLevelWarn,
			    "Could not find running plugin " \
			    "%s (iniLoadOptionsFromFile)", plugin);
	    return FALSE;
	}
    }
    else
    {
	return FALSE;
    }

    if (p->vTable->getObjectOptions)
	option = (*p->vTable->getObjectOptions) (p, object, &nOption);

    while (fgets (tmp, MAX_OPTION_LENGTH, optionFile) != NULL)
    {
	status = FALSE;

	if (!iniParseLine (tmp, &optionName, &optionValue))
	{
	    compLogMessage ("ini", CompLogLevelWarn,
			    "Ignoring line '%s' in %s", tmp, plugin);
	    continue;
	}

	if (option)
	{
	    o = compFindOption (option, nOption, optionName, 0);
	    if (o)
	    {
		value = o->value;

		switch (o->type)
		{
		case CompOptionTypeBool:
		    hasValue = TRUE;
		    value.b = (Bool) atoi (optionValue);
			break;
		case CompOptionTypeInt:
		    hasValue = TRUE;
		    value.i = atoi (optionValue);
			break;
		case CompOptionTypeFloat:
		    hasValue = TRUE;
		    value.f = atof (optionValue);
			break;
		case CompOptionTypeString:
		    hasValue = TRUE;
		    value.s = strdup (optionValue);
			break;
		case CompOptionTypeColor:
		    hasValue = stringToColor (optionValue, value.c);
			break;
		case CompOptionTypeKey:
		    hasValue = TRUE;
		    stringToKeyAction (GET_CORE_DISPLAY (object),
				       optionValue, &value.action);
		    break;
		case CompOptionTypeButton:
		    hasValue = TRUE;
		    stringToButtonAction (GET_CORE_DISPLAY (object),
					  optionValue, &value.action);
		    break;
		case CompOptionTypeEdge:
		    hasValue = TRUE;
		    value.action.edgeMask = stringToEdgeMask (optionValue);
		    break;
		case CompOptionTypeBell:
		    hasValue = TRUE;
		    value.action.bell = (Bool) atoi (optionValue);
		    break;
		case CompOptionTypeList:
		    hasValue = csvToList (GET_CORE_DISPLAY (object),
					  optionValue,
					  &value.list, value.list.type);
			break;
		case CompOptionTypeMatch:
		    hasValue = TRUE;
		    matchInit (&value.match);
		    matchAddFromString (&value.match, optionValue);
			break;
		default:
			break;
		}

		if (hasValue)
		{
		    status = (*core.setOptionForPlugin) (object,
							 plugin,
							 optionName,
							 &value);

		    if (o->type == CompOptionTypeMatch)
		    {
			matchFini (&value.match);
		    }
		}

		nOptionRead++;
	    }
	}

	/* clear up */
	if (optionName)
	    free (optionName);
	if (optionValue)
	    free (optionValue);
    }

    if (nOption != nOptionRead)
    {
	*reSave = TRUE;
    }

    return TRUE;
}
コード例 #19
0
ファイル: group-init.c プロジェクト: noodlylight/fusilli
/*
 * groupFiniScreen
 *
 */
static void
groupFiniScreen (CompPlugin *p,
                 CompScreen *s)
{
    GROUP_SCREEN (s);

    if (gs->groups)
    {
        GroupSelection *group, *nextGroup;

        for (group = gs->groups; group; )
        {
            if (group->tabBar)
            {
                GroupTabBarSlot *slot, *nextSlot;

                for (slot = group->tabBar->slots; slot; )
                {
                    if (slot->region)
                        XDestroyRegion (slot->region);

                    nextSlot = slot->next;
                    free (slot);
                    slot = nextSlot;
                }

                groupDestroyCairoLayer (s, group->tabBar->textLayer);
                groupDestroyCairoLayer (s, group->tabBar->bgLayer);
                groupDestroyCairoLayer (s, group->tabBar->selectionLayer);

                if (group->inputPrevention)
                    XDestroyWindow (display.display,
                                    group->inputPrevention);

                if (group->tabBar->region)
                    XDestroyRegion (group->tabBar->region);

                if (group->tabBar->timeoutHandle)
                    compRemoveTimeout (group->tabBar->timeoutHandle);

                free (group->tabBar);
            }

            nextGroup = group->next;
            free (group);
            group = nextGroup;
        }
    }

    if (gs->tmpSel.windows)
        free (gs->tmpSel.windows);

    if (gs->grabIndex)
        groupGrabScreen (s, ScreenGrabNone);

    if (gs->dragHoverTimeoutHandle)
        compRemoveTimeout (gs->dragHoverTimeoutHandle);

    if (gs->showDelayTimeoutHandle)
        compRemoveTimeout (gs->showDelayTimeoutHandle);

    if (gs->dequeueTimeoutHandle)
        compRemoveTimeout (gs->dequeueTimeoutHandle);

    if (gs->initialActionsTimeoutHandle)
        compRemoveTimeout (gs->initialActionsTimeoutHandle);

    freeWindowPrivateIndex (s, gs->windowPrivateIndex);

    matchFini (&gs->window_match);

    UNWRAP (gs, s, windowMoveNotify);
    UNWRAP (gs, s, windowResizeNotify);
    UNWRAP (gs, s, getOutputExtentsForWindow);
    UNWRAP (gs, s, preparePaintScreen);
    UNWRAP (gs, s, paintOutput);
    UNWRAP (gs, s, drawWindow);
    UNWRAP (gs, s, paintWindow);
    UNWRAP (gs, s, paintTransformedOutput);
    UNWRAP (gs, s, donePaintScreen);
    UNWRAP (gs, s, windowGrabNotify);
    UNWRAP (gs, s, windowUngrabNotify);
    UNWRAP (gs, s, damageWindowRect);
    UNWRAP (gs, s, windowStateChangeNotify);
    UNWRAP (gs, s, activateWindow);

    finiTexture (s, &gs->glowTexture);
    free (gs);
}
コード例 #20
0
ファイル: scalefilter.c プロジェクト: Elive/ecomp
static void
scalefilterHandleKeyPress (CompScreen *s,
			   XKeyEvent  *event)
{
    ScaleFilterInfo *info;
    Bool            needRelayout = FALSE;
    Bool            dropKeyEvent = FALSE;
    int             count, timeout;
    char            buffer[10];
    wchar_t         wbuffer[10];
    KeySym          ks;

    FILTER_DISPLAY (s->display);
    FILTER_SCREEN (s);
    SCALE_SCREEN (s);

    info = fs->filterInfo;
    memset (buffer, 0, sizeof (buffer));
    memset (wbuffer, 0, sizeof (wbuffer));

    if (fd->xic)
    {
	Status status;

	XSetICFocus (fd->xic);
	count = Xutf8LookupString (fd->xic, event, buffer, 9, &ks, &status);
	XUnsetICFocus (fd->xic);
    }
    else
    {
	count = XLookupString (event, buffer, 9, &ks, NULL);
    }

    mbstowcs (wbuffer, buffer, 9);

    if (ks == XK_Escape)
    {
	if (info)
	{
	    /* Escape key - drop current filter */
	    ss->currentMatch = info->origMatch;
	    scalefilterFiniFilterInfo (s, TRUE);
	    needRelayout = TRUE;
	    dropKeyEvent = TRUE;
	}
	else if (fs->matchApplied)
	{
	    /* remove filter applied previously
	       if currently not in input mode */
	    matchFini (&ss->match);
	    matchInit (&ss->match);
	    matchCopy (&ss->match, &fs->scaleMatch);
	    matchUpdate (s->display, &ss->match);

	    ss->currentMatch = &ss->match;
	    fs->matchApplied = FALSE;
	    needRelayout = TRUE;
	    dropKeyEvent = TRUE;
	}
    }
    else if (ks == XK_Return)
    {
	if (info)
	{
	    /* Return key - apply current filter persistently */
	    matchFini (&ss->match);
	    matchInit (&ss->match);
	    matchCopy (&ss->match, &info->match);
	    matchUpdate (s->display, &ss->match);

	    ss->currentMatch = &ss->match;
	    fs->matchApplied = TRUE;
	    dropKeyEvent = TRUE;
	    needRelayout = TRUE;
	    scalefilterFiniFilterInfo (s, TRUE);
	}
    }
    else if (ks == XK_BackSpace)
    {
	if (info && info->filterStringLength > 0)
	{
	    /* remove last character in string */
	    info->filterString[--(info->filterStringLength)] = '\0';
	    needRelayout = TRUE;
	}
    }
    else if (count > 0)
    {
	if (!info)
	{
	    fs->filterInfo = info = malloc (sizeof (ScaleFilterInfo));
	    scalefilterInitFilterInfo (s);
	}
	else if (info->timeoutHandle)
	    compRemoveTimeout (info->timeoutHandle);

	timeout = scalefilterGetTimeout (s);
	if (timeout > 0)
	    info->timeoutHandle = compAddTimeout (timeout,
				     		  scalefilterFilterTimeout, s);

	if (info->filterStringLength < MAX_FILTER_SIZE)
	{
	    info->filterString[info->filterStringLength++] = wbuffer[0];
	    info->filterString[info->filterStringLength] = '\0';
	    needRelayout = TRUE;
	}
    }

    /* set the event type invalid if we
       don't want other plugins see it */
    if (dropKeyEvent)
	event->type = LASTEvent+1;

    if (needRelayout)
    {
	scalefilterRenderFilterText (s);

	if (fs->filterInfo)
	    scalefilterUpdateFilter (s, &fs->filterInfo->match);

	scalefilterRelayout (s);
    }
}
コード例 #21
0
ファイル: group-init.c プロジェクト: noodlylight/fusilli
static void
groupChangeNotify (const char        *optionName,
                   BananaType        optionType,
                   const BananaValue *optionValue,
                   int               screenNum)
{
    GROUP_DISPLAY (&display);

    if (strcasecmp (optionName, "window_match") == 0)
    {
        CompScreen *s = getScreenFromScreenNum (screenNum);
        GROUP_SCREEN (s);

        matchFini (&gs->window_match);
        matchInit (&gs->window_match);
        matchAddFromString (&gs->window_match, optionValue->s);
        matchUpdate (&gs->window_match);
    }
    else if (strcasecmp (optionName, "tab_base_color") == 0 ||
             strcasecmp (optionName, "tab_highlight_color") == 0 ||
             strcasecmp (optionName, "tab_border_color") == 0 ||
             strcasecmp (optionName, "tab_style") == 0 ||
             strcasecmp (optionName, "border_radius") == 0 ||
             strcasecmp (optionName, "border_width") == 0)
    {
        GroupSelection *group;

        CompScreen *s = getScreenFromScreenNum (screenNum);
        GROUP_SCREEN (s);

        for (group = gs->groups; group; group = group->next)
            if (group->tabBar)
                groupRenderTabBarBackground (group);
    }
    else if (strcasecmp (optionName, "tabbar_font_size") == 0 ||
             strcasecmp (optionName, "tabbar_font_color") == 0)
    {
        GroupSelection *group;

        CompScreen *s = getScreenFromScreenNum (screenNum);
        GROUP_SCREEN (s);

        for (group = gs->groups; group; group = group->next)
            groupRenderWindowTitle (group);
    }
    else if (strcasecmp (optionName, "thumb_size") == 0 ||
             strcasecmp (optionName, "thumb_space") == 0)
    {
        GroupSelection *group;

        CompScreen *s = getScreenFromScreenNum (screenNum);
        GROUP_SCREEN (s);

        for (group = gs->groups; group; group = group->next)
            if (group->tabBar)
            {
                BoxPtr box = &group->tabBar->region->extents;
                groupRecalcTabBarPos (group, (box->x1 + box->x2 ) / 2,
                                      box->x1, box->x2);
            }
    }
    else if (strcasecmp (optionName, "glow") == 0 ||
             strcasecmp (optionName, "glow_size") == 0)
    {
        CompScreen *s = getScreenFromScreenNum (screenNum);
        GROUP_SCREEN (s);

        CompWindow *w;

        for (w = s->windows; w; w = w->next)
        {
            GROUP_WINDOW (w);

            groupComputeGlowQuads (w, &gs->glowTexture.matrix);
            if (gw->glowQuads)
            {
                damageWindowOutputExtents (w);
                updateWindowOutputExtents (w);
                damageWindowOutputExtents (w);
            }
        }
    }
    else if (strcasecmp (optionName, "glow_type") == 0)
    {
        CompScreen *s = getScreenFromScreenNum (screenNum);
        GROUP_SCREEN (s);

        int glowType;
        GlowTextureProperties *glowProperty;

        GROUP_DISPLAY (&display);

        const BananaValue *
        option_glow_type = bananaGetOption (bananaIndex,
                                            "glow_type",
                                            s->screenNum);

        glowType = option_glow_type->i;
        glowProperty = &gd->glowTextureProperties[glowType];

        finiTexture (s, &gs->glowTexture);
        initTexture (s, &gs->glowTexture);

        imageDataToTexture (s, &gs->glowTexture,
                            glowProperty->textureData,
                            glowProperty->textureSize,
                            glowProperty->textureSize,
                            GL_RGBA, GL_UNSIGNED_BYTE);

        const BananaValue *
        option_glow = bananaGetOption (bananaIndex,
                                       "glow",
                                       s->screenNum);

        if (option_glow->b && gs->groups)
        {
            CompWindow *w;

            for (w = s->windows; w; w = w->next)
                groupComputeGlowQuads (w, &gs->glowTexture.matrix);

            damageScreen (s);
        }
    }
    else if (strcasecmp (optionName, "select_button") == 0)
        updateButton (optionValue->s, &gd->select_button);
    else if (strcasecmp (optionName, "select_single_key") == 0)
        updateKey (optionValue->s, &gd->select_single_key);
    else if (strcasecmp (optionName, "group_key") == 0)
        updateKey (optionValue->s, &gd->group_key);
    else if (strcasecmp (optionName, "ungroup_key") == 0)
        updateKey (optionValue->s, &gd->ungroup_key);
    else if (strcasecmp (optionName, "remove_key") == 0)
        updateKey (optionValue->s, &gd->remove_key);
    else if (strcasecmp (optionName, "close_key") == 0)
        updateKey (optionValue->s, &gd->close_key);
    else if (strcasecmp (optionName, "ignore_key") == 0)
        updateKey (optionValue->s, &gd->ignore_key);
    else if (strcasecmp (optionName, "tabmode_key") == 0)
        updateKey (optionValue->s, &gd->tabmode_key);
    else if (strcasecmp (optionName, "change_tab_left_key") == 0)
        updateKey (optionValue->s, &gd->change_tab_left_key);
    else if (strcasecmp (optionName, "change_tab_right_key") == 0)
        updateKey (optionValue->s, &gd->change_tab_right_key);
    else if (strcasecmp (optionName, "change_color_key") == 0)
        updateKey (optionValue->s, &gd->change_color_key);
    else if (strcasecmp (optionName, "autotab_windows") == 0)
    {
        CompScreen *s = getScreenFromScreenNum (screenNum);

        GROUP_SCREEN (s);

        int i;
        if (gs->autotab && gs->autotabCount != 0)
        {
            for (i = 0; i <= gs->autotabCount - 1; i++)
                matchFini (&gs->autotab[i]);

            free (gs->autotab);
        }

        gs->autotabCount = optionValue->list.nItem;
        gs->autotab = malloc (gs->autotabCount * sizeof (CompMatch));

        for (i = 0; i <= gs->autotabCount - 1; i++)
        {
            matchInit (&gs->autotab[i]);
            matchAddFromString (&gs->autotab[i], optionValue->list.item[i].s);
            matchUpdate (&gs->autotab[i]);
        }
    }
}
コード例 #22
0
ファイル: winrules.c プロジェクト: noodlylight/fusilli
static void
winrulesChangeNotify (const char        *optionName,
                      BananaType        optionType,
                      const BananaValue *optionValue,
                      int               screenNum)
{
	unsigned int updateStateMask = 0, updateActionsMask = 0;

	CompScreen *screen = getScreenFromScreenNum (screenNum);

	WINRULES_SCREEN (screen);

	CompMatch *match;

	if (strcasecmp (optionName, "skiptaskbar_match") == 0)
	{
		match = &ws->skiptaskbar_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateStateMask = CompWindowStateSkipTaskbarMask;
	}
	else if (strcasecmp (optionName, "skippager_match") == 0)
	{
		match = &ws->skippager_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateStateMask = CompWindowStateSkipPagerMask;
	}
	else if (strcasecmp (optionName, "above_match") == 0)
	{
		match = &ws->above_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateStateMask = CompWindowStateAboveMask;
	}
	else if (strcasecmp (optionName, "below_match") == 0)
	{
		match = &ws->below_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateStateMask = CompWindowStateBelowMask;
	}
	else if (strcasecmp (optionName, "sticky_match") == 0)
	{
		match = &ws->sticky_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateStateMask = CompWindowStateStickyMask;
	}
	else if (strcasecmp (optionName, "fullscreen_match") == 0)
	{
		match = &ws->fullscreen_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateStateMask = CompWindowStateFullscreenMask;
	}
	else if (strcasecmp (optionName, "maximize_match") == 0)
	{
		match = &ws->maximize_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateStateMask = CompWindowStateMaximizedHorzMask |
		                  CompWindowStateMaximizedVertMask;
	}
	else if (strcasecmp (optionName, "no_move_match") == 0)
	{
		match = &ws->no_move_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateActionsMask = CompWindowActionMoveMask;
	}
	else if (strcasecmp (optionName, "no_resize_match") == 0)
	{
		match = &ws->no_resize_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateActionsMask = CompWindowActionResizeMask;
	}
	else if (strcasecmp (optionName, "no_minimize_match") == 0)
	{
		match = &ws->no_minimize_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateActionsMask = CompWindowActionMinimizeMask;
	}
	else if (strcasecmp (optionName, "no_maximize_match") == 0)
	{
		match = &ws->no_maximize_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateActionsMask = CompWindowActionMaximizeVertMask |
		                    CompWindowActionMaximizeHorzMask;
	}
	else if (strcasecmp (optionName, "no_close_match") == 0)
	{
		match = &ws->no_close_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateActionsMask = CompWindowActionCloseMask;
	}
	else if (strcasecmp (optionName, "no_argb_match") == 0)
	{
		match = &ws->no_argb_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		CompWindow *w;

		for (w = screen->windows; w; w = w->next)
			winrulesSetNoAlpha (w, match);
	}
	else if (strcasecmp (optionName, "no_focus_match") == 0)
	{
		match = &ws->no_focus_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		CompWindow *w;

		for (w = screen->windows; w; w = w->next)
			winrulesSetNoFocus (w, match);
	}
	else if (strcasecmp (optionName, "size_matches") == 0)
	{
		int i;
		for (i = 0; i < ws->size_matches_count; i++)
			matchFini (&ws->size_matches[i]);

		ws->size_matches_count = optionValue->list.nItem;
		for (i = 0; i < ws->size_matches_count; i++)
		{
			matchInit (&ws->size_matches[i]);
			matchAddFromString (&ws->size_matches[i],
			                    optionValue->list.item[i].s);
			matchUpdate (&ws->size_matches[i]);
		}
	}

	if (strcasecmp (optionName, "size_matches") == 0 ||
	    strcasecmp (optionName, "size_width_values") == 0 ||
	    strcasecmp (optionName, "size_height_values") == 0)
	{
		CompWindow *w;

		for (w = screen->windows; w; w = w->next)
		{
			int width, height;

			if (winrulesMatchSize (w, &width, &height))
				winrulesUpdateWindowSize (w, width, height);
		}
	}

	if (updateStateMask)
	{
		CompWindow *w;

		for (w = screen->windows; w; w = w->next)
			winrulesUpdateState (w, match, updateStateMask);
	}

	if (updateActionsMask)
	{
		CompWindow *w;

		for (w = screen->windows; w; w = w->next)
			winrulesSetAllowedActions (w, match, updateActionsMask);
	}
}
コード例 #23
0
ファイル: winrules.c プロジェクト: noodlylight/fusilli
static void
winrulesFiniScreen (CompPlugin *p,
                    CompScreen *s)
{
	WINRULES_SCREEN (s);

	UNWRAP (ws, s, getAllowedActionsForWindow);

	matchFini (&ws->skiptaskbar_match);
	matchFini (&ws->skippager_match);
	matchFini (&ws->above_match);
	matchFini (&ws->below_match);
	matchFini (&ws->sticky_match);
	matchFini (&ws->fullscreen_match);
	matchFini (&ws->maximize_match);
	matchFini (&ws->no_argb_match);
	matchFini (&ws->no_move_match);
	matchFini (&ws->no_resize_match);
	matchFini (&ws->no_minimize_match);
	matchFini (&ws->no_maximize_match);
	matchFini (&ws->no_close_match);
	matchFini (&ws->no_focus_match);

	int i;
	for (i = 0; i < ws->size_matches_count; i++)
		matchFini (&ws->size_matches[i]);

	freeWindowPrivateIndex (s, ws->windowPrivateIndex);

	free (ws);
}