~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/lib/Xaw/TextSinkP.h

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* $Xorg: TextSinkP.h,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $
 
3
*/
 
4
 
 
5
 
 
6
/***********************************************************
 
7
 
 
8
Copyright 1987, 1988, 1994, 1998  The Open Group
 
9
 
 
10
Permission to use, copy, modify, distribute, and sell this software and its
 
11
documentation for any purpose is hereby granted without fee, provided that
 
12
the above copyright notice appear in all copies and that both that
 
13
copyright notice and this permission notice appear in supporting
 
14
documentation.
 
15
 
 
16
The above copyright notice and this permission notice shall be included in
 
17
all copies or substantial portions of the Software.
 
18
 
 
19
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
20
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
21
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
22
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 
23
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
24
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
25
 
 
26
Except as contained in this notice, the name of The Open Group shall not be
 
27
used in advertising or otherwise to promote the sale, use or other dealings
 
28
in this Software without prior written authorization from The Open Group.
 
29
 
 
30
 
 
31
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
 
32
 
 
33
                        All Rights Reserved
 
34
 
 
35
Permission to use, copy, modify, and distribute this software and its 
 
36
documentation for any purpose and without fee is hereby granted, 
 
37
provided that the above copyright notice appear in all copies and that
 
38
both that copyright notice and this permission notice appear in 
 
39
supporting documentation, and that the name of Digital not be
 
40
used in advertising or publicity pertaining to distribution of the
 
41
software without specific, written prior permission.  
 
42
 
 
43
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 
44
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
 
45
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
 
46
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 
47
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 
48
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 
49
SOFTWARE.
 
50
 
 
51
******************************************************************/
 
52
/* $XFree86: xc/lib/Xaw/TextSinkP.h,v 1.12 2001/12/14 19:54:45 dawes Exp $ */
 
53
 
 
54
#ifndef _XawTextSinkP_h
 
55
#define _XawTextSinkP_h
 
56
 
 
57
/*
 
58
 * TextSink Object Private Data
 
59
 */
 
60
#include <X11/Xaw/TextSink.h>
 
61
#include <X11/Xaw/TextP.h>      /* This sink works with the Text widget */
 
62
#include <X11/Xaw/TextSrcP.h>   /* This sink works with the Text Source */
 
63
#include <X11/Xmu/Xmu.h>
 
64
 
 
65
#ifndef OLDXAW
 
66
/* font/fontset defined? */
 
67
#define XAW_TPROP_FONT          (1<<0)
 
68
#define XAW_TPROP_FONTSET       (1<<1)
 
69
 
 
70
/* extra attributes */
 
71
#define XAW_TPROP_FOREGROUND    (1<<2)
 
72
#define XAW_TPROP_BACKGROUND    (1<<3)
 
73
#define XAW_TPROP_FPIXMAP       (1<<4)
 
74
#define XAW_TPROP_BPIXMAP       (1<<5)
 
75
#define XAW_TPROP_UNDERLINE     (1<<6)
 
76
#define XAW_TPROP_OVERSTRIKE    (1<<7)
 
77
#define XAW_TPROP_SUBSCRIPT     (1<<8)
 
78
#define XAW_TPROP_SUPERSCRIPT   (1<<9)
 
79
 
 
80
/* xlfd attributes */
 
81
#define XAW_TPROP_FOUNDRY       (1<<0)
 
82
#define XAW_TPROP_FAMILY        (1<<1)
 
83
#define XAW_TPROP_WEIGHT        (1<<2)
 
84
#define XAW_TPROP_SLANT         (1<<3)
 
85
#define XAW_TPROP_SETWIDTH      (1<<4)
 
86
#define XAW_TPROP_ADDSTYLE      (1<<5)
 
87
#define XAW_TPROP_PIXELSIZE     (1<<6)
 
88
#define XAW_TPROP_POINTSIZE     (1<<7)
 
89
#define XAW_TPROP_RESX          (1<<8)
 
90
#define XAW_TPROP_RESY          (1<<9)
 
91
#define XAW_TPROP_SPACING       (1<<10)
 
92
#define XAW_TPROP_AVGWIDTH      (1<<11)
 
93
#define XAW_TPROP_REGISTRY      (1<<12)
 
94
#define XAW_TPROP_ENCODING      (1<<13)
 
