summaryrefslogtreecommitdiff
path: root/src/hints.h
blob: 9444ed475691975313e9cc17aab6c1e7705079e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
/*      $Id$

        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2, or (at your option)
        any later version.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

        oroborus - (c) 2001 Ken Lynch
        Metacity - (c) 2001 Havoc Pennington
        xfwm4    - (c) 2002-2006 Olivier Fourdan

 */

#ifndef INC_HINTS_H
#define INC_HINTS_H

#ifdef HAVE_CONFIG_H
#  include "config.h"
#endif

#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xmd.h>
#include <X11/Xatom.h>
#include <glib.h>
#include <gdk/gdk.h>

#include "display.h"

#define MWM_HINTS_ELEMENTS                      3L
#define MAX_STR_LENGTH                          255

#define MWM_HINTS_FUNCTIONS                     (1L << 0)
#define MWM_HINTS_DECORATIONS                   (1L << 1)
#define MWM_HINTS_INPUT_MODE                    (1L << 2)
#define MWM_HINTS_STATUS                        (1L << 3)

#define MWM_FUNC_ALL                            (1L << 0)
#define MWM_FUNC_RESIZE                         (1L << 1)
#define MWM_FUNC_MOVE                           (1L << 2)
#define MWM_FUNC_MINIMIZE                       (1L << 3)
#define MWM_FUNC_MAXIMIZE                       (1L << 4)
#define MWM_FUNC_CLOSE                          (1L << 5)

#define MWM_DECOR_ALL                           (1L << 0)
#define MWM_DECOR_BORDER                        (1L << 1)
#define MWM_DECOR_RESIZEH                       (1L << 2)
#define MWM_DECOR_TITLE                         (1L << 3)
#define MWM_DECOR_MENU                          (1L << 4)
#define MWM_DECOR_MINIMIZE                      (1L << 5)
#define MWM_DECOR_MAXIMIZE                      (1L << 6)

#define MWM_INPUT_MODELESS                      0
#define MWM_INPUT_PRIMARY_APPLICATION_MODAL     1
#define MWM_INPUT_SYSTEM_MODAL                  2
#define MWM_INPUT_FULL_APPLICATION_MODAL        3
#define MWM_INPUT_APPLICATION_MODAL             MWM_INPUT_PRIMARY_APPLICATION_MODAL

#define MWM_TEAROFF_WINDOW                      (1L<<0)

#define WIN_STATE_STICKY                        (1L<<0)
#define WIN_STATE_MAXIMIZED_VERT                (1L<<2)
#define WIN_STATE_MAXIMIZED_HORIZ               (1L<<3)
#define WIN_STATE_MAXIMIZED                     (WIN_STATE_MAXIMIZED_VERT | \
                                                 WIN_STATE_MAXIMIZED_HORIZ)
#define WIN_STATE_SHADED                        (1L<<5)

#define WIN_HINTS_SKIP_FOCUS                    (1L<<0)
#define WIN_HINTS_SKIP_TASKBAR                  (1L<<2)

#define WM_PROTOCOLS_TAKE_FOCUS                 (1L<<0)
#define WM_PROTOCOLS_DELETE_WINDOW              (1L<<1)
#define WM_PROTOCOLS_CONTEXT_HELP               (1L<<2)

#define WIN_LAYER_DESKTOP                       0
#define WIN_LAYER_BELOW                         2
#define WIN_LAYER_NORMAL                        4
#define WIN_LAYER_ONTOP                         6
#define WIN_LAYER_DOCK                          8
#define WIN_LAYER_ABOVE_DOCK                    10

#define NET_WM_MOVERESIZE_SIZE_TOPLEFT          0
#define NET_WM_MOVERESIZE_SIZE_TOP              1
#define NET_WM_MOVERESIZE_SIZE_TOPRIGHT         2
#define NET_WM_MOVERESIZE_SIZE_RIGHT            3
#define NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT      4
#define NET_WM_MOVERESIZE_SIZE_BOTTOM           5
#define NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT       6
#define NET_WM_MOVERESIZE_SIZE_LEFT             7
#define NET_WM_MOVERESIZE_MOVE                  8

#define NET_WM_STATE_REMOVE                     0
#define NET_WM_STATE_ADD                        1
#define NET_WM_STATE_TOGGLE                     2

#define NET_WM_ORIENTATION_HORZ                 0
#define NET_WM_ORIENTATION_VERT                 1

#define NET_WM_TOPLEFT                          0
#define NET_WM_TOPRIGHT                         1
#define NET_WM_BOTTOMRIGHT                      2
#define NET_WM_BOTTOMLEFT                       3

#define NET_WM_OPAQUE                           0xffffffff

#define STRUTS_LEFT                             0
#define STRUTS_RIGHT                            1
#define STRUTS_TOP                              2
#define STRUTS_BOTTOM                           3
#define STRUTS_LEFT_START_Y                     4
#define STRUTS_LEFT_END_Y                       5
#define STRUTS_RIGHT_START_Y                    6
#define STRUTS_RIGHT_END_Y                      7
#define STRUTS_TOP_START_X                      8
#define STRUTS_TOP_END_X                        9
#define STRUTS_BOTTOM_START_X                   10
#define STRUTS_BOTTOM_END_X                     11

/* Convenient macro */
#define HINTS_ACCEPT_INPUT(wmhints)     (!(wmhints) ||                                                              \
                                         ((wmhints) && !(wmhints->flags & InputHint)) ||                            \
                                         ((wmhints) && (wmhints->flags & InputHint) && (wmhints->input)))

