~compiz-team/compiz-libcompizconfig/0.9.5

« back to all changes in this revision

Viewing changes to include/ccs.h

  • Committer: Sam Spilsbury
  • Date: 2011-07-29 15:10:33 UTC
  • mfrom: (412.1.3)
  • Revision ID: git-v1:21d23fe4074b65ff356bf24c51925ab48a70535c
Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
typedef struct _CCSIntDesc        CCSIntDesc;
111
111
typedef struct _CCSStrRestriction CCSStrRestriction;
112
112
typedef struct _CCSStrExtension   CCSStrExtension;
 
113
typedef struct _CCSString         CCSString;
113
114
 
114
115
CCSLIST_HDR (Plugin, CCSPlugin)
115
116
CCSLIST_HDR (Setting, CCSSetting)
116
 
CCSLIST_HDR (String, char)
 
117
CCSLIST_HDR (String, CCSString)
117
118
CCSLIST_HDR (Group, CCSGroup)
118
119
CCSLIST_HDR (SubGroup, CCSSubGroup)
119
120
CCSLIST_HDR (SettingValue, CCSSettingValue)
123
124
CCSLIST_HDR (StrRestriction, CCSStrRestriction)
124
125
CCSLIST_HDR (StrExtension, CCSStrExtension)
125
126
 
 
127
/**
 
128
 * reference counting
 
129
 * 
 
130
 * ccsSettingRef
 
131
 * References the settings object so it can be kept in a list and
 
132
 * unreferenced later with freeObj (mixed with objects that need
 
133
 * to be freed and need not be freed)
 
134
 * 
 
135
 * ccsSettingUnref
 
136
 * Unreferences the settings object, when the reference count reaches
 
137
 * zero, the object is freed
 
138
 * 
 
139
 */
 
140
 
 
141
#define CCSREF_HDR(type,dtype) \
 
142
        void ccs##type##Ref (dtype *);  \
 
143
        void ccs##type##Unref (dtype *);
 
144
 
 
145
CCSREF_HDR (Plugin, CCSPlugin)
 
146
CCSREF_HDR (Setting, CCSSetting)
 
147
CCSREF_HDR (String, CCSString)
 
148
CCSREF_HDR (Group, CCSGroup)
 
149
CCSREF_HDR (SubGroup, CCSSubGroup)
 
150
CCSREF_HDR (SettingValue, CCSSettingValue)
 
151
CCSREF_HDR (PluginConflict, CCSPluginConflict)
 
152
CCSREF_HDR (BackendInfo, CCSBackendInfo)
 
153
CCSREF_HDR (IntDesc, CCSIntDesc)
 
154
CCSREF_HDR (StrRestriction, CCSStrRestriction)
 
155
CCSREF_HDR (StrExtension, CCSStrExtension)
 
156
 
126
157
struct _CCSContext
127
158
{
128
159
    CCSPluginList     plugins;         /* list of plugins settings
146
177
    char *longDesc;          /* backend's long description */
147
178
    Bool integrationSupport; /* does the backend support DE integration? */
148
179
    Bool profileSupport;     /* does the backend support profiles? */
 
180
    unsigned int refCount;   /* reference count */
149
181
};
150
182
 
151
183
struct _CCSPlugin
177
209
 
178
210
    void *ccsPrivate;              /* private pointer for compizconfig
179
211
                                      internal usage */
 
212
    unsigned int refCount;         /* reference count */
180
213
};
181
214
 
182
215
typedef enum _CCSSettingType
201
234
{
202
235
    char           *name;    /* sub group name in current locale */
203
236
    CCSSettingList settings; /* list of settings in this sub group */
 
237
    unsigned int   refCount;       /* reference count */
204
238
};
205
239
 
206
240
struct _CCSGroup
207
241
{
208
242
    char            *name;     /* group name in current locale */
209
243
    CCSSubGroupList subGroups; /* list of sub groups in this group */
 
244
    unsigned int    refCount;      /* reference count */
210
245
};
211
246
 
212
247
typedef enum _CCSPluginConflictType
228
263
                                      caused the conflict */
229
264
    CCSPluginConflictType type;    /* type of the conflict */
230
265
    CCSPluginList         plugins; /* list of conflicting plugins */
 
266
    unsigned int          refCount;        /* reference count */        
231
267
};
232
268
 
233
269
union _CCSSettingInfo;
234
270
 
 
271
struct _CCSString
 
272
{
 
273
    char         *value;
 
274
    unsigned int refCount;
 
275
};
 
276
 