95
struct _XawTextProperty {       /* to be extended/modified */
 
96
    XrmQuark identifier, code;
 
97
    unsigned long mask;
 
98
    XFontStruct *font;
 
99
    XFontSet fontset;
 
100
    Pixel foreground, background;
 
101
    Pixmap foreground_pixmap, background_pixmap;
 
102
    XrmQuark xlfd;
 
103
 
 
104
    unsigned long xlfd_mask;
 
105
    XrmQuark foundry, family, weight, slant, setwidth, addstyle, pixel_size,
 
106
             point_size, res_x, res_y, spacing, avgwidth, registry, encoding;
 
107
 
 
108
    short underline_position, underline_thickness;
 
109
};
 
110
 
 
111
struct _XawTextPropertyList {
 
112
    XrmQuark identifier;
 
113
    Screen *screen;
 
114
    Colormap colormap;
 
115
    int depth;
 
116
    XawTextProperty **properties;
 
117
    Cardinal num_properties;
 
118
    XawTextPropertyList *next;
 
119
};
 
120
 
 
121
typedef struct _XawTextPaintStruct XawTextPaintStruct;
 
122
struct _XawTextPaintStruct {
 
123
    XawTextPaintStruct *next;
 
124
    int x, y, width;
 
125
    char *text;                 /* formatted text */
 
126
    Cardinal length;            /* length of text */
 
127
    XawTextProperty *property;
 
128
    int max_ascent, max_descent;
 
129
    XmuArea *backtabs;
 
130
    Boolean highlight;
 
131
};
 
132
 
 
133
typedef struct {
 
134
    XmuArea *clip, *hightabs;                   /* clip list */
 
135
    XawTextPaintStruct *paint, *bearings;       /* drawing information */
 
136
} XawTextPaintList;
 
137
 
 
138
typedef struct {
 
139
    XtPointer next_extension;
 
140
    XrmQuark record_type;
 
141
    long version;
 
142
    Cardinal record_size;
 
143
    Bool (*BeginPaint)(Widget);
 
144
    void (*PreparePaint)(Widget, int, int,
 
145
                         XawTextPosition, XawTextPosition, Bool);
 
146
    void (*DoPaint)(Widget);
 
147
    Bool (*EndPaint)(Widget);
 
148
} TextSinkExtRec, *TextSinkExt;
 
149
#endif
 
150
 
 
151
typedef void (*_XawSinkDisplayTextProc)
 
152
     (Widget, int, int, XawTextPosition, XawTextPosition, Bool);
 
153
 
 
154
typedef void (*_XawSinkInsertCursorProc)
 
155
     (Widget, int, int, XawTextInsertState);
 
156
 
 
157
typedef void (*_XawSinkClearToBackgroundProc)
 
158
     (Widget, int, int, unsigned int, unsigned int);
 
159
 
 
160
typedef void (*_XawSinkFindPositionProc)
 
161
     (Widget, XawTextPosition, int, int, Bool, XawTextPosition*, int*, int*);
 
162
 
 
163
typedef void (*_XawSinkFindDistanceProc)
 
164
     (Widget, XawTextPosition, int, XawTextPosition, int*,
 
165
      XawTextPosition*, int*);
 
166
 
 
167
typedef void (*_XawSinkResolveProc)
 
168
     (Widget, XawTextPosition, int, int, XawTextPosition*);
 
169
 
 
170
typedef int  (*_XawSinkMaxLinesProc)
 
171
     (Widget, unsigned int);
 
172
 
 
173
typedef int  (*_XawSinkMaxHeightProc)
 
174
     (Widget, int);
 
175
 
 
176
typedef void (*_XawSinkSetTabsProc)
 
177
     (Widget, int, short*);
 
178
 
 
179
typedef void (*_XawSinkGetCursorBoundsProc)
 
180
     (Widget, XRectangle*);
 
181
 
 
182
typedef struct _TextSinkClassPart {
 
183
    _XawSinkDisplayTextProc DisplayText;
 
184
    _XawSinkInsertCursorProc InsertCursor;
 
185
    _XawSinkClearToBackgroundProc ClearToBackground;
 
186
    _XawSinkFindPositionProc FindPosition;
 
187
    _XawSinkFindDistanceProc FindDistance;
 
188
    _XawSinkResolveProc Resolve;
 
189
    _XawSinkMaxLinesProc MaxLines;
 
190
    _XawSinkMaxHeightProc MaxHeight;
 
191
    _XawSinkSetTabsProc SetTabs;
 
192
    _XawSinkGetCursorBoundsProc GetCursorBounds;
 
193
#ifndef OLDXAW
 
194
    TextSinkExt extension;
 
195
#endif
 
196
} TextSinkClassPart;
 
