libgint.h - sam - An updated version of the sam text editor.
(HTM) git clone git://vernunftzentrum.de/sam.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
libgint.h (3070B)
---
1 /* Copyright (c) 1998 Lucent Technologies - All rights reserved. */
2 /* internal libg implementation file - include after libg */
3
4 /*
5 * include defs of standard library routines, if possible,
6 * and string routines
7 */
8 #ifdef _POSIX_SOURCE
9 #include <stdlib.h>
10 #include <string.h>
11 #endif /* _POSIX_SOURCE */
12
13 /*
14 * use defines to rename X11 types Cursor, Font, Event
15 */
16
17 #define Font xFont
18 #define Event xEvent
19
20 #if defined(v10) || defined(HPUX)
21 typedef char* caddr_t;
22 #endif
23
24 #include <X11/Xlib.h>
25 #include <X11/Xatom.h>
26 #include <X11/Xutil.h>
27 #include <X11/XKBlib.h>
28 #include <X11/Xft/Xft.h>
29
30 #undef Font
31 #undef Event
32
33 /* keyboard info */
34 extern XkbDescPtr xkb;
35
36 /* binding and chord management */
37 void freechords(void);
38 void freebindings(void);
39
40 /* Cursor initialization */
41 void initcursors(void);
42
43 /* Return a GCs for solid filling/strings/etc., segments/points, and tiling */
44 extern GC _getfillgc(Fcode, Bitmap*, uint64_t);
45 extern GC _getcopygc(Fcode, Bitmap*, Bitmap*, int*);
46 extern GC _getfillgc2(Fcode, Bitmap*, uint64_t, uint64_t, uint64_t);
47 extern GC _getcopygc2(Fcode, Bitmap*, Bitmap*, int*, uint64_t, uint64_t);
48 extern GC _getgc(Bitmap*, uint64_t, XGCValues *);
49
50 /* convert between different bitmap depths */
51 extern void _ldconvert(char *, int, char *, int, int, int);
52
53 /* balloc without zero init (which uses a gc!) */
54 extern Bitmap *_balloc(Rectangle, int);
55
56 /* X Display for this application's connection */
57 extern Display *_dpy;
58
59 /* screen depth foreground and background for this application */
60 extern uint64_t _fgpixel, _bgpixel;
61 extern XColor _fgcolor, _bgcolor;
62
63 /* indexed by log depth (0 <= ld <= 5), to give depth and planemask */
64 extern int _ld2d[];
65 extern uint64_t _ld2dmask[];
66
67 /* libg.h defines:
68 * extern Bitmap screen; -- Bitmap for application Window after xbinit()
69 * extern Font *font; -- Font for application default font after xbinit()
70 */
71
72 /*
73 * Conventions:
74 * The .id field of a Bitmap is an X Pixmap unless the Bitmap is screen,
75 * in which case it is a Window.
76 * The .id field of a Font is set to the X xFont.
77 *
78 * Coordinate conventions: libg bitmaps can have non (0,0) origins,
79 * but not X Pixmaps, so we have to subtract the min point of a Bitmap
80 * from coords in the Bitmap before using the point in the corresponding Pixmap.
81 * The screen Bitmap, however, contains the rectangle in X coords of the
82 * widget in which the application is started, relative to the window.
83 * The origin may or may not be (0,0), but in any case, coordinates should
84 * NOT be translated before using in X calls on the Window.
85 */
86
87 /* values for bitmap flag field (see _getcopygc if change first two vals) */
88 enum {
89 DP1= 0x1, /* depth == 1 (ldepth == 0) */
90 BL1= 0x2, /* black == 1 model */
91 SCR= 0x4, /* on screen */
92 ZORG= 0x8, /* r.min == Pt(0,0) */
93 SHIFT= 0x20, /* !SCR & !ZORG */
94 CLIP= 0x40 /* r != clipr */
95 };
96
97 /* values for return bltfunc arg of _getcopygc */
98 enum {
99 UseCopyArea,
100 UseCopyPlane,
101 UseFillRectangle
102 };