Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alan Coopersmith
xgc
Commits
b01f39a8
Commit
b01f39a8
authored
Nov 26, 2003
by
Kaleb Keithley Keithley
Browse files
merge latest (4.3.99.16) from XFree86 (vendor) branch
parent
82a6e01a
Changes
12
Hide whitespace changes
Inline
Side-by-side
choice.c
View file @
b01f39a8
/* $XFree86: xc/programs/xgc/choice.c,v 1.3 2003/10/24 20:38:18 tsi Exp $ */
/*
** xgc
**
...
...
@@ -15,14 +16,7 @@
#include
"xgc.h"
static
void
print_text_to_buffer
(
#if NeedFunctionPrototypes
Widget
,
caddr_t
,
caddr_t
#endif
);
extern
void
interpret
();
extern
XStuff
X
;
static
void
print_text_to_buffer
(
Widget
,
caddr_t
,
caddr_t
);
/* create_choice(w,info)
** ---------------------
...
...
@@ -50,9 +44,7 @@ extern XStuff X;
*/
ChoiceDesc
*
create_choice
(
w
,
info
)
Widget
w
;
XgcStuff
*
info
;
create_choice
(
Widget
w
,
XgcStuff
*
info
)
{
ChoiceDesc
*
choice
;
/* What we will return. Contains
** Widget ID's of the label and toggles. */
...
...
@@ -188,9 +180,7 @@ create_choice(w,info)
*/
void
select_button
(
choice
,
togglenum
)
ChoiceDesc
*
choice
;
int
togglenum
;
select_button
(
ChoiceDesc
*
choice
,
int
togglenum
)
{
static
Arg
toggleargs
[]
=
{
{
XtNstate
,
(
XtArgVal
)
True
}
...
...
@@ -207,9 +197,7 @@ select_button(choice,togglenum)
*/
void
line_up_labels
(
descs
,
numdescs
)
ChoiceDesc
*
descs
[];
int
numdescs
;
line_up_labels
(
ChoiceDesc
*
descs
[],
int
numdescs
)
{
int
i
;
/* counter */
Dimension
width
;
/* current width */
...
...
@@ -246,9 +234,7 @@ line_up_labels(descs,numdescs)
*/
void
choose_defaults
(
descs
,
numdescs
)
ChoiceDesc
*
descs
[];
int
numdescs
;
choose_defaults
(
ChoiceDesc
*
descs
[],
int
numdescs
)
{
int
i
;
/* which choice layout */
int
j
;
/* which toggle within it */
...
...
@@ -273,10 +259,10 @@ choose_defaults(descs,numdescs)
/*ARGSUSED*/
static
void
print_text_to_buffer
(
w
,
closure
,
call_data
)
Widget
w
;
caddr_t
closure
;
/* contains the string */
caddr_t
call_data
;
print_text_to_buffer
(
Widget
w
,
caddr_t
closure
,
/* contains the string */
caddr_t
call_data
)
{
interpret
((
char
*
)
closure
);
/* Gee, that was easy */
}
dashlist.c
View file @
b01f39a8
...
...
@@ -7,7 +7,7 @@
** functions to create more than one of these dashlist choice things
** will fail in a big way.
*/
/* $XFree86: xc/programs/xgc/dashlist.c,v 1.
3
200
1
/0
7/29 21:23:21 tsi
Exp $ */
/* $XFree86: xc/programs/xgc/dashlist.c,v 1.
4
200
3
/0
5/07 21:02:06 herrb
Exp $ */
#include
<stdio.h>
#include
<X11/Xos.h>
...
...
@@ -19,14 +19,7 @@
#include
<X11/Xaw/Toggle.h>
#include
"xgc.h"
static
void
change_dashlist
(
#if NeedFunctionPrototypes
Widget
,
caddr_t
,
caddr_t
#endif
);
extern
void
interpret
();
extern
XStuff
X
;
static
void
change_dashlist
(
Widget
,
caddr_t
,
caddr_t
);
static
short
dashlist
=
240
;
/* in binary, becomes the dashlist
(240 = XXXX____) */
...
...
@@ -40,8 +33,7 @@ static Widget *dashes; /* the toggle widgets */
*/
void
create_dashlist_choice
(
w
)
Widget
w
;
create_dashlist_choice
(
Widget
w
)
{
/* callback list for the toggle widgets */
static
XtCallbackRec
callbacklist
[]
=
{
...
...
@@ -106,7 +98,7 @@ create_dashlist_choice(w)
else
dashargs
[
6
].
value
=
(
XtArgVal
)
False
;
sprintf
(
name
,
"dashlist%d"
,
i
);
s
n
printf
(
name
,
sizeof
name
,
"dashlist%d"
,
i
);
dashinfo
[
i
]
=
i
;
/* which bit we're on; this is needed
in change_dashlist (the callback) */
...
...
@@ -127,10 +119,7 @@ create_dashlist_choice(w)
/*ARGSUSED*/
static
void
change_dashlist
(
w
,
closure
,
call_data
)
Widget
w
;
caddr_t
closure
;
caddr_t
call_data
;
change_dashlist
(
Widget
w
,
caddr_t
closure
,
caddr_t
call_data
)
{
int
num
;
/* what number button it is */
Boolean
on
;
/* is it currently on or off? */
...
...
@@ -156,8 +145,8 @@ change_dashlist(w,closure,call_data)
}
/* now tell interpret() about it */
sprintf
(
buf
,
"dashlist %d
\n
"
,
dashlist
);
interpret
(
buf
,
FALSE
);
s
n
printf
(
buf
,
sizeof
buf
,
"dashlist %d
\n
"
,
dashlist
);
interpret
(
buf
);
}
/* update_dashlist(newdash)
...
...
@@ -167,8 +156,7 @@ change_dashlist(w,closure,call_data)
*/
void
update_dashlist
(
newdash
)
int
newdash
;
update_dashlist
(
int
newdash
)
{
int
i
;
/* counter */
static
Arg
dashargs
[]
=
{
/* Arglist for setting toggle state */
...
...
getfile.c
View file @
b01f39a8
...
...
@@ -2,7 +2,7 @@
** getfilename.c
**
*/
/* $XFree86: xc/programs/xgc/getfile.c,v 1.
3
200
0/02/17 14:00:35 dawes
Exp $ */
/* $XFree86: xc/programs/xgc/getfile.c,v 1.
5
200
3/05/27 22:27:06 tsi
Exp $ */
#include
<X11/Intrinsic.h>
#include
<X11/StringDefs.h>
...
...
@@ -15,26 +15,22 @@
#include
"xgc.h"
extern
XStuff
X
;
extern
Widget
topform
;
static
Widget
popupshell
=
NULL
;
/* popup dialog box */
Widget
filename_text_widget
;
/* Widget containing the name of
the file the user has selected */
extern
XtAppContext
appcontext
;
static
void
kill_popup_shell
();
static
void
kill_popup_shell
(
void
);
void
get_filename
(
success
,
failure
)
void
(
*
success
)(
);
/* what function to call when a filename is
get_filename
(
void
(
*
success
)(
void
),
/* what function to call when a filename is
chosen */
void
(
*
failure
)(
);
/* what function to call when the user
void
(
*
failure
)(
void
))
/* what function to call when the user
cancels */
{
static
Widget
popupform
;
/* form inside shell */
static
Widget
label
;
/* "Filename :" */
static
Widget
cancel
;
/* command, select to cancel */
Window
dummy1
,
dummy2
;
int
x1
,
y1
,
x2
,
y2
;
...
...
@@ -138,8 +134,8 @@ get_filename(success,failure)
cancelargs
[
0
].
value
=
(
XtArgVal
)
filename_text_widget
;
cancelargs
[
1
].
value
=
(
XtArgVal
)
cancelcallbacklist
;
cancel
=
XtCreateManagedWidget
(
"Cancel"
,
commandWidgetClass
,
popupform
,
cancelargs
,
XtNumber
(
cancelargs
));
(
void
)
XtCreateManagedWidget
(
"Cancel"
,
commandWidgetClass
,
popupform
,
cancelargs
,
XtNumber
(
cancelargs
));
/* Bring up the popup. When the user presses cancel or the return key,
** the function kill_popup_shell (below) will be called to remove it. */
...
...
@@ -153,7 +149,7 @@ get_filename(success,failure)
*/
static
void
kill_popup_shell
()
kill_popup_shell
(
void
)
{
XtPopdown
(
popupshell
);
}
gram.y
View file @
b01f39a8
/*
** grammar for xgc syntax
*/
/* $XFree86: xc/programs/xgc/gram.y,v 1.
3
200
0
/0
2/17 14:00:36 dawes
Exp $ */
/* $XFree86: xc/programs/xgc/gram.y,v 1.
4
200
3
/0
5/07 21:02:07 herrb
Exp $ */
%{
#define YYDEBUG 1
#include <stdio.h>
#include <X11/X.h>
#include "constants.h"
#include <X11/Intrinsic.h>
#include "xgc.h"
extern int yylineno;
extern FILE *yyin;
int yylex();
void yyerror();
extern void GC_change_function();
extern void GC_change_foreground();
extern void GC_change_background();
extern void GC_change_linewidth();
extern void GC_change_linestyle();
extern void GC_change_capstyle();
extern void GC_change_joinstyle();
extern void GC_change_fillstyle();
extern void GC_change_fillrule();
extern void GC_change_arcmode();
extern void GC_change_dashlist();
extern void GC_change_planemask();
extern void GC_change_font();
extern void change_test();
extern void change_percent();
extern void run_test();
%}
%union
...
...
@@ -109,8 +91,7 @@ stmt : error
%%
void
yyerror(s)
const char *s;
yyerror(const char *s)
{
fprintf(stderr, "xgc: syntax error, line %d\n", yylineno);
}
interpret.c
View file @
b01f39a8
...
...
@@ -3,7 +3,7 @@
**
** interprets and executes lines in the Xgc syntax.
*/
/* $XFree86: xc/programs/xgc/interpret.c,v 1.
4
200
2
/0
1
/07 2
0:38:30 dawes
Exp $ */
/* $XFree86: xc/programs/xgc/interpret.c,v 1.
5
200
3
/0
5
/07 2
1:02:07 herrb
Exp $ */
#include
<stdio.h>
#include
<stdlib.h>
...
...
@@ -12,55 +12,6 @@
#include
"xgc.h"
#include
"tile"
void
change_text
();
void
GC_change_function
();
void
GC_change_foreground
();
void
GC_change_background
();
void
GC_change_linewidth
();
void
GC_change_linestyle
();
void
GC_change_capstyle
();
void
GC_change_joinstyle
();
void
GC_change_fillstyle
();
void
GC_change_fillrule
();
void
GC_change_arcmode
();
void
GC_change_dashlist
();
void
GC_change_planemask
();
void
GC_change_font
();
void
change_test
();
void
change_percent
();
extern
void
update_dashlist
();
extern
void
update_planemask
();
extern
void
update_slider
();
extern
void
select_button
();
extern
void
run_test
();
extern
void
print_if_recording
();
extern
XgcStuff
TestStuff
;
extern
XgcStuff
FunctionStuff
;
extern
XgcStuff
LinestyleStuff
;
extern
XgcStuff
CapstyleStuff
;
extern
XgcStuff
JoinstyleStuff
;
extern
XgcStuff
FillstyleStuff
;
extern
XgcStuff
FillruleStuff
;
extern
XgcStuff
ArcmodeStuff
;
extern
XStuff
X
;
extern
ChoiceDesc
*
GCdescs
[];
extern
ChoiceDesc
*
testchoicedesc
;
extern
Widget
test
;
extern
Widget
GCform
;
extern
Widget
foregroundtext
;
extern
Widget
backgroundtext
;
extern
Widget
linewidthtext
;
extern
Widget
fonttext
;
extern
Widget
dashlistchoice
;
extern
Widget
planemaskchoice
;
extern
Widget
testchoiceform
;
extern
int
fildes
[
2
];
extern
FILE
*
outend
;
extern
FILE
*
yyin
;
/* interpret(string)
** -----------------
...
...
@@ -74,8 +25,7 @@ extern FILE *yyin;
*/
void
interpret
(
string
)
const
char
*
string
;
interpret
(
const
char
*
string
)
{
char
word1
[
20
],
word2
[
80
];
int
i
;
...
...
@@ -174,8 +124,7 @@ interpret(string)
#ifdef notdef
void
interpret
(
instring
)
const
char
*
instring
;
interpret
(
const
char
*
instring
)
{
FILE
*
inend
;
...
...
@@ -199,9 +148,7 @@ interpret(instring)
*/
void
GC_change_function
(
function
,
feedback
)
int
function
;
Boolean
feedback
;
GC_change_function
(
int
function
,
Boolean
feedback
)
{
XSetFunction
(
X
.
dpy
,
X
.
gc
,
function
);
X
.
gcv
.
function
=
function
;
...
...
@@ -209,9 +156,7 @@ GC_change_function(function,feedback)
}
void
GC_change_foreground
(
foreground
,
feedback
)
unsigned
long
foreground
;
Boolean
feedback
;
GC_change_foreground
(
unsigned
long
foreground
,
Boolean
feedback
)
{
char
text
[
40
];
...
...
@@ -222,15 +167,13 @@ GC_change_foreground(foreground,feedback)
XSetTile
(
X
.
dpy
,
X
.
gc
,
X
.
tile
);
XSetTile
(
X
.
dpy
,
X
.
miscgc
,
X
.
tile
);
if
(
feedback
)
{
sprintf
(
text
,
"%lu"
,
foreground
);
s
n
printf
(
text
,
sizeof
text
,
"%lu"
,
foreground
);
change_text
(
foregroundtext
,
text
);
}
}
void
GC_change_background
(
background
,
feedback
)
unsigned
long
background
;
Boolean
feedback
;
GC_change_background
(
unsigned
long
background
,
Boolean
feedback
)
{
char
text
[
40
];
...
...
@@ -247,30 +190,26 @@ GC_change_background(background,feedback)
XClearWindow
(
X
.
dpy
,
XtWindow
(
test
));
if
(
feedback
)
{
sprintf
(
text
,
"%lu"
,
background
);
s
n
printf
(
text
,
sizeof
text
,
"%lu"
,
background
);
change_text
(
backgroundtext
,
text
);
}
}
void
GC_change_linewidth
(
linewidth
,
feedback
)
int
linewidth
;
Boolean
feedback
;
GC_change_linewidth
(
int
linewidth
,
Boolean
feedback
)
{
char
text
[
40
];
X
.
gcv
.
line_width
=
linewidth
;
XChangeGC
(
X
.
dpy
,
X
.
gc
,
GCLineWidth
,
&
X
.
gcv
);
if
(
feedback
)
{
sprintf
(
text
,
"%d"
,
linewidth
);
s
n
printf
(
text
,
sizeof
text
,
"%d"
,
linewidth
);
change_text
(
linewidthtext
,
text
);
}
}
void
GC_change_linestyle
(
linestyle
,
feedback
)
int
linestyle
;
Boolean
feedback
;
GC_change_linestyle
(
int
linestyle
,
Boolean
feedback
)
{
X
.
gcv
.
line_style
=
linestyle
;
XChangeGC
(
X
.
dpy
,
X
.
gc
,
GCLineStyle
,
&
X
.
gcv
);
...
...
@@ -278,9 +217,7 @@ GC_change_linestyle(linestyle,feedback)
}
void
GC_change_capstyle
(
capstyle
,
feedback
)
int
capstyle
;
Boolean
feedback
;
GC_change_capstyle
(
int
capstyle
,
Boolean
feedback
)
{
X
.
gcv
.
cap_style
=
capstyle
;
XChangeGC
(
X
.
dpy
,
X
.
gc
,
GCCapStyle
,
&
X
.
gcv
);
...
...
@@ -288,9 +225,7 @@ GC_change_capstyle(capstyle,feedback)
}
void
GC_change_joinstyle
(
joinstyle
,
feedback
)
int
joinstyle
;
Boolean
feedback
;
GC_change_joinstyle
(
int
joinstyle
,
Boolean
feedback
)
{
X
.
gcv
.
join_style
=
joinstyle
;
XChangeGC
(
X
.
dpy
,
X
.
gc
,
GCJoinStyle
,
&
X
.
gcv
);
...
...
@@ -298,9 +233,7 @@ GC_change_joinstyle(joinstyle,feedback)
}
void
GC_change_fillstyle
(
fillstyle
,
feedback
)
int
fillstyle
;
Boolean
feedback
;
GC_change_fillstyle
(
int
fillstyle
,
Boolean
feedback
)
{
XSetFillStyle
(
X
.
dpy
,
X
.
gc
,
fillstyle
);
X
.
gcv
.
fill_style
=
fillstyle
;
...
...
@@ -308,9 +241,7 @@ GC_change_fillstyle(fillstyle,feedback)
}
void
GC_change_fillrule
(
fillrule
,
feedback
)
int
fillrule
;
Boolean
feedback
;
GC_change_fillrule
(
int
fillrule
,
Boolean
feedback
)
{
XSetFillRule
(
X
.
dpy
,
X
.
gc
,
fillrule
);
X
.
gcv
.
fill_rule
=
fillrule
;
...
...
@@ -318,9 +249,7 @@ GC_change_fillrule(fillrule,feedback)
}
void
GC_change_arcmode
(
arcmode
,
feedback
)
int
arcmode
;
Boolean
feedback
;
GC_change_arcmode
(
int
arcmode
,
Boolean
feedback
)
{
XSetArcMode
(
X
.
dpy
,
X
.
gc
,
arcmode
);
X
.
gcv
.
arc_mode
=
arcmode
;
...
...
@@ -336,9 +265,7 @@ GC_change_arcmode(arcmode,feedback)
*/
void
GC_change_dashlist
(
dashlist
,
feedback
)
int
dashlist
;
Boolean
feedback
;
GC_change_dashlist
(
int
dashlist
,
Boolean
feedback
)
{
char
dasharray
[
DASHLENGTH
];
/* what we're gonna pass to XSetDashes */
int
dashnumber
=
0
;
/* which element of dasharray we're currently
...
...
@@ -381,9 +308,7 @@ GC_change_dashlist(dashlist,feedback)
}
void
GC_change_planemask
(
planemask
,
feedback
)
unsigned
long
planemask
;
Boolean
feedback
;
GC_change_planemask
(
unsigned
long
planemask
,
Boolean
feedback
)
{
XSetPlaneMask
(
X
.
dpy
,
X
.
gc
,
planemask
);
X
.
gcv
.
plane_mask
=
planemask
;
...
...
@@ -391,18 +316,14 @@ GC_change_planemask(planemask,feedback)
}
void
change_test
(
test
,
feedback
)
int
test
;
Boolean
feedback
;
change_test
(
int
test
,
Boolean
feedback
)
{
X
.
test
=
test
;
if
(
feedback
)
select_button
(
testchoicedesc
,
test
);
}
void
GC_change_font
(
str
,
feedback
)
const
char
*
str
;
Boolean
feedback
;
GC_change_font
(
char
*
str
,
Boolean
feedback
)
{
int
num_fonts
;
/* number of fonts that match the string */
...
...
@@ -415,9 +336,7 @@ GC_change_font(str,feedback)
}
void
change_percent
(
percent
,
feedback
)
int
percent
;
Boolean
feedback
;
change_percent
(
int
percent
,
Boolean
feedback
)
{
/* Make sure that percent is valid */
...
...
main.c
View file @
b01f39a8
...
...
@@ -28,7 +28,7 @@ other dealings in this Software without prior written authorization
from the X Consortium.
*/
/* $XFree86: xc/programs/xgc/main.c,v 1.
5
200
1/10/28 03:34:34
tsi Exp $ */
/* $XFree86: xc/programs/xgc/main.c,v 1.
7
200
3/05/27 22:27:06
tsi Exp $ */
/* xgc
**
...
...
@@ -51,28 +51,12 @@ from the X Consortium.
#include
"tile"
#include
"main.h"
static
void
fill_up_commandform
();
extern
void
run_test
();
static
void
quit
();
static
void
quitAction
();
static
void
clear_test_window
();
static
void
clear_result_window
();
extern
void
start_playback
();
extern
void
read_from_keyboard
();
extern
void
toggle_recordbutton
();
static
void
set_foreground_and_background
();
extern
ChoiceDesc
*
create_choice
();
extern
void
choose_defaults
();
extern
void
line_up_labels
();
extern
Widget
create_text_choice
();
extern
void
create_planemask_choice
();
extern
void
create_dashlist_choice
();
extern
void
create_testfrac_choice
();
extern
void
GC_change_foreground
();
extern
void
GC_change_background
();
extern
void
GC_change_font
();
extern
void
close_file_if_recording
();
extern
void
set_text
(
Widget
ww
,
char
*
string
);
static
void
fill_up_commandform
(
Widget
);
static
void
quit
(
void
);
static
void
quitAction
(
Widget
,
XEvent
*
,
String
*
,
Cardinal
*
);
static
void
clear_test_window
(
void
);
static
void
clear_result_window
(
void
);
static
void
set_foreground_and_background
(
void
);
#ifdef notdef
int
fildes
[
2
];
/* for pipe */
...
...
@@ -98,7 +82,6 @@ static Widget commandform; /* form with run, quit, clear, etc. */
Widget
test
;
/* where the test is run */
Widget
result
;
/* where the results are displayed */
static
Widget
runbutton
;
/* command for running */
static
Widget
quitbutton
;
/* command for quitting */
static
Widget
clearbutton
;
/* command for clearing the test window */
Widget
recordbutton
;
/* start/stop recording */
static
Widget
playbackbutton
;
/* playback from file */
...
...
@@ -126,9 +109,7 @@ static Widget percentchoice; /* form for choosing percentage of test */
*/
int
main
(
argc
,
argv
)
int
argc
;
char
**
argv
;
main
(
int
argc
,
char
*
argv
[])
{
static
Arg
shellargs
[]
=
{
{
XtNinput
,
(
XtArgVal
)
True
}
...
...
@@ -339,8 +320,7 @@ main(argc,argv)
*/
static
void
fill_up_commandform
(
w
)
Widget
w
;
fill_up_commandform
(
Widget
w
)
{
static
XtCallbackRec
runcallbacklist
[]
=
{
{(
XtCallbackProc
)
run_test
,
NULL
},
...
...
@@ -432,8 +412,8 @@ fill_up_commandform(w)
quitargs
[
0
].
value
=
(
XtArgVal
)
quitcallbacklist
;
quitargs
[
1
].
value
=
(
XtArgVal
)
keyinputbutton
;
/* under */
quitbutton
=
XtCreateManagedWidget
(
"Quit"
,
commandWidgetClass
,
w
,
quitargs
,
XtNumber
(
quitargs
));
(
void
)
XtCreateManagedWidget
(
"Quit"
,
commandWidgetClass
,
w
,
quitargs
,
XtNumber
(
quitargs
));
}
/* quit()
...
...
@@ -442,17 +422,13 @@ fill_up_commandform(w)
*/
static
void
quit
()
quit
(
void
)
{
close_file_if_recording
();
exit
(
0
);
}
static
void
quitAction
(
w
,
e
,
p
,
n
)
Widget
w
;
XEvent
*
e
;
String
*
p
;
Cardinal
*
n
;
static
void
quitAction
(
Widget
w
,
XEvent
*
e
,
String
*
p
,
Cardinal
*
n
)
{
if
(
e
->
type
==
ClientMessage
&&
e
->
xclient
.
data
.
l
[
0
]
!=
wm_delete_window
)
XBell
(
XtDisplay
(
w
),
0
);
...
...
@@ -466,7 +442,7 @@ static void quitAction(w, e, p, n)
*/
static
void
clear_test_window
()
clear_test_window
(
void
)
{
XClearWindow
(
X
.
dpy
,
XtWindow
(
test
));
}
...
...
@@ -477,7 +453,7 @@ clear_test_window()
*/
static
void
clear_result_window
()
clear_result_window
(
void
)
{
set_text
(
result
,
""
);
}
...
...
@@ -490,7 +466,7 @@ clear_result_window()
*/
static
void
set_foreground_and_background
()
set_foreground_and_background
(
void
)
{
static
XtResource
resources
[]
=
{
{
XtNforeground
,
XtCForeground
,
XtRPixel
,
sizeof
(
Pixel
),
...
...
planemask.c
View file @
b01f39a8
...
...
@@ -7,7 +7,7 @@
** functions to create more than one of these planemask choice things
** will fail in a big way.
*/
/* $XFree86: xc/programs/xgc/planemask.c,v 1.
3
200
0/02/17 14:00:37 dawes
Exp $ */