source: trunk/third/mwm/WmGlobal.h @ 9757

Revision 9757, 47.4 KB checked in by ghudson, 28 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r9756, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2 * (c) Copyright 1989, 1990, 1991, 1992, 1993 OPEN SOFTWARE FOUNDATION, INC.
3 * ALL RIGHTS RESERVED
4*/
5/*
6 * Motif Release 1.2.3
7*/
8/*   $RCSfile: WmGlobal.h,v $ $Revision: 1.1.1.1 $ $Date: 1997-03-25 09:12:20 $ */
9/*
10 * (c) Copyright 1987, 1988, 1989, 1990 HEWLETT-PACKARD COMPANY */
11
12/*
13 * Included Files:
14 */
15
16#include <stdio.h>
17#include <X11/Xlib.h>
18#include <X11/Xutil.h>
19#ifndef NO_SHAPE
20#include <X11/extensions/shape.h>
21#endif /* NO_SHAPE  */
22#include <X11/IntrinsicP.h>
23#include <X11/Intrinsic.h>
24#include <X11/StringDefs.h>
25#include <Xm/MwmUtil.h>
26#ifdef AUTOMATION
27#include <X11/Xfuncs.h>
28#include <AutoMwm.h>
29#endif /* AUTOMATION */
30#include <Xm/Xm.h>
31
32/*
33 * Value definitions and macros:
34 */
35
36#ifdef MOTIF_ONE_DOT_ONE
37#define XmFONTLIST_DEFAULT_TAG  "XmSTRING_DEFAULT_CHARSET"
38#endif
39
40/* window manager name and class used to get resources: */
41#define WM_RESOURCE_CLASS       "Mwm"
42#define WM_RESOURCE_NAME        "mwm"
43
44
45/* ICCC atom names: */
46
47#define _XA_WM_STATE            "WM_STATE"
48#define _XA_WM_PROTOCOLS        "WM_PROTOCOLS"
49#define _XA_WM_CHANGE_STATE     "WM_CHANGE_STATE"
50#define _XA_WM_SAVE_YOURSELF    "WM_SAVE_YOURSELF"
51#define _XA_WM_DELETE_WINDOW    "WM_DELETE_WINDOW"
52#define _XA_WM_TAKE_FOCUS       "WM_TAKE_FOCUS"
53#define _XA_WM_COLORMAP_WINDOWS "WM_COLORMAP_WINDOWS"
54
55/* window manager exit value on fatal errors: */
56#define WM_ERROR_EXIT_VALUE     1
57
58/* built-in button bindings for window manager actions: */
59#define SELECT_BUTTON                   Button1
60#define SELECT_BUTTON_MASK              Button1Mask
61#define SELECT_BUTTON_MOTION_MASK       Button1MotionMask
62
63#define FOCUS_SELECT_BUTTON     SELECT_BUTTON
64#define FOCUS_SELECT_MODIFIERS  0
65
66/* direct manipulation button */
67#define DMANIP_BUTTON                   Button2
68#define DMANIP_BUTTON_MASK              Button2Mask
69#define DMANIP_BUTTON_MOTION_MASK       Button2MotionMask
70
71/* menu button */
72#define BMENU_BUTTON                    Button3
73#define BMENU_BUTTON_MASK               Button3Mask
74
75/* Needed by PostMenu() to specify key post: */
76#define NoButton                0
77
78/* manage window flags: */
79#define MANAGEW_WM_STARTUP      (1L << 0)
80#define MANAGEW_WM_RESTART      (1L << 1)
81#define MANAGEW_NORMAL          (1L << 2)
82#define MANAGEW_ICON_BOX        (1L << 3)
83#define MANAGEW_CONFIRM_BOX     (1L << 4)
84#define MANAGEW_WM_RESTART_ICON (1L << 5)
85
86#define MANAGEW_WM_CLIENTS      (MANAGEW_ICON_BOX | MANAGEW_CONFIRM_BOX)
87
88/* keyboard input focus flag values (for calls to SetKeyboardFocus) */
89#define ALWAYS_SET_FOCUS        (1L << 0)
90#define REFRESH_LAST_FOCUS      (1L << 1)
91#define CLIENT_AREA_FOCUS       (1L << 2)
92#define SCREEN_SWITCH_FOCUS     (1L << 3)
93/* special value for use for Do_Focus_Key to set to internal window */
94#define WORKSPACE_IF_NULL       (1L << 4)
95
96/* Menu posting flag values (for calls to PostMenu) */
97#define POST_AT_XY              (1L << 0)
98#define POST_TRAVERSAL_ON       (1L << 1)
99#define POST_STICKY             (1L << 2)
100
101/* feedback box styles */
102#define FB_OFF                  (0)
103#define FB_SIZE                 (1L << 0)
104#define FB_POSITION             (1L << 1)
105
106/* confirmbox and waitbox indexes */
107#define DEFAULT_BEHAVIOR_ACTION         0
108#define CUSTOM_BEHAVIOR_ACTION          1
109#define RESTART_ACTION          2
110#define QUIT_MWM_ACTION         3
111
112/* extract text height in pixels from a (XFontStruct *) */
113#define TEXT_HEIGHT(pfs) (((pfs)->ascent)+((pfs)->descent))
114
115/* icon frame shadow widths */
116#define ICON_EXTERNAL_SHADOW_WIDTH      2
117#define ICON_INTERNAL_SHADOW_WIDTH      1
118
119/* padding widths */
120#define ICON_IMAGE_TOP_PAD      2
121#define ICON_IMAGE_BOTTOM_PAD   2
122#define ICON_IMAGE_LEFT_PAD     2
123#define ICON_IMAGE_RIGHT_PAD    2
124
125/* image offsets */
126#define ICON_INNER_X_OFFSET     \
127            (ICON_IMAGE_LEFT_PAD+ICON_EXTERNAL_SHADOW_WIDTH)
128#define ICON_INNER_Y_OFFSET     \
129            (ICON_IMAGE_TOP_PAD+ICON_EXTERNAL_SHADOW_WIDTH)
130
131
132#define ICON_IMAGE_X_OFFSET ICON_INNER_X_OFFSET+ICON_INTERNAL_SHADOW_WIDTH
133#define ICON_IMAGE_Y_OFFSET ICON_INNER_Y_OFFSET+ICON_INTERNAL_SHADOW_WIDTH
134
135
136
137/* number of rectangles to allocate */
138#define NUM_IMAGE_TOP_RECTS     \
139            ((2*ICON_EXTERNAL_SHADOW_WIDTH)+(2*ICON_INTERNAL_SHADOW_WIDTH))
140
141
142#define NUM_IMAGE_BOTTOM_RECTS  \
143            ((2*ICON_EXTERNAL_SHADOW_WIDTH)+(2*ICON_INTERNAL_SHADOW_WIDTH))
144
145
146#define NUM_LABEL_TOP_RECTS     (2*ICON_EXTERNAL_SHADOW_WIDTH)
147#define NUM_LABEL_BOTTOM_RECTS  (2*ICON_EXTERNAL_SHADOW_WIDTH)
148
149#define NUM_BOTH_TOP_RECTS      \
150            ((3*ICON_EXTERNAL_SHADOW_WIDTH)+(3*ICON_INTERNAL_SHADOW_WIDTH))
151
152
153#define NUM_BOTH_BOTTOM_RECTS   \
154            ((3*ICON_EXTERNAL_SHADOW_WIDTH)+(3*ICON_INTERNAL_SHADOW_WIDTH))
155
156
157#define NUM_STATIC_TOP_RECTS    (2*ICON_INTERNAL_SHADOW_WIDTH)
158#define NUM_STATIC_BOTTOM_RECTS (2*ICON_INTERNAL_SHADOW_WIDTH)
159
160
161/* client frame shadow widths */
162#define FRAME_EXTERNAL_SHADOW_WIDTH     2
163#define FRAME_INTERNAL_SHADOW_WIDTH     1
164#define FRAME_CLIENT_SHADOW_WIDTH       1
165#define FRAME_MATTE_SHADOW_WIDTH        1
166
167/* padding around text in title bar */
168#define WM_TOP_TITLE_PADDING    1
169#define WM_BOTTOM_TITLE_PADDING 1
170#define WM_TOP_TITLE_SHADOW     FRAME_INTERNAL_SHADOW_WIDTH
171#define WM_BOTTOM_TITLE_SHADOW  FRAME_INTERNAL_SHADOW_WIDTH
172
173#define WM_TITLE_BAR_PADDING    (WM_TOP_TITLE_PADDING \
174                                 +WM_BOTTOM_TITLE_PADDING \
175                                 +WM_TOP_TITLE_SHADOW \
176                                 +WM_BOTTOM_TITLE_SHADOW)
177
178/* stretch directions  - (starts at NW and goes clockwise) */
179#define STRETCH_NO_DIRECTION    -1
180#define STRETCH_NORTH_WEST      0
181#define STRETCH_NORTH           1
182#define STRETCH_NORTH_EAST      2
183#define STRETCH_EAST            3
184#define STRETCH_SOUTH_EAST      4
185#define STRETCH_SOUTH           5
186#define STRETCH_SOUTH_WEST      6
187#define STRETCH_WEST            7
188
189#define STRETCH_COUNT           8
190
191
192/* function flag masks */
193#define WM_FUNC_DEFAULT         MWM_FUNC_ALL
194#define WM_FUNC_NONE            0
195#define WM_FUNC_ALL             (MWM_FUNC_RESIZE | MWM_FUNC_MOVE |\
196                                 MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE |\
197                                 MWM_FUNC_CLOSE)
198
199/* decorations flag masks */
200#define WM_DECOR_DEFAULT        MWM_DECOR_ALL
201#define WM_DECOR_NONE           0
202#define WM_DECOR_BORDER         (MWM_DECOR_BORDER)
203#define WM_DECOR_TITLE          (MWM_DECOR_TITLE)
204#define WM_DECOR_SYSTEM         (WM_DECOR_TITLE | MWM_DECOR_MENU)
205#define WM_DECOR_MINIMIZE       (WM_DECOR_TITLE | MWM_DECOR_MINIMIZE)
206#define WM_DECOR_MAXIMIZE       (WM_DECOR_TITLE | MWM_DECOR_MAXIMIZE)
207#define WM_DECOR_TITLEBAR       (WM_DECOR_SYSTEM | WM_DECOR_MINIMIZE |\
208                                 WM_DECOR_MAXIMIZE)
209#define WM_DECOR_RESIZEH        (WM_DECOR_BORDER | MWM_DECOR_RESIZEH)
210#define WM_DECOR_RESIZE         (WM_DECOR_RESIZEH)
211#define WM_DECOR_ALL            (WM_DECOR_TITLEBAR | WM_DECOR_RESIZEH)
212
213
214/* icon box definitions */
215#define ICON_BOX_FUNCTIONS      (MWM_FUNC_RESIZE | MWM_FUNC_MOVE |\
216                                 MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE)
217
218
219/* show feedback definitions */
220#define WM_SHOW_FB_BEHAVIOR     (1L << 0)
221#define WM_SHOW_FB_MOVE         (1L << 1)
222#define WM_SHOW_FB_PLACEMENT    (1L << 2)
223#define WM_SHOW_FB_RESIZE       (1L << 3)
224#define WM_SHOW_FB_RESTART      (1L << 4)
225#define WM_SHOW_FB_QUIT         (1L << 5)
226#define WM_SHOW_FB_KILL         (1L << 6)
227
228#define WM_SHOW_FB_ALL          (WM_SHOW_FB_BEHAVIOR  | WM_SHOW_FB_MOVE    |\
229                                 WM_SHOW_FB_PLACEMENT | WM_SHOW_FB_RESIZE  |\
230                                 WM_SHOW_FB_RESTART   | WM_SHOW_FB_QUIT    |\
231                                 WM_SHOW_FB_KILL)
232
233#define WM_SHOW_FB_NONE         0
234
235#define WM_SHOW_FB_DEFAULT      WM_SHOW_FB_ALL
236
237
238
239
240/*************************************<->*************************************
241 *
242 *  Miscellaneous utility window manager data structures ...
243 *
244 *
245 *  Description:
246 *  -----------
247 *  These data structures are used in resource processing, ...
248 *
249 *************************************<->***********************************/
250
251typedef struct _WHSize
252{
253    int         width;
254    int         height;
255
256} WHSize;
257
258
259typedef struct _AspectRatio
260{
261    int         x;
262    int         y;
263
264} AspectRatio;
265
266
267typedef struct _WmColorData
268{
269    Screen *screen;
270    Colormap colormap;
271    Pixel background;
272    Pixel foreground;
273    Pixel top_shadow;
274    Pixel bottom_shadow;
275
276} WmColorData;
277
278
279
280/*************************************<->*************************************
281 *
282 *  Event processing data structures ...
283 *
284 *
285 *  Description:
286 *  -----------
287 *  These data structures are used in saving button and key
288 *  specifications that are used in processing events that are used to do
289 *  window manager functions (e.g., set the colormap focus).
290 *
291 *************************************<->***********************************/
292
293typedef unsigned long Context;
294typedef unsigned long Behavior;
295typedef unsigned long GroupArg;
296
297typedef Boolean (*WmFunction) ();
298
299#define NO_MODIFIER     0               /* value for state field */
300
301typedef struct _KeySpec
302{
303    unsigned int state;
304    KeyCode      keycode;
305    Context      context;
306    Context      subContext;
307    WmFunction   wmFunction;
308    String       wmFuncArgs;
309    struct _KeySpec *nextKeySpec;
310
311} KeySpec;
312
313typedef struct _ButtonSpec
314{
315    unsigned int state;
316    unsigned int button;
317    unsigned int eventType;
318    Boolean     click;
319    Context     context;
320    Context     subContext;
321    WmFunction  wmFunction;
322    String      wmFuncArgs;
323    struct _ButtonSpec *nextButtonSpec;
324
325} ButtonSpec;
326
327
328/*
329 * Context field values:
330 */
331
332#define F_CONTEXT_NONE          0
333#define F_CONTEXT_ROOT          (1L << 0)
334#define F_CONTEXT_ICON          (1L << 1)
335#define F_CONTEXT_NORMAL        (1L << 2)
336#define F_CONTEXT_MAXIMIZE      (1L << 3)
337#define F_CONTEXT_ICONBOX       (1L << 4)
338#define F_CONTEXT_WINDOW        (F_CONTEXT_NORMAL|F_CONTEXT_MAXIMIZE)
339#define F_CONTEXT_ALL           (F_CONTEXT_ROOT|F_CONTEXT_ICON|F_CONTEXT_WINDOW)
340
341
342/*
343 * context field mark for catching menu recursion
344 *   (tied to F_CONTEXT_... values):
345 */
346
347#define CR_MENU_MARK            (1L << 5)
348
349
350/*
351 * Part context defines for event processing.  The part context is used
352 * to make a subcontext mask.
353 */
354
355/* window (frame and client) part contexts */
356#define WINDOW_PART_NONE        0
357#define FRAME_NONE              WINDOW_PART_NONE
358#define FRAME_CLIENT            1
359#define FRAME_SYSTEM            2
360#define FRAME_TITLE             3
361#define FRAME_MINIMIZE          4
362#define FRAME_MAXIMIZE          5
363#define FRAME_RESIZE_NW         6
364#define FRAME_RESIZE_N          7
365#define FRAME_RESIZE_NE         8
366#define FRAME_RESIZE_E          9
367#define FRAME_RESIZE_SE         10
368#define FRAME_RESIZE_S          11
369#define FRAME_RESIZE_SW         12
370#define FRAME_RESIZE_W          13
371#define FRAME_NBORDER           14
372#define FRAME_MATTE             15
373#define FRAME_MISC              FRAME_MATTE
374
375/* icon part contexts */
376#define ICON_PART_NONE          0
377#define ICON_PART_ALL           16
378
379/* root part contexts */
380#define ROOT_PART_NONE          0
381#define ROOT_PART_ALL           17
382
383/* iconbox part contexts */
384#define ICONBOX_PART_NONE       0
385#define ICONBOX_PART_IBOX       18
386#define ICONBOX_PART_IICON      19
387#define ICONBOX_PART_WICON      20
388
389
390/*
391 * Subcontext field values:
392 */
393
394#define F_SUBCONTEXT_NONE               (1L << WINDOW_PART_NONE)
395
396#define F_SUBCONTEXT_I_ALL              (1L << ICON_PART_ALL)
397
398#define F_SUBCONTEXT_R_ALL              (1L << ROOT_PART_ALL)
399
400
401#define F_SUBCONTEXT_IB_IBOX            (1L << ICONBOX_PART_IBOX)
402#define F_SUBCONTEXT_IB_IICON           (1L << ICONBOX_PART_IICON)
403#define F_SUBCONTEXT_IB_WICON           (1L << ICONBOX_PART_WICON)
404
405#define F_SUBCONTEXT_IB_ICONS           (F_SUBCONTEXT_IB_IICON |\
406                                         F_SUBCONTEXT_IB_WICON)
407
408#define F_SUBCONTEXT_IB_ALL             (F_SUBCONTEXT_IB_IBOX |\
409                                         F_SUBCONTEXT_IB_IICON |\
410                                         F_SUBCONTEXT_IB_WICON)
411
412
413#define F_SUBCONTEXT_W_CLIENT           (1L << FRAME_CLIENT)
414#define F_SUBCONTEXT_W_APP              F_SUBCONTEXT_W_CLIENT
415#define F_SUBCONTEXT_W_SYSTEM           (1L << FRAME_SYSTEM)
416#define F_SUBCONTEXT_W_TITLE            (1L << FRAME_TITLE)
417#define F_SUBCONTEXT_W_MINIMIZE         (1L << FRAME_MINIMIZE)
418#define F_SUBCONTEXT_W_MAXIMIZE         (1L << FRAME_MAXIMIZE)
419#define F_SUBCONTEXT_W_RESIZE_NW        (1L << FRAME_RESIZE_NW)
420#define F_SUBCONTEXT_W_RESIZE_N         (1L << FRAME_RESIZE_N)
421#define F_SUBCONTEXT_W_RESIZE_NE        (1L << FRAME_RESIZE_NE)
422#define F_SUBCONTEXT_W_RESIZE_E         (1L << FRAME_RESIZE_E)
423#define F_SUBCONTEXT_W_RESIZE_SE        (1L << FRAME_RESIZE_SE)
424#define F_SUBCONTEXT_W_RESIZE_S         (1L << FRAME_RESIZE_S)
425#define F_SUBCONTEXT_W_RESIZE_SW        (1L << FRAME_RESIZE_SW)
426#define F_SUBCONTEXT_W_RESIZE_W         (1L << FRAME_RESIZE_W)
427#define F_SUBCONTEXT_W_NBORDER          (1L << FRAME_NBORDER)
428#define F_SUBCONTEXT_W_MATTE            (1L << FRAME_MATTE)
429#define F_SUBCONTEXT_W_MISC             F_SUBCONTEXT_W_MATTE
430
431
432#define F_SUBCONTEXT_W_RBORDER          (F_SUBCONTEXT_W_RESIZE_NW |\
433                                         F_SUBCONTEXT_W_RESIZE_N |\
434                                         F_SUBCONTEXT_W_RESIZE_NE |\
435                                         F_SUBCONTEXT_W_RESIZE_E |\
436                                         F_SUBCONTEXT_W_RESIZE_SE |\
437                                         F_SUBCONTEXT_W_RESIZE_S |\
438                                         F_SUBCONTEXT_W_RESIZE_SW |\
439                                         F_SUBCONTEXT_W_RESIZE_W)
440
441#define F_SUBCONTEXT_W_BORDER           (F_SUBCONTEXT_W_RBORDER |\
442                                         F_SUBCONTEXT_W_NBORDER)
443
444#define F_SUBCONTEXT_W_TITLEBAR         (F_SUBCONTEXT_W_SYSTEM |\
445                                         F_SUBCONTEXT_W_TITLE |\
446                                         F_SUBCONTEXT_W_MINIMIZE |\
447                                         F_SUBCONTEXT_W_MAXIMIZE)
448
449#define F_SUBCONTEXT_W_FRAME            (F_SUBCONTEXT_W_BORDER |\
450                                         F_SUBCONTEXT_W_TITLEBAR)
451
452#define F_SUBCONTEXT_W_ALL              (F_SUBCONTEXT_W_FRAME |\
453                                         F_SUBCONTEXT_W_MATTE |\
454                                         F_SUBCONTEXT_W_CLIENT)
455
456
457/*
458 * Click / double-click processing data:
459 */
460
461typedef struct _ClickData
462{
463    Boolean     clickPending;
464    Boolean     doubleClickPending;
465    unsigned int button;
466    unsigned int state;
467    unsigned int releaseState;
468    struct _ClientData *pCD;
469    Context     context;
470    Context     subContext;
471    Context     clickContext;
472    Context     doubleClickContext;
473    Time        time;
474
475} ClickData;
476
477
478/*
479 * Frame part identification aids:
480 */
481
482typedef struct _Gadget_Rectangle
483{
484    short       id;
485    XRectangle  rect;
486
487} GadgetRectangle;
488
489
490/*
491 * Behavior function argument field values:
492 */
493
494#define F_BEHAVIOR_DEFAULT      (1L << 0)
495#define F_BEHAVIOR_CUSTOM       (1L << 1)
496#define F_BEHAVIOR_SWITCH       (1L << 2)
497
498
499/*
500 * Window/icon group function argument field values:
501 */
502
503#define F_GROUP_WINDOW          (1L << 0)
504#define F_GROUP_ICON            (1L << 1)
505#define F_GROUP_DEFAULT         (F_GROUP_WINDOW | F_GROUP_ICON)
506#define F_GROUP_TRANSIENT       (1L << 2)
507#define F_GROUP_ALL             (F_GROUP_DEFAULT | F_GROUP_TRANSIENT)
508#define F_GROUP_GROUP           (1L << 3)
509
510
511
512/*************************************<->*************************************
513 *
514 *  Menu specification data structures ...
515 *
516 *
517 *  Description:
518 *  -----------
519 *  These data structures are used in creating window manager menus that
520 *  are specified using resource files.  A list of menu specifications
521 *  (MenuSpec) is made when the resource files are parsed.  The desktop
522 *  menu and system menus are created as needed using the menu specification
523 *  list.
524 *
525 *************************************<->***********************************/
526
527typedef struct _MenuItem
528{
529    int          labelType;
530    String       label;
531    int          labelBitmapIndex;
532    KeySym       mnemonic;
533    unsigned int accelState;
534    KeyCode      accelKeyCode;
535    String       accelText;
536    WmFunction   wmFunction;
537    String       wmFuncArgs;
538    Context      greyedContext;
539    long         mgtMask;
540    struct _MenuItem *nextMenuItem;
541
542} MenuItem;
543
544
545typedef struct _MenuButton
546{
547    MenuItem    *menuItem;
548    Widget      buttonWidget;
549    Boolean     managed;
550
551} MenuButton;
552
553
554typedef struct _MenuSpec
555{
556    String        name;
557    Context       currentContext;
558    Widget        menuWidget;      /* RowColumn widget */
559    unsigned int  whichButton;    /* tracks whichButton resource for top menu */
560    unsigned int  height;          /* height of top menu */
561    MenuItem     *menuItems;       /* linked list of MenuItem structures */
562    MenuButton   *menuButtons;     /* array of MenuButton structures */
563    unsigned int  menuButtonSize;  /* size of menuButtons array */
564    unsigned int  menuButtonCount; /* number of menuButtons elements in use */
565    Context       accelContext;    /* accelerator context */
566    KeySpec      *accelKeySpecs;   /* list of accelerator KeySpecs */
567    struct _MenuSpec *nextMenuSpec;
568
569} MenuSpec;
570
571
572/*************************************<->*************************************
573 *
574 *  Window and function specification data structures ...
575 *
576 *
577 *  Description:
578 *  -----------
579 *
580 *************************************<->***********************************/
581
582typedef struct _WindowItem
583{
584    String              window;
585    struct _WindowItem *nextWindowItem;
586
587} WindowItem;
588
589typedef struct _WindowSet
590{
591    String             name;
592    WindowItem        *windowItems;
593    struct _WindowSet *nextWindowSet;
594
595} WindowSet;
596
597typedef struct _FunctionItem
598{
599    WmFunction            wmFunction;
600    String                wmFuncArgs;
601    struct _FunctionItem *nextFunctionItem;
602
603} FunctionItem;
604
605typedef struct _FunctionSet
606{
607    String               name;
608    FunctionItem        *functionItems;
609    struct _FunctionSet *nextFunctionSet;
610
611} FunctionSet;
612
613
614/*************************************<->*************************************
615 *
616 *  Window manager timer data structure ...
617 *
618 *
619 *  Description:
620 *  -----------
621 *  This data stucture is used to keep track of window manager timers.  Each
622 *  active timer has an instance of the data structure.
623 *
624 *************************************<->***********************************/
625
626typedef struct _WmTimer
627{
628    XtIntervalId        timerId;
629    struct _ClientData  *timerCD;
630    unsigned int        timerType;
631    struct _WmTimer     *nextWmTimer;
632
633} WmTimer;
634
635/* Timer types: */
636#define TIMER_NONE              0
637#define TIMER_QUIT              1
638#define TIMER_RAISE             2
639
640
641/*************************************<->*************************************
642 *
643 *  Window manager frame component data structures
644 *
645 *
646 *  Description:
647 *  -----------
648 *  This data stucture is used for drawing frame component graphics.
649 *
650 *************************************<->***********************************/
651
652typedef struct _RList
653{
654    int         allocated;              /* number of allocated XRectangles */
655    int         used;                   /* number currently in use */
656    XRectangle  *prect;                 /* array of XRectangles */
657} RList;
658
659
660
661
662/*************************************<->*************************************
663 *
664 *  Window manager component appearance data structure ...
665 *
666 *
667 *  Description:
668 *  -----------
669 *  This structure is used to hold component appearance data for client,
670 *  icon, and feedback subparts.
671 *
672 *************************************<->***********************************/
673
674
675typedef struct _AppearanceData
676{
677    XmFontList  fontList;                       /* resource */
678    XFontStruct *font;
679#ifndef NO_MULTIBYTE
680    unsigned int        titleHeight;            /* title bar's height */
681#endif
682    Boolean     saveUnder;                      /* resource */
683    Pixel       background;                     /* resource */
684    Pixel       foreground;                     /* resource */
685    String      backgroundPStr;                 /* resource */
686    Pixmap      backgroundPixmap;
687    Pixel       bottomShadowColor;              /* resource */
688    String      bottomShadowPStr;               /* resource */
689    Pixmap      bottomShadowPixmap;
690    Pixel       topShadowColor;                 /* resource */
691    String      topShadowPStr;                  /* resource */
692    Pixmap      topShadowPixmap;
693    Pixel       activeBackground;               /* resource */
694    String      activeBackgroundPStr;           /* resource */
695    Pixmap      activeBackgroundPixmap;
696    Pixel       activeBottomShadowColor;        /* resource */
697    String      activeBottomShadowPStr;         /* resource */
698    Pixmap      activeBottomShadowPixmap;
699    Pixel       activeForeground;               /* resource */
700    Pixel       activeTopShadowColor;           /* resource */
701    String      activeTopShadowPStr;            /* resource */
702    Pixmap      activeTopShadowPixmap;
703
704    GC          inactiveGC;
705    GC          inactiveTopShadowGC;
706    GC          inactiveBottomShadowGC;
707    GC          activeGC;
708    GC          activeTopShadowGC;
709    GC          activeBottomShadowGC;
710
711} AppearanceData;
712
713
714typedef struct _AppearanceData *PtrAppearanceData;
715
716
717/*************************************<->*************************************
718 *
719 *  IconInfo
720 *
721 *
722 *  Description:
723 *  -----------
724 *
725 *************************************<->***********************************/
726
727typedef struct _IconInfo
728{
729        Widget theWidget;
730        struct _ClientData *pCD;
731} IconInfo;
732
733typedef struct _IconInfo *PtrIconInfo;
734
735
736
737/*************************************<->*************************************
738 *
739 *  IconPlacement
740 *
741 *
742 *  Description:
743 *  -----------
744 *
745 *************************************<->***********************************/
746
747typedef struct _IconPlacementData
748{
749    Boolean     onRootWindow;           /* true if icons on root window */
750    unsigned    iconPlacement;          /* style of placement */
751    int         placementRows;          /* number of rows in placement space */
752    int         placementCols;          /* number of cols in placement space */
753    int         totalPlaces;            /* total number of placment slots */
754    int         iPlaceW;                /* width increment (to next place) */
755    int         iPlaceH;                /* height increment (to next place) */
756    IconInfo    *placeList;             /* list of icon info */
757    int         placeIconX;
758    int         placeIconY;
759    int         *placementRowY;
760    int         *placementColX;
761} IconPlacementData;
762
763
764
765/*************************************<->*************************************
766 *
767 *  IconBoxData
768 *
769 *
770 *  Description:
771 *  -----------
772 *  This structure is used to hold window and widget information for
773 *  each icon box.
774 *
775 *************************************<->***********************************/
776
777typedef struct _IconBoxData
778{
779    Widget      shellWidget;
780    Widget      frameWidget;
781    Widget      scrolledWidget;
782    Widget      vScrollBar;
783    Widget      hScrollBar;
784    Widget      bBoardWidget;
785    Widget      clipWidget;
786    int         numberOfIcons;
787    int         currentRow;
788    int         currentCol;
789    int         lastRow;
790    int         lastCol;
791    struct _ClientData  *pCD_iconBox;   /* ptr to its own clientdata */
792    struct _IconBoxData *pNextIconBox;  /* ptr to next icon box */
793    struct _IconPlacementData IPD;      /* icon placement data */
794} IconBoxData;
795
796typedef struct _IconBoxData *PtrIconBoxData;
797
798#define IB_SPACING              0
799#define IB_MARGIN_HEIGHT        3
800#define IB_MARGIN_WIDTH         3
801#define IB_HIGHLIGHT_BORDER     3
802
803
804/*************************************<->*************************************
805 *
806 *  Bitmap/Pixmap cache data
807 *
808 *
809 *  Description:
810 *  -----------
811 *  These structures are used for the bitmap and pixmap caches held
812 *  on a per-screen basis. (This is per-screen because you can't do
813 *  XCopyPlane from one pixmap to another when they have different
814 *  roots.)
815 *
816 *************************************<->***********************************/
817
818#define NO_PIXMAP    0
819#define LABEL_PIXMAP 1
820#define ICON_PIXMAP  2
821
822typedef struct _PixmapCache
823{
824   unsigned int  pixmapType;   /* icon or label? */
825   Pixel         foreground;
826   Pixel         background;
827   Pixmap        pixmap;
828   struct _PixmapCache *next;
829
830} PixmapCache;
831
832typedef struct _BitmapCache
833{
834   char         *path;
835   Pixmap        bitmap;
836   unsigned int  width;
837   unsigned int  height;
838   PixmapCache  *pixmapCache;
839
840} BitmapCache;
841
842
843
844
845
846/******************************<->*************************************
847 *
848 *  Client window list entry data structure ...
849 *
850 *
851 *  Description:
852 *  -----------
853 *  This structure provides the data for an entry in the client window list.
854 *  The client window list has an entry for each non-transient client
855 *  window and each non-iconbox icon.
856 *
857 ******************************<->***********************************/
858
859typedef struct _ClientListEntry
860{
861    struct _ClientListEntry *nextSibling;
862    struct _ClientListEntry *prevSibling;
863    int         type;
864    struct _ClientData *pCD;
865
866} ClientListEntry;
867
868
869
870/*************************************<->*************************************
871 *
872 *  Frame information
873 *
874 *
875 *  Description:
876 *  -----------
877 *  This structure contains geometry information for the window manager
878 *  frame.
879 *
880 *************************************<->***********************************/
881
882typedef struct _FrameInfo
883{
884    int                 x;
885    int                 y;
886    unsigned int        width;
887    unsigned int        height;
888    unsigned int        upperBorderWidth;
889    unsigned int        lowerBorderWidth;
890    unsigned int        cornerWidth;
891    unsigned int        cornerHeight;
892    unsigned int        titleBarHeight;
893
894} FrameInfo;
895
896
897
898/*************************************<->*************************************
899 *
900 *  WmScreenData
901 *
902 *
903 *  Description:
904 *  -----------
905 *  This is the data structure for holding the window manager's
906 *  screen data. There is one instantiation of the structure for
907 *  each screen.
908 *
909 *************************************<->***********************************/
910
911typedef struct _WmScreenData
912{
913    int         dataType;
914    int         screen;                 /* number for this screen */
915    Boolean     managed;
916    Window      rootWindow;
917    Widget      screenTopLevelW;
918    Widget      screenTopLevelW1;       /* for internal WM components */
919    Widget      confirmboxW[4];
920    Window      wmWorkspaceWin;         /* holds wm properties */
921    Window      feedbackWin;
922    Window      activeIconTextWin;
923    Window      activeLabelParent;
924    String      displayString;          /* used for putenv in F_Exec */
925
926    /* wm state info: */
927
928    unsigned long clientCounter;
929    long        focusPriority;
930    Window      inputScreenWindow;
931    struct _ClientData  *colormapFocus;
932    Colormap    workspaceColormap;
933    Colormap    lastInstalledColormap;
934    struct _WmWorkspaceData     *pActiveWS;     /* for this screen */
935
936    /* per screen caches */
937    BitmapCache *bitmapCache;
938    unsigned int bitmapCacheSize;
939    unsigned int bitmapCacheCount;
940
941    /* per screen icon info */
942    Boolean     fadeNormalIcon;                 /* resource */
943    long        iconPlacement;                  /* resource */
944    int         iconPlacementMargin;            /* resource */
945    long        iconDecoration;                 /* resource */
946    WHSize      iconImageMaximum;               /* resource */
947    WHSize      iconImageMinimum;               /* resource */
948    Pixmap      builtinIconPixmap;
949    int         iconWidth;
950    int         iconHeight;
951    int         iconImageHeight;
952    int         iconLabelHeight;
953    GC          shrinkWrapGC;
954    GC          fadeIconGC;
955    GC          fadeIconTextGC;
956
957
958    /* per screen feedback data */
959    unsigned long fbStyle;
960    unsigned int fbWinWidth;
961    unsigned int fbWinHeight;
962    char fbLocation[20];
963    char fbSize[20];
964    int fbLocX;
965    int fbLocY;
966    int fbSizeX;
967    int fbSizeY;
968    int fbLastX;
969    int fbLastY;
970    unsigned int fbLastWidth;
971    unsigned int fbLastHeight;
972    RList *fbTop;
973    RList *fbBottom;
974    int     actionNbr;
975
976    /* resource description file data: */
977
978    String      buttonBindings;                 /* resource */
979    ButtonSpec  *buttonSpecs;
980    String      keyBindings;                    /* resource */
981    KeySpec     *keySpecs;
982    MenuSpec   **acceleratorMenuSpecs;
983    unsigned int acceleratorMenuCount;
984    MenuSpec    *menuSpecs;
985
986    Boolean     defaultSystemMenuUseBuiltin;
987
988    Pixmap      defaultPixmap;
989    GC          xorGC;
990
991    /* per screen appearance resources */
992
993    Boolean     cleanText;                      /* resource */
994    Boolean     decoupleTitleAppearance;        /* see clientTitleAppearance */
995    int         frameBorderWidth;               /* resource */
996    String      feedbackGeometry;               /* resource */
997    String      iconBoxGeometry;                /* resource */
998    String      iconBoxName;                    /* resource */
999    String      iconBoxSBDisplayPolicy;         /* resource */
1000    int         iconBoxScheme;                  /* resource - testing */
1001    XmString    iconBoxTitle;                   /* resource */
1002    int         externalBevel;
1003    int         joinBevel;
1004    Boolean     limitResize;                    /* resource */
1005    WHSize      maximumMaximumSize;             /* resource */
1006    int         resizeBorderWidth;              /* resource */
1007    Boolean     resizeCursors;                  /* resource */
1008    int         transientDecoration;            /* resource */
1009    int         transientFunctions;             /* resource */
1010    Boolean     useIconBox;                     /* resource */
1011    Boolean     moveOpaque;                     /* move window not outlines */
1012
1013
1014    /* client frame component appearance resources and data: */
1015
1016    AppearanceData clientAppearance;            /* resources ... */
1017    AppearanceData clientTitleAppearance;       /* resources ... */
1018    XPoint      transientOffset;
1019    int         Num_Resize_Ts_Elements;
1020    int         Num_Resize_Bs_Elements;
1021    int         Num_Title_Ts_Elements;
1022    int         Num_Title_Bs_Elements;
1023
1024    /* icon component appearance resources and data: */
1025
1026    AppearanceData iconAppearance;              /* resources ... */
1027
1028    /* feedback component appearance resources and data: */
1029
1030    AppearanceData feedbackAppearance;          /* resources ... */
1031
1032    /* client list pointers: */
1033
1034    ClientListEntry     *clientList;
1035    ClientListEntry     *lastClient;
1036
1037    /* workspace for this screen */
1038
1039    struct _WmWorkspaceData     *pWS;
1040
1041} WmScreenData;
1042
1043typedef struct _WmScreenData *PtrScreenData;
1044
1045
1046/*
1047 * Convenience macros for data access
1048 */
1049#define ROOT_FOR_CLIENT(pcd) ((pcd)->pSD->rootWindow)
1050#define SCREEN_FOR_CLIENT(pcd) ((pcd)->pSD->screen)
1051#define PSD_FOR_CLIENT(pcd) ((pcd)->pSD)
1052#define BUTTON_SPECS(pcd) ((pcd)->pSD->buttonSpecs)
1053#define KEY_SPECS(pcd) ((pcd)->pSD->keySpecs)
1054#define ACCELERATOR_MENU_COUNT(pcd) ((pcd)->pSD->acceleratorMenuCount)
1055#define ACCELERATOR_MENU_SPECS(pcd) ((pcd)->pSD->acceleratorMenuSpecs)
1056#define WORKSPACE_COLORMAP(pcd) ((pcd)->pSD->workspaceColormap)
1057#define FADE_NORMAL_ICON(pcd) ((pcd)->pSD->fadeNormalIcon)
1058/*
1059#define ICON_DEFAULT_TITLE(pcd) ((pcd)->iconDefaultTitle)
1060*/
1061#define ICON_DECORATION(pcd) ((pcd)->pSD->iconDecoration)
1062#define ICON_HEIGHT(pcd) ((pcd)->pSD->iconHeight)
1063#define ICON_WIDTH(pcd) ((pcd)->pSD->iconWidth)
1064#define ICON_IMAGE_HEIGHT(pcd) ((pcd)->pSD->iconImageHeight)
1065#define ICON_LABEL_HEIGHT(pcd) ((pcd)->pSD->iconLabelHeight)
1066#define ICON_IMAGE_MAXIMUM(pcd) ((pcd)->pSD->iconImageMaximum)
1067#define ICON_IMAGE_MINIMUM(pcd) ((pcd)->pSD->iconImageMinimum)
1068#define SHRINK_WRAP_GC(pcd) ((pcd)->pSD->shrinkWrapGC)
1069#define FADE_ICON_GC(pcd) ((pcd)->pSD->fadeIconGC)
1070#define FADE_ICON_TEXT_GC(pcd) ((pcd)->pSD->fadeIconTextGC)
1071#define DEFAULT_PIXMAP(pcd) ((pcd)->pSD->defaultPixmap)
1072#define ICON_PLACE(pcd) ((pcd)->iconPlace)
1073#define ICON_X(pcd) ((pcd)->iconX)
1074#define ICON_Y(pcd) ((pcd)->iconY)
1075#define P_ICON_BOX(pcd) ((pcd)->pIconBox)
1076#define ICON_FRAME_WIN(pcd) ((pcd)->iconFrameWin)
1077
1078 
1079
1080
1081/*************************************<->*************************************
1082 *
1083 *  WmWorkspaceData
1084 *
1085 *
1086 *  Description:
1087 *  -----------
1088 *  This is the structure for holding the workspace specific data.
1089 *  (This has been broken out in anticipation of possible future
1090 *  enhancements.)
1091 *
1092 *************************************<->***********************************/
1093
1094typedef struct _WmWorkspaceData
1095{
1096    int                 dataType;
1097
1098    String              name;           /* workspace name */
1099
1100    WmScreenData        *pSD;           /* screen data for this workspace */
1101    IconBoxData         *pIconBox;      /* icon box data for this workspace */
1102    IconPlacementData   IPData;
1103
1104    Widget              workspaceTopLevelW;
1105
1106    /* workspace state information */
1107
1108    struct _ClientData  *keyboardFocus; /* ptr to client with the key focus */
1109    struct _ClientData  *nextKeyboardFocus; /* next client to get focus */
1110
1111} WmWorkspaceData;
1112
1113typedef struct _WmWorkspaceData *PtrWorkspaceData;
1114
1115
1116/*
1117 * Convenience macros for data access
1118 */
1119#define CLIENT_APPEARANCE(pcd) ((pcd)->pSD->clientAppearance)
1120#define CLIENT_TITLE_APPEARANCE(pcd) ((pcd)->pSD->clientTitleAppearance)
1121#define DECOUPLE_TITLE_APPEARANCE(pcd) ((pcd)->pSD->decoupleTitleAppearance)
1122/*
1123#define CLIENT_DEFAULT_TITLE(pcd) ((pcd)->pSD->clientDefaultTitle)
1124*/
1125#define MAX_MAX_SIZE(pcd) ((pcd)->pSD->maximumMaximumSize)
1126#define SHOW_RESIZE_CURSORS(pcd) ((pcd)->pSD->resizeCursors)
1127#define JOIN_BEVEL(pcd) ((pcd)->pSD->joinBevel)
1128#define EXTERNAL_BEVEL(pcd) ((pcd)->pSD->externalBevel)
1129#define FRAME_BORDER_WIDTH(pcd) ((pcd)->pSD->frameBorderWidth)
1130#define RESIZE_BORDER_WIDTH(pcd) ((pcd)->pSD->resizeBorderWidth)
1131#define NUM_TITLE_TS_ELEMENTS(pcd) ((pcd)->pSD->Num_Title_Ts_Elements)
1132#define NUM_TITLE_BS_ELEMENTS(pcd) ((pcd)->pSD->Num_Title_Bs_Elements)
1133#define NUM_RESIZE_TS_ELEMENTS(pcd) ((pcd)->pSD->Num_Resize_Ts_Elements)
1134#define NUM_RESIZE_BS_ELEMENTS(pcd) ((pcd)->pSD->Num_Resize_Bs_Elements)
1135#define ICON_APPEARANCE(pcd) ((pcd)->pSD->iconAppearance)
1136
1137#define ACTIVE_LABEL_PARENT(pcd) ((pcd)->pSD->activeLabelParent)
1138
1139#define ICON_BOX_GEOMETRY(pcd) ((pcd)->pSD->iconBoxGeometry)
1140#define ICON_BOX_TITLE(pcd) ((pcd)->pSD->iconBoxTitle)
1141
1142#define TRANSIENT_DECORATION(pcd) ((pcd)->pSD->transientDecoration)
1143#define TRANSIENT_FUNCTIONS(pcd) ((pcd)->pSD->transientFunctions)
1144
1145
1146/*************************************<->*************************************
1147 *
1148 *  ClientData
1149 *
1150 *
1151 *  Description:
1152 *  -----------
1153 *  This data structure is instantiated for every client window that is
1154 *  managed by the window manager.  The information that is saved in the
1155 *  data structure is specific to the associated client window.
1156 *
1157 *  ClientData is instantiated at the time a client window is intially
1158 *  managed and is destroyed when the client window is withdrawn from
1159 *  window management (the ClientData may not be destroyed when a
1160 *  client window is withdrawn if frame/icons are cached).
1161 *
1162 *************************************<->***********************************/
1163
1164typedef struct _ClientData
1165{
1166    int         dataType;                       /* client data type */
1167
1168    Window      client;
1169    long        clientFlags;
1170    int         icccVersion;
1171    int         clientState;                    /* WM_HINTS field */
1172    int         inputFocusModel;                /* WM_HINTS field */
1173    int         inputMode;
1174    long        focusPriority;
1175    unsigned long clientID;
1176    int         wmUnmapCount;
1177
1178    /* client supported protocols: */
1179
1180    Atom        *clientProtocols;               /* WM_PROTOCOLS */
1181    int         clientProtocolCount;
1182    long        protocolFlags;
1183    long        *mwmMessages;                   /* _MWM_MESSAGES */
1184    int         mwmMessagesCount;
1185
1186    /* client colormap data: */
1187
1188    Colormap    clientColormap;                 /* selected client colormap */
1189    Window      *cmapWindows;                   /* from WM_COLORMAP_WINDOWS */
1190    Colormap    *clientCmapList;
1191    int         clientCmapCount;                /* len of clientCmapList */
1192    int         clientCmapIndex;                /* current cmap in list */
1193#ifndef OLD_COLORMAP /* colormap */
1194    int         *clientCmapFlags;               /* installed, uninstalled */
1195    Bool        clientCmapFlagsInitialized;     /* Are clientCmapFlags valid? */
1196#endif
1197
1198    /* associated window data: */
1199
1200    ClientListEntry clientEntry;
1201    ClientListEntry iconEntry;
1202    XID         windowGroup;                    /* WM_HINTS field */
1203    IconBoxData *pIconBox;                      /* icon box for this win */
1204    IconBoxData *thisIconBox;                   /* icon box data for self */
1205                                                /*   if this is an icon box */
1206    Context    grabContext;                     /* used to support icon box */
1207                                                /* icon key, button, menus */
1208    Window      transientFor;                   /* transient for another win */
1209    struct _ClientData *transientLeader;        /* trans leader of this win */
1210    struct _ClientData *transientChildren;      /* transients of this win */
1211    struct _ClientData *transientSiblings;      /* related transient win's */
1212    int         primaryModalCount;              /* primary modal win count */
1213    int         fullModalCount;                 /* full modal win count */
1214
1215    /* client resource data */
1216
1217    String      clientClass;                    /* WM_CLASS field */
1218    String      clientName;                     /* WM_CLASS filed */
1219    long        clientDecoration;               /* resource */
1220    long        clientFunctions;                /* resource */
1221    Boolean     focusAutoRaise;                 /* resource */
1222    String      iconImage;                      /* resource */
1223    Pixel       iconImageBackground;            /* resource */
1224    Pixel       iconImageBottomShadowColor;     /* resource */
1225    String      iconImageBottomShadowPStr;      /* resource */
1226    Pixmap      iconImageBottomShadowPixmap;
1227    Pixel       iconImageForeground;            /* resource */
1228    Pixel       iconImageTopShadowColor;        /* resource */
1229    String      iconImageTopShadowPStr;         /* resource */
1230    Pixmap      iconImageTopShadowPixmap;
1231    int         internalBevel;                  /* resource */
1232    Pixel       matteBackground;                /* resource */
1233    Pixel       matteBottomShadowColor;         /* resource */
1234    String      matteBottomShadowPStr;          /* resource */
1235    Pixmap      matteBottomShadowPixmap;
1236    Pixel       matteForeground;                /* resource */
1237    Pixel       matteTopShadowColor;            /* resource */
1238    String      matteTopShadowPStr;             /* resource */
1239    Pixmap      matteTopShadowPixmap;
1240    int         matteWidth;                     /* resource */
1241    WHSize      maximumClientSize;              /* resource */
1242    String      systemMenu;                     /* resource */
1243    MenuItem    *mwmMenuItems;                  /* custom menu items or NULL */
1244    MenuSpec    *systemMenuSpec;
1245    Boolean     useClientIcon;                  /* resource */
1246
1247    /* client frame data: */
1248
1249    long        sizeFlags;                      /* WM_NORMAL_HINTS field */
1250    long        decor;                          /* client decoration*/
1251    long        decorFlags;                     /* depressed gadgets flags */
1252    int         minWidth;                       /* WM_NORMAL_HINTS field */
1253    int         minHeight;                      /* WM_NORMAL_HINTS field */
1254    Boolean     maxConfig;                      /* True => use max config */
1255    int         maxX;                           /* maximized window X loc */
1256    int         maxY;                           /* maximized window Y loc */
1257    int         maxWidthLimit;
1258    int         maxWidth;                       /* WM_NORMAL_HINTS field */
1259    int         maxHeightLimit;
1260    int         maxHeight;                      /* WM_NORMAL_HINTS field */
1261    int         widthInc;                       /* WM_NORMAL_HINTS field */
1262    int         heightInc;                      /* WM_NORMAL_HINTS field */
1263    AspectRatio minAspect;                      /* WM_NORMAL_HINTS field */
1264    AspectRatio maxAspect;                      /* WM_NORMAL_HINTS field */
1265    int         baseWidth;                      /* WM_NORMAL_HINTS field */
1266    int         baseHeight;                     /* WM_NORMAL_HINTS field */
1267    int         windowGravity;                  /* WM_NORMAL_HINTS field */
1268    int         clientX;                        /* normal window X loc */
1269    int         clientY;                        /* normal window Y loc */
1270    int         clientWidth;                    /* normal window width */
1271    int         clientHeight;                   /* normal window height */
1272    XPoint      clientOffset;                   /* frame to client window */
1273    XmString    clientTitle;                    /* WM_NAME field */
1274    Window      clientFrameWin;                 /* top-level, frame window */
1275    Window      clientStretchWin[STRETCH_COUNT];/* for resizing border */
1276    Window      clientTitleWin;                 /* for title bar */
1277    Window      clientBaseWin;                  /* for matte & reparenting */
1278    int         xBorderWidth;                   /* original X border width */
1279    FrameInfo   frameInfo;                      /* frame geometry data */
1280
1281    /* client window frame graphic data: */
1282
1283    RList       *pclientTopShadows;             /* top shadow areas */
1284    RList       *pclientBottomShadows;          /* bottom shadow areas */
1285
1286    RList       *pclientTitleTopShadows;        /* top shadow areas */
1287    RList       *pclientTitleBottomShadows;     /* bottom shadow areas */
1288
1289    RList       *pclientMatteTopShadows;        /* matte top shadows */
1290    RList       *pclientMatteBottomShadows;     /* matte bottom shadows */
1291
1292    /* rectangles for client frame gadgets */
1293
1294    XRectangle          titleRectangle;         /* title bar area */
1295    GadgetRectangle     *pTitleGadgets;         /* title bar gadgets */
1296    int                 cTitleGadgets;          /* count of title rects */
1297    GadgetRectangle     *pResizeGadgets;        /* resize areas */
1298    XRectangle          matteRectangle;         /* matte / base window area */
1299
1300    /* client appearance data: */
1301
1302    GC          clientMatteTopShadowGC;
1303    GC          clientMatteBottomShadowGC;
1304    WmScreenData        *pSD;                   /* where visuals come from */
1305
1306    /* icon data: */
1307
1308    long        iconFlags;
1309    XmString    iconTitle;                      /* WM_ICON_NAME field */
1310    int         iconX;                          /* WM_HINTS field */
1311    int         iconY;                          /* WM_HINTS field */
1312    int         iconPlace;
1313    Window      iconFrameWin;
1314    Pixmap      iconPixmap;                     /* WM_HINTS field */
1315    Pixmap      iconMask;                       /* WM_HINTS field */
1316    Window      iconWindow;                     /* WM_HINTS field */
1317
1318    RList       *piconTopShadows;               /* these change to      */
1319                                                /* to reflect the       */
1320    RList       *piconBottomShadows;            /* depressed icon image */
1321
1322#ifndef NO_SHAPE
1323    short       wShaped;                /* this window has a bounding shape */
1324#endif /* NO_SHAPE  */
1325
1326    int         usePPosition;           /* indicate whether to use PPosition */
1327
1328    long        window_status;                  /* used for Tear-off Menus */
1329
1330} ClientData;
1331
1332typedef struct _ClientData *PtrClientData;
1333
1334/* client data convenience macros */
1335
1336#define IS_APP_MODALIZED(pcd) \
1337    (((pcd)->primaryModalCount)||((pcd)->fullModalCount))
1338
1339#define IS_MAXIMIZE_VERTICAL(pcd) \
1340  ((pcd->maximumClientSize.height == BIGSIZE) && \
1341   (pcd->maximumClientSize.width == 0))
1342
1343#define IS_MAXIMIZE_HORIZONTAL(pcd) \
1344  ((pcd->maximumClientSize.width == BIGSIZE) && \
1345   (pcd->maximumClientSize.height == 0))
1346
1347/* window management state of client windows (clientState): */
1348#define WITHDRAWN_STATE         0
1349#define NORMAL_STATE            1
1350#define MINIMIZED_STATE         2
1351#define MAXIMIZED_STATE         3
1352
1353/* clientFlags field values: */
1354#define CLIENT_HINTS_TITLE              (1L << 0)
1355#define CLIENT_REPARENTED               (1L << 1)
1356#define CLIENT_TRANSIENT                (1L << 2)
1357#define CLIENT_CONTEXT_SAVED            (1L << 3)
1358#define CLIENT_IN_SAVE_SET              (1L << 4)
1359#define USERS_MAX_POSITION              (1L << 5)
1360#define WM_INITIALIZATION               (1L << 6)
1361#define CLIENT_DESTROYED                (1L << 7)
1362#define ICON_REPARENTED                 (1L << 8)
1363#define ICON_IN_SAVE_SET                (1L << 9)
1364#define CLIENT_TERMINATING              (1L << 10)
1365#define ICON_BOX                        (1L << 11)  /* one of our icon boxes */
1366#define CONFIRM_BOX                     (1L << 12)  /* a confirmation box */
1367
1368
1369#define CLIENT_WM_CLIENTS               (ICON_BOX | CONFIRM_BOX)
1370
1371/* decorFlags bit fields */
1372#define SYSTEM_DEPRESSED                (1L << 0)
1373#define TITLE_DEPRESSED                 (1L << 1)
1374#define MINIMIZE_DEPRESSED              (1L << 2)
1375#define MAXIMIZE_DEPRESSED              (1L << 3)
1376
1377/* iconFlags field values: */
1378#define ICON_HINTS_POSITION             (1L << 0)
1379#define ICON_HINTS_TITLE                (1L << 1)
1380#define ICON_HINTS_PIXMAP               (1L << 2)
1381
1382/* client protocol flags and sizes: */
1383#define PROTOCOL_WM_SAVE_YOURSELF       (1L << 0)
1384#define PROTOCOL_WM_DELETE_WINDOW       (1L << 1)
1385#define PROTOCOL_WM_TAKE_FOCUS          (1L << 2)
1386#define PROTOCOL_MWM_MESSAGES           (1L << 3)
1387#define PROTOCOL_MWM_OFFSET             (1L << 4)
1388
1389#define MAX_CLIENT_PROTOCOL_COUNT       40
1390#define MAX_COLORMAP_WINDOWS_COUNT      40
1391#define MAX_MWM_MESSAGES_COUNT          40
1392
1393/* bevel width limits between window manager frame and client window */
1394#define MIN_INTERNAL_BEVEL              1
1395#define MAX_INTERNAL_BEVEL              2
1396
1397
1398
1399/*************************************<->*************************************
1400 *
1401 *  WmGlobalData
1402 *
1403 *
1404 *  Description:
1405 *  -----------
1406 *  This is the main data structure for holding the window manager's
1407 *  global data. There is one instantiation of the structure for
1408 *  the window manager.
1409 *
1410 *************************************<->***********************************/
1411
1412typedef struct _WmGlobalData
1413{
1414    int         dataType;
1415    char        **argv;                 /* command line argument vector */
1416    char        **environ;              /* environment vector */       
1417    char        *mwmName;               /* name of our executable */
1418    Widget      topLevelW;
1419    Boolean     confirmDialogMapped;    /* confirm dialog is mapped */
1420    XtAppContext        mwmAppContext;  /* application context for mwm */
1421    XContext    windowContextType;      /* window context for XSaveContext */
1422    XContext    screenContextType;      /* screen context for XSaveContext */
1423
1424    /* presentation resource id's: */
1425
1426    String      displayString;          /* used for putenv in F_Exec */
1427    Display     *display;               /* display we are running to */
1428    int         numScreens;             /* number of screens */
1429    unsigned char       **screenNames;  /* default names for screens */
1430    WmScreenData        *Screens;       /* array of screen info */
1431
1432    Cursor      workspaceCursor;                /* basic arrow cursor */
1433    Cursor      stretchCursors[STRETCH_COUNT];
1434    Cursor      configCursor;
1435    Cursor      movePlacementCursor;
1436    Cursor      sizePlacementCursor;
1437
1438
1439
1440    /* wm state info: */
1441
1442    WmScreenData *pActiveSD;            /* with keyfocus window */
1443    Boolean     useStandardBehavior;    /* behavior flag */
1444    Boolean     wmRestarted;            /* restart flag */
1445    Boolean     errorFlag;              /* handle on async errors */
1446
1447                    /* The following are global because pointer is grabbed */
1448    MenuSpec    *menuActive;            /* ptr to currently active menu */
1449    KeySpec     *menuUnpostKeySpec;     /* key to upost current menu */
1450    ClientData  *menuClient;            /* client for which menu is posted */
1451    KeySpec     *F_NextKeySpec;         /* used when travering to windows */
1452    KeySpec     *F_PrevKeySpec;         /* used when travering to windows */
1453
1454    Context     grabContext;            /* used in GrabWin when no event */
1455
1456    ClickData   clickData;              /* double-click detection data */
1457    int         configAction;           /* none, resize, move */
1458    unsigned int configButton;          /* button used for config */
1459    unsigned int configPart;            /* resize frame part */
1460    Boolean     configSet;              /* True if configPart set */
1461    Boolean     movingIcon;             /* True if icon being moved */
1462    Boolean     preMove;                /* move threshold support */
1463    int         preMoveX;
1464    int         preMoveY;
1465    ClientData  *gadgetClient;          /* last client with */
1466    int         gadgetDepressed;        /* depressed gadget */
1467    Boolean     checkHotspot;           /* event hotspot flag */
1468    XRectangle  hotspotRectangle;       /* event hotspot area */
1469    WmTimer     *wmTimers;              /* timer data */
1470    Boolean     passKeysActive;         /* flag for pass keys function */
1471    KeySpec     *passKeysKeySpec;       /* key for pass keys function */
1472    Boolean     activeIconTextDisplayed;        /* True if active label up */
1473    unsigned int currentEventState;     /* key/button event modifier state */
1474    Boolean     queryScreen;            /* True if not sure of active screen */
1475
1476    /* keyboard focus data: */
1477
1478    ClientData  *keyboardFocus;         /* ptr to client with the key focus */
1479    ClientData  *nextKeyboardFocus;     /* next client to get focus */
1480    Boolean     systemModalActive;
1481    ClientData  *systemModalClient;
1482    Window      systemModalWindow;
1483
1484    /* atoms used in inter-client communication: */
1485
1486    Atom        xa_WM_STATE;
1487    Atom        xa_WM_PROTOCOLS;
1488    Atom        xa_WM_CHANGE_STATE;
1489    Atom        xa_WM_SAVE_YOURSELF;
1490    Atom        xa_WM_DELETE_WINDOW;
1491    Atom        xa_WM_TAKE_FOCUS;
1492    Atom        xa_WM_COLORMAP_WINDOWS;
1493    Atom        xa_MWM_HINTS;
1494    Atom        xa_MWM_MESSAGES;
1495    Atom        xa_MWM_MENU;
1496    Atom        xa_MWM_INFO;
1497    Atom        xa_MWM_OFFSET;
1498#ifdef AUTOMATION
1499        Atom    xa_MWM_FRAME_ICON_INFO;
1500#endif
1501    Atom        xa_MOTIF_BINDINGS;
1502    Atom        xa_COMPOUND_TEXT;
1503
1504
1505    /* mwm specific appearance and behavior resources and data: */
1506
1507    Boolean     autoKeyFocus;                   /* resource */
1508    int         autoRaiseDelay;                 /* resource */
1509    String      bitmapDirectory;                /* resource */
1510    Boolean     clientAutoPlace;                /* resource */
1511    int         colormapFocusPolicy;            /* resource */
1512    String      configFile;                     /* resource */
1513    Boolean     deiconifyKeyFocus;              /* resource */
1514    int         doubleClickTime;                /* resource */
1515    Boolean     enableWarp;                     /* resource */
1516    Boolean     enforceKeyFocus;                /* resource */
1517    Boolean     freezeOnConfig;                 /* resource - testing */
1518    Boolean     iconAutoPlace;                  /* resource */
1519    Boolean     iconClick;                      /* resource */
1520    Boolean     ignoreLockMod;                  /* resource */
1521    Boolean     interactivePlacement;           /* resource */
1522    int         keyboardFocusPolicy;            /* resource */
1523    Boolean     lowerOnIconify;                 /* resource */
1524    int         moveThreshold;                  /* resource */
1525    Boolean     passButtonsCheck; /* used to override passButtons */
1526    Boolean     passButtons;                    /* resource */
1527    Boolean     passSelectButton;               /* resource */
1528    Boolean     positionIsFrame;                /* resource */
1529    Boolean     positionOnScreen;               /* resource */
1530    int         quitTimeout;                    /* resource */
1531    Boolean     raiseKeyFocus;                  /* resource */
1532    Boolean     multiScreen;                    /* resource */
1533    String      screenList;                     /* resource */
1534    long        showFeedback;                   /* resource */
1535    Boolean     startupKeyFocus;                /* resource */
1536    Boolean     systemButtonClick;              /* resource */
1537    Boolean     systemButtonClick2;             /* resource */
1538    Boolean     useLargeCursors;
1539    Boolean     waitForClicks;                  /* resource */
1540
1541    XmString    clientDefaultTitle;
1542    XmString    iconDefaultTitle;
1543
1544    Window      attributesWindow;
1545    XWindowAttributes   windowAttributes;
1546
1547#ifndef NO_SHAPE
1548    Boolean     hasShape;                /* server supports Shape extension */
1549    int         shapeEventBase, shapeErrorBase;
1550#endif /* NO_SHAPE */
1551
1552} WmGlobalData;
1553
1554/* quick references to global data: */
1555#define DISPLAY         wmGD.display
1556#define ACTIVE_PSD      (wmGD.pActiveSD)
1557#define ACTIVE_SCREEN   (wmGD.pActiveSD->screen)
1558#define ACTIVE_WS       (wmGD.pActiveSD->pActiveWS)
1559#define ACTIVE_ROOT     (wmGD.pActiveSD->rootWindow)
1560#define ACTIVE_ICON_TEXT_WIN (wmGD.pActiveSD->activeIconTextWin)
1561
1562/* colormap focus policy values (colormapFocus): */
1563#define CMAP_FOCUS_EXPLICIT     0
1564#define CMAP_FOCUS_POINTER      1
1565#define CMAP_FOCUS_KEYBOARD     2
1566
1567/* keyboard input focus policy values (keyboardFocus): */
1568#define KEYBOARD_FOCUS_EXPLICIT 0
1569#define KEYBOARD_FOCUS_POINTER  1
1570
1571/* icon appearance values (iconAppearance): */
1572#define ICON_LABEL_PART                 (1L << 0)
1573#define ICON_IMAGE_PART                 (1L << 1)
1574#define ICON_ACTIVE_LABEL_PART          (1L << 2)
1575#define USE_ICON_DEFAULT_APPEARANCE     (1L << 3)
1576#define ICON_APPEARANCE_STANDALONE      (ICON_LABEL_PART | ICON_IMAGE_PART |\
1577                                         ICON_ACTIVE_LABEL_PART)
1578#define ICON_APPEARANCE_ICONBOX         (ICON_LABEL_PART | ICON_IMAGE_PART)
1579
1580/* icon placement values (iconPlacement, ...): */
1581#define ICON_PLACE_LEFT_PRIMARY         (1L << 0)
1582#define ICON_PLACE_RIGHT_PRIMARY        (1L << 1)
1583#define ICON_PLACE_TOP_PRIMARY          (1L << 2)
1584#define ICON_PLACE_BOTTOM_PRIMARY       (1L << 3)
1585#define ICON_PLACE_LEFT_SECONDARY       (1L << 4)
1586#define ICON_PLACE_RIGHT_SECONDARY      (1L << 5)
1587#define ICON_PLACE_TOP_SECONDARY        (1L << 6)
1588#define ICON_PLACE_BOTTOM_SECONDARY     (1L << 7)
1589#define ICON_PLACE_EDGE                 (1L << 8)
1590#define ICON_PLACE_TIGHT                (1L << 9)
1591#define ICON_PLACE_RESERVE              (1L << 10)
1592
1593#define NO_ICON_PLACE                   -1
1594#define MINIMUM_ICON_SPACING            4
1595#define MAXIMUM_ICON_MARGIN             128
1596#define ICON_IMAGE_MAX_WIDTH            128
1597#define ICON_IMAGE_MAX_HEIGHT           128
1598#define ICON_IMAGE_MIN_WIDTH            16
1599#define ICON_IMAGE_MIN_HEIGHT           16
1600
1601/*default client window title: */
1602#define DEFAULT_CLIENT_TITLE    "*****"
1603#define DEFAULT_ICON_TITLE      DEFAULT_CLIENT_TITLE
1604
1605/* client decoration parameters */
1606#define MAXIMUM_FRAME_BORDER_WIDTH      64
1607
1608/* configuration action (configAction): */
1609#define NO_ACTION                       0
1610#define MOVE_CLIENT                     1
1611#define RESIZE_CLIENT                   2
1612#define PLACE_CLIENT                    3
1613
1614/* Motif input bindings file name */
1615#define MOTIF_BINDINGS_FILE             ".motifbind"
1616
1617/* Data type definitions */
1618#define GLOBAL_DATA_TYPE                1001
1619#define CLIENT_DATA_TYPE                1002
1620#define SCREEN_DATA_TYPE                1003
1621#define WORKSPACE_DATA_TYPE             1004
1622
1623/* Stacking functions */
1624#define STACK_NORMAL                    0
1625#define STACK_WITHIN_FAMILY             1
1626#define STACK_FREE_FAMILY               2
1627
1628/* UsePPosition values */
1629#define USE_PPOSITION_OFF               0
1630#define USE_PPOSITION_ON                1
1631#define USE_PPOSITION_NONZERO           2
1632
1633/* Largest dimension for special casing */
1634#define BIGSIZE 32767
1635
1636/*
1637 * External references for global data:
1638 */
1639
1640extern WmGlobalData     wmGD;
Note: See TracBrowser for help on using the repository browser.