1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
4 |
– |
|
5 |
– |
/* Copyright (c) 1989 Regents of the University of California */ |
6 |
– |
|
4 |
|
/* |
5 |
|
* x11twind.c - routines for X11 text windows. |
6 |
|
* |
11 |
|
* 9/26/88 |
12 |
|
*/ |
13 |
|
|
14 |
+ |
#include "copyright.h" |
15 |
+ |
|
16 |
|
#include <stdio.h> |
17 |
|
|
18 |
+ |
#include <stdlib.h> |
19 |
+ |
|
20 |
|
#include <X11/Xlib.h> |
21 |
|
|
22 |
|
#include "x11twind.h" |
23 |
|
|
24 |
|
#ifndef BSD |
25 |
|
#define bzero(d,n) (void)memset(d,0,n) |
25 |
– |
extern char *memset(); |
26 |
|
#endif |
27 |
|
|
28 |
|
#define checkcurs(t) if ((t)->cursor) togglecurs(t) |
34 |
|
#define Height(f) ((f)->ascent + (f)->descent) |
35 |
|
#define YStart(f) ((f)->ascent) |
36 |
|
|
37 |
< |
extern char *calloc(), *malloc(); |
37 |
> |
static void togglecurs(); |
38 |
|
|
39 |
|
|
40 |
|
TEXTWIND * |
41 |
< |
xt_open(dpy, gc, parent, x, y, width, height, bw, fontname) |
42 |
< |
Display *dpy; |
43 |
< |
GC gc; |
44 |
< |
Window parent; |
45 |
< |
int x, y; |
46 |
< |
int width, height; |
47 |
< |
int bw; |
48 |
< |
char *fontname; |
41 |
> |
xt_open(dpy, parent, x, y, width, height, bw, fore, back, fontname) |
42 |
> |
Display *dpy; |
43 |
> |
Window parent; |
44 |
> |
int x, y; |
45 |
> |
int width, height; |
46 |
> |
int bw; |
47 |
> |
unsigned long fore, back; |
48 |
> |
char *fontname; |
49 |
|
{ |
50 |
|
register int i; |
51 |
|
register TEXTWIND *t; |
54 |
|
return(NULL); |
55 |
|
|
56 |
|
t->dpy = dpy; |
57 |
< |
t->w = XCreateSimpleWindow(dpy, parent, x, y, width, height, bw, |
58 |
< |
BlackPixel(dpy,DefaultScreen(dpy)), |
59 |
< |
WhitePixel(dpy,DefaultScreen(dpy))); |
60 |
< |
/* |
61 |
< |
t->w = XCreateWindow(dpy, parent, x, y, width, height, bw, 0, |
62 |
< |
CopyFromParent, CopyFromParent, 0, 0); |
63 |
< |
*/ |
64 |
< |
|
57 |
> |
t->w = XCreateSimpleWindow(dpy, parent, x, y, width, height, |
58 |
> |
bw, fore, back); |
59 |
|
if (t->w == 0) |
60 |
|
return(NULL); |
61 |
|
XMapWindow(dpy, t->w); |
65 |
|
|
66 |
|
/* if (!t->f.fixedwidth) check for fixedwidth later |
67 |
|
return(NULL); */ |
74 |
– |
t->gc = XCreateGC(dpy,t->w,0,NULL); |
68 |
|
|
69 |
< |
XCopyGC(dpy, gc, ~0L, t->gc); |
70 |
< |
|
69 |
> |
t->gc = XCreateGC(dpy,t->w,0,NULL); |
70 |
> |
XSetState(dpy, t->gc, fore, back, GXcopy, AllPlanes); |
71 |
|
XSetFont(dpy, t->gc, t->f->fid); |
79 |
– |
XSetFunction(dpy, t->gc, GXcopy); |
72 |
|
|
73 |
|
t->nc = (width - LEFTMAR) / |
74 |
|
Width(t->f); /* number of columns */ |
88 |
|
} |
89 |
|
|
90 |
|
|
91 |
+ |
void |
92 |
|
xt_puts(s, t) /* output a string */ |
93 |
|
register char *s; |
94 |
|
TEXTWIND *t; |
102 |
|
} |
103 |
|
|
104 |
|
|
105 |
+ |
void |
106 |
|
xt_putc(c, t) /* output a character */ |
107 |
|
char c; |
108 |
|
register TEXTWIND *t; |
136 |
|
} |
137 |
|
|
138 |
|
|
139 |
+ |
void |
140 |
|
xt_delete(t, r) /* delete a line */ |
141 |
|
register TEXTWIND *t; |
142 |
|
int r; |
164 |
|
} |
165 |
|
|
166 |
|
|
167 |
+ |
void |
168 |
|
xt_insert(t, r) /* insert a line */ |
169 |
|
register TEXTWIND *t; |
170 |
|
int r; |
191 |
|
} |
192 |
|
|
193 |
|
|
194 |
+ |
void |
195 |
|
xt_redraw(t) /* redraw text window */ |
196 |
|
register TEXTWIND *t; |
197 |
|
{ |
207 |
|
} |
208 |
|
|
209 |
|
|
210 |
+ |
void |
211 |
|
xt_clear(t) /* clear text window */ |
212 |
|
register TEXTWIND *t; |
213 |
|
{ |
221 |
|
} |
222 |
|
|
223 |
|
|
224 |
+ |
void |
225 |
|
xt_move(t, r, c) /* move to new position */ |
226 |
|
register TEXTWIND *t; |
227 |
|
int r, c; |
252 |
|
} |
253 |
|
|
254 |
|
|
255 |
+ |
void |
256 |
|
xt_close(t) /* close text window */ |
257 |
|
register TEXTWIND *t; |
258 |
|
{ |
263 |
|
XDestroyWindow(t->dpy, t->w); |
264 |
|
for (i = 0; i < t->nr; i++) |
265 |
|
free(t->lp[i]); |
266 |
< |
free((char *)t->lp); |
267 |
< |
free((char *)t); |
266 |
> |
free((void *)t->lp); |
267 |
> |
free((void *)t); |
268 |
|
} |
269 |
|
|
270 |
|
|
271 |
< |
static |
271 |
> |
static void |
272 |
|
togglecurs(t) |
273 |
|
register TEXTWIND *t; |
274 |
|
{ |