~ubuntu-branches/ubuntu/lucid/compiz-fusion-plugins-extra/lucid

« back to all changes in this revision

Viewing changes to src/scalefilter/scalefilter_options.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2007-12-05 22:48:25 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20071205224825-yhfs0zm2evj7ca3x
Tags: 0.6.99+git20071127-0ubuntu1
new git HEAD snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#include <stdlib.h>
14
14
#include <string.h>
15
15
 
16
 
#include <compiz.h>
 
16
#include <compiz-core.h>
17
17
 
18
 
#define _SCALEFILTER_OPTIONS_INTERNAL
19
18
#include "scalefilter_options.h"
20
19
 
21
20
static int displayPrivateIndex;
26
25
CompPluginVTable scalefilterOptionsVTable;
27
26
 
28
27
#define GET_SCALEFILTER_OPTIONS_DISPLAY(d) \
29
 
        ((ScalefilterOptionsDisplay *) (d)->privates[displayPrivateIndex].ptr)
 
28
        ((ScalefilterOptionsDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
30
29
 
31
30
#define SCALEFILTER_OPTIONS_DISPLAY(d) \
32
31
        ScalefilterOptionsDisplay *od = GET_SCALEFILTER_OPTIONS_DISPLAY (d)
33
32
 
34
33
#define GET_SCALEFILTER_OPTIONS_SCREEN(s, od) \
35
 
        ((ScalefilterOptionsScreen *) (s)->privates[(od)->screenPrivateIndex].ptr)
 
34
        ((ScalefilterOptionsScreen *) (s)->base.privates[(od)->screenPrivateIndex].ptr)
36
35
 
37
36
#define SCALEFILTER_OPTIONS_SCREEN(s) \
38
37
        ScalefilterOptionsScreen *os = GET_SCALEFILTER_OPTIONS_SCREEN (s, GET_SCALEFILTER_OPTIONS_DISPLAY (s->display))
258
257
    { "back_color", "color", 0, 0, 0 },
259
258
};
260
259
 
261
 
static Bool scalefilterOptionsSetScreenOption (CompPlugin *plugin, CompScreen *s, char *name, CompOptionValue *value)
 
260
static Bool scalefilterOptionsSetScreenOption (CompPlugin *plugin, CompScreen *s, const char *name, CompOptionValue *value)
262
261
{
263
262
    SCALEFILTER_OPTIONS_SCREEN(s);
264
263
    CompOption *o;
358
357
    if (!os)
359
358
        return FALSE;
360
359
 
361
 
    s->privates[od->screenPrivateIndex].ptr = os;
 
360
    s->base.privates[od->screenPrivateIndex].ptr = os;
362
361
 
363
362
    if (!compInitScreenOptionsFromMetadata (s, &scalefilterOptionsMetadata, scalefilterOptionsScreenOptionInfo, os->opt, ScalefilterScreenOptionNum))
364
363
    {
365
364
        free (os);
366
365
        return FALSE;
367
366
    }
368
 
    if (scalefilterPluginVTable && scalefilterPluginVTable->initScreen)
369
 
        return scalefilterPluginVTable->initScreen (p, s);
 
367
 
370
368
    return TRUE;
371
369
}
372
370
 
373
371
static void scalefilterOptionsFiniScreen (CompPlugin *p, CompScreen *s)
374
372
{
375
 
    if (scalefilterPluginVTable && scalefilterPluginVTable->finiScreen)
376
 
        return scalefilterPluginVTable->finiScreen (p, s);
377
 
 
378
373
    SCALEFILTER_OPTIONS_SCREEN (s);
379
374
 
380
375
 
399
394
        return FALSE;
400
395
    }
401
396
 
402
 
    d->privates[displayPrivateIndex].ptr = od;
 
397
    d->base.privates[displayPrivateIndex].ptr = od;
403
398
 
404
 
        if (scalefilterPluginVTable && scalefilterPluginVTable->initDisplay)
405
 
        return scalefilterPluginVTable->initDisplay (p, d);
 
399
    
406
400
    return TRUE;
407
401
}
408
402
 
409
403
static void scalefilterOptionsFiniDisplay (CompPlugin *p, CompDisplay *d)
410
404
{
411
 
    if (scalefilterPluginVTable && scalefilterPluginVTable->finiDisplay)
412
 
        return scalefilterPluginVTable->finiDisplay (p, d);
413
 
 
414
405
    SCALEFILTER_OPTIONS_DISPLAY (d);
415
406
 
416
407
    freeScreenPrivateIndex(d, od->screenPrivateIndex);
443
434
    compFiniMetadata (&scalefilterOptionsMetadata);
444
435
}
445
436
 
 
437
static CompBool scalefilterOptionsInitObject (CompPlugin *p, CompObject *o)
 
