annotate etc/tests/external-widget/test-ew-xlib.c @ 5853:1044acf60048

Revert part of Jerry's December 2014 that broke gnuclient on some OS X. lib-src/ChangeLog addition: 2015-03-08 Aidan Kehoe <kehoea@parhasard.net> * gnuserv.c (echo_request): No longer close the file handle unconditionally, leave this to the individual socket types. * gnuserv.c (handle_internet_request): Close the file handle here. * gnuserv.c (handle_unix_request): Don't close the file handle here, document why (it broke gnuclient under OS X). It should actually be OK, but my suspicion is that the issues is that the Unix (local) domain sockets are still underdocumented compared to the internet sockets.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 08 Mar 2015 20:59:25 +0000
parents 6a8c6c6f6c8e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4894
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
1 /* Test external widget code in Motif.
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
2 Copyright (C) 1989 O'Reilly and Associates, Inc.
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
3 Copyright (C) 1993 Ben Wing.
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
4
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
5 This file is part of XEmacs.
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
6
5412
6a8c6c6f6c8e Convert to GPLv3 or later from plain text GPLv2 or later.
Mats Lidell <matsl@xemacs.org>
parents: 5231
diff changeset
7 XEmacs is free software: you can redistribute it and/or modify it
4894
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
8 under the terms of the GNU General Public License as published by the
5412
6a8c6c6f6c8e Convert to GPLv3 or later from plain text GPLv2 or later.
Mats Lidell <matsl@xemacs.org>
parents: 5231
diff changeset
9 Free Software Foundation, either version 3 of the License, or (at your
6a8c6c6f6c8e Convert to GPLv3 or later from plain text GPLv2 or later.
Mats Lidell <matsl@xemacs.org>
parents: 5231
diff changeset
10 option) any later version.
4894
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
11
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
15 for more details.
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
16
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
17 You should have received a copy of the GNU General Public License
5412
6a8c6c6f6c8e Convert to GPLv3 or later from plain text GPLv2 or later.
Mats Lidell <matsl@xemacs.org>
parents: 5231
diff changeset
18 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */
4894
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
19
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
20 #include <X11/Xlib.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
21 #include <X11/Xutil.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
22 #include <X11/Xos.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
23 #include <X11/Xatom.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
24
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
25 #include <stdio.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
26
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
27 #define BITMAPDEPTH 1
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
28 #define TOO_SMALL 0
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
29 #define BIG_ENOUGH 1
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
30
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
31 /* These are used as arguments to nearly every Xlib routine, so it saves
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
32 * routine arguments to declare them global. If there were
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
33 * additional source files, they would be declared extern there. */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
34 Display *display;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
35 int screen_num;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
36
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
37 static char *progname; /* name this program was invoked by */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
38
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
39 void main(argc, argv)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
40 int argc;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
41 char **argv;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
42 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
43 Window topwin, win, win2;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
44 unsigned int width, height; /* window size */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
45 int x, y; /* window position */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
46 unsigned int border_width = 4; /* four pixels */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
47 unsigned int display_width, display_height;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
48 char *window_name = "Basic Window Program";
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
49 char *icon_name = "basicwin";
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
50 XSizeHints size_hints;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
51 int count;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
52 XEvent report;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
53 GC gc;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
54 XFontStruct *font_info;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
55 char *display_name = NULL;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
56 int window_size = BIG_ENOUGH; /* or TOO_SMALL to display contents */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
57
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
58 progname = argv[0];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
59
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
60 /* connect to X server */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
61 if ( (display=XOpenDisplay(display_name)) == NULL )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
62 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
63 (void) fprintf( stderr, "%s: cannot connect to X server %s\n",
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
64 progname, XDisplayName(display_name));
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
65 exit( -1 );
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
66 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
67
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
68 /* get screen size from display structure macro */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
69 screen_num = DefaultScreen(display);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
70 display_width = DisplayWidth(display, screen_num);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
71 display_height = DisplayHeight(display, screen_num);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
72
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
73 /* Note that in a real application, x and y would default to 0
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
74 * but would be settable from the command line or resource database.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
75 */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
76 x = y = 0;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
77
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
78 /* size window with enough room for text */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
79 width = display_width/2, height = display_height/3;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
80
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
81 /* ------------------------------------------------------------ */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
82
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
83 /* create top-level window */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
84 topwin = XCreateSimpleWindow(display, RootWindow(display,screen_num),
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
85 x, y, width, 2*height, border_width,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
86 BlackPixel(display, screen_num),
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
87 WhitePixel(display,screen_num));
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
88
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
89 /* Set size hints for window manager. The window manager may
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
90 * override these settings. Note that in a real
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
91 * application if size or position were set by the user
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
92 * the flags would be UPosition and USize, and these would
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
93 * override the window manager's preferences for this window. */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
94
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
95 /* x, y, width, and height hints are now taken from
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
96 * the actual settings of the window when mapped. Note
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
97 * that PPosition and PSize must be specified anyway. */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
98
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
99 size_hints.flags = PPosition | PSize | PMinSize;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
100 size_hints.min_width = 300;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
101 size_hints.min_height = 200;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
102
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
103 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
104 XWMHints wm_hints;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
105 XClassHint class_hints;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
106
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
107 /* format of the window name and icon name
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
108 * arguments has changed in R4 */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
109 XTextProperty windowName, iconName;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
110
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
111 /* These calls store window_name and icon_name into
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
112 * XTextProperty structures and set their other
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
113 * fields properly. */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
114 if (XStringListToTextProperty(&window_name, 1, &windowName) == 0) {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
115 (void) fprintf( stderr, "%s: structure allocation for windowName failed.\n",
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
116 progname);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
117 exit(-1);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
118 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
119
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
120 if (XStringListToTextProperty(&icon_name, 1, &iconName) == 0) {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
121 (void) fprintf( stderr, "%s: structure allocation for iconName failed.\n",
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
122 progname);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
123 exit(-1);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
124 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
125
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
126 wm_hints.initial_state = NormalState;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
127 wm_hints.input = True;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
128 wm_hints.flags = StateHint | InputHint;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
129
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
130 class_hints.res_name = progname;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
131 class_hints.res_class = "Basicwin";
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
132
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
133 XSetWMProperties(display, topwin, &windowName, &iconName,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
134 argv, argc, &size_hints, &wm_hints,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
135 &class_hints);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
136 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
137
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
138 /* ------------------------------------------------------------ */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
139
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
140 /* create the window we're in charge of */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
141
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
142 win = XCreateSimpleWindow(display, topwin,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
143 x, y, width, height, border_width, BlackPixel(display,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
144 screen_num), WhitePixel(display,screen_num));
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
145
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
146 /* Select event types wanted */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
147 XSelectInput(display, win, ExposureMask | KeyPressMask |
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
148 ButtonPressMask | StructureNotifyMask);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
149
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
150 load_font(&font_info);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
151
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
152 /* create GC for text and drawing */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
153 getGC(win, &gc, font_info);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
154
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
155 /* ------------------------------------------------------------ */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
156
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
157 /* create the external-client window */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
158
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
159 win2 = XCreateSimpleWindow(display, topwin,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
160 x, y+height, width, height, border_width,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
161 BlackPixel(display, screen_num),
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
162 WhitePixel(display,screen_num));
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
163 printf("external window: %d\n", win2);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
164 ExternalClientInitialize(display, win2);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
165
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
166 /* ------------------------------------------------------------ */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
167
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
168 /* Display windows */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
169 XMapWindow(display, topwin);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
170 XMapWindow(display, win);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
171 XMapWindow(display, win2);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
172
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
173 /* get events, use first to display text and graphics */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
174 while (1) {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
175 XNextEvent(display, &report);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
176 if (report.xany.window == win2)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
177 ExternalClientEventHandler(display, win2, &report);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
178 else
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
179 switch (report.type) {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
180 case Expose:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
181 /* unless this is the last contiguous expose,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
182 * don't draw the window */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
183 if (report.xexpose.count != 0)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
184 break;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
185
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
186 /* if window too small to use */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
187 if (window_size == TOO_SMALL)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
188 TooSmall(win, gc, font_info);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
189 else {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
190 /* place text in window */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
191 draw_text(win, gc, font_info, width, height);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
192
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
193 /* place graphics in window, */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
194 draw_graphics(win, gc, width, height);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
195 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
196 break;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
197 case ConfigureNotify:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
198 /* window has been resized, change width and
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
199 * height to send to draw_text and draw_graphics
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
200 * in next Expose */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
201 width = report.xconfigure.width;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
202 height = report.xconfigure.height;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
203 if ((width < size_hints.min_width) ||
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
204 (height < size_hints.min_height))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
205 window_size = TOO_SMALL;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
206 else
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
207 window_size = BIG_ENOUGH;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
208 break;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
209 case ButtonPress:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
210 /* trickle down into KeyPress (no break) */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
211 case KeyPress:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
212 XUnloadFont(display, font_info->fid);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
213 XFreeGC(display, gc);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
214 XCloseDisplay(display);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
215 exit(1);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
216 default:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
217 /* all events selected by StructureNotifyMask
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
218 * except ConfigureNotify are thrown away here,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
219 * since nothing is done with them */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
220 break;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
221 } /* end switch */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
222 } /* end while */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
223 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
224
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
225 getGC(win, gc, font_info)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
226 Window win;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
227 GC *gc;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
228 XFontStruct *font_info;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
229 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
230 unsigned long valuemask = 0; /* ignore XGCvalues and use defaults */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
231 XGCValues values;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
232 unsigned int line_width = 6;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
233 int line_style = LineOnOffDash;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
234 int cap_style = CapRound;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
235 int join_style = JoinRound;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
236 int dash_offset = 0;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
237 static char dash_list[] = {12, 24};
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
238 int list_length = 2;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
239
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
240 /* Create default Graphics Context */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
241 *gc = XCreateGC(display, win, valuemask, &values);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
242
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
243 /* specify font */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
244 XSetFont(display, *gc, font_info->fid);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
245
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
246 /* specify black foreground since default window background is
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
247 * white and default foreground is undefined. */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
248 XSetForeground(display, *gc, BlackPixel(display,screen_num));
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
249
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
250 /* set line attributes */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
251 XSetLineAttributes(display, *gc, line_width, line_style,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
252 cap_style, join_style);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
253
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
254 /* set dashes */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
255 XSetDashes(display, *gc, dash_offset, dash_list, list_length);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
256 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
257
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
258 load_font(font_info)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
259 XFontStruct **font_info;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
260 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
261 char *fontname = "9x15";
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
262
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
263 /* Load font and get font information structure. */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
264 if ((*font_info = XLoadQueryFont(display,fontname)) == NULL)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
265 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
266 (void) fprintf( stderr, "%s: Cannot open 9x15 font\n",
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
267 progname);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
268 exit( -1 );
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
269 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
270 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
271
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
272 draw_text(win, gc, font_info, win_width, win_height)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
273 Window win;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
274 GC gc;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
275 XFontStruct *font_info;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
276 unsigned int win_width, win_height;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
277 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
278 char *string1 = "Hi! I'm a window, who are you?";
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
279 char *string2 = "To terminate program; Press any key";
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
280 char *string3 = "or button while in this window.";
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
281 char *string4 = "Screen Dimensions:";
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
282 int len1, len2, len3, len4;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
283 int width1, width2, width3;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
284 char cd_height[50], cd_width[50], cd_depth[50];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
285 int font_height;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
286 int initial_y_offset, x_offset;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
287
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
288
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
289 /* need length for both XTextWidth and XDrawString */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
290 len1 = strlen(string1);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
291 len2 = strlen(string2);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
292 len3 = strlen(string3);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
293
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
294 /* get string widths for centering */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
295 width1 = XTextWidth(font_info, string1, len1);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
296 width2 = XTextWidth(font_info, string2, len2);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
297 width3 = XTextWidth(font_info, string3, len3);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
298
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
299 font_height = font_info->ascent + font_info->descent;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
300
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
301 /* output text, centered on each line */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
302 XDrawString(display, win, gc, (win_width - width1)/2,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
303 font_height,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
304 string1, len1);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
305 XDrawString(display, win, gc, (win_width - width2)/2,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
306 (int)(win_height - (2 * font_height)),
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
307 string2, len2);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
308 XDrawString(display, win, gc, (win_width - width3)/2,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
309 (int)(win_height - font_height),
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
310 string3, len3);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
311
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
312 /* copy numbers into string variables */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
313 (void) sprintf(cd_height, " Height - %d pixels",
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
314 DisplayHeight(display,screen_num));
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
315 (void) sprintf(cd_width, " Width - %d pixels",
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
316 DisplayWidth(display,screen_num));
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
317 (void) sprintf(cd_depth, " Depth - %d plane(s)",
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
318 DefaultDepth(display, screen_num));
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
319
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
320 /* reuse these for same purpose */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
321 len4 = strlen(string4);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
322 len1 = strlen(cd_height);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
323 len2 = strlen(cd_width);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
324 len3 = strlen(cd_depth);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
325
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
326 /* To center strings vertically, we place the first string
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
327 * so that the top of it is two font_heights above the center
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
328 * of the window. Since the baseline of the string is what we
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
329 * need to locate for XDrawString, and the baseline is one
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
330 * font_info->ascent below the top of the character,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
331 * the final offset of the origin up from the center of the
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
332 * window is one font_height + one descent. */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
333
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
334 initial_y_offset = win_height/2 - font_height - font_info->descent;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
335 x_offset = (int) win_width/4;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
336 XDrawString(display, win, gc, x_offset, (int) initial_y_offset,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
337 string4,len4);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
338
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
339 XDrawString(display, win, gc, x_offset, (int) initial_y_offset +
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
340 font_height,cd_height,len1);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
341 XDrawString(display, win, gc, x_offset, (int) initial_y_offset +
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
342 2 * font_height,cd_width,len2);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
343 XDrawString(display, win, gc, x_offset, (int) initial_y_offset +
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
344 3 * font_height,cd_depth,len3);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
345 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
346
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
347 draw_graphics(win, gc, window_width, window_height)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
348 Window win;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
349 GC gc;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
350 unsigned int window_width, window_height;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
351 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
352 int x, y;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
353 int width, height;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
354
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
355 height = window_height/2;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
356 width = 3 * window_width/4;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
357 x = window_width/2 - width/2; /* center */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
358 y = window_height/2 - height/2;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
359 XDrawRectangle(display, win, gc, x, y, width, height);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
360 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
361
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
362 TooSmall(win, gc, font_info)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
363 Window win;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
364 GC gc;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
365 XFontStruct *font_info;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
366 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
367 char *string1 = "Too Small";
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
368 int y_offset, x_offset;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
369
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
370 y_offset = font_info->ascent + 2;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
371 x_offset = 2;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
372
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
373 /* output text, centered on each line */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
374 XDrawString(display, win, gc, x_offset, y_offset, string1,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
375 strlen(string1));
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
376 }