1 /* Definitions and headers for communication on the pure Gtk+3.
2 Copyright (C) 1995, 2005, 2008-2023 Free Software Foundation, Inc.
3
4 This file is part of GNU Emacs.
5
6 GNU Emacs is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or (at
9 your option) any later version.
10
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
18
19 #ifndef __PGTKGUI_H__
20 #define __PGTKGUI_H__
21
22 /* Emulate XCharStruct. */
23 typedef struct _XCharStruct
24 {
25 int rbearing;
26 int lbearing;
27 int width;
28 int ascent;
29 int descent;
30 } XCharStruct;
31
32 /* Fake structure from Xlib.h to represent two-byte characters. */
33 typedef unsigned short unichar;
34 typedef unichar XChar2b;
35
36 #define STORE_XCHAR2B(chp, b1, b2) \
37 (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff))))
38
39 #define XCHAR2B_BYTE1(chp) \
40 ((*(chp) & 0xff00) >> 8)
41
42 #define XCHAR2B_BYTE2(chp) \
43 (*(chp) & 0x00ff)
44
45
46 typedef struct _GdkCursor *Emacs_Cursor;
47
48 typedef void *Color;
49 typedef int Window;
50 typedef struct _GdkDisplay Display;
51
52 /* Xism */
53 typedef void *XrmDatabase;
54
55
56 /* Some sort of attempt to normalize rectangle handling.. seems a bit much
57 for what is accomplished. */
58 typedef struct
59 {
60 int x, y;
61 unsigned width, height;
62 } XRectangle;
63
64 /* This stuff is needed by frame.c. */
65 #define ForgetGravity 0
66 #define NorthWestGravity 1
67 #define NorthGravity 2
68 #define NorthEastGravity 3
69 #define WestGravity 4
70 #define CenterGravity 5
71 #define EastGravity 6
72 #define SouthWestGravity 7
73 #define SouthGravity 8
74 #define SouthEastGravity 9
75 #define StaticGravity 10
76
77 #define NoValue 0x0000
78 #define XValue 0x0001
79 #define YValue 0x0002
80 #define WidthValue 0x0004
81 #define HeightValue 0x0008
82 #define AllValues 0x000F
83 #define XNegative 0x0010
84 #define YNegative 0x0020
85
86 #define USPosition (1L << 0) /* user specified x, y */
87 #define USSize (1L << 1) /* user specified width, height */
88
89 #define PPosition (1L << 2) /* program specified position */
90 #define PSize (1L << 3) /* program specified size */
91 #define PMinSize (1L << 4) /* program specified minimum size */
92 #define PMaxSize (1L << 5) /* program specified maximum size */
93 #define PResizeInc (1L << 6) /* program specified resize increments */
94 #define PAspect (1L << 7) /* program specified min, max aspect ratios */
95 #define PBaseSize (1L << 8) /* program specified base for incrementing */
96 #define PWinGravity (1L << 9) /* program specified window gravity */
97
98
99 #define NativeRectangle XRectangle
100
101 #define CONVERT_TO_EMACS_RECT(xr, nr) \
102 ((xr).x = (nr).x, \
103 (xr).y = (nr).y, \
104 (xr).width = (nr).width, \
105 (xr).height = (nr).height)
106
107 #define CONVERT_FROM_EMACS_RECT(xr, nr) \
108 ((nr).x = (xr).x, \
109 (nr).y = (xr).y, \
110 (nr).width = (xr).width, \
111 (nr).height = (xr).height)
112
113 #define STORE_NATIVE_RECT(nr, px, py, pwidth, pheight) \
114 ((nr).x = (px), \
115 (nr).y = (py), \
116 (nr).width = (pwidth), \
117 (nr).height = (pheight))
118
119 #endif /* __PGTKGUI_H__ */