235
277
struct _CCSIntDesc
236
278
{
237
279
    int  value; /* value the description is assigned to */
238
280
    char *name; /* description */
 
281
    unsigned int refCount;         /* reference count */
239
282
};
240
283
 
241
284
struct _CCSStrRestriction
242
285
{
243
286
    char *value; /* value the restriction is assigned to */
244
287
    char *name;  /* description */
 
288
    unsigned int refCount;         /* reference count */
245
289
};
246
290
 
247
291
struct _CCSStrExtension
249
293
    char *basePlugin;           /* plugin this extension extends */
250
294
    CCSStringList baseSettings; /* list of settings this extension extends */
251
295
    CCSStrRestrictionList restriction; /* list of added restriction items */
 
296
    unsigned int refCount;         /* reference count */
252
297
};
253
298
 
254
299
typedef struct _CCSSettingIntInfo
271
316
    int                sortStartsAt; /* the restriction index to start sorting
272
317
                                        at (defaults to -1 for no sorting) */
273
318
    Bool               extensible;   /* whether extension is allowed for
274
 
                                        this setting */
 
319
                                        this setting */ 
275
320
} CCSSettingStringInfo;
276
321
 
277
322
typedef struct _CCSSettingListInfo
351
396
    CCSSettingValueUnion value;
352
397
    CCSSetting *         parent;
353
398
    Bool                 isListChild;
 
399
    unsigned int         refCount;         /* reference count */
354
400
};
355
401
 
356
402
struct _CCSSetting
376
422
 
377
423
    CCSPlugin *parent;            /* plugin this setting belongs to */
378
424
    void      *privatePtr;        /* private pointer for usage by the caller */
 
425
    unsigned int refCount;         /* reference count */
379
426
};
380
427
 
381
428
struct _CCSPluginCategory
385
432
    const char *longDesc;  /* plugin category long description */
386
433
 
387
434
    CCSStringList plugins; /* list of plugins in this category */
 
435
    unsigned int refCount;         /* reference count */
388
436
};
389
437
 
390
438
/* set basic metadata to TRUE and no additional
434
482
void ccsFreeIntDesc (CCSIntDesc *value);
435
483
void ccsFreeStrRestriction (CCSStrRestriction *restriction);
436
484
void ccsFreeStrExtension (CCSStrExtension *extension);
437
 
 
438
 
#define ccsFreeString(val) free(val)
 
485
void ccsFreeString (CCSString *str);
439
486
 
440
487
/* Setting setters. Set <setting> to value <data>. Return TRUE if new value
441
488
   matches data. If the new value doesn't match the old value, the setting
442
489
   is added to the context's changedSettings list. */
443
490
Bool ccsSetInt (CCSSetting *setting,
444
 
                int        data);
 
491
                int        data,
 
492
                Bool       processChanged);
445
493
Bool ccsSetFloat (CCSSetting *setting,
446
 
                  float      data);
 
494
                  float      data,
 
495
                  Bool       processChanged);
447
496
Bool ccsSetBool (CCSSetting *setting,
448
 
                 Bool       data);
 
497
                 Bool       data,
 
498
                 Bool       processChanged);
449
499
Bool ccsSetString (CCSSetting *setting,
450
 
                   const char *data);
 
500
                   const char *data,
 
501
                   Bool       processChanged);
451
502
Bool ccsSetColor (CCSSetting           *setting,
452
 
                  CCSSettingColorValue data);
 
503
                  CCSSettingColorValue data,
 
504
                  Bool                 processChanged);
453
505
Bool ccsSetMatch (CCSSetting *setting,
454
 
                  const char *data);
 
506
                  const char *data,
 
507
                  Bool       processChanged);
455
508
Bool ccsSetKey (CCSSetting         *setting,
456
 
                CCSSettingKeyValue data);
 
509
                CCSSettingKeyValue data,
 
510
                Bool               processChanged);
457
511
Bool ccsSetButton (CCSSetting            *setting,
458
 
                   CCSSettingButtonValue data);
 
512
                   CCSSettingButtonValue data,
 
513
                   Bool                  processChanged);
459
514
Bool ccsSetEdge (CCSSetting   *setting,
460
 
                 unsigned int data);
 
515
                 unsigned int data,
 
516
                 Bool         processChanged);
461
517
Bool ccsSetBell (CCSSetting *setting,
462
 
                 Bool       data);
 
518
                 Bool       data,
 
519
                 Bool       processChanged);
463
520
Bool ccsSetList (CCSSetting          *setting,
464
 
                 CCSSettingValueList data);
 
