dtwm: Change to ANSI function definitions
[oweals/cde.git] / cde / programs / dtwm / WmGlobal.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 #ifndef _WmGlobal_h
24 #define _WmGlobal_h
25 /* 
26  * (c) Copyright 1989, 1990, 1991, 1992, 1993, 1994 OPEN SOFTWARE FOUNDATION, INC. 
27  * ALL RIGHTS RESERVED 
28 */ 
29 /* 
30  * Motif Release 1.2.4
31 */ 
32 /*
33  * (c) Copyright 1987,1988,1989,1990,1992,1993,1994 HEWLETT-PACKARD COMPANY 
34  * (c) Copyright 1993, 1994 International Business Machines Corp.
35  * (c) Copyright 1993, 1994 Sun Microsystems, Inc.
36  * (c) Copyright 1993, 1994 Novell, Inc.
37  */
38
39 /* ANSI C definitions,  This should be the first thing in WmGlobal.h */
40 #ifdef __STDC__
41 #define Const const
42 #else
43 #define Const /**/
44 #endif
45
46
47 /*
48  * Included Files:
49  */
50
51 #include <stdio.h>
52 #include <X11/Xlib.h>
53 #include <X11/Xutil.h>
54 #ifndef NO_SHAPE
55 #include <X11/extensions/shape.h>
56 #endif /* NO_SHAPE  */
57 #include <X11/IntrinsicP.h>
58 #include <X11/Intrinsic.h>
59 #include <X11/StringDefs.h>
60 #include <Xm/MwmUtil.h>
61 #include <Xm/Xm.h>
62 #include <Xm/ColorObjP.h>
63 #include <Dt/Service.h>
64 #include <Dt/Wsm.h>
65 #include <Dt/WsmP.h>
66 #include "WmParse.h"
67 #include <Dt/Action.h>
68
69 #if defined(sun) && defined(ALLPLANES)
70 #include <X11/extensions/allplanes.h>
71 #endif /* defined(sun) && defined(ALLPLANES) */
72
73 /*
74  * Value definitions and macros:
75  */
76
77 extern int WmIdentity;
78
79 /*
80  * Color server defines
81  */
82 #define CSERVE_NORMAL              0
83 #define CSERVE_NOT_AVAILABLE       1
84 #define CSERVE_FAILURE             2
85
86 /* window manager name and class used to get resources: */
87 #define WM_RESOURCE_CLASS       "Mwm"
88 #define WM_RESOURCE_NAME        "mwm"
89
90 #define DT_WM_RESOURCE_CLASS    "Dtwm"
91 #define DT_WM_RESOURCE_NAME     "dtwm"
92
93
94 extern Pixel            FPbackground;
95 extern Pixel            FPforeground;
96 extern Pixel            FPtopshadow;
97 extern Pixel            FPbottomshadow;
98 extern Pixel            FPselectcolor;
99
100 #define  USE_ACTIVE_PIXELSET            0
101 #define  USE_INACTIVE_PIXELSET          1
102 #define  USE_PRIMARY_PIXELSET           2
103 #define  USE_SECONDARY_PIXELSET         3
104
105 #define MWM                          0
106 #define DT_MWM                       1
107
108 #define MwmBehavior             (WmIdentity == MWM)
109 #define DtwmBehavior            (WmIdentity == DT_MWM)
110
111
112 /* ICCC atom names: */
113
114 #define _XA_WM_STATE            "WM_STATE"
115 #define _XA_WM_PROTOCOLS        "WM_PROTOCOLS"
116 #define _XA_WM_CHANGE_STATE     "WM_CHANGE_STATE"
117 #define _XA_WM_SAVE_YOURSELF    "WM_SAVE_YOURSELF"
118 #define _XA_WM_DELETE_WINDOW    "WM_DELETE_WINDOW"
119 #define _XA_WM_TAKE_FOCUS       "WM_TAKE_FOCUS"
120 #define _XA_WM_COLORMAP_WINDOWS "WM_COLORMAP_WINDOWS"
121
122 /* window manager exit value on fatal errors: */
123 #define WM_ERROR_EXIT_VALUE     1
124
125 /* built-in button bindings for window manager actions: */
126 #define SELECT_BUTTON                   Button1
127 #define SELECT_BUTTON_MASK              Button1Mask
128 #define SELECT_BUTTON_MOTION_MASK       Button1MotionMask
129
130 #define FOCUS_SELECT_BUTTON     SELECT_BUTTON
131 #define FOCUS_SELECT_MODIFIERS  0
132
133 /* direct manipulation button */
134 #define DMANIP_BUTTON                   Button2
135 #define DMANIP_BUTTON_MASK              Button2Mask
136 #define DMANIP_BUTTON_MOTION_MASK       Button2MotionMask
137
138 /* menu button */
139 #define BMENU_BUTTON                    Button3
140 #define BMENU_BUTTON_MASK               Button3Mask
141
142 /* max number of buttons on a mouse */
143 #define NUM_BUTTONS                     5
144
145 /* Needed by PostMenu() to specify key post: */
146 #define NoButton                0
147
148 /* manage window flags: */
149 #define MANAGEW_WM_STARTUP      (1L << 0)
150 #define MANAGEW_WM_RESTART      (1L << 1)
151 #define MANAGEW_NORMAL          (1L << 2)
152 #define MANAGEW_ICON_BOX        (1L << 3)
153 #define MANAGEW_CONFIRM_BOX     (1L << 4)
154 #define MANAGEW_WM_RESTART_ICON (1L << 5)
155
156 #define MANAGEW_WM_CLIENTS      (MANAGEW_ICON_BOX | \
157                                  MANAGEW_CONFIRM_BOX )
158
159 /* keyboard input focus flag values (for calls to SetKeyboardFocus) */
160 #define ALWAYS_SET_FOCUS        (1L << 0)
161 #define REFRESH_LAST_FOCUS      (1L << 1)
162 #define CLIENT_AREA_FOCUS       (1L << 2)
163 #define SCREEN_SWITCH_FOCUS     (1L << 3)
164 /* special value for use for Do_Focus_Key to set to internal window */
165 #define WORKSPACE_IF_NULL       (1L << 4)
166
167 /* Menu posting flag values (for calls to PostMenu) */
168 #define POST_AT_XY              (1L << 0)
169 #define POST_TRAVERSAL_ON       (1L << 1)
170 #define POST_STICKY             (1L << 2)
171
172 /* feedback box styles */
173 #define FB_OFF                  (0)
174 #define FB_SIZE                 (1L << 0)
175 #define FB_POSITION             (1L << 1)
176
177 /* confirmbox and waitbox indexes */
178 #define DEFAULT_BEHAVIOR_ACTION         0
179 #define CUSTOM_BEHAVIOR_ACTION          1
180 #define RESTART_ACTION          2
181 #define QUIT_MWM_ACTION         3
182
183 /* extract text height in pixels from a (XFontStruct *) */
184 #define TEXT_HEIGHT(pfs) (((pfs)->ascent)+((pfs)->descent))
185
186 /* icon frame shadow widths */
187 #define ICON_EXTERNAL_SHADOW_WIDTH      (wmGD.iconExternalShadowWidth)
188 #define ICON_INTERNAL_SHADOW_WIDTH      1
189
190 /* padding widths */
191 #define ICON_IMAGE_TOP_PAD      2
192 #define ICON_IMAGE_BOTTOM_PAD   2
193 #define ICON_IMAGE_LEFT_PAD     2
194 #define ICON_IMAGE_RIGHT_PAD    2
195
196 /* image offsets */
197 #define ICON_INNER_X_OFFSET     \
198             (ICON_IMAGE_LEFT_PAD+ICON_EXTERNAL_SHADOW_WIDTH)
199 #define ICON_INNER_Y_OFFSET     \
200             (ICON_IMAGE_TOP_PAD+ICON_EXTERNAL_SHADOW_WIDTH)
201
202
203 #define ICON_IMAGE_X_OFFSET ICON_INNER_X_OFFSET+ICON_INTERNAL_SHADOW_WIDTH
204 #define ICON_IMAGE_Y_OFFSET ICON_INNER_Y_OFFSET+ICON_INTERNAL_SHADOW_WIDTH
205
206
207
208 /* number of rectangles to allocate */
209 #define NUM_MATTE_TS_RECTS      (6)
210 #define NUM_MATTE_BS_RECTS      (6)
211
212 #define NUM_IMAGE_TOP_RECTS     \
213             ((2*ICON_EXTERNAL_SHADOW_WIDTH)+(2*ICON_INTERNAL_SHADOW_WIDTH)) 
214
215
216 #define NUM_IMAGE_BOTTOM_RECTS  \
217             ((2*ICON_EXTERNAL_SHADOW_WIDTH)+(2*ICON_INTERNAL_SHADOW_WIDTH)) 
218
219
220 #define NUM_LABEL_TOP_RECTS     (2*ICON_EXTERNAL_SHADOW_WIDTH)
221 #define NUM_LABEL_BOTTOM_RECTS  (2*ICON_EXTERNAL_SHADOW_WIDTH)
222
223 #define NUM_BOTH_TOP_RECTS      \
224             ((3*ICON_EXTERNAL_SHADOW_WIDTH)+(3*ICON_INTERNAL_SHADOW_WIDTH)) 
225
226
227 #define NUM_BOTH_BOTTOM_RECTS   \
228             ((3*ICON_EXTERNAL_SHADOW_WIDTH)+(3*ICON_INTERNAL_SHADOW_WIDTH)) 
229
230
231 #define NUM_STATIC_TOP_RECTS    (2*ICON_INTERNAL_SHADOW_WIDTH)
232 #define NUM_STATIC_BOTTOM_RECTS (2*ICON_INTERNAL_SHADOW_WIDTH)
233
234
235 /* client frame shadow widths */
236 #define FRAME_EXTERNAL_SHADOW_WIDTH     (wmGD.frameExternalShadowWidth)
237 #define FRAME_INTERNAL_SHADOW_WIDTH     1
238 #define FRAME_CLIENT_SHADOW_WIDTH       1
239 #define FRAME_MATTE_SHADOW_WIDTH        1
240
241 /* padding around text in title bar */
242 #define WM_TOP_TITLE_PADDING    1
243 #define WM_BOTTOM_TITLE_PADDING 1
244 #define WM_TOP_TITLE_SHADOW     FRAME_INTERNAL_SHADOW_WIDTH
245 #define WM_BOTTOM_TITLE_SHADOW  FRAME_INTERNAL_SHADOW_WIDTH
246
247 #define WM_TITLE_BAR_PADDING    (WM_TOP_TITLE_PADDING \
248                                  +WM_BOTTOM_TITLE_PADDING \
249                                  +WM_TOP_TITLE_SHADOW \
250                                  +WM_BOTTOM_TITLE_SHADOW)
251
252 /* stretch directions  - (starts at NW and goes clockwise) */
253 #define STRETCH_NO_DIRECTION    -1
254 #define STRETCH_NORTH_WEST      0
255 #define STRETCH_NORTH           1
256 #define STRETCH_NORTH_EAST      2
257 #define STRETCH_EAST            3
258 #define STRETCH_SOUTH_EAST      4 
259 #define STRETCH_SOUTH           5
260 #define STRETCH_SOUTH_WEST      6
261 #define STRETCH_WEST            7
262
263 #define STRETCH_COUNT           8
264
265
266 /* Workspace allocation granularity */
267 #define WS_ALLOC_AMOUNT                 8
268
269 /* Window list allocation granularity */
270 #define WINDOW_ALLOC_AMOUNT             16
271
272 /* function flag masks */
273 #define WM_FUNC_DEFAULT         MWM_FUNC_ALL
274 #define WM_FUNC_NONE            0
275 #define WM_FUNC_ALL             (MWM_FUNC_RESIZE | MWM_FUNC_MOVE |\
276                                  MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE |\
277                                  MWM_FUNC_CLOSE)
278
279 /* decorations flag masks */
280 #define WM_DECOR_DEFAULT        MWM_DECOR_ALL
281 #define WM_DECOR_NONE           0
282 #define WM_DECOR_BORDER         (MWM_DECOR_BORDER)
283 #define WM_DECOR_TITLE          (MWM_DECOR_TITLE)
284 #define WM_DECOR_SYSTEM         (WM_DECOR_TITLE | MWM_DECOR_MENU)
285 #define WM_DECOR_MINIMIZE       (WM_DECOR_TITLE | MWM_DECOR_MINIMIZE)
286 #define WM_DECOR_MAXIMIZE       (WM_DECOR_TITLE | MWM_DECOR_MAXIMIZE)
287 #define WM_DECOR_TITLEBAR       (WM_DECOR_SYSTEM | WM_DECOR_MINIMIZE |\
288                                  WM_DECOR_MAXIMIZE)
289 #define WM_DECOR_RESIZEH        (WM_DECOR_BORDER | MWM_DECOR_RESIZEH)
290 #define WM_DECOR_RESIZE         (WM_DECOR_RESIZEH)
291 #define WM_DECOR_ALL            (WM_DECOR_TITLEBAR | WM_DECOR_RESIZEH)
292
293 #define WM_DECOR_PANEL_DEFAULT  WM_DECOR_BORDER
294
295 /* icon box definitions */
296 #define ICON_BOX_FUNCTIONS      (MWM_FUNC_RESIZE | MWM_FUNC_MOVE |\
297                                  MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE)
298
299 /* accessory panel definitions */
300 #define WM_FUNC_PANEL_DEFAULT   (MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE)
301 #define WM_FUNC_SUBPANEL_DEFAULT (MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE|\
302                                 MWM_FUNC_CLOSE)
303 /* workspace controller definitions */
304 #define CONTROL_BOX_FUNCTIONS   (MWM_FUNC_MOVE)
305
306 /* workspace presence definitions */
307 #define PRESENCE_BOX_FUNCTIONS  (MWM_FUNC_MOVE)
308
309 /* show feedback definitions */
310 #define WM_SHOW_FB_BEHAVIOR     (1L << 0)
311 #define WM_SHOW_FB_MOVE         (1L << 1)
312 #define WM_SHOW_FB_PLACEMENT    (1L << 2)
313 #define WM_SHOW_FB_RESIZE       (1L << 3)
314 #define WM_SHOW_FB_RESTART      (1L << 4)
315 #define WM_SHOW_FB_QUIT         (1L << 5)
316 #define WM_SHOW_FB_KILL         (1L << 6)
317
318 #define WM_SHOW_FB_ALL          (WM_SHOW_FB_BEHAVIOR  | WM_SHOW_FB_MOVE    |\
319                                  WM_SHOW_FB_PLACEMENT | WM_SHOW_FB_RESIZE  |\
320                                  WM_SHOW_FB_RESTART   | WM_SHOW_FB_QUIT    |\
321                                  WM_SHOW_FB_KILL)
322
323 #define WM_SHOW_FB_NONE         0
324
325 #define WM_SHOW_FB_DEFAULT      WM_SHOW_FB_ALL
326
327 /* flags identifying resources to save */
328
329 #define WM_RES_WORKSPACE_LIST           (1L << 0)
330 #define WM_RES_BACKDROP_IMAGE           (1L << 1)
331 #define WM_RES_WORKSPACE_TITLE          (1L << 2)
332 #define WM_RES_INITIAL_WORKSPACE        (1L << 3)
333 #define WM_RES_FP_POSITION              (1L << 4)
334 #define WM_RES_ICONBOX_GEOMETRY         (1L << 5)
335 #define WM_RES_WORKSPACE_COUNT          (1L << 6)
336
337
338
339 \f
340 /*************************************<->*************************************
341  *
342  *  Miscellaneous utility window manager data structures ...
343  *
344  *
345  *  Description:
346  *  -----------
347  *  These data structures are used in resource processing, ...
348  *
349  *************************************<->***********************************/
350
351 typedef struct _WHSize
352 {
353     int         width;
354     int         height;
355
356 } WHSize;
357
358
359 typedef struct _AspectRatio
360 {
361     int         x;
362     int         y;
363
364 } AspectRatio;
365
366
367 typedef struct _WmColorData
368 {
369     Screen *screen;
370     Colormap colormap;
371     Pixel background;
372     Pixel foreground;
373     Pixel top_shadow;
374     Pixel bottom_shadow;
375
376 } WmColorData;
377
378 typedef Atom WorkspaceID;
379
380 \f
381 /*************************************<->*************************************
382  *
383  *  Event processing data structures ...
384  *
385  *
386  *  Description:
387  *  -----------
388  *  These data structures are used in saving button and key
389  *  specifications that are used in processing events that are used to do 
390  *  window manager functions (e.g., set the colormap focus).
391  *
392  *************************************<->***********************************/
393
394 typedef unsigned long Context;
395 typedef unsigned long Behavior;
396 typedef unsigned long GroupArg;
397
398 typedef Boolean (*WmFunction) ();
399
400 #define NO_MODIFIER     0               /* value for state field */
401
402 typedef struct _KeySpec
403 {
404     unsigned int state;
405     KeyCode      keycode;
406     Context      context;
407     Context      subContext;
408     WmFunction   wmFunction;
409     String       wmFuncArgs;
410     struct _KeySpec *nextKeySpec;
411
412 } KeySpec;
413
414 typedef struct _ButtonSpec
415 {
416     unsigned int state;
417     unsigned int button;
418     unsigned int eventType;
419     Boolean     click;
420     Context     context;
421     Context     subContext;
422     WmFunction  wmFunction;
423     String      wmFuncArgs;
424     struct _ButtonSpec *nextButtonSpec;
425
426 } ButtonSpec;
427
428
429 /*
430  * Context field values:
431  */
432
433 #define F_CONTEXT_NONE          0
434 #define F_CONTEXT_ROOT          (1L << 0)
435 #define F_CONTEXT_ICON          (1L << 1)
436 #define F_CONTEXT_NORMAL        (1L << 2)
437 #define F_CONTEXT_MAXIMIZE      (1L << 3)
438 #define F_CONTEXT_ICONBOX       (1L << 4)
439 #define F_CONTEXT_IFKEY         (1L << 7)
440 #define F_CONTEXT_WINDOW        (F_CONTEXT_NORMAL|F_CONTEXT_MAXIMIZE)
441 #define F_CONTEXT_ALL           (F_CONTEXT_ROOT|F_CONTEXT_ICON|F_CONTEXT_WINDOW)
442
443
444 /*
445  * context field mark for catching menu recursion 
446  *   (tied to F_CONTEXT_... values):
447  */
448
449 #define CR_MENU_MARK            (1L << 5)
450
451
452 /*
453  * Part context defines for event processing.  The part context is used
454  * to make a subcontext mask.
455  */
456
457 /* window (frame and client) part contexts */
458 #define WINDOW_PART_NONE        0
459 #define FRAME_NONE              WINDOW_PART_NONE
460 #define FRAME_CLIENT            1
461 #define FRAME_SYSTEM            2
462 #define FRAME_TITLE             3
463 #define FRAME_MINIMIZE          4
464 #define FRAME_MAXIMIZE          5
465 #define FRAME_RESIZE_NW         6
466 #define FRAME_RESIZE_N          7
467 #define FRAME_RESIZE_NE         8
468 #define FRAME_RESIZE_E          9
469 #define FRAME_RESIZE_SE         10
470 #define FRAME_RESIZE_S          11
471 #define FRAME_RESIZE_SW         12
472 #define FRAME_RESIZE_W          13
473 #define FRAME_NBORDER           14
474 #define FRAME_MATTE             15
475 #define FRAME_MISC              FRAME_MATTE
476 #define FRAME_TITLEBAR          17
477
478 /* icon part contexts */
479 #define ICON_PART_NONE          0
480 #define ICON_PART_ALL           16
481
482 /* root part contexts */
483 #define ROOT_PART_NONE          0
484 #define ROOT_PART_ALL           17
485
486 /* iconbox part contexts */
487 #define ICONBOX_PART_NONE       0
488 #define ICONBOX_PART_IBOX       18
489 #define ICONBOX_PART_IICON      19
490 #define ICONBOX_PART_WICON      20
491
492
493 /*
494  * Subcontext field values:
495  */
496
497 #define F_SUBCONTEXT_NONE               (1L << WINDOW_PART_NONE)
498
499 #define F_SUBCONTEXT_I_ALL              (1L << ICON_PART_ALL)
500
501 #define F_SUBCONTEXT_R_ALL              (1L << ROOT_PART_ALL)
502
503
504 #define F_SUBCONTEXT_IB_IBOX            (1L << ICONBOX_PART_IBOX)
505 #define F_SUBCONTEXT_IB_IICON           (1L << ICONBOX_PART_IICON)
506 #define F_SUBCONTEXT_IB_WICON           (1L << ICONBOX_PART_WICON)
507
508 #define F_SUBCONTEXT_IB_ICONS           (F_SUBCONTEXT_IB_IICON |\
509                                          F_SUBCONTEXT_IB_WICON)
510
511 #define F_SUBCONTEXT_IB_ALL             (F_SUBCONTEXT_IB_IBOX |\
512                                          F_SUBCONTEXT_IB_IICON |\
513                                          F_SUBCONTEXT_IB_WICON)
514
515
516 #define F_SUBCONTEXT_W_CLIENT           (1L << FRAME_CLIENT)
517 #define F_SUBCONTEXT_W_APP              F_SUBCONTEXT_W_CLIENT
518 #define F_SUBCONTEXT_W_SYSTEM           (1L << FRAME_SYSTEM)
519 #define F_SUBCONTEXT_W_TITLE            (1L << FRAME_TITLE)
520 #define F_SUBCONTEXT_W_MINIMIZE         (1L << FRAME_MINIMIZE)
521 #define F_SUBCONTEXT_W_MAXIMIZE         (1L << FRAME_MAXIMIZE)
522 #define F_SUBCONTEXT_W_RESIZE_NW        (1L << FRAME_RESIZE_NW)
523 #define F_SUBCONTEXT_W_RESIZE_N         (1L << FRAME_RESIZE_N)
524 #define F_SUBCONTEXT_W_RESIZE_NE        (1L << FRAME_RESIZE_NE)
525 #define F_SUBCONTEXT_W_RESIZE_E         (1L << FRAME_RESIZE_E)
526 #define F_SUBCONTEXT_W_RESIZE_SE        (1L << FRAME_RESIZE_SE)
527 #define F_SUBCONTEXT_W_RESIZE_S         (1L << FRAME_RESIZE_S)
528 #define F_SUBCONTEXT_W_RESIZE_SW        (1L << FRAME_RESIZE_SW)
529 #define F_SUBCONTEXT_W_RESIZE_W         (1L << FRAME_RESIZE_W)
530 #define F_SUBCONTEXT_W_NBORDER          (1L << FRAME_NBORDER)
531 #define F_SUBCONTEXT_W_MATTE            (1L << FRAME_MATTE)
532 #define F_SUBCONTEXT_W_MISC             F_SUBCONTEXT_W_MATTE
533
534
535 #define F_SUBCONTEXT_W_RBORDER          (F_SUBCONTEXT_W_RESIZE_NW |\
536                                          F_SUBCONTEXT_W_RESIZE_N |\
537                                          F_SUBCONTEXT_W_RESIZE_NE |\
538                                          F_SUBCONTEXT_W_RESIZE_E |\
539                                          F_SUBCONTEXT_W_RESIZE_SE |\
540                                          F_SUBCONTEXT_W_RESIZE_S |\
541                                          F_SUBCONTEXT_W_RESIZE_SW |\
542                                          F_SUBCONTEXT_W_RESIZE_W)
543
544 #define F_SUBCONTEXT_W_BORDER           (F_SUBCONTEXT_W_RBORDER |\
545                                          F_SUBCONTEXT_W_NBORDER)
546
547 #define F_SUBCONTEXT_W_TITLEBAR         (F_SUBCONTEXT_W_SYSTEM |\
548                                          F_SUBCONTEXT_W_TITLE |\
549                                          F_SUBCONTEXT_W_MINIMIZE |\
550                                          F_SUBCONTEXT_W_MAXIMIZE)
551
552 #define F_SUBCONTEXT_W_FRAME            (F_SUBCONTEXT_W_BORDER |\
553                                          F_SUBCONTEXT_W_TITLEBAR)
554
555 #define F_SUBCONTEXT_W_ALL              (F_SUBCONTEXT_W_FRAME |\
556                                          F_SUBCONTEXT_W_MATTE |\
557                                          F_SUBCONTEXT_W_CLIENT)
558
559
560 /*
561  * Click / double-click processing data:
562  */
563
564 typedef struct _ClickData
565 {
566     Boolean     clickPending;
567     Boolean     doubleClickPending;
568     Boolean     bReplayed;
569     unsigned int button;
570     unsigned int state;
571     unsigned int releaseState;
572     struct _ClientData *pCD;
573     Context     context;
574     Context     subContext;
575     Context     clickContext;
576     Context     doubleClickContext;
577     Time        time;
578
579 } ClickData;
580
581
582 /*
583  * Frame part identification aids:
584  */
585
586 typedef struct _Gadget_Rectangle
587 {
588     short       id;
589     XRectangle  rect;
590
591 } GadgetRectangle;
592
593
594 /*
595  * Behavior function argument field values:
596  */
597
598 #define F_BEHAVIOR_DEFAULT      (1L << 0)
599 #define F_BEHAVIOR_CUSTOM       (1L << 1)
600 #define F_BEHAVIOR_SWITCH       (1L << 2)
601
602
603 /*
604  * Window/icon group function argument field values:
605  */
606
607 #define F_GROUP_WINDOW          (1L << 0)
608 #define F_GROUP_ICON            (1L << 1)
609 #define F_GROUP_DEFAULT         (F_GROUP_WINDOW | F_GROUP_ICON)
610 #define F_GROUP_TRANSIENT       (1L << 2)
611 #define F_GROUP_ALL             (F_GROUP_DEFAULT | F_GROUP_TRANSIENT)
612 #define F_GROUP_GROUP           (1L << 3)
613
614
615 /*************************************<->*************************************
616  *
617  *  Workspace data structures ...
618  *
619  ***************************************************************************/
620
621 /*
622  * Specific data for workspacePresence dialog box
623  */
624
625 typedef struct _WsPresenceData
626 {
627     XmString            title;                  /* resource */
628
629     Widget              shellW;
630     Widget              formW;
631     Widget              windowLabelW;
632     Widget              windowNameW;
633     Widget              workspaceLabelW;
634     Widget              workspaceScrolledListW;
635     Widget              workspaceListW;
636     Widget              allWsW;
637     Widget              sepW;
638     Widget              OkW;
639     Widget              CancelW;
640     Widget              HelpW;
641
642     struct _ClientData  *pCDforClient;
643     Context             contextForClient;
644
645     Boolean             *ItemSelected;          /* workspaces in list */
646     XmStringTable       ItemStrings;            /* workspace names */
647     int                 currentWsItem;
648     Boolean             onScreen;
649     Boolean             userDismissed;
650     int                 numWorkspaces;
651
652 } WsPresenceData;
653
654 #define NUM_WSP_WIDGETS         11
655
656 typedef struct _WsPresenceData *PtrWsPresenceData;
657
658
659 /*
660  * Specific data for top level help dialog 
661  */
662
663 typedef struct _WsDtHelpData
664 {
665     XmString            title;                  /* resource */
666     Widget              shell;
667     Widget              dialog;
668     Widget              errorDialog;
669     Position            xPos;
670     Position            yPos;
671     Boolean             restored;
672     Boolean             onScreen;
673     Boolean             userDismissed;
674     Boolean             bMapped;
675     struct _ClientData  *pCDforClient;
676 } WsDtHelpData;
677
678 typedef struct _WsDtHelpData *PtrWsDtHelpData;
679
680 \f
681 /*************************************<->*************************************
682  *
683  *  DtSessionItems
684  *
685  *
686  *  Description:
687  *  -----------
688  *
689  *************************************<->***********************************/
690
691 typedef struct _DtSessionItem
692 {
693     Boolean                processed;
694     int                    clientState;
695     String                 workspaces;
696     String                 clientMachine;
697     String                 command;
698     int                    commandArgc;
699     char                   **commandArgv;
700     struct _SessionGeom    *sessionGeom;
701 } DtSessionItem;
702
703 typedef struct _SessionGeom
704 {
705     int          flags;
706     int          clientX;
707     int          clientY;
708     int          clientWidth;
709     int          clientHeight;
710 } SessionGeom;
711
712 /*      
713  *  Status of Session Manager Contention Management
714  */
715 #define  SM_UNITIALIZED                  0
716 #define  SM_START_ACK                    1
717 #define  SM_STOP_ACK                     2
718
719
720 /*************************************<->*************************************
721  *
722  *  Menu specification data structures ...
723  *
724  *
725  *  Description:
726  *  -----------
727  *  These data structures are used in creating window manager menus that
728  *  are specified using resource files.  A list of menu specifications
729  *  (MenuSpec) is made when the resource files are parsed.  The desktop
730  *  menu and system menus are created as needed using the menu specification
731  *  list.
732  *
733  *************************************<->***********************************/
734
735 typedef struct _MenuItem
736 {
737     int          labelType;
738     String       label;
739     int          labelBitmapIndex;
740     KeySym       mnemonic;
741     unsigned int accelState;
742     KeyCode      accelKeyCode;
743     String       accelText;
744     WmFunction   wmFunction;
745     String       wmFuncArgs;
746     Context      greyedContext;
747     long         mgtMask;
748     struct _MenuItem *nextMenuItem;
749
750 } MenuItem;
751
752
753 /*
754  * We use the top part of mgtMask for workspace function bits.
755  * When OSF MWM outgrows the lower 16 bits, we'll have to
756  * change how we do things.
757  */
758
759 #define MWM_MGT_MASK    0x0000FFFF
760 #define DTWM_MGT_MASK   0xFFFF0000
761
762
763 typedef struct _MenuButton
764 {
765     MenuItem    *menuItem;
766     Widget      buttonWidget;
767     Boolean     managed;
768
769 } MenuButton;
770
771 typedef struct _MenuSpec
772 {
773     String        name;
774     Context       currentContext;
775     Widget        menuWidget;      /* RowColumn widget */
776     unsigned int  whichButton;    /* tracks whichButton resource for top menu */
777     unsigned int  height;          /* height of top menu */
778     MenuItem     *menuItems;       /* linked list of MenuItem structures */
779     MenuButton   *menuButtons;     /* array of MenuButton structures */
780     unsigned int  menuButtonSize;  /* size of menuButtons array */
781     unsigned int  menuButtonCount; /* number of menuButtons elements in use */
782     Context       accelContext;    /* accelerator context */
783     KeySpec      *accelKeySpecs;   /* list of accelerator KeySpecs */
784     struct _MenuSpec *nextMenuSpec;
785
786 } MenuSpec;
787
788 /*************************************<->*************************************
789  *
790  *  Window and function specification data structures ...
791  *
792  *
793  *  Description:
794  *  -----------
795  *
796  *************************************<->***********************************/
797
798 typedef struct _WindowItem
799 {
800     String              window;
801     struct _WindowItem *nextWindowItem;
802
803 } WindowItem;
804
805 typedef struct _WindowSet
806 {
807     String             name;
808     WindowItem        *windowItems;
809     struct _WindowSet *nextWindowSet;
810
811 } WindowSet;
812
813 typedef struct _FunctionItem
814 {
815     WmFunction            wmFunction;
816     String                wmFuncArgs;
817     struct _FunctionItem *nextFunctionItem;
818
819 } FunctionItem;
820
821 typedef struct _FunctionSet
822 {
823     String               name;
824     FunctionItem        *functionItems;
825     struct _FunctionSet *nextFunctionSet;
826
827 } FunctionSet;
828
829 /*************************************<->*************************************
830  *
831  *  Window manager timer data structure ...
832  *
833  *
834  *  Description:
835  *  -----------
836  *  This data stucture is used to keep track of window manager timers.  Each
837  *  active timer has an instance of the data structure.
838  *
839  *************************************<->***********************************/
840
841 typedef struct _WmTimer
842 {
843     XtIntervalId        timerId;
844     struct _ClientData  *timerCD;
845     unsigned int        timerType;
846     struct _WmTimer     *nextWmTimer;
847
848 } WmTimer;
849
850 /* Timer types: */
851 #define TIMER_NONE              0
852 #define TIMER_QUIT              1
853 #define TIMER_RAISE             2
854
855 \f
856 /*************************************<->*************************************
857  *
858  *  Window manager frame component data structures
859  *
860  *
861  *  Description:
862  *  -----------
863  *  This data stucture is used for drawing frame component graphics.
864  *
865  *************************************<->***********************************/
866
867 typedef struct _RList
868 {
869     int         allocated;              /* number of allocated XRectangles */
870     int         used;                   /* number currently in use */
871     XRectangle  *prect;                 /* array of XRectangles */
872 } RList;
873
874
875
876 \f
877 /*************************************<->*************************************
878  *
879  *  Window manager component appearance data structure ...
880  *
881  *
882  *  Description:
883  *  -----------
884  *  This structure is used to hold component appearance data for client,
885  *  icon, and feedback subparts. 
886  * 
887  *************************************<->***********************************/
888
889
890 typedef struct _AppearanceData
891 {
892     XmFontList  fontList;                       /* resource */
893     XFontStruct *font;
894     unsigned int        titleHeight;            /* title bar's height */
895     Boolean     saveUnder;                      /* resource */
896     Pixel       background;                     /* resource */
897     Pixel       foreground;                     /* resource */
898     String      backgroundPStr;                 /* resource */
899     Pixmap      backgroundPixmap;
900     Pixel       bottomShadowColor;              /* resource */
901     String      bottomShadowPStr;               /* resource */
902     Pixmap      bottomShadowPixmap;
903     Pixel       topShadowColor;                 /* resource */
904     String      topShadowPStr;                  /* resource */
905     Pixmap      topShadowPixmap;
906     Pixel       activeBackground;               /* resource */
907     String      activeBackgroundPStr;           /* resource */
908     Pixmap      activeBackgroundPixmap;
909     Pixel       activeBottomShadowColor;        /* resource */
910     String      activeBottomShadowPStr;         /* resource */
911     Pixmap      activeBottomShadowPixmap;
912     Pixel       activeForeground;               /* resource */
913     Pixel       activeTopShadowColor;           /* resource */
914     String      activeTopShadowPStr;            /* resource */
915     Pixmap      activeTopShadowPixmap;
916
917     GC          inactiveGC;
918     GC          inactiveTopShadowGC;
919     GC          inactiveBottomShadowGC;
920     GC          activeGC;
921     GC          activeTopShadowGC;
922     GC          activeBottomShadowGC;
923
924 } AppearanceData;
925
926
927 typedef struct _AppearanceData *PtrAppearanceData;
928
929 \f
930 /*************************************<->*************************************
931  *
932  *  IconInfo
933  *
934  *
935  *  Description:
936  *  -----------
937  *
938  *************************************<->***********************************/
939
940 typedef struct _IconInfo
941 {
942         Widget theWidget;
943         struct _ClientData *pCD;
944 } IconInfo;
945
946 typedef struct _IconInfo *PtrIconInfo;
947
948
949 \f
950 /*************************************<->*************************************
951  *
952  *  IconPlacement
953  *
954  *
955  *  Description:
956  *  -----------
957  *
958  *************************************<->***********************************/
959
960 typedef struct _IconPlacementData
961 {
962     Boolean     onRootWindow;           /* true if icons on root window */
963     unsigned    iconPlacement;          /* style of placement */
964     int         placementRows;          /* number of rows in placement space */
965     int         placementCols;          /* number of cols in placement space */
966     int         totalPlaces;            /* total number of placment slots */
967     int         iPlaceW;                /* width increment (to next place) */
968     int         iPlaceH;                /* height increment (to next place) */
969     IconInfo    *placeList;             /* list of icon info */
970     int         placeIconX;
971     int         placeIconY;
972     int         *placementRowY;
973     int         *placementColX;
974 } IconPlacementData;
975
976
977 \f
978 /*************************************<->*************************************
979  *
980  *  IconBoxData
981  *
982  *
983  *  Description:
984  *  -----------
985  *  This structure is used to hold window and widget information for
986  *  each icon box.
987  *
988  *************************************<->***********************************/
989
990 typedef struct _IconBoxData
991 {
992     Widget      shellWidget;
993     Widget      frameWidget;
994     Widget      scrolledWidget;
995     Widget      vScrollBar;
996     Widget      hScrollBar;
997     Widget      bBoardWidget;
998     Widget      clipWidget; 
999     int         numberOfIcons;
1000     int         currentRow;
1001     int         currentCol;
1002     int         lastRow;
1003     int         lastCol;
1004     WorkspaceID         wsID;           /* workspace identifier */
1005     struct _ClientData  *pCD_iconBox;   /* ptr to its own clientdata */
1006     struct _IconBoxData *pNextIconBox;  /* ptr to next icon box */
1007     struct _IconPlacementData IPD;      /* icon placement data */
1008 } IconBoxData;
1009
1010 typedef struct _IconBoxData *PtrIconBoxData;
1011
1012 #define IB_SPACING              0
1013 #define IB_MARGIN_HEIGHT        3 
1014 #define IB_MARGIN_WIDTH         3 
1015 #define IB_HIGHLIGHT_BORDER     3
1016
1017 \f
1018 /*************************************<->*************************************
1019  *
1020  *  Bitmap/Pixmap cache data
1021  *
1022  *
1023  *  Description:
1024  *  -----------
1025  *  These structures are used for the bitmap and pixmap caches held
1026  *  on a per-screen basis. (This is per-screen because you can't do
1027  *  XCopyPlane from one pixmap to another when they have different
1028  *  roots.)
1029  *
1030  *************************************<->***********************************/
1031
1032 #define NO_PIXMAP    0
1033 #define LABEL_PIXMAP 1
1034 #define ICON_PIXMAP  2
1035
1036 typedef struct _PixmapCache
1037 {
1038    unsigned int  pixmapType;   /* icon or label? */
1039    Pixel         foreground;
1040    Pixel         background;
1041    Pixmap        pixmap;
1042    struct _PixmapCache *next;
1043
1044 } PixmapCache;
1045
1046 typedef struct _BitmapCache
1047 {
1048    char         *path;
1049    Pixmap        bitmap;
1050    unsigned int  width;
1051    unsigned int  height;
1052    PixmapCache  *pixmapCache;
1053
1054 } BitmapCache;
1055
1056
1057
1058
1059 \f
1060 /******************************<->*************************************
1061  *
1062  *  Client window list entry data structure ...
1063  *
1064  *
1065  *  Description:
1066  *  -----------
1067  *  This structure provides the data for an entry in the client window list.
1068  *  The client window list has an entry for each non-transient client
1069  *  window and each non-iconbox icon.
1070  * 
1071  ******************************<->***********************************/
1072
1073 typedef struct _ClientListEntry
1074 {
1075     struct _ClientListEntry *nextSibling;
1076     struct _ClientListEntry *prevSibling;
1077     int         type;
1078     struct _ClientData *pCD;
1079
1080 } ClientListEntry;
1081
1082
1083 \f
1084 /*************************************<->*************************************
1085  *
1086  *  Frame information
1087  *
1088  *
1089  *  Description:
1090  *  -----------
1091  *  This structure contains geometry information for the window manager 
1092  *  frame.
1093  * 
1094  *************************************<->***********************************/
1095
1096 typedef struct _FrameInfo
1097 {
1098     int                 x;
1099     int                 y;
1100     unsigned int        width;
1101     unsigned int        height;
1102     unsigned int        upperBorderWidth;
1103     unsigned int        lowerBorderWidth;
1104     unsigned int        cornerWidth;
1105     unsigned int        cornerHeight;
1106     unsigned int        titleBarHeight;
1107
1108 } FrameInfo;
1109
1110
1111 \f
1112 /*************************************<->*************************************
1113  *
1114  *  WmScreenData
1115  *
1116  *
1117  *  Description:
1118  *  -----------
1119  *  This is the data structure for holding the window manager's
1120  *  screen data. There is one instantiation of the structure for
1121  *  each screen.
1122  *
1123  *************************************<->***********************************/
1124
1125 typedef struct _WmScreenData
1126 {
1127     int         dataType;
1128     int         screen;                 /* number for this screen */
1129     Boolean     managed;
1130     Window      rootWindow;
1131     Widget      screenTopLevelW;
1132     Widget      screenTopLevelW1;       /* for internal WM components */
1133     Widget      confirmboxW[4];
1134     Widget      wPanelist;              /* panel object */
1135     WsPresenceData      presence;       /* workspace presence dialog*/
1136     Widget      switcherW;              /* workspace switcher */
1137     Widget      switcherShellW;         /* shell for ws switcher */
1138     Window      wmWorkspaceWin;         /* holds wm properties */
1139     Window      feedbackWin;
1140     Window      activeIconTextWin;
1141     Window      activeLabelParent;
1142     String      displayString;          /* used for putenv in F_Exec */
1143     int displayResolutionType;
1144     struct _WmFpEmbeddedClientData  *pECD; /* clients living in front panel */
1145     int         numEmbeddedClients;
1146     struct _WmFpPushRecallClientData  *pPRCD; /* push_recall clients */
1147     int         numPushRecallClients;
1148
1149     /* wm state info: */
1150
1151     unsigned long clientCounter;
1152     long        focusPriority;
1153     Window      inputScreenWindow;
1154     struct _ClientData  *colormapFocus;
1155     Colormap    workspaceColormap;
1156     Colormap    lastInstalledColormap;
1157     struct _WmWorkspaceData     *pActiveWS;     /* for this screen */
1158     struct _WmWorkspaceData     *pLastWS;       /* previously active WS */
1159
1160     /* per screen caches */
1161     BitmapCache *bitmapCache;
1162     unsigned int bitmapCacheSize;
1163     unsigned int bitmapCacheCount;
1164
1165     /* per screen icon info */
1166     Boolean     fadeNormalIcon;                 /* resource */
1167     int         iconPlacement;                  /* resource */
1168     int         iconPlacementMargin;            /* resource */
1169     int         iconDecoration;                 /* resource */
1170     WHSize      iconImageMaximum;               /* resource */
1171     WHSize      iconImageMinimum;               /* resource */
1172     Pixmap      builtinIconPixmap;
1173     int         iconWidth;
1174     int         iconHeight;
1175     int         iconImageHeight;
1176     int         iconLabelHeight;
1177     GC          shrinkWrapGC;
1178     GC          fadeIconGC;
1179     GC          fadeIconTextGC;
1180
1181     /* per screen configuration outline windows */
1182     Window      woN;            /* North outline window */
1183     Window      woS;            /* South outline window */
1184     Window      woE;            /* East outline window */
1185     Window      woW;            /* West outline window */
1186
1187     /* per screen feedback data */
1188     unsigned long fbStyle;
1189     unsigned int fbWinWidth;
1190     unsigned int fbWinHeight;
1191     char fbLocation[20];
1192     char fbSize[20];
1193     int fbLocX;
1194     int fbLocY;
1195     int fbSizeX;
1196     int fbSizeY;
1197     int fbLastX;
1198     int fbLastY;
1199     unsigned int fbLastWidth;
1200     unsigned int fbLastHeight;
1201     RList *fbTop;
1202     RList *fbBottom;
1203     int     actionNbr;
1204
1205     /* resource description file data: */
1206     String      buttonBindings;                 /* resource */
1207     ButtonSpec  *buttonSpecs;
1208     String      keyBindings;                    /* resource */
1209     KeySpec     *keySpecs;
1210     MenuSpec   **acceleratorMenuSpecs;
1211     unsigned int acceleratorMenuCount;
1212     MenuSpec    *menuSpecs;
1213
1214     Boolean     defaultSystemMenuUseBuiltin;
1215
1216     Pixmap      defaultPixmap;
1217     GC          xorGC;
1218
1219     /* per screen appearance resources */
1220
1221     Boolean     cleanText;                      /* resource */
1222     Boolean     decoupleTitleAppearance;        /* see clientTitleAppearance */
1223     int         frameBorderWidth;               /* resource */
1224     String      feedbackGeometry;               /* resource */
1225     String      iconBoxName;                    /* resource */
1226     String      iconBoxSBDisplayPolicy;         /* resource */
1227     int         iconBoxScheme;                  /* resource - testing */
1228     XmString    iconBoxTitle;                   /* resource */
1229     int         externalBevel;
1230     int         joinBevel;
1231     Boolean     limitResize;                    /* resource */
1232     WHSize      maximumMaximumSize;             /* resource */
1233     int         resizeBorderWidth;              /* resource */
1234     Boolean     resizeCursors;                  /* resource */
1235     int         transientDecoration;            /* resource */
1236     int         transientFunctions;             /* resource */
1237     Boolean     useIconBox;                     /* resource */
1238     int         subpanelDecoration;             /* resource */
1239     String      subpanelResources;              /*to restore subpanels */
1240     Boolean     iconBoxControl;                 /* FP control for icon box */
1241     Boolean     moveOpaque;                     /* move window not outlines */
1242
1243     /* pixel set info (from color object) */
1244     XmPixelSet  *pPixelData;            /* all pixel data */
1245     XmPixelSet  *pActivePixelSet;       /* ptr into pPixelData */
1246     XmPixelSet  *pInactivePixelSet;     /* ptr into pPixelData */
1247     XmPixelSet  *pPrimaryPixelSet;      /* ptr into pPixelData */
1248     XmPixelSet  *pSecondaryPixelSet;    /* ptr into pPixelData */
1249     XmPixelSet  *pTextPixelSet;         /* ptr into pPixelData */
1250     int         colorUse;               /* indication from color obj */
1251
1252     /* client frame component appearance resources and data: */
1253
1254     AppearanceData clientAppearance;            /* resources ... */
1255     AppearanceData clientTitleAppearance;       /* resources ... */
1256     XPoint      transientOffset;
1257     int         Num_Resize_Ts_Elements;
1258     int         Num_Resize_Bs_Elements;
1259     int         Num_Title_Ts_Elements;
1260     int         Num_Title_Bs_Elements;
1261
1262     /* icon component appearance resources and data: */
1263
1264     AppearanceData iconAppearance;              /* resources ... */
1265
1266     /* feedback component appearance resources and data: */
1267
1268     AppearanceData feedbackAppearance;          /* resources ... */
1269
1270     /* client list pointers: */
1271
1272     ClientListEntry     *clientList;
1273     ClientListEntry     *lastClient;
1274
1275     /* DtSessionHints for clients */
1276     struct _DtSessionItem     *pDtSessionItems;
1277     int                        totalSessionItems;
1278     int                        remainingSessionItems;
1279
1280
1281     /* workspace list for this screen */
1282     String                      initialWorkspace; /* private resource */
1283     String                      workspaceList;    /* resource */
1284     int                         numWorkspaces;
1285     int                         numWsDataAllocated;
1286     struct _WmWorkspaceData     *pWS;
1287     Window                      lastBackdropWin;
1288     struct _WsDtHelpData        dtHelp;
1289     struct _CacheListStruct     *cachedHelp;
1290     String                      helpResources;  /* to restore help */
1291     DtSvcHandle hWsm;           /* WORKSPACEMGR message handle */
1292     Boolean     bMarqueeSelectionInitialized;
1293
1294 } WmScreenData;
1295
1296 typedef struct _WmScreenData *PtrScreenData;
1297
1298
1299 /* 
1300  * Convenience macros for data access
1301  */
1302 #define ROOT_FOR_CLIENT(pcd) ((pcd)->pSD->rootWindow)
1303 #define SCREEN_FOR_CLIENT(pcd) ((pcd)->pSD->screen)
1304 #define PSD_FOR_CLIENT(pcd) ((pcd)->pSD)
1305 #define BUTTON_SPECS(pcd) ((pcd)->pSD->buttonSpecs)
1306 #define KEY_SPECS(pcd) ((pcd)->pSD->keySpecs)
1307 #define ACCELERATOR_MENU_COUNT(pcd) ((pcd)->pSD->acceleratorMenuCount)
1308 #define ACCELERATOR_MENU_SPECS(pcd) ((pcd)->pSD->acceleratorMenuSpecs)
1309 #define WORKSPACE_COLORMAP(pcd) ((pcd)->pSD->workspaceColormap)
1310 #define FADE_NORMAL_ICON(pcd) ((pcd)->pSD->fadeNormalIcon)
1311 /*
1312 #define ICON_DEFAULT_TITLE(pcd) ((pcd)->iconDefaultTitle)
1313 */
1314 #define ICON_DECORATION(pcd) ((pcd)->pSD->iconDecoration)
1315 #define ICON_HEIGHT(pcd) ((pcd)->pSD->iconHeight)
1316 #define ICON_WIDTH(pcd) ((pcd)->pSD->iconWidth)
1317 #define ICON_IMAGE_HEIGHT(pcd) ((pcd)->pSD->iconImageHeight)
1318 #define ICON_LABEL_HEIGHT(pcd) ((pcd)->pSD->iconLabelHeight)
1319 #define ICON_IMAGE_MAXIMUM(pcd) ((pcd)->pSD->iconImageMaximum)
1320 #define ICON_IMAGE_MINIMUM(pcd) ((pcd)->pSD->iconImageMinimum)
1321 #define SHRINK_WRAP_GC(pcd) ((pcd)->pSD->shrinkWrapGC)
1322 #define FADE_ICON_GC(pcd) ((pcd)->pSD->fadeIconGC)
1323 #define FADE_ICON_TEXT_GC(pcd) ((pcd)->pSD->fadeIconTextGC)
1324 #define DEFAULT_PIXMAP(pcd) ((pcd)->pSD->defaultPixmap)
1325 #define ICON_PLACE(pcd) ((pcd)->pWsList[(pcd)->currentWsc].iconPlace)
1326 #define ICON_X(pcd) ((pcd)->pWsList[(pcd)->currentWsc].iconX)
1327 #define ICON_Y(pcd) ((pcd)->pWsList[(pcd)->currentWsc].iconY)
1328 #define P_ICON_BOX(pcd) ((pcd)->pWsList[(pcd)->currentWsc].pIconBox)
1329 #define ICON_FRAME_WIN(pcd) ((pcd)->pWsList[(pcd)->currentWsc].iconFrameWin)
1330
1331 /*
1332  * Definitions for Screen data
1333  */
1334 #define MAX_WORKSPACE_COUNT     64
1335
1336
1337 \f
1338 /*************************************<->*************************************
1339  *
1340  *  BackdropData
1341  *
1342  *
1343  *  Description:
1344  *  -----------
1345  *  This structure hold information for the workspace background
1346  * 
1347  *************************************<->***********************************/
1348
1349 typedef struct _WmBackdropData
1350 {
1351     String              image;                  /* resource */
1352     Atom                nameAtom;
1353     Pixmap              imagePixmap;
1354     int                 colorSet;               /* resource */
1355     Pixel               background;             /* resource */
1356     Pixel               foreground;             /* resource */
1357     unsigned int        flags;
1358     Window              window;
1359 } BackdropData;
1360
1361
1362 /*
1363  * bit definiton for "flags" member of BackdropData
1364  */
1365 #define BACKDROP_NONE           0
1366 #define BACKDROP_CLIENT         (1L<<1)
1367 #define BACKDROP_BITMAP         (1L<<2)
1368 #define BACKDROP_IMAGE_ALLOCED  (1L<<3)  /* image string can be freed */
1369
1370 typedef struct _WmBackdropData *PtrBackdropData;
1371
1372 #define DEFAULT_BACKDROP_DIR CDE_INSTALLATION_TOP "/backdrops"
1373
1374 /*
1375  * direction for slide-out panels
1376  */
1377 typedef enum _SlideDirection
1378 {
1379     SLIDE_NOT, SLIDE_NORTH, SLIDE_EAST, SLIDE_SOUTH, SLIDE_WEST
1380 } SlideDirection;
1381
1382 /* 
1383  * Slide out record for subpanels
1384  */
1385 typedef struct _SlideOutRec 
1386 {
1387     struct _ClientData  *pCD;
1388     Window              coverWin;
1389     Dimension           incWidth;
1390     Dimension           incHeight;
1391     Dimension           currWidth;
1392     Dimension           currHeight;
1393     Position            currX;
1394     Position            currY;
1395     unsigned int        interval;
1396     SlideDirection      direction;
1397     Boolean             mapping;
1398     Widget              wSubpanel;
1399 } SlideOutRec;
1400
1401 /*
1402  * Data structure for arguments to f.action
1403  */
1404 typedef struct _WmActionArg {
1405     String        actionName;
1406     int           numArgs;
1407     DtActionArg * aap;
1408     String        szExecParms;
1409 } WmActionArg;
1410
1411  
1412
1413 \f
1414 /*************************************<->*************************************
1415  *
1416  *  WmWorkspaceData
1417  *
1418  *
1419  *  Description:
1420  *  -----------
1421  *  This is the structure for holding the workspace specific data. 
1422  *  (This has been broken out in anticipation of possible future 
1423  *  enhancements.)
1424  * 
1425  *************************************<->***********************************/
1426
1427 typedef struct _WmWorkspaceData
1428 {
1429     int                 dataType;
1430
1431     WorkspaceID         id;
1432     int                 map_state;
1433     BackdropData        backdrop;
1434     Widget              buttonW;
1435     XmString            title;          /* resource (visible name) */
1436     String              iconBoxGeometry;/* resource */
1437     String              name;           /* workspace name */
1438                                         /* (used for resource fetching) */
1439
1440     WmScreenData        *pSD;           /* screen data for this workspace */
1441     IconBoxData         *pIconBox;      /* icon box data for this workspace */
1442     IconPlacementData   IPData;
1443
1444     Widget              workspaceTopLevelW;
1445
1446     /* workspace state information */
1447
1448     struct _ClientData  *keyboardFocus; /* ptr to client with the key focus */
1449     struct _ClientData  *nextKeyboardFocus; /* next client to get focus */
1450     struct _ClientData **ppClients;     /* list of client data ptrs */
1451     unsigned int        numClients;     /* number of client in list */
1452     unsigned int        sizeClientList; /* size of client list */
1453
1454 } WmWorkspaceData;
1455
1456 typedef struct _WmWorkspaceData *PtrWorkspaceData;
1457
1458
1459 /*
1460  * Convenience macros for data access
1461  */
1462 #define CLIENT_APPEARANCE(pcd) ((pcd)->pSD->clientAppearance)
1463 #define CLIENT_TITLE_APPEARANCE(pcd) ((pcd)->pSD->clientTitleAppearance)
1464 #define DECOUPLE_TITLE_APPEARANCE(pcd) ((pcd)->pSD->decoupleTitleAppearance)
1465 /*
1466 #define CLIENT_DEFAULT_TITLE(pcd) ((pcd)->pSD->clientDefaultTitle)
1467 */
1468 #define MAX_MAX_SIZE(pcd) ((pcd)->pSD->maximumMaximumSize)
1469 #define SHOW_RESIZE_CURSORS(pcd) ((pcd)->pSD->resizeCursors)
1470 #define JOIN_BEVEL(pcd) ((pcd)->pSD->joinBevel)
1471 #define EXTERNAL_BEVEL(pcd) ((pcd)->pSD->externalBevel)
1472 #define FRAME_BORDER_WIDTH(pcd) ((pcd)->pSD->frameBorderWidth)
1473 #define RESIZE_BORDER_WIDTH(pcd) ((pcd)->pSD->resizeBorderWidth)
1474 #define NUM_TITLE_TS_ELEMENTS(pcd) ((pcd)->pSD->Num_Title_Ts_Elements)
1475 #define NUM_TITLE_BS_ELEMENTS(pcd) ((pcd)->pSD->Num_Title_Bs_Elements)
1476 #define NUM_RESIZE_TS_ELEMENTS(pcd) ((pcd)->pSD->Num_Resize_Ts_Elements)
1477 #define NUM_RESIZE_BS_ELEMENTS(pcd) ((pcd)->pSD->Num_Resize_Bs_Elements)
1478 #define ICON_APPEARANCE(pcd) ((pcd)->pSD->iconAppearance)
1479
1480 #define ACTIVE_LABEL_PARENT(pcd) ((pcd)->pSD->activeLabelParent)
1481
1482 #define ICON_BOX_TITLE(pcd) ((pcd)->pSD->iconBoxTitle)
1483
1484 #define TRANSIENT_DECORATION(pcd) ((pcd)->pSD->transientDecoration)
1485 #define TRANSIENT_FUNCTIONS(pcd) ((pcd)->pSD->transientFunctions)
1486
1487 \f
1488 /*************************************<->*************************************
1489  *
1490  *  ClientData
1491  *
1492  *
1493  *  Description:
1494  *  -----------
1495  *  This data structure is instantiated for every client window that is
1496  *  managed by the window manager.  The information that is saved in the
1497  *  data structure is specific to the associated client window.
1498  *
1499  *  ClientData is instantiated at the time a client window is intially
1500  *  managed and is destroyed when the client window is withdrawn from
1501  *  window management (the ClientData may not be destroyed when a 
1502  *  client window is withdrawn if frame/icons are cached).
1503  *
1504  *************************************<->***********************************/
1505
1506 typedef struct _ClientData
1507 {
1508     int         dataType;                       /* client data type */
1509
1510     Window      client;
1511     long        clientFlags;
1512     int         icccVersion;
1513     int         clientState;                    /* WM_HINTS field */
1514     int         inputFocusModel;                /* WM_HINTS field */
1515     int         inputMode;
1516     long        focusPriority;
1517     unsigned long clientID;
1518     int         wmUnmapCount;
1519     struct _WmFpEmbeddedClientData  *pECD; /* embedded client data */
1520     struct _WmFpPushRecallClientData  *pPRCD; /* embedded client data */
1521     Atom *      paInitialProperties;    /* initial window properties */
1522     int         numInitialProperties;   /* number of initial properties */
1523
1524     /* client supported protocols: */
1525
1526     Atom        *clientProtocols;               /* WM_PROTOCOLS */
1527     int         clientProtocolCount;
1528     long        protocolFlags;
1529     long        *mwmMessages;                   /* _MWM_MESSAGES */
1530     int         mwmMessagesCount;
1531
1532     /* client colormap data: */
1533
1534     Colormap    clientColormap;                 /* selected client colormap */
1535     Window      *cmapWindows;                   /* from WM_COLORMAP_WINDOWS */
1536     Colormap    *clientCmapList;
1537     int         clientCmapCount;                /* len of clientCmapList */
1538     int         clientCmapIndex;                /* current cmap in list */
1539 #ifndef OLD_COLORMAP /* colormap */
1540     int         *clientCmapFlags;               /* installed, uninstalled */
1541     Bool        clientCmapFlagsInitialized;     /* Are clientCmapFlags valid? */
1542 #endif
1543
1544     /* associated window data: */
1545
1546     ClientListEntry clientEntry;
1547     ClientListEntry iconEntry;
1548     XID         windowGroup;                    /* WM_HINTS field */
1549 #ifndef NO_OL_COMPAT
1550     Boolean     bPseudoTransient;               /* transientFor window group */
1551 #endif /* NO_OL_COMPAT */
1552     IconBoxData *thisIconBox;                   /* icon box data for self */
1553                                                 /*   if this is an icon box */
1554     Context    grabContext;                     /* used to support icon box */
1555                                                 /* icon key, button, menus */
1556     Window      transientFor;                   /* transient for another win */
1557     struct _ClientData *transientLeader;        /* trans leader of this win */
1558     struct _ClientData *transientChildren;      /* transients of this win */
1559     struct _ClientData *transientSiblings;      /* related transient win's */
1560     int         primaryStackPosition;           /* stack pos'n of primary */
1561     Boolean     secondariesOnTop;               /* resource */
1562     int         primaryModalCount;              /* primary modal win count */
1563     int         fullModalCount;                 /* full modal win count */
1564
1565     /* client resource data */
1566
1567     String      clientClass;                    /* WM_CLASS field */
1568     String      clientName;                     /* WM_CLASS field */
1569     int         clientDecoration;               /* resource */
1570     int         clientFunctions;                /* resource */
1571     Boolean     focusAutoRaise;                 /* resource */
1572     Boolean     focusAutoRaiseDisabled;         /* to support f.lower */
1573     Boolean     focusAutoRaiseDisablePending;   /* to support f.lower */
1574     String      iconImage;                      /* resource */
1575     Pixel       iconImageBackground;            /* resource */
1576     Pixel       iconImageBottomShadowColor;     /* resource */
1577     String      iconImageBottomShadowPStr;      /* resource */
1578     Pixmap      iconImageBottomShadowPixmap;
1579     Pixel       iconImageForeground;            /* resource */
1580     Pixel       iconImageTopShadowColor;        /* resource */
1581     String      iconImageTopShadowPStr;         /* resource */
1582     Pixmap      iconImageTopShadowPixmap;
1583     Boolean     ignoreWMSaveHints;              /* resource */
1584     int         internalBevel;                  /* resource */
1585     Pixel       matteBackground;                /* resource */
1586     Pixel       matteBottomShadowColor;         /* resource */
1587     String      matteBottomShadowPStr;          /* resource */
1588     Pixmap      matteBottomShadowPixmap;
1589     Pixel       matteForeground;                /* resource */
1590     Pixel       matteTopShadowColor;            /* resource */
1591     String      matteTopShadowPStr;             /* resource */
1592     Pixmap      matteTopShadowPixmap;
1593     int         matteWidth;                     /* resource */
1594     WHSize      maximumClientSize;              /* resource */
1595     String      smClientID;                     /* SM_CLIENT_ID */
1596     String      systemMenu;                     /* resource */
1597     MenuItem    *mwmMenuItems;                  /* custom menu items or NULL */
1598     MenuSpec    *systemMenuSpec;
1599     Boolean     useClientIcon;                  /* resource */
1600     int         wmSaveHintFlags;                /* WMSAVE_HINT */
1601
1602     /* client frame data: */
1603
1604     long        sizeFlags;                      /* WM_NORMAL_HINTS field */
1605     long        decor;                          /* client decoration*/
1606     long        decorFlags;                     /* depressed gadgets flags */
1607     int         minWidth;                       /* WM_NORMAL_HINTS field */
1608     int         minHeight;                      /* WM_NORMAL_HINTS field */
1609     Boolean     maxConfig;                      /* True => use max config */
1610     int         maxX;                           /* maximized window X loc */
1611     int         maxY;                           /* maximized window Y loc */
1612     int         maxWidthLimit;
1613     int         maxWidth;                       /* WM_NORMAL_HINTS field */
1614     int         maxHeightLimit;
1615     int         maxHeight;                      /* WM_NORMAL_HINTS field */
1616     int         oldMaxWidth;                    /* for good HPterm behavior */
1617     int         oldMaxHeight;                   /* for good HPterm behavior */
1618     int         widthInc;                       /* WM_NORMAL_HINTS field */
1619     int         heightInc;                      /* WM_NORMAL_HINTS field */
1620     AspectRatio minAspect;                      /* WM_NORMAL_HINTS field */
1621     AspectRatio maxAspect;                      /* WM_NORMAL_HINTS field */
1622     int         baseWidth;                      /* WM_NORMAL_HINTS field */
1623     int         baseHeight;                     /* WM_NORMAL_HINTS field */
1624     int         windowGravity;                  /* WM_NORMAL_HINTS field */
1625     int         clientX;                        /* normal window X loc */
1626     int         clientY;                        /* normal window Y loc */
1627     int         clientWidth;                    /* normal window width */
1628     int         clientHeight;                   /* normal window height */
1629     XPoint      clientOffset;                   /* frame to client window */
1630     XmString    clientTitle;                    /* WM_NAME field */
1631     Window      clientFrameWin;                 /* top-level, frame window */
1632     Window      clientStretchWin[STRETCH_COUNT];/* for resizing border */
1633     Window      clientTitleWin;                 /* for title bar */
1634     Window      clientBaseWin;                  /* for matte & reparenting */
1635     int         xBorderWidth;                   /* original X border width */
1636     FrameInfo   frameInfo;                      /* frame geometry data */
1637
1638     /* client window frame graphic data: */
1639
1640     RList       *pclientTopShadows;             /* top shadow areas */
1641     RList       *pclientBottomShadows;          /* bottom shadow areas */
1642
1643     RList       *pclientTitleTopShadows;        /* top shadow areas */
1644     RList       *pclientTitleBottomShadows;     /* bottom shadow areas */
1645
1646     RList       *pclientMatteTopShadows;        /* matte top shadows */
1647     RList       *pclientMatteBottomShadows;     /* matte bottom shadows */
1648
1649     /* rectangles for client frame gadgets */
1650
1651     XRectangle          titleRectangle;         /* title bar area */
1652     GadgetRectangle     *pTitleGadgets;         /* title bar gadgets */
1653     int                 cTitleGadgets;          /* count of title rects */
1654     GadgetRectangle     *pResizeGadgets;        /* resize areas */
1655     XRectangle          matteRectangle;         /* matte / base window area */
1656
1657     /* client appearance data: */
1658
1659     GC          clientMatteTopShadowGC;
1660     GC          clientMatteBottomShadowGC;
1661     WmScreenData        *pSD;                   /* where visuals come from */
1662
1663     /* icon data: */
1664
1665     long        iconFlags;
1666     XmString    iconTitle;                      /* WM_ICON_NAME field */
1667     Pixmap      iconPixmap;                     /* WM_HINTS field */
1668     Pixmap      iconMask;                       /* WM_HINTS field */
1669     Window      iconWindow;                     /* WM_HINTS field */
1670
1671     RList       *piconTopShadows;               /* these change to      */
1672                                                 /* to reflect the       */
1673     RList       *piconBottomShadows;            /* depressed icon image */
1674
1675     /* workspace data */
1676
1677     int         absentMapBehavior;              /* resource */
1678     int         numInhabited;           /* number of WS's inhabited */
1679     int         sizeWsList;             /* size of wsc data list */
1680     struct _WsClientData *pWsList;      /* list of workspace-client data */
1681     int         currentWsc;             /* index to current wsc data */
1682     WorkspaceID *pWorkspaceHints;       /* _DT_WORKSPACE_HINTS */
1683     int         numWorkspaceHints;      /* size of pWorkspaceHints */
1684     Boolean     putInAll;               /* persistent window flag */
1685     long        dtwmFunctions;          /* _DT_WM_HINTS */
1686     long        dtwmBehaviors;          /* _DT_WM_HINTS */      
1687     Window      attachWindow;           /* _DT_WM_HINTS */
1688     SlideDirection      slideDirection; /* slide-up direction */
1689     SlideOutRec *pSOR;                  /* slide-out record */
1690 #ifndef NO_SHAPE
1691     short       wShaped;                /* this window has a bounding shape */
1692 #endif /* NO_SHAPE  */
1693
1694     int         usePPosition;           /* indicate whether to use PPosition */
1695
1696     long        window_status;                  /* used for Tear-off Menus */
1697
1698 } ClientData;
1699
1700 typedef struct _ClientData *PtrClientData;
1701
1702 /* client data convenience macros */
1703
1704 #define IS_APP_MODALIZED(pcd) \
1705     (((pcd)->primaryModalCount)||((pcd)->fullModalCount))
1706
1707 #define IS_MAXIMIZE_VERTICAL(pcd) \
1708   ((pcd->maximumClientSize.height == BIGSIZE) && \
1709    (pcd->maximumClientSize.width == 0))
1710
1711 #define IS_MAXIMIZE_HORIZONTAL(pcd) \
1712   ((pcd->maximumClientSize.width == BIGSIZE) && \
1713    (pcd->maximumClientSize.height == 0))
1714
1715 /* window management state of client windows (clientState): */
1716 #define WITHDRAWN_STATE         0
1717 #define NORMAL_STATE            1
1718 #define MINIMIZED_STATE         2
1719 #define MAXIMIZED_STATE         3
1720 #define UNSEEN_STATE            8
1721
1722 /* clientFlags field values: */
1723 #define CLIENT_HINTS_TITLE              (1L << 0)
1724 #define CLIENT_REPARENTED               (1L << 1)
1725 #define CLIENT_TRANSIENT                (1L << 2)
1726 #define CLIENT_CONTEXT_SAVED            (1L << 3)
1727 #define CLIENT_IN_SAVE_SET              (1L << 4)
1728 #define USERS_MAX_POSITION              (1L << 5)
1729 #define WM_INITIALIZATION               (1L << 6)
1730 #define CLIENT_DESTROYED                (1L << 7)
1731 #define ICON_REPARENTED                 (1L << 8)
1732 #define ICON_IN_SAVE_SET                (1L << 9)
1733 #define CLIENT_TERMINATING              (1L << 10)
1734 #define ICON_BOX                        (1L << 11)  /* one of our icon boxes */
1735 #define CONFIRM_BOX                     (1L << 12)  /* a confirmation box */
1736
1737 #define FRONT_PANEL_BOX                 (1L << 14)  /* a DT 3.0 front panel */
1738 #define GOT_DT_WM_HINTS         (1L << 15)
1739 #define SM_LAUNCHED                     (1L << 17) /* launched by dtsession */
1740
1741 #define SM_X                            (1L << 18) /* X from DB/dtsession */
1742 #define SM_Y                            (1L << 19) /* Y from DB/dtsession */
1743 #define SM_WIDTH                        (1L << 20) /* width fm DB/dtsession */
1744 #define SM_HEIGHT                       (1L << 21) /* height fm DB/dtsession */
1745 #define SM_CLIENT_STATE                 (1L << 22) /* clientState fm DB/dtsession */
1746 #define SM_ICON_X                       (1L << 23) /* icon X from DB */
1747 #define SM_ICON_Y                       (1L << 24) /* icon Y from DB */
1748
1749 #define CLIENT_WM_CLIENTS               (ICON_BOX | CONFIRM_BOX)
1750
1751 /* decorFlags bit fields */
1752 #define SYSTEM_DEPRESSED                (1L << 0)
1753 #define TITLE_DEPRESSED                 (1L << 1)
1754 #define MINIMIZE_DEPRESSED              (1L << 2)
1755 #define MAXIMIZE_DEPRESSED              (1L << 3)
1756
1757 /* iconFlags field values: */
1758 #define ICON_HINTS_POSITION             (1L << 0)
1759 #define ICON_HINTS_TITLE                (1L << 1)
1760 #define ICON_HINTS_PIXMAP               (1L << 2)
1761
1762 /* client protocol flags and sizes: */
1763 #define PROTOCOL_WM_SAVE_YOURSELF       (1L << 0)
1764 #define PROTOCOL_WM_DELETE_WINDOW       (1L << 1)
1765 #define PROTOCOL_WM_TAKE_FOCUS          (1L << 2)
1766 #define PROTOCOL_MWM_MESSAGES           (1L << 3)
1767 #define PROTOCOL_MWM_OFFSET             (1L << 4)
1768
1769 #define MAX_CLIENT_PROTOCOL_COUNT       40
1770 #define MAX_COLORMAP_WINDOWS_COUNT      40
1771 #define MAX_MWM_MESSAGES_COUNT          40
1772
1773 /* bevel width limits between window manager frame and client window */
1774 #define MIN_INTERNAL_BEVEL              0
1775 #define MAX_INTERNAL_BEVEL              2
1776
1777 /* global return buffer */
1778 #define MAXWMPATH                               1023
1779 #define MAXBUF                          (MAXWMPATH+1)
1780
1781 /*************************************<->*************************************
1782  *
1783  *  WsClientData
1784  *
1785  *
1786  *  Description:
1787  *  -----------
1788  *  This datum compartmentalizes client data that must be replicated 
1789  *  on a per workspace basis.
1790  * 
1791  *************************************<->***********************************/
1792 typedef struct _WsClientData
1793 {
1794     WorkspaceID wsID;                   /* workspace identifier */
1795     int         iconPlace;              /* icon placment index */
1796     int         iconX;
1797     int         iconY;
1798     Window      iconFrameWin;
1799     IconBoxData *pIconBox;              /* icon box for this win */
1800
1801 } WsClientData;
1802
1803
1804 /*
1805  * frame style types
1806  */
1807 typedef enum _FrameStyle
1808 {
1809     WmRECESSED,
1810     WmSLAB
1811 } FrameStyle;
1812
1813 \f
1814 /*************************************<->*************************************
1815  *
1816  *  WmGlobalData
1817  *
1818  *
1819  *  Description:
1820  *  -----------
1821  *  This is the main data structure for holding the window manager's
1822  *  global data. There is one instantiation of the structure for
1823  *  the window manager.
1824  * 
1825  *************************************<->***********************************/
1826
1827 typedef struct _WmGlobalData
1828 {
1829     int         dataType;
1830     char        **argv;                 /* command line argument vector */
1831     char        **environ;              /* environment vector */        
1832     char        *mwmName;               /* name of our executable */
1833     Widget      topLevelW;
1834     Widget      topLevelW1;             /* from which WM components hang */
1835     Boolean     confirmDialogMapped;    /* confirm dialog is mapped */
1836     XtAppContext        mwmAppContext;  /* application context for mwm */
1837     XContext    windowContextType;      /* window context for XSaveContext */
1838     XContext    screenContextType;      /* screen context for XSaveContext */
1839 #ifndef IBM_169380
1840     XContext  cmapWindowContextType;  /* list of pCD's in WM_COLORMAP_WINDOWS                                              context for XSaveContext */
1841 #endif
1842     XContext    mwmWindowContextType;   /* mwm win context for XSaveContext */
1843     Window      dtSmWindow;            /* used for contention management */
1844     Window      commandWindow;          /* WM_SAVE_YOURSELF win for dtwm */
1845
1846     /* presentation resource id's: */
1847
1848     String      displayString;          /* used for putenv in F_Exec */
1849     Display     *display;               /* display we are running to */
1850     Display     *display1;              /* second display connection */
1851     int         statusColorServer;      /* CSERVE_NORMAL, CSERVE_NOT_AVAILABLE */
1852     DtWmpParseBuf       *pWmPB;         /* global parse buffer */
1853     int         numScreens;             /* number of screens */
1854     unsigned char       **screenNames;  /* default names for screens */
1855     WmScreenData        *Screens;       /* array of screen info */
1856
1857     Cursor      workspaceCursor;                /* basic arrow cursor */
1858     Cursor      stretchCursors[STRETCH_COUNT];
1859     Cursor      configCursor;
1860     Cursor      movePlacementCursor;
1861     Cursor      sizePlacementCursor;
1862
1863 #ifndef NO_MESSAGE_CATALOG
1864     XmString okLabel;
1865     XmString cancelLabel;
1866     XmString helpLabel;
1867 #endif
1868
1869
1870     /* wm state info: */
1871
1872     WmScreenData *pActiveSD;            /* with keyfocus window */
1873     Boolean     useStandardBehavior;    /* behavior flag */
1874     Boolean     wmRestarted;            /* restart flag */
1875     Boolean     errorFlag;              /* handle on async errors */
1876     XID         errorResource;          /* from XErrorEvent */
1877     unsigned char errorRequestCode;     /* from XErrorEvent */
1878
1879                     /* The following are global because pointer is grabbed */
1880     MenuSpec    *menuActive;            /* ptr to currently active menu */
1881     KeySpec     *menuUnpostKeySpec;     /* key to upost current menu */
1882     ClientData  *menuClient;            /* client for which menu is posted */
1883     KeySpec     *F_NextKeySpec;         /* used when travering to windows */
1884     KeySpec     *F_PrevKeySpec;         /* used when travering to windows */
1885
1886     Context     grabContext;            /* used in GrabWin when no event */
1887
1888     ClickData   clickData;              /* double-click detection data */
1889     int         configAction;           /* none, resize, move */
1890     unsigned int configButton;          /* button used for config */
1891     unsigned int configPart;            /* resize frame part */
1892     Boolean     configSet;              /* True if configPart set */
1893     Boolean     movingIcon;             /* True if icon being moved */
1894     Boolean     preMove;                /* move threshold support */
1895     int         preMoveX;
1896     int         preMoveY;
1897     ClientData  *gadgetClient;          /* last client with */
1898     int         gadgetDepressed;        /* depressed gadget */
1899     Boolean     checkHotspot;           /* event hotspot flag */
1900     XRectangle  hotspotRectangle;       /* event hotspot area */
1901     WmTimer     *wmTimers;              /* timer data */
1902     Boolean     passKeysActive;         /* flag for pass keys function */
1903     KeySpec     *passKeysKeySpec;       /* key for pass keys function */
1904     Boolean     activeIconTextDisplayed;        /* True if active label up */
1905     Boolean     queryScreen;            /* True if not sure of active screen */
1906
1907     /* keyboard focus data: */
1908
1909     ClientData  *keyboardFocus;         /* ptr to client with the key focus */
1910     ClientData  *nextKeyboardFocus;     /* next client to get focus */
1911     Boolean     systemModalActive;
1912     ClientData  *systemModalClient;
1913     Window      systemModalWindow;
1914
1915     /* Resource database used to restore client geometries, etc. */
1916     XrmDatabase clientResourceDB;
1917
1918     /* atoms used in inter-client communication: */
1919
1920     Atom        xa_WM_STATE;
1921     Atom        xa_WM_PROTOCOLS;
1922     Atom        xa_WM_CHANGE_STATE;
1923     Atom        xa_WM_SAVE_YOURSELF;
1924     Atom        xa_WM_DELETE_WINDOW;
1925     Atom        xa_WM_TAKE_FOCUS;
1926     Atom        xa_WM_COLORMAP_WINDOWS;
1927     Atom        xa_MWM_HINTS;
1928     Atom        xa_MWM_MESSAGES;
1929     Atom        xa_MWM_MENU;
1930     Atom        xa_MWM_INFO;
1931     Atom        xa_MWM_OFFSET;
1932
1933     Atom        xa_MOTIF_BINDINGS;
1934     Atom        xa_COMPOUND_TEXT;
1935     Atom        xa_SM_CLIENT_ID;
1936     Atom        xa_WMSAVE_HINT;
1937
1938
1939     /* atoms used for workspace management: */
1940
1941     Atom        xa_DT_WORKSPACE_HINTS;
1942     Atom        xa_DT_WORKSPACE_PRESENCE;
1943     Atom        xa_DT_WORKSPACE_INFO;
1944     Atom        xa_DT_EMBEDDED_CLIENTS;
1945     Atom        xa_DT_WORKSPACE_LIST;
1946     Atom        xa_DT_WORKSPACE_CURRENT;
1947
1948     Atom        xa_ALL_WORKSPACES;
1949     Atom        xa_DT_SESSION_HINTS;
1950     Atom        xa_DT_WM_REQUEST;
1951
1952     Atom        xa_DT_SM_WM_PROTOCOL;
1953     Atom        xa_DT_SM_START_ACK_WINDOWS;
1954     Atom        xa_DT_SM_STOP_ACK_WINDOWS;
1955     Atom        xa_DT_WM_WINDOW_ACK;
1956     Atom        xa_DT_WM_EXIT_SESSION;
1957     Atom        xa_DT_WM_LOCK_DISPLAY;
1958     Atom        xa_DT_WM_READY;
1959
1960 #ifndef NO_OL_COMPAT
1961     Atom        xa_OL_WIN_ATTR;
1962     Atom        xa_OL_DECOR_RESIZE;
1963     Atom        xa_OL_DECOR_HEADER;
1964     Atom        xa_OL_DECOR_CLOSE;
1965     Atom        xa_OL_DECOR_PIN;
1966     Atom        xa_OL_DECOR_ADD;
1967     Atom        xa_OL_DECOR_DEL;
1968     Atom        xa_OL_WT_BASE;
1969     Atom        xa_OL_WT_COMMAND;
1970     Atom        xa_OL_WT_HELP;
1971     Atom        xa_OL_WT_NOTICE;
1972     Atom        xa_OL_WT_OTHER;
1973     Atom        xa_OL_PIN_IN;
1974     Atom        xa_OL_PIN_OUT;
1975     Atom        xa_OL_MENU_LIMITED;
1976     Atom        xa_OL_MENU_FULL;
1977 #endif /* NO_OL_COMPAT */
1978
1979     /* mwm specific appearance and behavior resources and data: */
1980
1981     Boolean     autoKeyFocus;                   /* resource */
1982     int         autoRaiseDelay;                 /* resource */
1983     String      bitmapDirectory;                /* resource */
1984     String      backdropDirs;                   /* resource */
1985     Boolean     clientAutoPlace;                /* resource */
1986     int         colormapFocusPolicy;            /* resource */
1987     String      configFile;                     /* resource */
1988     String      cppCommand;                     /* resource */
1989     Boolean     deiconifyKeyFocus;              /* resource */
1990     int         doubleClickTime;                /* resource */
1991     Boolean     enableWarp;                     /* resource */
1992     Boolean     enforceKeyFocus;                /* resource */
1993     Boolean     freezeOnConfig;                 /* resource - testing */
1994     Boolean     useWindowOutline;               /* resource */
1995     Boolean     iconAutoPlace;                  /* resource */
1996     Boolean     iconClick;                      /* resource */
1997     Boolean     interactivePlacement;           /* resource */
1998     int         keyboardFocusPolicy;            /* resource */
1999     Boolean     lowerOnIconify;                 /* resource */
2000     int         moveThreshold;                  /* resource */
2001     Boolean     passButtonsCheck; /* used to override passButtons */
2002     Boolean     passButtons;                    /* resource */
2003     Boolean     passSelectButton;               /* resource */
2004     Boolean     positionIsFrame;                /* resource */
2005     Boolean     positionOnScreen;               /* resource */
2006     int         quitTimeout;                    /* resource */
2007     Boolean     raiseKeyFocus;                  /* resource */
2008     Boolean     multiScreen;                    /* resource */
2009     String      screenList;                     /* resource */
2010     int         showFeedback;                   /* resource */
2011     Boolean     refreshByClearing;              /* resource */
2012     Boolean     rootButtonClick;                /* resource */
2013     Boolean     startupKeyFocus;                /* resource */
2014     Boolean     systemButtonClick;              /* resource */
2015     Boolean     systemButtonClick2;             /* resource */
2016     Boolean     useLargeCursors;
2017     Boolean     useFrontPanel;                  /* resource */
2018     String      helpDirectory;                  /* resource */
2019     Window      requestContextWin;              /* for WmRequest f.fcns */
2020     Boolean     dtLite;                        /* resource */
2021     Boolean     blinkOnExec;                    /* resource */
2022     WmScreenData *dtSD; /* screen for front panel */
2023     int         iSlideUpsInProgress;
2024     Boolean     waitForClicks;                  /* resource */
2025     FrameStyle  frameStyle;                     /* resource */
2026     Dimension   iconExternalShadowWidth;        /* resource */
2027     Dimension   frameExternalShadowWidth;       /* resource */
2028     int         marqueeSelectGranularity;       /* resource */
2029     XButtonEvent evLastButton;                  /* for detecting replayed 
2030                                                    button events */
2031     Boolean     bReplayedButton;                /* true if button replayed */
2032     Boolean     bSuspendSecondaryRestack;       /* overrides transient
2033                                                    stacking */
2034
2035     XmString    clientDefaultTitle;
2036     XmString    iconDefaultTitle;
2037
2038     Window      attributesWindow;
2039     XWindowAttributes   windowAttributes;
2040
2041 #ifndef NO_SHAPE
2042     Boolean     hasShape;                /* server supports Shape extension */
2043     int         shapeEventBase, shapeErrorBase;
2044 #endif /* NO_SHAPE */
2045     /* Need to replay enter notify events on windows with the
2046        pointer that used to be modalized.  This is for pointer focus. */
2047     int         replayEnterEvent;
2048     XEnterWindowEvent savedEnterEvent;
2049
2050     unsigned int lockingModMask;        /* mask of locking modifier keys */
2051     unsigned int *pLockMaskSequence;    
2052
2053     unsigned char tmpBuffer[MAXBUF];    /* replaces static buffers used */
2054                                         /* for large return values */
2055
2056     int numMouseButtons;                /* num of mouse buttons available */
2057     unsigned int bMenuButton;           /* BMenu binding (button/state) */
2058 #if defined(sun) && defined(ALLPLANES)
2059     Bool        allplanes;              /* is SUN_ALLPLANES available? */
2060 #endif /* defined(sun) && defined(ALLPLANES) */
2061 } WmGlobalData;
2062
2063 /* quick references to global data: */
2064 #define DISPLAY         wmGD.display
2065 #define DISPLAY1        wmGD.display1
2066 #define ACTIVE_PSD      (wmGD.pActiveSD)
2067 #define ACTIVE_SCREEN   (wmGD.pActiveSD->screen)
2068 #define ACTIVE_WS       (wmGD.pActiveSD->pActiveWS)
2069 #define ACTIVE_ROOT     (wmGD.pActiveSD->rootWindow)
2070 #define ACTIVE_ICON_TEXT_WIN (wmGD.pActiveSD->activeIconTextWin)
2071
2072 /* According to the xkb protocol bits 13 and 14 are interpreted as a  */
2073 /* two-bit unsigned numeric value and report the state keyboard group */
2074 #define NOLOCKMOD(state)  ((state) & ~wmGD.lockingModMask & ~(3 << 13))
2075 /* absent map behavior policy values (absentMapBehavior): */
2076 #define AMAP_BEHAVIOR_ADD       0
2077 #define AMAP_BEHAVIOR_MOVE      1
2078 #define AMAP_BEHAVIOR_IGNORE    2 
2079
2080 /* colormap focus policy values (colormapFocus): */
2081 #define CMAP_FOCUS_EXPLICIT     0
2082 #define CMAP_FOCUS_POINTER      1
2083 #define CMAP_FOCUS_KEYBOARD     2
2084
2085 /* keyboard input focus policy values (keyboardFocus): */
2086 #define KEYBOARD_FOCUS_EXPLICIT 0
2087 #define KEYBOARD_FOCUS_POINTER  1
2088
2089 /* icon appearance values (iconAppearance): */
2090 #define ICON_LABEL_PART                 (1L << 0)
2091 #define ICON_IMAGE_PART                 (1L << 1)
2092 #define ICON_ACTIVE_LABEL_PART          (1L << 2)
2093 #define USE_ICON_DEFAULT_APPEARANCE     (1L << 3)
2094 #define ICON_APPEARANCE_STANDALONE      (ICON_LABEL_PART | ICON_IMAGE_PART |\
2095                                          ICON_ACTIVE_LABEL_PART)
2096 #define ICON_APPEARANCE_ICONBOX         (ICON_LABEL_PART | ICON_IMAGE_PART)
2097
2098 /* icon placement values (iconPlacement, ...): */
2099 #define ICON_PLACE_LEFT_PRIMARY         (1L << 0)
2100 #define ICON_PLACE_RIGHT_PRIMARY        (1L << 1)
2101 #define ICON_PLACE_TOP_PRIMARY          (1L << 2)
2102 #define ICON_PLACE_BOTTOM_PRIMARY       (1L << 3)
2103 #define ICON_PLACE_LEFT_SECONDARY       (1L << 4)
2104 #define ICON_PLACE_RIGHT_SECONDARY      (1L << 5)
2105 #define ICON_PLACE_TOP_SECONDARY        (1L << 6)
2106 #define ICON_PLACE_BOTTOM_SECONDARY     (1L << 7)
2107 #define ICON_PLACE_EDGE                 (1L << 8)
2108 #define ICON_PLACE_TIGHT                (1L << 9)
2109 #define ICON_PLACE_RESERVE              (1L << 10)
2110
2111 #define NO_ICON_PLACE                   -1
2112 #define MINIMUM_ICON_SPACING            4
2113 #define MAXIMUM_ICON_MARGIN             128
2114 #define ICON_IMAGE_MAX_WIDTH            128
2115 #define ICON_IMAGE_MAX_HEIGHT           128
2116 #define ICON_IMAGE_MIN_WIDTH            16
2117 #define ICON_IMAGE_MIN_HEIGHT           16
2118
2119 /*default client window title: */
2120 #define DEFAULT_CLIENT_TITLE    "*****"
2121 #define DEFAULT_ICON_TITLE      DEFAULT_CLIENT_TITLE
2122
2123 /* client decoration parameters */
2124 #define MAXIMUM_FRAME_BORDER_WIDTH      64
2125
2126 /* configuration action (configAction): */
2127 #define NO_ACTION                       0
2128 #define MOVE_CLIENT                     1
2129 #define RESIZE_CLIENT                   2
2130 #define PLACE_CLIENT                    3
2131 #define MARQUEE_SELECT                  4
2132
2133 /* Motif input bindings file name */
2134 #define MOTIF_BINDINGS_FILE             ".motifbind"
2135
2136 /* Data type definitions */
2137 #define GLOBAL_DATA_TYPE                1001
2138 #define CLIENT_DATA_TYPE                1002
2139 #define SCREEN_DATA_TYPE                1003
2140 #define WORKSPACE_DATA_TYPE             1004
2141
2142 #ifndef NO_MESSAGE_CATALOG
2143 /*************************************<->*************************************
2144  *
2145  *  NlsStrings
2146  *
2147  *
2148  *  Description:
2149  *  -----------
2150  *  This structure is used to hold message strings that used to
2151  *  be defines
2152  *
2153  *************************************<->***********************************/
2154
2155 typedef struct _NlsStrings
2156 {
2157     char *default_icon_box_title;
2158     char *builtinSystemMenu;
2159     char *defaultKeyBindings;
2160     char *builtinKeyBindings;
2161     char *defaultButtonBindings;
2162     char *defaultVersionTitle;
2163     char *defaultDtwmHelpTitle;
2164     char *defaultHelpTitle;
2165 } NlsStrings;
2166
2167
2168 extern NlsStrings wmNLS;
2169
2170 #endif
2171
2172 /* Stacking functions */
2173 #define STACK_NORMAL                    0
2174 #define STACK_WITHIN_FAMILY             1
2175 #define STACK_FREE_FAMILY               2
2176
2177 /* UsePPosition values */
2178 #define USE_PPOSITION_OFF               0
2179 #define USE_PPOSITION_ON                1
2180 #define USE_PPOSITION_NONZERO           2
2181
2182 /* Largest dimension for special casing */
2183 #define BIGSIZE 32767
2184
2185 /*
2186  * External references for global data:
2187  */
2188
2189 extern WmGlobalData     wmGD;
2190 extern char     defaultSystemMenuName[];
2191 extern char     defaultKeyBindings[];
2192 extern char     defaultKeyBindingsName[];
2193 #ifndef NO_MESSAGE_CATALOG
2194 extern char     *builtinSystemMenu;
2195 #else
2196 extern char     builtinSystemMenu[];
2197 #endif
2198 extern char     builtinKeyBindings[];
2199
2200 extern Const char       _75_foreground[];
2201 extern Const char       _50_foreground[];
2202 extern Const char       _25_foreground[];
2203
2204
2205 extern char *_DtGetMessage(char *filename, int set, int n, char *s);
2206
2207 /*
2208  * macro to get message catalog strings
2209  */
2210 #ifndef NO_MESSAGE_CATALOG
2211 # ifdef __ultrix
2212 #  define _CLIENT_CAT_NAME "dtwm.cat"
2213 # else  /* __ultrix */
2214 #  define _CLIENT_CAT_NAME "dtwm"
2215 # endif /* __ultrix */
2216 # define GETMESSAGE(set, number, string)\
2217     _DtGetMessage(_CLIENT_CAT_NAME, set, number, string)
2218 #else
2219 # define GETMESSAGE(set, number, string)\
2220     string
2221 #endif
2222 #endif /* _WmGlobal_h */