438
{
 
439
    static InitPluginObjectProc dispTab[] = {
 
440
        (InitPluginObjectProc) 0,
 
441
        (InitPluginObjectProc) scalefilterOptionsInitDisplay,
 
442
        (InitPluginObjectProc) scalefilterOptionsInitScreen
 
443
    };
 
444
 
 
445
    RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
 
446
}
 
447
 
 
448
static void scalefilterOptionsFiniObject (CompPlugin *p, CompObject *o)
 
449
{
 
450
    static FiniPluginObjectProc dispTab[] = {
 
451
        (FiniPluginObjectProc) 0,
 
452
        (FiniPluginObjectProc) scalefilterOptionsFiniDisplay,
 
453
        (FiniPluginObjectProc) scalefilterOptionsFiniScreen
 
454
    };
 
455
 
 
456
    DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
 
457
}
 
458
 
 
459
static CompBool scalefilterOptionsInitObjectWrapper (CompPlugin *p, CompObject *o)
 
460
{
 
461
    CompBool rv = TRUE;
 
462
    rv = scalefilterOptionsInitObject (p, o);
 
463
    if (scalefilterPluginVTable->initObject)
 
464
        rv &= scalefilterPluginVTable->initObject (p, o);
 
465
    return rv;
 
466
}
 
467
 
 
468
static void scalefilterOptionsFiniObjectWrapper (CompPlugin *p, CompObject *o)
 
469
{
 
470
    if (scalefilterPluginVTable->finiObject)
 
471
        scalefilterPluginVTable->finiObject (p, o);
 
472
    scalefilterOptionsFiniObject (p, o);
 
473
}
 
474
 
 
475
static CompOption * scalefilterOptionsGetObjectOptions (CompPlugin *p, CompObject *o, int *count)
 
476
{
 
477
    static GetPluginObjectOptionsProc dispTab[] = {
 
478
        (GetPluginObjectOptionsProc) 0,
 
479
            (GetPluginObjectOptionsProc) 0,
 
480
        (GetPluginObjectOptionsProc) scalefilterOptionsGetScreenOptions
 
481
    };
 
482
 
 
483
    RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab),
 
484
                     (void *) (*count = 0), (p, o, count));
 
485
}
 
486
 
 
487
static CompBool scalefilterOptionsSetObjectOption (CompPlugin *p, CompObject *o, const char *name, CompOptionValue *value)
 
488
{
 
489
    static SetPluginObjectOptionProc dispTab[] = {
 
490
        (SetPluginObjectOptionProc) 0,
 
491
        (SetPluginObjectOptionProc) 0,
 
492
        (SetPluginObjectOptionProc) scalefilterOptionsSetScreenOption
 
493
    };
 
494
 
 
495
    RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), FALSE,
 
496
                     (p, o, name, value));
 
497
}
 
498
 
446
499
static CompMetadata *
447
500
scalefilterOptionsGetMetadata (CompPlugin *plugin)
448
501
{
449
502
    return &scalefilterOptionsMetadata;
450
503
}
451
504
 
452
 
CompPluginVTable *getCompPluginInfo (void)
 
505
CompPluginVTable *getCompPluginInfo20070830 (void)
453
506
{
454
507
    if (!scalefilterPluginVTable)
455
508
    {
456
 
        scalefilterPluginVTable = scalefilterOptionsGetCompPluginInfo ();
 
509
        scalefilterPluginVTable = getCompPluginInfo ();
457
510
        memcpy(&scalefilterOptionsVTable, scalefilterPluginVTable, sizeof(CompPluginVTable));
458
511
        scalefilterOptionsVTable.getMetadata = scalefilterOptionsGetMetadata;
459
512
        scalefilterOptionsVTable.init = scalefilterOptionsInit;
460
513
        scalefilterOptionsVTable.fini = scalefilterOptionsFini;
461
 
        scalefilterOptionsVTable.initDisplay = scalefilterOptionsInitDisplay;
462
 
        scalefilterOptionsVTable.finiDisplay = scalefilterOptionsFiniDisplay;
463
 
        scalefilterOptionsVTable.initScreen = scalefilterOptionsInitScreen;
464
 
        scalefilterOptionsVTable.finiScreen = scalefilterOptionsFiniScreen;
465
 
        scalefilterOptionsVTable.getScreenOptions = scalefilterOptionsGetScreenOptions;
466
 
        scalefilterOptionsVTable.setScreenOption = scalefilterOptionsSetScreenOption;
 
514
        scalefilterOptionsVTable.initObject = scalefilterOptionsInitObjectWrapper;
 
515
        scalefilterOptionsVTable.finiObject = scalefilterOptionsFiniObjectWrapper;
 
516
        scalefilterOptionsVTable.getObjectOptions = scalefilterOptionsGetObjectOptions;
 
517
        scalefilterOptionsVTable.setObjectOption = scalefilterOptionsSetObjectOption;
467
518
        
468
519
    }
469
520
    return &scalefilterOptionsVTable;