CTWM
Loading...
Searching...
No Matches
/usr/src/RPM/BUILD/ctwm-4.1.0/ctwm.h
Go to the documentation of this file.
1/*
2 * Copyright 1988 by Evans & Sutherland Computer Corporation,
3 * Salt Lake City, Utah
4 * Portions Copyright 1989 by the Massachusetts Institute of Technology
5 * Cambridge, Massachusetts
6 *
7 * $XConsortium: twm.h,v 1.74 91/05/31 17:38:30 dave Exp $
8 *
9 * twm include file
10 *
11 * 28-Oct-87 Thomas E. LaStrange File created
12 * 10-Oct-90 David M. Sternlicht Storeing saved colors on root
13 *
14 * Copyright 1992 Claude Lecommandeur.
15 */
16#ifndef _CTWM_CTWM_H
17#define _CTWM_CTWM_H
18
19/*
20 * Include config first, before anything else. Including ctwm.h should
21 * be the first action of any of our files, so this happens before
22 * ANYthing else, anywhere.
23 */
24#include "ctwm_config.h"
25
26#ifdef DMALLOC
27#include <dmalloc.h>
28#endif
29
30#include <stdbool.h>
31
32/*
33 * Intrinsic.h is needed for at least the Pixel type, which we use in
34 * this file. And Intrinsic.h (always?) implicitly brings in Xlib.h
35 * anyway.
36 */
37//#include <X11/Xlib.h>
38#include <X11/Intrinsic.h>
39
40#include "types.h"
41#ifdef EWMH
42#include "ewmh.h"
43#endif
44
45/*
46 * This appears to be the standard way of testing this for portability,
47 * though calling it GNUC is sorta non-portable portability :)
48 */
49#ifndef __GNUC__
50#define __attribute__(x) /*NOTHING*/
51#endif
52
53#define BW 2 /* border width */
54#define BW2 4 /* border width * 2 */
55
56#define MAX_BUTTONS 24
57
58
59/*
60 * Contexts for button presses.
61 * n.b.: These go alongside the ModXMask X11 defs, so better stay above
62 * them!
63 */
64#define Alt1Mask (1<<8)
65#define Alt2Mask (1<<9)
66#define Alt3Mask (1<<10)
67#define Alt4Mask (1<<11)
68#define Alt5Mask (1<<12)
69
70// X-ref the Over_Mask's used for testing in mk_twmkeys_entry() if we
71// grow more here, to avoid collision.
72
73
74#define C_NO_CONTEXT -1
75#define C_WINDOW 0
76#define C_TITLE 1
77#define C_ICON 2
78#define C_ROOT 3
79#define C_FRAME 4
80#define C_ICONMGR 5
81#define C_NAME 6
82#define C_IDENTIFY 7
83#define C_ALTERNATE 8
84#define C_WORKSPACE 9
85#define NUM_CONTEXTS 10
86
87#define C_WINDOW_BIT (1 << C_WINDOW)
88#define C_TITLE_BIT (1 << C_TITLE)
89#define C_ICON_BIT (1 << C_ICON)
90#define C_ROOT_BIT (1 << C_ROOT)
91#define C_FRAME_BIT (1 << C_FRAME)
92#define C_ICONMGR_BIT (1 << C_ICONMGR)
93#define C_NAME_BIT (1 << C_NAME)
94#define C_ALTER_BIT (1 << C_ALTERNATE)
95#define C_WORKSPACE_BIT (1 << C_WORKSPACE)
96
97#define C_ALL_BITS (C_WINDOW_BIT | C_TITLE_BIT | C_ICON_BIT |\
98 C_ROOT_BIT | C_FRAME_BIT | C_ICONMGR_BIT |\
99 C_WORKSPACE_BIT)
100
101/* modifiers for button presses */
102#define MOD_SIZE ((ShiftMask | ControlMask | Mod1Mask \
103 | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask) + 1)
104
105/*
106 * Used for TwmWindow.zoomed. Var holds the number of the function that
107 * caused zooming, if one has, else ZOOM_NONE. This mirror F_NOP
108 * currently, but that's OK, because f.nop doesn't do anything, so it
109 * can't be a real cause of zooming.
110 */
111#define ZOOM_NONE 0
112
113#define FBF(fix_fore, fix_back, fix_font)\
114 Gcv.foreground = fix_fore;\
115 Gcv.background = fix_back;\
116 Gcv.font = fix_font;\
117 XChangeGC(dpy, Scr->NormalGC, GCFont|GCForeground|GCBackground,&Gcv)
118
119#define FB(fix_fore, fix_back)\
120 Gcv.foreground = fix_fore;\
121 Gcv.background = fix_back;\
122 XChangeGC(dpy, Scr->NormalGC, GCForeground|GCBackground,&Gcv)
123
124#define MaxSize(a, b) (((a) < (b)) ? (b) : (a))
125#define MinSize(a, b) (((a) > (b)) ? (b) : (a))
126
127struct MyFont {
128 char *basename; /* name of the font */
132 int height; /* height of the font */
133 int y; /* Y coordinate to draw characters */
134 /* Average height, maintained using the extra two auxiliary fields. */
135 unsigned int avg_height;
137 unsigned int avg_count;
138};
139
143
145 struct TitleButtonFunc *next; /* next in the list of function buttons */
146 int num; /* button number */
147 int mods; /* modifiers */
148 int func; /* function to execute */
149 char *action; /* optional action arg */
150 struct MenuRoot *menuroot; /* menu to pop on F_MENU */
151};
152
154 struct TitleButton *next; /* next link in chain */
155 char *name; /* bitmap name in case of deferal */
156 Image *image; /* image to display in button */
157 int srcx, srcy; /* from where to start copying */
158 unsigned int width, height; /* size of pixmap */
159 int dstx, dsty; /* to where to start copying */
160 bool rightside; /* t: on right, f: on left */
161 TitleButtonFunc *funs; /* funcs assoc'd to each button */
162};
163
164struct TBWindow {
165 Window window; /* which window in this frame */
166 Image *image; /* image to display in button */
167 TitleButton *info; /* description of this window */
168};
169
170
176
179 int num; /* signed pixel count or numerator */
180 int denom; /* 0 for pix count or denominator */
181};
182
183
184/*
185 * Type for IconRegion alignment and config entries relating
186 *
187 * Misspeelt for hysterical raisins
188 */
196
197/*
198 * Justification for title stuff. Window titles (TitleJustification),
199 * icon titles (IconJustification). _Not_ the same as for
200 * IconRegionJustification.
201 */
208
209/*
210 * And IconRegion Justification's.
211 */
219
220
221/*
222 * Gravity used by IconRegion and WindowRegion. Strictly, there should
223 * probably be separate vertical/horizontal types, but it'll take some
224 * nontrivial code reshuffling to make that possible because of how the
225 * values are used in the split* functions.
226 */
233
234
235/* RandomPlacement bits */
241
242/* UsePPosition */
243typedef enum {
247 /*
248 * may eventually want an option for having the PPosition be the
249 * initial location for the drag lines.
250 */
251} UsePPoss;
252
253
254/* Colormap window entry for each window in WM_COLORMAP_WINDOWS
255 * ICCCM property.
256 */
258 Colormap c; /* Colormap id */
259 int state; /* install(ability) state */
260 unsigned long install_req; /* request number which installed it */
261 Window w; /* window causing load of color table */
263};
264
265/* TwmColormap.state bit definitions */
266#define CM_INSTALLABLE 1
267#define CM_INSTALLED 2
268#define CM_INSTALL 4
269
270
272 Window w; /* Window id */
273 TwmColormap *colormap; /* Colormap for this window */
274 int visibility; /* Visibility of this window */
276};
277
278struct Colormaps {
279 ColormapWindow **cwins; /* current list of colormap windows */
280 int number_cwins; /* number of elements in current list */
281 char *scoreboard; /* conflicts between installable colortables */
282};
283
284#define ColormapsScoreboardLength(cm) ((cm)->number_cwins * \
285 ((cm)->number_cwins - 1) / 2)
286
294
297 int x, y, w, h;
299 bool used;
300};
301
302#ifdef WINBOX
303struct WindowBox {
304 struct WindowBox *next;
305 char *name;
306 char *geometry;
308 Window window;
309 struct TwmWindow *twmwin;
310};
311#endif
312
313
314/*
315 * Pull in struct TwmWindow. Moved to a separate file to ease scanning
316 * through both it and the other stuff in here.
317 */
318#include "twm_window_struct.h"
319
320
321/* Flags for TwmWindow.protocols */
322#define DoesWmTakeFocus (1L << 0)
323#define DoesWmSaveYourself (1L << 1)
324#define DoesWmDeleteWindow (1L << 2)
325
326
327extern char *ProgramName;
328extern size_t ProgramNameLen;
329extern Display *dpy;
331extern Window ResizeWindow; /* the window we are resizing */
332extern bool HasShape; /* this server supports Shape extension */
334
335extern int PreviousScreen;
336
338extern Cursor RightButt;
339extern Cursor MiddleButt;
340extern Cursor LeftButt;
341
342extern XClassHint NoClass;
343
344extern XContext TwmContext;
345extern XContext MenuContext;
348
349extern char *Home;
350extern int HomeLen;
351
352extern bool HandlingEvents;
355
356/* Junk vars; see comment in ctwm.c about usage */
358extern int JunkX, JunkY;
360
361extern XGCValues Gcv;
362extern int Argc;
363extern char **Argv;
364
365extern bool RestartPreviousState;
366
367extern bool SignalFlag; ///< Some signal flag has been set
368
369#define OCCUPY(w, b) ((b == NULL) ? 1 : (w->occupation & (1 << b->number)))
370
371
372/*
373 * Dev utils
374 */
375// Quiet static analyzer warnings
376#if defined(__clang_analyzer__)
377#define ALLOW_DEAD_STORE(x) (void)(x)
378#else
379#define ALLOW_DEAD_STORE(x) (void)0
380#endif
381
382
383/*
384 * Command-line arg handling bits
385 */
386typedef struct _ctwm_cl_args {
387 bool MultiScreen; // ! --single, grab multiple screens
388 bool Monochrome; // --mono, force monochrome
389 bool cfgchk; // --cfgchk, check config and exit
390 char *InitFile; // --file, config filename
391 char *display_name; // --display, X server display
392
393 bool PrintErrorMessages; // --verbose, show more debug output
394 bool ShowWelcomeWindow; // ! --nowelcome, show splash screen
395
396#ifdef CAPTIVE
397 bool is_captive; // --window (flag), running captive
398 Window capwin; // --window (arg), existing window to capture
399 char *captivename; // --name, captive name
400#endif
401
402#ifdef USEM4
403 bool KeepTmpFile; // --keep-defs, keep generated m4 defs
404 char *keepM4_filename; // --keep, keep m4 post-processed output
405 bool GoThroughM4; // ! --nom4, do m4 processing
406#endif
407
408#ifdef EWMH
409 bool ewmh_replace; // --replace, replacing running WM
410#endif
411
412 char *client_id; // --clientId, session client id
413 char *restore_filename; // --restore, session filename
415extern ctwm_cl_args CLarg;
416
417
418#endif /* _CTWM_CTWM_H */
static int PlaceX
Definition add_window.c:82
bool RestartPreviousState
Definition ctwm_main.c:151
int PreviousScreen
Definition ctwm_main.c:94
XClassHint NoClass
Definition ctwm_main.c:124
XContext MenuContext
Definition ctwm_main.c:120
int JunkY
Definition ctwm.h:358
SIJust
Definition ctwm.h:171
@ SIJ_CENTER
Definition ctwm.h:173
@ SIJ_LEFT
Definition ctwm.h:172
@ SIJ_RIGHT
Definition ctwm.h:174
char * ProgramName
Definition ctwm_main.c:146
Cursor LeftButt
Definition ctwm_main.c:117
int Argc
Definition ctwm_main.c:148
Cursor RightCursor
Definition ctwm.h:354
TitleJust
Definition ctwm.h:202
@ TJ_CENTER
Definition ctwm.h:205
@ TJ_RIGHT
Definition ctwm.h:206
@ TJ_UNDEF
Definition ctwm.h:203
@ TJ_LEFT
Definition ctwm.h:204
bool HandlingEvents
Definition ctwm_main.c:131
IRJust
Definition ctwm.h:212
@ IRJ_RIGHT
Definition ctwm.h:216
@ IRJ_UNDEF
Definition ctwm.h:213
@ IRJ_LEFT
Definition ctwm.h:214
@ IRJ_CENTER
Definition ctwm.h:215
@ IRJ_BORDER
Definition ctwm.h:217
int ShapeErrorBase
Definition ctwm.h:333
char * Home
Definition ctwm_main.c:128
unsigned int JunkBW
Definition ctwm.h:359
int ShapeEventBase
Definition ctwm_main.c:91
ctwm_cl_args CLarg
Definition clargs.c:27
UsePPoss
Definition ctwm.h:243
@ PPOS_OFF
Definition ctwm.h:244
@ PPOS_NON_ZERO
Definition ctwm.h:246
@ PPOS_ON
Definition ctwm.h:245
unsigned int JunkWidth
Definition ctwm_main.c:144
Window JunkRoot
Definition ctwm_main.c:142
XContext ScreenContext
Definition ctwm_main.c:121
XGCValues Gcv
Definition ctwm_main.c:126
RandPlac
Definition ctwm.h:236
@ RP_UNMAPPED
Definition ctwm.h:239
@ RP_OFF
Definition ctwm.h:237
@ RP_ALL
Definition ctwm.h:238
struct _ctwm_cl_args ctwm_cl_args
int JunkX
Definition ctwm_main.c:143
Cursor UpperLeftCursor
Definition ctwm_main.c:105
Cursor BottomCursor
Definition ctwm.h:354
Display * dpy
Definition ctwm_main.c:84
XtAppContext appContext
Definition ctwm_main.c:83
Cursor LeftCursor
Definition ctwm.h:353
XContext TwmContext
Definition ctwm_main.c:119
unsigned int JunkMask
Definition ctwm.h:359
RegGravity
Definition ctwm.h:227
@ GRAV_WEST
Definition ctwm.h:231
@ GRAV_SOUTH
Definition ctwm.h:230
@ GRAV_EAST
Definition ctwm.h:229
@ GRAV_NORTH
Definition ctwm.h:228
Cursor BottomRightCursor
Definition ctwm.h:354
char ** Argv
Definition ctwm_main.c:149
bool SignalFlag
Some signal flag has been set.
Definition signals.c:27
XContext ColormapContext
Definition ctwm_main.c:122
Cursor MiddleButt
Definition ctwm_main.c:116
Cursor TopRightCursor
Definition ctwm.h:354
Cursor TopCursor
Definition ctwm_main.c:112
Cursor BottomLeftCursor
Definition ctwm.h:353
Window JunkChild
Definition ctwm.h:357
size_t ProgramNameLen
Definition ctwm_main.c:147
int HomeLen
Definition ctwm_main.c:129
bool HasShape
Definition ctwm_main.c:90
Window ResizeWindow
Definition ctwm_main.c:85
IRAlignement
Definition ctwm.h:189
@ IRA_UNDEF
Definition ctwm.h:190
@ IRA_CENTER
Definition ctwm.h:192
@ IRA_TOP
Definition ctwm.h:191
@ IRA_BORDER
Definition ctwm.h:194
@ IRA_BOTTOM
Definition ctwm.h:193
unsigned int JunkHeight
Definition ctwm.h:359
Cursor TopLeftCursor
Definition ctwm.h:353
Cursor RightButt
Definition ctwm_main.c:115
unsigned int JunkDepth
Definition ctwm.h:359
Pixel back
Definition ctwm.h:141
Pixel shadd
Definition ctwm.h:141
Pixel fore
Definition ctwm.h:141
Pixel shadc
Definition ctwm.h:141
TwmColormap * colormap
Definition ctwm.h:273
int visibility
Definition ctwm.h:274
Window w
Definition ctwm.h:272
int number_cwins
Definition ctwm.h:280
char * scoreboard
Definition ctwm.h:281
ColormapWindow ** cwins
Definition ctwm.h:279
Definition image.h:9
Definition ctwm.h:127
int descent
Definition ctwm.h:131
unsigned int avg_height
Definition ctwm.h:135
int height
Definition ctwm.h:132
XFontSet font_set
Definition ctwm.h:129
int y
Definition ctwm.h:133
float avg_fheight
Definition ctwm.h:136
int ascent
Definition ctwm.h:130
char * basename
Definition ctwm.h:128
unsigned int avg_count
Definition ctwm.h:137
int denom
Definition ctwm.h:180
SIJust justify
Definition ctwm.h:178
int num
Definition ctwm.h:179
Image * image
Definition ctwm.h:166
Window window
Definition ctwm.h:165
TitleButton * info
Definition ctwm.h:167
char * action
Definition ctwm.h:149
struct MenuRoot * menuroot
Definition ctwm.h:150
struct TitleButtonFunc * next
Definition ctwm.h:145
char * name
Definition ctwm.h:155
int srcy
Definition ctwm.h:157
Image * image
Definition ctwm.h:156
struct TitleButton * next
Definition ctwm.h:154
TitleButtonFunc * funs
Definition ctwm.h:161
int dsty
Definition ctwm.h:159
bool rightside
Definition ctwm.h:160
int dstx
Definition ctwm.h:159
int srcx
Definition ctwm.h:157
unsigned int height
Definition ctwm.h:158
unsigned int width
Definition ctwm.h:158
int state
Definition ctwm.h:259
unsigned long install_req
Definition ctwm.h:260
Window w
Definition ctwm.h:261
Colormap c
Definition ctwm.h:258
int refcnt
Definition ctwm.h:262
Info and control for every X Window we take over.
int x
Definition ctwm.h:297
bool used
Definition ctwm.h:299
int h
Definition ctwm.h:297
struct WindowEntry * next
Definition ctwm.h:296
int w
Definition ctwm.h:297
int y
Definition ctwm.h:297
struct TwmWindow * twm_win
Definition ctwm.h:298
struct WindowRegion * next
Definition ctwm.h:288
RegGravity grav1
Definition ctwm.h:290
RegGravity grav2
Definition ctwm.h:290
struct WindowEntry * entries
Definition ctwm.h:292
name_list * clientlist
Definition ctwm.h:291
char * restore_filename
Definition ctwm.h:413
char * InitFile
Definition ctwm.h:390
char * client_id
Definition ctwm.h:412
bool PrintErrorMessages
Definition ctwm.h:393
bool MultiScreen
Definition ctwm.h:387
bool Monochrome
Definition ctwm.h:388
bool cfgchk
Definition ctwm.h:389
char * display_name
Definition ctwm.h:391
bool ShowWelcomeWindow
Definition ctwm.h:394
TwmWindow struct definition.
struct WindowBox WindowBox
Definition types.h:44