示例#1
0
static Bool
minSetScreenOption(CompPlugin * plugin,
		   CompScreen * screen,
		   const char *name, CompOptionValue * value)
{
	CompOption *o;
	int index;

	MIN_SCREEN(screen);

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

	switch (index) {
	case MIN_SCREEN_OPTION_SHADE_RESISTANCE:
		if (compSetIntOption(o, value)) {
			if (o->value.i)
				ms->shadeStep = o->rest.i.max - o->value.i + 1;
			else
				ms->shadeStep = 0;

			return TRUE;
		}
		break;
	default:
		if (compSetOption(o, value))
			return TRUE;
		break;
	}

	return FALSE;
}
示例#2
0
Bool
compSetDisplayOption (CompDisplay     *d,
		      CompOption      *o,
		      CompOptionValue *value)
{
    if (isActionOption (o))
    {
	if (o->value.action.state & CompActionStateAutoGrab)
	{
	    if (setDisplayAction (d, o, value))
		return TRUE;
	}
	else
	{
	    if (compSetActionOption (o, value))
		return TRUE;
	}
    }
    else
    {
	if (compSetOption (o, value))
	    return TRUE;
    }

    return FALSE;
}
static Bool
notifySetDisplayOption (CompPlugin      *p,
                        CompDisplay     *display,
                        const char      *name,
                        CompOptionValue *value)
{
    CompOption *o;
    int	       index;

    NOTIFY_DISPLAY (display);

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

    switch (index) {
    case NOTIFY_DISPLAY_OPTION_TIMEOUT:
        if (compSetIntOption (o, value))
        {
            if (value->i == -1)
                nd->timeout = value->i;
            else
                nd->timeout = value->i * 1000;
            return TRUE;
        }
    default:
        if (compSetOption (o, value))
            return TRUE;
        break;
    }

    return FALSE;
}
示例#4
0
文件: metadata.c 项目: Elive/ecomp
Bool
compSetDisplayOption(CompDisplay     *d,
                     CompOption      *o,
                     CompOptionValue *value)
{
   /* if (o->type == CompOptionTypeAction)
    * {
    *   if (o->value.action.state & CompActionStateAutoGrab)
    *   {
    *       if (setDisplayAction (d, o, value))
    *     return TRUE;
    *   }
    *   else
    *   {
    *       if (compSetActionOption (o, value))
    *     return TRUE;
    *   }
    * }
    * else */
     {
        if (compSetOption (o, value))
          return TRUE;
     }

     return FALSE;
}
示例#5
0
Bool
compSetScreenOption (CompScreen      *s,
		     CompOption      *o,
		     CompOptionValue *value)
{
    if (compSetOption (o, value))
	return TRUE;

    return FALSE;
}
static Bool
sessionSetDisplayOption (CompPlugin      *p,
			 CompDisplay     *d,
			 const char      *name,
			 CompOptionValue *value)
{
    CompOption *o;

    SESSION_DISPLAY (d);

    o = compFindOption (sd->opt, NUM_OPTIONS (sd), name, NULL);
    if (!o)
	return FALSE;

    return compSetOption (o, value);
}
示例#7
0
文件: fade.c 项目: zmike/compiz
static Bool
fadeSetScreenOption(CompPlugin *plugin,
                    CompScreen *screen,
                    const char *name,
                    CompOptionValue *value)
{
   CompOption *o;
   int index;

   FADE_SCREEN(screen);

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

   switch (index)
     {
      case FADE_SCREEN_OPTION_FADE_SPEED:
        if (compSetFloatOption(o, value))
          {
             fs->fadeTime = 1000.0f / o->value.f;
             return TRUE;
          }
        break;

      case FADE_SCREEN_OPTION_WINDOW_MATCH:
        if (compSetMatchOption(o, value))
          {
             fadeUpdateWindowFadeMatch(screen->display, &o->value, &fs->match);
             return TRUE;
          }
        break;

      default:
        if (compSetOption(o, value))
          return TRUE;
        break;
     }

   return FALSE;
}
示例#8
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;
}