typedef struct
{
    unsigned long orientation;
    unsigned long start;
    unsigned long rows;
    unsigned long cols;
}
NetWmDesktopLayout;


typedef struct
{
    unsigned long flags;
    unsigned long functions;
    unsigned long decorations;
}
PropMwmHints;

unsigned long            getWMState                             (DisplayInfo *, 
                                                                 Window);
void                     setWMState                             (DisplayInfo *, 
                                                                 Window, 
                                                                 unsigned long);
PropMwmHints            *getMotifHints                          (DisplayInfo *, 
                                                                 Window);
unsigned int             getWMProtocols                         (DisplayInfo *, 
                                                                 Window);
gboolean                 getHint                                (DisplayInfo *, 
                                                                 Window, 
                                                                 int, 
                                                                 long *);
void                     setHint                                (DisplayInfo *, 
                                                                 Window, 
                                                                 int, 
                                                                 long);
void                     getDesktopLayout                       (DisplayInfo *, 
                                                                 Window, 
                                                                 int, 
                                                                 NetWmDesktopLayout *);
void                     getGnomeDesktopMargins                 (DisplayInfo *, 
                                                                 Window, 
                                                                 int *);
void                     setGnomeProtocols                      (DisplayInfo *, 
                                                                 Window, 
                                                                 Window);
void                     setNetSupportedHint                    (DisplayInfo *, 
                                                                 Window, 
                                                                 Window);
gboolean                 getAtomList                            (DisplayInfo *, 
                                                                 Window, 
                                                                 int, 
                                                                 Atom **, 
                                                                 int *);
gboolean                 getCardinalList                        (DisplayInfo *, 
                                                                 Window, 
                                                                 int, 
                                                                 unsigned long **, 
                                                                 int *);
void                     setNetWorkarea                         (DisplayInfo *, 
                                                                 Window, 
                                                                 int, 
                                                                 int, 
                                                                 int, 
                                                                 int *);
void                     setNetFrameExtents                     (DisplayInfo *, 
                                                                 Window, 
                                                                 int, 
                                                                 int, 
                                                                 int, 
                                                                 int);
void                     initNetDesktopInfo                     (DisplayInfo *, 
                                                                 Window, 
                                                                 int, 
                                                                 int, 
                                                                 int);
void                     setUTF8StringHint                      (DisplayInfo *, 
                                                                 Window, 
                                                                 int, 
                                                                 const gchar *);
void                     getTransientFor                        (DisplayInfo *, 
                                                                 Window, 
                                                                 Window, 
                                                                 Window *);
gboolean                 getWindowName                          (DisplayInfo *, 
                                                                 Window, 
                                                                 gchar **);
gboolean                 getUTF8String                          (DisplayInfo *, 
                                                                 Window, 
                                                                 int, 
                                                                 gchar **, 
                                                                 int *);
gboolean                 getUTF8StringList                      (DisplayInfo *, 
                                                                 Window, 
                                                                 int, 
                                                                 gchar ***, 
                                                                 int *);
gboolean                 getClientMachine                       (DisplayInfo *, 
                                                                 Window, 
                                                                 gchar **);
gboolean                 getClientMachine                       (DisplayInfo *, 
                                                                 Window, 
                                                                 gchar **);
gboolean                 getWindowRole                          (DisplayInfo *, 
                                                                 Window, 
                                                                 gchar **);
Window                   getClientLeader                        (DisplayInfo *, 
                                                                 Window);
gboolean                 getNetWMUserTime                       (DisplayInfo *, 
                                                                 Window, 
                                                                 Time *);
gboolean                 getClientID                            (DisplayInfo *, 
                                                                 Window, 
                                                                 gchar **);
gboolean                 getWindowCommand                       (DisplayInfo *, 
                                                                 Window, 
                                                                 char ***, 
                                                                 int *);
gboolean                 getKDEIcon                             (DisplayInfo *, 
                                                                 Window, 
                                                                 Pixmap *, 
                                                                 Pixmap *);
gboolean                 getRGBIconData                         (DisplayInfo *, 
                                                                 Window, 
                                                                 unsigned long **, 
                                                                 unsigned long *);
gboolean                 getOpacity                             (DisplayInfo *, 
                                                                 Window, 
                                                                 guint *);
gboolean                 getOpacityLock                         (DisplayInfo *, 
                                                                 Window);
gboolean                 setXAtomManagerOwner                   (DisplayInfo *, 
                                                                 Atom, 
                                                                 Window, 
                                                                 Window);
gboolean                 setAtomIdManagerOwner                  (DisplayInfo *, 
                                                                 int, 
                                                                 Window , 
                                                                 Window);
Time                     getXServerTime                         (DisplayInfo *);

#ifdef ENABLE_KDE_SYSTRAY_PROXY
gboolean                 checkKdeSystrayWindow                  (DisplayInfo *, 
                                                                 Window);
void                     sendSystrayReqDock                     (DisplayInfo *, 
                                                                 Window, 
                                                                 Window);
Window                   getSystrayWindow                       (DisplayInfo *, 
                                                                 Atom);
#endif

#ifdef HAVE_LIBSTARTUP_NOTIFICATION
gboolean                 getWindowStartupId                     (DisplayInfo *, 
                                                                 Window, 
                                                                 char **);
#endif

#ifdef HAVE_XSYNC
gboolean                 getXSyncCounter                        (DisplayInfo *, 
                                                                 Window, 
                                                                 XSyncCounter *);
void                     sendXSyncRequest                       (DisplayInfo *, 
                                                                 Window, 
                                                                 XSyncValue);
#endif /* HAVE_XSYNC */

#endif /* INC_HINTS_H */