1 | /* Copyright 1997 by the Massachusetts Institute of Technology. |
---|
2 | * |
---|
3 | * Permission to use, copy, modify, and distribute this |
---|
4 | * software and its documentation for any purpose and without |
---|
5 | * fee is hereby granted, provided that the above copyright |
---|
6 | * notice appear in all copies and that both that copyright |
---|
7 | * notice and this permission notice appear in supporting |
---|
8 | * documentation, and that the name of M.I.T. not be used in |
---|
9 | * advertising or publicity pertaining to distribution of the |
---|
10 | * software without specific, written prior permission. |
---|
11 | * M.I.T. makes no representations about the suitability of |
---|
12 | * this software for any purpose. It is provided "as is" |
---|
13 | * without express or implied warranty. |
---|
14 | */ |
---|
15 | |
---|
16 | static const char rcsid[] = "$Id: Snoop.c,v 1.1 1998-12-17 16:27:11 ghudson Exp $"; |
---|
17 | |
---|
18 | #include <stdio.h> |
---|
19 | #include <Jets/Jets.h> |
---|
20 | #include "Snoop.h" |
---|
21 | |
---|
22 | #define offset(field) XjOffset(Snoop_jet,field) |
---|
23 | |
---|
24 | static XjResource resources[] = { |
---|
25 | { XjNeventProc, XjCEventProc, XjRCallback, |
---|
26 | sizeof(XjCallback *), offset(snoop.event_proc), XjRString, NULL }, |
---|
27 | }; |
---|
28 | |
---|
29 | #undef offset |
---|
30 | |
---|
31 | static void realize(Snoop_jet), destroy(Snoop_jet); |
---|
32 | static Boolean event_handler(Snoop_jet, XEvent *); |
---|
33 | |
---|
34 | Snoop_class_rec snoop_class_rec = { |
---|
35 | { |
---|
36 | /* class name */ "Snoop", |
---|
37 | /* jet size */ sizeof(Snoop_rec), |
---|
38 | /* classInitialize */ NULL, |
---|
39 | /* classInitialized? */ 1, |
---|
40 | /* initialize */ NULL, |
---|
41 | /* prerealize */ NULL, |
---|
42 | /* realize */ realize, |
---|
43 | /* event */ event_handler, |
---|
44 | /* expose */ NULL, |
---|
45 | /* querySize */ NULL, |
---|
46 | /* move */ NULL, |
---|
47 | /* resize */ NULL, |
---|
48 | /* destroy */ NULL, |
---|
49 | /* resources */ resources, |
---|
50 | /* number of 'em */ XjNumber(resources) |
---|
51 | } |
---|
52 | }; |
---|
53 | |
---|
54 | JetClass snoop_jet_class = (JetClass)&snoop_class_rec; |
---|
55 | |
---|
56 | static void realize(Snoop_jet me) |
---|
57 | { |
---|
58 | /* If this were general purpose, we'd have to have XjGetOwner |
---|
59 | in the library. But since it isn't (it doesn't have to be |
---|
60 | deinstalled) it doesn't matter. */ |
---|
61 | |
---|
62 | /* me->snoop.lastOwner = XjGetOwner(me->core.window); */ |
---|
63 | XjRegisterWindow(me->core.window, (Jet)me); |
---|
64 | } |
---|
65 | |
---|
66 | static void destroy(Snoop_jet me) |
---|
67 | { |
---|
68 | /* XjRegisterWindow(me->core.window, me->snoop.lastOwner); */ |
---|
69 | } |
---|
70 | |
---|
71 | static Boolean event_handler(Snoop_jet me, XEvent *event) |
---|
72 | { |
---|
73 | XjCallCallbacks(me, me->snoop.event_proc, event); |
---|
74 | return False; |
---|
75 | } |
---|