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

« back to all changes in this revision

Viewing changes to src/splash/splash.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:
19
19
 *
20
20
 */
21
21
 
22
 
#include <stdlib.h>
23
 
#include <string.h>
24
 
#include <stdio.h>
25
22
#include <math.h>
 
23
 
 
24
#include <compiz-core.h>
26
25
#include <X11/Xatom.h>
27
 
#include <X11/extensions/Xrender.h>
28
 
 
29
 
#include <compiz.h>
30
26
 
31
27
#include "splash_options.h"
32
28
 
34
30
#define SPLASH_LOGO_DEFAULT ""
35
31
 
36
32
#define GET_SPLASH_DISPLAY(d)                                  \
37
 
    ((SplashDisplay *) (d)->privates[displayPrivateIndex].ptr)
 
33
    ((SplashDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
38
34
 
39
35
#define SPLASH_DISPLAY(d)                      \
40
36
    SplashDisplay *sd = GET_SPLASH_DISPLAY (d)
41
37
 
42
38
#define GET_SPLASH_SCREEN(s, sd)                                   \
43
 
    ((SplashScreen *) (s)->privates[(sd)->screenPrivateIndex].ptr)
 
39
    ((SplashScreen *) (s)->base.privates[(sd)->screenPrivateIndex].ptr)
44
40
 
45
41
#define SPLASH_SCREEN(s)                                                      \
46
42
    SplashScreen *ss = GET_SPLASH_SCREEN (s, GET_SPLASH_DISPLAY (s->display))
497
493
 
498
494
    SplashScreen *ss = (SplashScreen *) calloc (1, sizeof (SplashScreen) );
499
495
 
500
 
    s->privates[sd->screenPrivateIndex].ptr = ss;
 
496
    s->base.privates[sd->screenPrivateIndex].ptr = ss;
501
497
 
502
498
    WRAP (ss, s, paintOutput, splashPaintOutput);
503
499
    WRAP (ss, s, preparePaintScreen, splashPreparePaintScreen);
587
583
splashInitDisplay (CompPlugin  *p,
588
584
                   CompDisplay *d)
589
585
{
 
586
    SplashDisplay *sd;
 
587
 
 
588
    if (!checkPluginABI ("core", CORE_ABIVERSION))
 
589
        return FALSE;
 
590
 
590
591
    /* Generate a splash display */
591
 
    SplashDisplay *sd = (SplashDisplay *) malloc (sizeof (SplashDisplay) );
 
592
    sd = (SplashDisplay *) malloc (sizeof (SplashDisplay) );
 
593
 
 
594
    if (!sd)
 
595
        return FALSE;
592
596
 
593
597
    /* Allocate a private index */
594
598
    sd->screenPrivateIndex = allocateScreenPrivateIndex (d);
603
607
 
604
608
    sd->splashAtom = XInternAtom (d->display, "_COMPIZ_WM_SPLASH", 0);
605
609
 
606
 
    splashSetInitiateInitiate (d, splashInitiate);
 
610
    splashSetInitiateKeyInitiate (d, splashInitiate);
607
611
 
608
 
    d->privates[displayPrivateIndex].ptr = sd;
 
612
    d->base.privates[displayPrivateIndex].ptr = sd;
609
613
    return TRUE;
610
614
}
611
615
 
640
644
        freeDisplayPrivateIndex (displayPrivateIndex);
641
645
}
642
646
 
643
 
static int
644
 
splashGetVersion (CompPlugin *plugin,
645
 
                  int        version)
646
 
{
647
 
    return ABIVERSION;
 
647
static CompBool
 
648
splashInitObject (CompPlugin *p,
 
649
                  CompObject *o)
 
650
{
 
651
    static InitPluginObjectProc dispTab[] = {
 
652
        (InitPluginObjectProc) 0, /* InitCore */
 
653
        (InitPluginObjectProc) splashInitDisplay,
 
654
        (InitPluginObjectProc) splashInitScreen
 
655
    };
 
656
 
 
657
    RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
 
658
}
 
659
 
 
660
static void
 
661
splashFiniObject (CompPlugin *p,
 
662
                  CompObject *o)
 
663
{
 
664
    static FiniPluginObjectProc dispTab[] = {
 
665
        (FiniPluginObjectProc) 0, /* FiniCore */
 
666
        (FiniPluginObjectProc) splashFiniDisplay,
 
667
        (FiniPluginObjectProc) splashFiniScreen
 
668
    };
 
669
 
 
670
    DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
648
671
}
649
672
 
650
673
CompPluginVTable splashVTable = {
651
 
 
652
674
    "splash",
653
 
    splashGetVersion,
654
675
    0,
655
676
    splashInit,
656
677
    splashFini,
657
 
    splashInitDisplay,
658
 
    splashFiniDisplay,
659
 
    splashInitScreen,
660
 
    splashFiniScreen,
661
 
    0,
662
 
    0,
663
 
    0,
664
 
    0,
 
678
    splashInitObject,
 
679
    splashFiniObject,
665
680
    0,
666
681
    0
667
682
};