197
 
 
198
/* Full class record */
 
199
typedef struct _TextSinkClassRec {
 
200
    ObjectClassPart     object_class;
 
201
    TextSinkClassPart   text_sink_class;
 
202
} TextSinkClassRec;
 
203
 
 
204
extern TextSinkClassRec textSinkClassRec;
 
205
 
 
206
/* New fields for the TextSink object */
 
207
typedef struct {
 
208
    /* resources */
 
209
    Pixel foreground;           /* Foreground color */
 
210
    Pixel background;           /* Background color */
 
211
 
 
212
    /* private */
 
213
    Position *tabs;             /* The tab stops as pixel values */
 
214
    short *char_tabs;           /* The tabs stops as character values */
 
215
    int tab_count;              /* number of items in tabs */
 
216
 
 
217
#ifndef OLDXAW
 
218
    /* more resources */
 
219
    Pixel cursor_color;
 
220
    XawTextPropertyList *properties;
 
221
    XawTextPaintList *paint;
 
222
    XtPointer pad[2];   /* for future use and keep binary compatability */
 
223
#endif
 
224
} TextSinkPart;
 
225
 
 
226
/* Full instance record */
 
227
typedef struct _TextSinkRec {
 
228
    ObjectPart   object;
 
229
    TextSinkPart text_sink;
 
230
} TextSinkRec;
 
231
 
 
232
/* Semi private routines */
 
233
#ifndef OLDXAW
 
234
XawTextPropertyList *XawTextSinkConvertPropertyList
 
235
(
 
236
 String                  name,
 
237
 String                  spec,
 
238
 Screen                 *screen,
 
239
 Colormap                Colormap,
 
240
 int                     depth
 
241
 );
 
242
 
 
243
XawTextProperty *XawTextSinkGetProperty
 
244
(
 
245
 Widget                  w,
 
246
 XrmQuark                property
 
247
 );
 
248
 
 
249
XawTextProperty *XawTextSinkCopyProperty
 
250
(
 
251
 Widget                 w,
 
252
 XrmQuark               property
 
253
 );
 
254
 
 
255
XawTextProperty *XawTextSinkAddProperty
 
256
(
 
257
 Widget                  w,
 
258
 XawTextProperty        *property
 
259
 );
 
260
 
 
261
XawTextProperty *XawTextSinkCombineProperty
 
262
(
 
263
 Widget                  w,
 
264
 XawTextProperty        *result_in_out,
 
265
 XawTextProperty        *property,
 
266
 Bool                    override
 
267
 );
 
268
 
 
269
Bool XawTextSinkBeginPaint
 
270
(
 
271
 Widget                 w
 
272
 );
 
273
 
 
274
void XawTextSinkPreparePaint
 
275
(
 
276
 Widget                 w,
 
277
 int                    y,
 
278
 int                    line,
 
279
 XawTextPosition        from,
 
280
 XawTextPosition        to,
 
281
 Bool                   highlight
 
282
);
 
283
 
 
284
void XawTextSinkDoPaint
 
285
(
 
286
 Widget                 w
 
287
 );
 
288
 
 
289
Bool XawTextSinkEndPaint
 
290
(
 
291
 Widget                 w
 
292
 );
 
293
#endif
 
294
 
 
295
#define XtInheritDisplayText       ((_XawSinkDisplayTextProc)_XtInherit)
 
296
#define XtInheritInsertCursor      ((_XawSinkInsertCursorProc)_XtInherit)
 
297
#define XtInheritClearToBackground ((_XawSinkClearToBackgroundProc)_XtInherit)
 
298
#define XtInheritFindPosition      ((_XawSinkFindPositionProc)_XtInherit)
 
299
#define XtInheritFindDistance      ((_XawSinkFindDistanceProc)_XtInherit)
 
300
#define XtInheritResolve           ((_XawSinkResolveProc)_XtInherit)
 
301
#define XtInheritMaxLines          ((_XawSinkMaxLinesProc)_XtInherit)
 
302
#define XtInheritMaxHeight         ((_XawSinkMaxHeightProc)_XtInherit)
 
303
#define XtInheritSetTabs           ((_XawSinkSetTabsProc)_XtInherit)
 
304
#define XtInheritGetCursorBounds   ((_XawSinkGetCursorBoundsProc)_XtInherit)
 
305
 
 
306
#endif /* _XawTextSinkP_h */