521
                 CCSSettingValueList data,
 
522
                 Bool    processChanged);
465
523
Bool ccsSetValue (CCSSetting      *setting,
466
 
                  CCSSettingValue *data);
 
524
                  CCSSettingValue *data,
 
525
                  Bool            processChanged);
467
526
 
468
527
/* Compares two setting values. Returns TRUE if values match,
469
528
   FALSE otherwise. */
652
711
 
653
712
/* Reset all settings to defaults. Settings that were non-default
654
713
   previously are added to the changedSettings list of the context. */
655
 
void ccsResetToDefault (CCSSetting * setting);
 
714
void ccsResetToDefault (CCSSetting * setting, Bool processChanged);
656
715
 
657
716
/* Exports a profile to a file. If skipDefaults is TRUE, only exports
658
717
   non-default settings. Returns TRUE on successful export, FALSE otherwise. */
680
739
void ccsDisableFileWatch (unsigned int watchId);
681
740
void ccsEnableFileWatch (unsigned int watchId);
682
741
 
683
 
/* INI file stuff */
 
742
/* INI file stuff
 
743
 * FIXME: This should not be part of the
 
744
 * public API */
684
745
 
685
746
typedef struct _dictionary_
686
747
{
704
765
 
705
766
Bool ccsCreateDirFor (const char *fileName);
706
767
 
 
768
Bool ccsIniParseString (char        *str,
 
769
                        char        **value);
707
770
Bool ccsIniGetString (IniDictionary *dictionary,
708
771
                      const char    *section,
709
772
                      const char    *entry,
710
773
                      char          **value);
 
774
 
 
775
Bool ccsIniParseInt (const char  *str,
 
776
                     int         *value);
711
777
Bool ccsIniGetInt (IniDictionary *dictionary,
712
778
                   const char    *section,
713
779
                   const char    *entry,
714
780
                   int           *value);
 
781
 
 
782
Bool ccsIniParseFloat (const char  *str,
 
783
                       float       *value);
715
784
Bool ccsIniGetFloat (IniDictionary *dictionary,
716
785
                     const char    *section,
717
786
                     const char    *entry,
718
787
                     float         *value);
 
788
 
 
789
Bool ccsIniParseBool (const char  *str,
 
790
                      Bool        *value);
719
791
Bool ccsIniGetBool (IniDictionary *dictionary,
720
792
                    const char    *section,
721
793
                    const char    *entry,
722
794
                    Bool          *value);
 
795
 
 
796
Bool ccsIniParseColor (const char           *str,
 
797
                       CCSSettingColorValue *value);
723
798
Bool ccsIniGetColor (IniDictionary        *dictionary,
724
799
                     const char           *section,
725
800
                     const char           *entry,
726
801
                     CCSSettingColorValue *value);
 
802
 
 
803
Bool ccsIniParseKey (const char         *str,
 
804
                     CCSSettingKeyValue *value);
727
805
Bool ccsIniGetKey (IniDictionary        *dictionary,
728
806
                   const char           *section,
729
807
                   const char           *entry,
730
808
                   CCSSettingKeyValue   *value);
 
809
 
 
810
Bool ccsIniParseButton (const char            *str,
 
811
                        CCSSettingButtonValue *value);
731
812
Bool ccsIniGetButton (IniDictionary         *dictionary,
732
813
                      const char            *section,
733
814
                      const char            *entry,
734
815
                      CCSSettingButtonValue *value);
 
816
 
 
817
Bool ccsIniParseEdge (const char  *str,
 
818
                      unsigned int *value);
735
819
Bool ccsIniGetEdge (IniDictionary *dictionary,
736
820
                    const char    *section,
737
821
                    const char    *entry,
738
822
                    unsigned int  *value);
 
823
        
739
824
Bool ccsIniGetBell (IniDictionary *dictionary,
740
825
                    const char    *section,
741
826
                    const char    *entry,
742
827
                    Bool          *value);
 
828
 
 
829
Bool ccsIniParseList (const char          *str,
 
830
                      CCSSettingValueList *value,
 
831
                      CCSSetting          *parent);
743
832
Bool ccsIniGetList (IniDictionary       *dictionary,
744
833
                    const char          *section,
745
834
                    const char          *entry,
821
910
 
822
911
CCSStrExtensionList ccsGetPluginStrExtensions (CCSPlugin *plugin);
823
912
 
 
913
/* Checks if settings need to be constrained */
 
914
Bool ccsContextNeedsConstraining (CCSContext *context);
 
915
 
824
916
#endif