1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
$NetBSD: patch-ad,v 1.2 1998/11/12 23:34:32 frueauf Exp $
--- main.c.orig Fri Sep 13 22:32:10 1991
+++ main.c Mon Aug 17 00:20:12 1998
@@ -138,9 +138,7 @@
{"do_nothing",(XtActionProc)do_nothing_action},
};
-Pixel fg, bg;
-
-XtTranslations translations;
+AppData app_data;
static XrmOptionDescRec options[] = {
{"-scorefile","scorefile",XrmoptionSepArg, NULL },
@@ -148,13 +146,13 @@
static XtResource application_resources[] = {
{"foreground", "Foreground", XtRPixel, sizeof(Pixel),
- (Cardinal)&fg, XtRString, (caddr_t) "Black"},
+ XtOffsetOf(AppData,fg), XtRString, (caddr_t) "Black"},
{"background", "Background", XtRPixel, sizeof(Pixel),
- (Cardinal)&bg, XtRString, (caddr_t) "White"},
+ XtOffsetOf(AppData,bg), XtRString, (caddr_t) "White"},
{"translations","Translations", XtRTranslationTable, sizeof(XtTranslations),
- (Cardinal)&translations, XtRString, (caddr_t)translations_str},
+ XtOffsetOf(AppData,translations), XtRString,(caddr_t)translations_str},
{"scorefile","Scorefile", XtRString, sizeof(String),
- (Cardinal)&score_filename, XtRString, (caddr_t)SCORE_FILE},
+ XtOffsetOf(AppData,score_filename), XtRString,(caddr_t)SCORE_FILE},
};
/*----------------------------------------------------------------------*/
@@ -177,7 +175,7 @@
XtAddActions(actions,XtNumber(actions));
- XtGetApplicationResources(top_shell, 0, application_resources,
+ XtGetApplicationResources(top_shell, &app_data, application_resources,
XtNumber(application_resources), NULL, 0 );
top_widget = XtCreateManagedWidget(
@@ -193,7 +191,7 @@
arglistplayfield,
XtNumber(arglistplayfield));
- XtAugmentTranslations(playfield_widget,translations);
+ XtAugmentTranslations(playfield_widget,app_data.translations);
quit_command = XtCreateManagedWidget(
"quit_button",
@@ -263,12 +261,12 @@
display = XtDisplay(playfield_widget);
playfield = XtWindow(playfield_widget);
- gcv.foreground = fg;
- gcv.background = bg;
+ gcv.foreground = app_data.fg;
+ gcv.background = app_data.bg;
gcv.function = GXcopy;
gc = XCreateGC(display, playfield,
GCForeground | GCBackground | GCFunction, &gcv);
- gcv.foreground = bg;
+ gcv.foreground = app_data.bg;
cleargc = XCreateGC(display, playfield,
GCForeground | GCBackground | GCFunction, &gcv);
|