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

« back to all changes in this revision

Viewing changes to src/reflex/reflex.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:
18
18
 * GNU General Public License for more details.
19
19
 *
20
20
 */
21
 
 
22
 
#include <stdlib.h>
23
 
#include <string.h>
24
 
#include <stdio.h>
25
 
 
26
 
#include <X11/Xatom.h>
27
 
#include <X11/extensions/Xrender.h>
28
 
 
29
 
#include <compiz.h>
 
21
#include <compiz-core.h>
30
22
 
31
23
#include "reflex_options.h"
32
24
 
73
65
} ReflexWindow;
74
66
 
75
67
#define GET_REFLEX_DISPLAY(d)                                  \
76
 
    ((ReflexDisplay *) (d)->privates[displayPrivateIndex].ptr)
 
68
    ((ReflexDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
77
69
 
78
70
#define REFLEX_DISPLAY(d)                                      \
79
71
    ReflexDisplay *rd = GET_REFLEX_DISPLAY (d)
80
72
 
81
73
#define GET_REFLEX_SCREEN(s, rd)                               \
82
 
    ((ReflexScreen *) (s)->privates[(rd)->screenPrivateIndex].ptr)
 
74
    ((ReflexScreen *) (s)->base.privates[(rd)->screenPrivateIndex].ptr)
83
75
 
84
76
#define REFLEX_SCREEN(s)                                       \
85
77
    ReflexScreen *rs = GET_REFLEX_SCREEN (s, GET_REFLEX_DISPLAY (s->display))
86
78
 
87
79
#define GET_REFLEX_WINDOW(w, rs)                                         \
88
 
    ((ReflexWindow *) (w)->privates[(rs)->windowPrivateIndex].ptr)
 
80
    ((ReflexWindow *) (w)->base.privates[(rs)->windowPrivateIndex].ptr)
89
81
 
90
82
#define REFLEX_WINDOW(w)                                             \
91
83
    ReflexWindow *rw = GET_REFLEX_WINDOW  (w,                \
379
371
{
380
372
    ReflexDisplay *rd;
381
373
 
 
374
    if (!checkPluginABI ("core", CORE_ABIVERSION))
 
375
        return FALSE;
 
376
 
382
377
    rd = malloc (sizeof (ReflexDisplay) );
383
378
 
384
379
    if (!rd)
392
387
        return FALSE;
393
388
    }
394
389
 
395
 
    d->privates[displayPrivateIndex].ptr = rd;
 
390
    d->base.privates[displayPrivateIndex].ptr = rd;
396
391
 
397
392
    WRAP (rd, d, matchExpHandlerChanged, reflexMatchExpHandlerChanged);
398
393
    WRAP (rd, d, matchPropertyChanged, reflexMatchPropertyChanged);
442
437
    reflexSetFileNotify (s, reflexScreenOptionChanged);
443
438
    reflexSetMatchNotify (s, reflexScreenOptionChanged);
444
439
 
445
 
    s->privates[rd->screenPrivateIndex].ptr = rs;
 
440
    s->base.privates[rd->screenPrivateIndex].ptr = rs;
446
441
 
447
442
    rs->reflexFunctions = NULL;
448
443
 
481
476
 
482
477
    rw->active = FALSE;
483
478
 
484
 
    w->privates[rs->windowPrivateIndex].ptr = rw;
 
479
    w->base.privates[rs->windowPrivateIndex].ptr = rw;
485
480
 
486
481
    reflexUpdateWindowMatch (w);
487
482
 
514
509
        freeDisplayPrivateIndex (displayPrivateIndex);
515
510
}
516
511
 
517
 
static int
518
 
reflexGetVersion (CompPlugin *plugin,
519
 
                  int        version)
520
 
{
521
 
    return ABIVERSION;
 
512
static CompBool
 
513
reflexInitObject (CompPlugin *p,
 
514
                  CompObject *o)
 
515
{
 
516
    static InitPluginObjectProc dispTab[] = {
 
517
        (InitPluginObjectProc) 0, /* InitCore */
 
518
        (InitPluginObjectProc) reflexInitDisplay,
 
519
        (InitPluginObjectProc) reflexInitScreen,
 
520
        (InitPluginObjectProc) reflexInitWindow
 
521
    };
 
522
 
 
523
    RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
 
524
}
 
525
 
 
526
static void
 
527
reflexFiniObject (CompPlugin *p,
 
528
                  CompObject *o)
 
529
{
 
530
    static FiniPluginObjectProc dispTab[] = {
 
531
        (FiniPluginObjectProc) 0, /* FiniCore */
 
532
        (FiniPluginObjectProc) reflexFiniDisplay,
 
533
        (FiniPluginObjectProc) reflexFiniScreen,
 
534
        (FiniPluginObjectProc) reflexFiniWindow
 
535
    };
 
536
 
 
537
    DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
522
538
}
523
539
 
524
540
CompPluginVTable reflexVTable = {
525
 
 
526
541
    "reflex",
527
 
    reflexGetVersion,
528
542
    0,
529
543
    reflexInit,
530
544
    reflexFini,
531
 
    reflexInitDisplay,
532
 
    reflexFiniDisplay,
533
 
    reflexInitScreen,
534
 
    reflexFiniScreen,
535
 
    reflexInitWindow,
536
 
    reflexFiniWindow,
537
 
    0,
538
 
    0,
 
545
    reflexInitObject,
 
546
    reflexFiniObject,
539
547
    0,
540
548
    0
541
549
};