コード例 #1
0
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;
}
コード例 #2
0
ファイル: minimize.c プロジェクト: AtheistSpacePirate/compiz
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;
}
コード例 #3
0
ファイル: video.c プロジェクト: zmike/compiz
static Bool
videoSetDisplayOption(CompPlugin *plugin,
                      CompDisplay *display,
                      const char *name,
                      CompOptionValue *value)
{
   CompOption *o;
   int index;

   VIDEO_DISPLAY(display);

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

   switch (index)
     {
      case VIDEO_DISPLAY_OPTION_YV12:
        if (compSetBoolOption(o, value))
          {
             CompScreen *s;

             for (s = display->screens; s; s = s->next)
               videoSetSupportedHint(s);
          }

      default:
        break;
     }

   return FALSE;
}
コード例 #4
0
static Bool
setScreenOption (CompScreen      *screen,
		 char	         *name,
		 CompOptionValue *value)
{
    CompOption *o;
    int	       index;

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

    switch (index) {
    case COMP_SCREEN_OPTION_REFRESH_RATE:
	if (compSetIntOption (o, value))
	{
	    screen->redrawTime = 1000 / o->value.i;
	    return TRUE;
	}
    default:
	break;
    }

    return FALSE;
}
コード例 #5
0
static CompBool
kconfigSetOptionForPlugin (CompObject      *object,
			   const char	   *plugin,
			   const char	   *name,
			   CompOptionValue *value)
{
    CompBool status;

    KCONFIG_CORE (&core);

    UNWRAP (kc, &core, setOptionForPlugin);
    status = (*core.setOptionForPlugin) (object, plugin, name, value);
    WRAP (kc, &core, setOptionForPlugin, kconfigSetOptionForPlugin);

    if (status && !kc->reloadHandle)
    {
	CompPlugin *p;

	p = findActivePlugin (plugin);
	if (p && p->vTable->getObjectOptions)
	{
	    CompOption *option;
	    int	       nOption;

	    option = (*p->vTable->getObjectOptions) (p, object, &nOption);
	    option = compFindOption (option, nOption, name, 0);
	    if (option)
		kconfigSetOption (object, option, p->vTable->name);
	}
    }

    return status;
}
コード例 #6
0
static CompBool
ccpSetOptionForPlugin (CompObject      *object,
		       const char      *plugin,
		       const char      *name,
		       CompOptionValue *value)
{
    CompBool status;

    CCP_CORE (&core);

    UNWRAP (cc, &core, setOptionForPlugin);
    status = (*core.setOptionForPlugin) (object, plugin, name, value);
    WRAP (cc, &core, setOptionForPlugin, ccpSetOptionForPlugin);

    if (status && !cc->applyingSettings && !cc->reloadHandle)
    {
	CompPlugin *p;

	p = findActivePlugin (plugin);
	if (p && p->vTable->getObjectOptions)
	{
	    CompOption *option;
	    int	       nOption;

	    option = (*p->vTable->getObjectOptions) (p, object, &nOption);
	    option = compFindOption (option, nOption, name, 0);
	    if (option)
		ccpSetContextFromOption (object, option, p->vTable->name);
	}
    }

    return status;
}
コード例 #7
0
ファイル: zoom.c プロジェクト: zmike/compiz
static Bool
zoomSetDisplayOption(CompPlugin *plugin,
                     CompDisplay *display,
                     const char *name,
                     CompOptionValue *value)
{
   CompOption *o;
   int index;

   ZOOM_DISPLAY(display);

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

   switch (index)
     {
      case ZOOM_DISPLAY_OPTION_OUT_BUTTON:
        if (compSetActionOption(o, value))
          return TRUE;
        break;

      default:
        return compSetDisplayOption(display, o, value);
     }

   return FALSE;
}
コード例 #8
0
ファイル: fuse.c プロジェクト: zmike/compiz
static Bool
fuseSetDisplayOption(CompPlugin *plugin,
                     CompDisplay *display,
                     const char *name,
                     CompOptionValue *value)
{
   CompOption *o;
   int index;

   FUSE_DISPLAY(display);

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

   switch (index)
     {
      case FUSE_DISPLAY_OPTION_MOUNT_POINT:
        if (compSetStringOption(o, value))
          {
             fuseUnmount(display);
             fuseMount(display);
             return TRUE;
          }

      default:
        break;
     }

   return FALSE;
}
コード例 #9
0
static Bool
scaleSetScreenOption (CompPlugin      *plugin,
		      CompScreen      *screen,
		      const char      *name,
		      CompOptionValue *value)
{
    CompOption *o;
    int	       index;

    SCALE_SCREEN (screen);

    o = compFindOption (ss->opt, NUM_OPTIONS (ss), name, &index);

    if (!o)
	return FALSE;

    switch (index) {
    case SCALE_SCREEN_OPTION_OPACITY:
	if (compSetIntOption (o, value))
	{
	    ss->opacity = (OPAQUE * o->value.i) / 100;
	    return TRUE;
	}
	break;
    default:
	return compSetScreenOption (screen, o, value);
    }

    return FALSE;
}
コード例 #10
0
static Bool
fadeSetScreenOption (CompScreen      *screen,
		     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;
	}
    default:
	break;
    }

    return FALSE;
}
コード例 #11
0
ファイル: water.c プロジェクト: SubwayDesktop/compiz-stable
static Bool
waterSetDisplayOption (CompPlugin      *plugin,
		       CompDisplay     *display,
		       const char      *name,
		       CompOptionValue *value)
{
    CompOption *o;
    int	       index;

    WATER_DISPLAY (display);

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

    switch (index) {
    case WATER_DISPLAY_OPTION_OFFSET_SCALE:
	if (compSetFloatOption (o, value))
	{
	    wd->offsetScale = o->value.f * 50.0f;
	    return TRUE;
	}
	break;
    case WATER_DISPLAY_OPTION_RAIN_DELAY:
	if (compSetIntOption (o, value))
	{
	    CompScreen *s;

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

		if (!ws->rainHandle)
		    continue;

		compRemoveTimeout (ws->rainHandle);
		ws->rainHandle = compAddTimeout (value->i,
						 (float)value->i * 1.2,
						 waterRainTimeout, s);
	    }
	    return TRUE;
	}
	break;
    default:
	return compSetDisplayOption (display, o, value);
    }

    return FALSE;
}
コード例 #12
0
ファイル: clone.c プロジェクト: AtheistSpacePirate/compiz
static Bool
cloneSetDisplayOption(CompPlugin * plugin,
		      CompDisplay * display,
		      const char *name, CompOptionValue * value)
{
	CompOption *o;

	CLONE_DISPLAY(display);

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

	return compSetDisplayOption(display, o, value);
}
コード例 #13
0
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);
}
コード例 #14
0
ファイル: commands.c プロジェクト: zmike/compiz
static CompBool
commandsSetDisplayOption(CompPlugin *p,
                         CompDisplay *d,
                         const char *name,
                         CompOptionValue *value)
{
   CompOption *o;

   COMMANDS_DISPLAY(d);

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

   return compSetDisplayOption(d, o, value);
}
コード例 #15
0
ファイル: zoom.c プロジェクト: zmike/compiz
static Bool
zoomSetScreenOption(CompPlugin *plugin,
                    CompScreen *screen,
                    const char *name,
                    CompOptionValue *value)
{
   CompOption *o;

   ZOOM_SCREEN(screen);

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

   return compSetScreenOption(screen, o, value);
}
コード例 #16
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;
}
コード例 #17
0
static Bool
setDisplayOption (CompDisplay     *display,
		  char	          *name,
		  CompOptionValue *value)
{
    CompOption *o;
    int	       index;

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

    switch (index) {
    case COMP_DISPLAY_OPTION_ACTIVE_PLUGINS:
	if (compSetOptionList (o, value))
	{
	    display->dirtyPluginList = TRUE;
	    return TRUE;
	}
	break;
    case COMP_DISPLAY_OPTION_TEXTURE_FILTER:
	if (compSetStringOption (o, value))
	{
	    CompScreen *s;

	    for (s = display->screens; s; s = s->next)
		damageScreen (s);

	    if (strcmp (o->value.s, "Fast") == 0)
		display->textureFilter = GL_NEAREST;
	    else
		display->textureFilter = GL_LINEAR;

	    return TRUE;
	}
    default:
	break;
    }

    return FALSE;
}
コード例 #18
0
static Bool
ccpTimeout (void *closure)
{
    unsigned int flags = 0;

    CCP_CORE (&core);

    if (findActivePlugin ("glib"))
	flags |= ProcessEventsNoGlibMainLoopMask;

    ccsProcessEvents (cc->context, flags);

    if (ccsSettingListLength (cc->context->changedSettings))
    {
	CCSSettingList list = cc->context->changedSettings;
	CCSSettingList l = list;	
	CCSSetting     *s;
	CompObject     *object;
    	CompPlugin     *p;
    	CompOption     *option;
    	int            nOption;

    	char tmp[256];

	cc->context->changedSettings = NULL;
	
	while (l)
	{
	    s = l->data;
	    l = l->next;

	    if (s->isScreen)
	    {
		snprintf (tmp, 256, "%d", s->screenNum);
		object = compObjectFind (&core.base, COMP_OBJECT_TYPE_DISPLAY,
					 NULL);
		object = compObjectFind (object, COMP_OBJECT_TYPE_SCREEN,
					 tmp);
	    }
	    else
	    {
		object = compObjectFind (&core.base, COMP_OBJECT_TYPE_DISPLAY,
					 NULL);
	    }

	    if (!object)
		continue;

	    p = findActivePlugin (s->parent->name);

	    if (!p)
		continue;

	    option = (*p->vTable->getObjectOptions) (p, object, &nOption);
	    option = compFindOption (option, nOption, s->name, 0);
	    if (option)
		ccpSetOptionFromContext (object, option, s->parent->name);
	    D (D_FULL, "Setting Update \"%s\"\n", s->name);
	}

	ccsSettingListFree (list, FALSE);
	cc->context->changedSettings =
	    ccsSettingListFree (cc->context->changedSettings, FALSE);
    }

    return TRUE;
}
コード例 #19
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;
}
コード例 #20
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;
}