jpayne@69
|
1 /*
|
jpayne@69
|
2 * tkMacOSXWm.h --
|
jpayne@69
|
3 *
|
jpayne@69
|
4 * Declarations of Macintosh specific window manager structures.
|
jpayne@69
|
5 *
|
jpayne@69
|
6 * Copyright 2001-2009, Apple Inc.
|
jpayne@69
|
7 * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
|
jpayne@69
|
8 *
|
jpayne@69
|
9 * See the file "license.terms" for information on usage and redistribution of
|
jpayne@69
|
10 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
jpayne@69
|
11 */
|
jpayne@69
|
12
|
jpayne@69
|
13 #ifndef _TKMACWM
|
jpayne@69
|
14 #define _TKMACWM
|
jpayne@69
|
15
|
jpayne@69
|
16 #include "tkMacOSXInt.h"
|
jpayne@69
|
17 #include "tkMenu.h"
|
jpayne@69
|
18
|
jpayne@69
|
19 /*
|
jpayne@69
|
20 * A data structure of the following type holds information for each window
|
jpayne@69
|
21 * manager protocol (such as WM_DELETE_WINDOW) for which a handler (i.e. a Tcl
|
jpayne@69
|
22 * command) has been defined for a particular top-level window.
|
jpayne@69
|
23 */
|
jpayne@69
|
24
|
jpayne@69
|
25 typedef struct ProtocolHandler {
|
jpayne@69
|
26 Atom protocol; /* Identifies the protocol. */
|
jpayne@69
|
27 struct ProtocolHandler *nextPtr;
|
jpayne@69
|
28 /* Next in list of protocol handlers for the
|
jpayne@69
|
29 * same top-level window, or NULL for end of
|
jpayne@69
|
30 * list. */
|
jpayne@69
|
31 Tcl_Interp *interp; /* Interpreter in which to invoke command. */
|
jpayne@69
|
32 char* command; /* Tcl command to invoke when a client message
|
jpayne@69
|
33 * for this protocol arrives. The actual size
|
jpayne@69
|
34 * of the structure varies to accommodate the
|
jpayne@69
|
35 * needs of the actual command. THIS MUST BE
|
jpayne@69
|
36 * THE LAST FIELD OF THE STRUCTURE. */
|
jpayne@69
|
37 } ProtocolHandler;
|
jpayne@69
|
38
|
jpayne@69
|
39 /* The following data structure is used in the TkWmInfo to maintain a list of all of the
|
jpayne@69
|
40 * transient windows belonging to a given container.
|
jpayne@69
|
41 */
|
jpayne@69
|
42
|
jpayne@69
|
43 typedef struct Transient {
|
jpayne@69
|
44 TkWindow *winPtr;
|
jpayne@69
|
45 int flags;
|
jpayne@69
|
46 struct Transient *nextPtr;
|
jpayne@69
|
47 } Transient;
|
jpayne@69
|
48
|
jpayne@69
|
49 #define WITHDRAWN_BY_CONTAINER 0x1
|
jpayne@69
|
50 #define WITHDRAWN_BY_MASTER 0x1
|
jpayne@69
|
51
|
jpayne@69
|
52 /*
|
jpayne@69
|
53 * A data structure of the following type holds window-manager-related
|
jpayne@69
|
54 * information for each top-level window in an application.
|
jpayne@69
|
55 */
|
jpayne@69
|
56
|
jpayne@69
|
57 typedef struct TkWmInfo {
|
jpayne@69
|
58 TkWindow *winPtr; /* Pointer to main Tk information for this
|
jpayne@69
|
59 * window. */
|
jpayne@69
|
60 Window reparent; /* If the window has been reparented, this
|
jpayne@69
|
61 * gives the ID of the ancestor of the window
|
jpayne@69
|
62 * that is a child of the root window (may not
|
jpayne@69
|
63 * be window's immediate parent). If the window
|
jpayne@69
|
64 * isn't reparented, this has the value
|
jpayne@69
|
65 * None. */
|
jpayne@69
|
66 Tk_Uid titleUid; /* Title to display in window caption. If NULL,
|
jpayne@69
|
67 * use name of widget. */
|
jpayne@69
|
68 char *iconName; /* Name to display in icon. */
|
jpayne@69
|
69 Tk_Window container; /* Container window for TRANSIENT_FOR property,
|
jpayne@69
|
70 * or None. */
|
jpayne@69
|
71 XWMHints hints; /* Various pieces of information for window
|
jpayne@69
|
72 * manager. */
|
jpayne@69
|
73 char *leaderName; /* Path name of leader of window group
|
jpayne@69
|
74 * (corresponds to hints.window_group).
|
jpayne@69
|
75 * Malloc-ed. Note: this field doesn't get
|
jpayne@69
|
76 * updated if leader is destroyed. */
|
jpayne@69
|
77 Tk_Window icon; /* Window to use as icon for this window, or
|
jpayne@69
|
78 * NULL. */
|
jpayne@69
|
79 Tk_Window iconFor; /* Window for which this window is icon, or
|
jpayne@69
|
80 * NULL if this isn't an icon for anyone. */
|
jpayne@69
|
81 Transient *transientPtr; /* First item in a list of all transient windows
|
jpayne@69
|
82 * belonging to this window, or NULL if there
|
jpayne@69
|
83 * are no transients. */
|
jpayne@69
|
84
|
jpayne@69
|
85 /*
|
jpayne@69
|
86 * Information used to construct an XSizeHints structure for the window
|
jpayne@69
|
87 * manager:
|
jpayne@69
|
88 */
|
jpayne@69
|
89
|
jpayne@69
|
90 int sizeHintsFlags; /* Flags word for XSizeHints structure. If the
|
jpayne@69
|
91 * PBaseSize flag is set then the window is
|
jpayne@69
|
92 * gridded; otherwise it isn't gridded. */
|
jpayne@69
|
93 int minWidth, minHeight; /* Minimum dimensions of window, in grid units,
|
jpayne@69
|
94 * not pixels. */
|
jpayne@69
|
95 int maxWidth, maxHeight; /* Maximum dimensions of window, in grid units,
|
jpayne@69
|
96 * not pixels. */
|
jpayne@69
|
97 Tk_Window gridWin; /* Identifies the window that controls gridding
|
jpayne@69
|
98 * for this top-level, or NULL if the top-level
|
jpayne@69
|
99 * isn't currently gridded. */
|
jpayne@69
|
100 int widthInc, heightInc; /* Increments for size changes (# pixels per
|
jpayne@69
|
101 * step). */
|
jpayne@69
|
102 struct {
|
jpayne@69
|
103 int x; /* numerator */
|
jpayne@69
|
104 int y; /* denominator */
|
jpayne@69
|
105 } minAspect, maxAspect; /* Min/max aspect ratios for window. */
|
jpayne@69
|
106 int reqGridWidth, reqGridHeight;
|
jpayne@69
|
107 /* The dimensions of the window (in grid units)
|
jpayne@69
|
108 * requested through the geometry manager. */
|
jpayne@69
|
109 int gravity; /* Desired window gravity. */
|
jpayne@69
|
110
|
jpayne@69
|
111 /*
|
jpayne@69
|
112 * Information used to manage the size and location of a window.
|
jpayne@69
|
113 */
|
jpayne@69
|
114
|
jpayne@69
|
115 int width, height; /* Desired dimensions of window, specified in
|
jpayne@69
|
116 * grid units. These values are set by the "wm
|
jpayne@69
|
117 * geometry" command and by ConfigureNotify
|
jpayne@69
|
118 * events (for when wm resizes window). -1
|
jpayne@69
|
119 * means user hasn't requested dimensions. */
|
jpayne@69
|
120 int x, y; /* Desired X and Y coordinates for window.
|
jpayne@69
|
121 * These values are set by "wm geometry", plus
|
jpayne@69
|
122 * by ConfigureNotify events (when wm moves
|
jpayne@69
|
123 * window). These numbers are different than
|
jpayne@69
|
124 * the numbers stored in winPtr->changes
|
jpayne@69
|
125 * because (a) they could be measured from the
|
jpayne@69
|
126 * right or bottom edge of the screen (see
|
jpayne@69
|
127 * WM_NEGATIVE_X and WM_NEGATIVE_Y flags) and
|
jpayne@69
|
128 * (b) if the window has been reparented then
|
jpayne@69
|
129 * they refer to the parent rather than the
|
jpayne@69
|
130 * window itself. */
|
jpayne@69
|
131 int parentWidth, parentHeight;
|
jpayne@69
|
132 /* Width and height of reparent, in pixels
|
jpayne@69
|
133 * *including border*. If window hasn't been
|
jpayne@69
|
134 * reparented then these will be the outer
|
jpayne@69
|
135 * dimensions of the window, including
|
jpayne@69
|
136 * border. */
|
jpayne@69
|
137 int xInParent, yInParent; /* Offset of window within reparent, measured
|
jpayne@69
|
138 * from upper-left outer corner of parent's
|
jpayne@69
|
139 * border to upper-left outer corner of child's
|
jpayne@69
|
140 * border. If not reparented then these are
|
jpayne@69
|
141 * zero. */
|
jpayne@69
|
142 int configX, configY; /* x,y position of toplevel when window is
|
jpayne@69
|
143 * switched into fullscreen state, */
|
jpayne@69
|
144 int configWidth, configHeight;
|
jpayne@69
|
145 /* Dimensions passed to last request that we
|
jpayne@69
|
146 * issued to change geometry of window. Used to
|
jpayne@69
|
147 * eliminate redundant resize operations. */
|
jpayne@69
|
148
|
jpayne@69
|
149 /*
|
jpayne@69
|
150 * Information about the virtual root window for this top-level, if there
|
jpayne@69
|
151 * is one.
|
jpayne@69
|
152 */
|
jpayne@69
|
153
|
jpayne@69
|
154 Window vRoot; /* Virtual root window for this top-level, or
|
jpayne@69
|
155 * None if there is no virtual root window
|
jpayne@69
|
156 * (i.e. just use the screen's root). */
|
jpayne@69
|
157 int vRootX, vRootY; /* Position of the virtual root inside the root
|
jpayne@69
|
158 * window. If the WM_VROOT_OFFSET_STALE flag is
|
jpayne@69
|
159 * set then this information may be incorrect
|
jpayne@69
|
160 * and needs to be refreshed from the OS. If
|
jpayne@69
|
161 * vRoot is None then these values are both
|
jpayne@69
|
162 * 0. */
|
jpayne@69
|
163 unsigned int vRootWidth, vRootHeight;
|
jpayne@69
|
164 /* Dimensions of the virtual root window. If
|
jpayne@69
|
165 * vRoot is None, gives the dimensions of the
|
jpayne@69
|
166 * containing screen. This information is never
|
jpayne@69
|
167 * stale, even though vRootX and vRootY can
|
jpayne@69
|
168 * be. */
|
jpayne@69
|
169
|
jpayne@69
|
170 /*
|
jpayne@69
|
171 * List of children of the toplevel which have private colormaps.
|
jpayne@69
|
172 */
|
jpayne@69
|
173
|
jpayne@69
|
174 TkWindow **cmapList; /* Array of window with private colormaps. */
|
jpayne@69
|
175 int cmapCount; /* Number of windows in array. */
|
jpayne@69
|
176
|
jpayne@69
|
177 /*
|
jpayne@69
|
178 * Miscellaneous information.
|
jpayne@69
|
179 */
|
jpayne@69
|
180
|
jpayne@69
|
181 ProtocolHandler *protPtr; /* First in list of protocol handlers for this
|
jpayne@69
|
182 * window (NULL means none). */
|
jpayne@69
|
183 Tcl_Obj *commandObj; /* The command (guaranteed to be a list) for
|
jpayne@69
|
184 * the WM_COMMAND property. NULL means nothing
|
jpayne@69
|
185 * available. */
|
jpayne@69
|
186 char *clientMachine; /* String to store in WM_CLIENT_MACHINE
|
jpayne@69
|
187 * property, or NULL. */
|
jpayne@69
|
188 int flags; /* Miscellaneous flags, defined below. */
|
jpayne@69
|
189
|
jpayne@69
|
190 /*
|
jpayne@69
|
191 * Macintosh information.
|
jpayne@69
|
192 */
|
jpayne@69
|
193
|
jpayne@69
|
194 WindowClass macClass;
|
jpayne@69
|
195 UInt64 attributes, configAttributes;
|
jpayne@69
|
196 TkWindow *scrollWinPtr; /* Ptr to scrollbar handling grow widget. */
|
jpayne@69
|
197 TkMenu *menuPtr;
|
jpayne@69
|
198 NSWindow *window;
|
jpayne@69
|
199
|
jpayne@69
|
200 /*
|
jpayne@69
|
201 * Space to cache current window state when window becomes Fullscreen.
|
jpayne@69
|
202 */
|
jpayne@69
|
203
|
jpayne@69
|
204 unsigned long cachedStyle;
|
jpayne@69
|
205 unsigned long cachedPresentation;
|
jpayne@69
|
206 NSRect cachedBounds;
|
jpayne@69
|
207
|
jpayne@69
|
208 } WmInfo;
|
jpayne@69
|
209
|
jpayne@69
|
210 /*
|
jpayne@69
|
211 * Flag values for WmInfo structures:
|
jpayne@69
|
212 *
|
jpayne@69
|
213 * WM_NEVER_MAPPED - non-zero means window has never been mapped;
|
jpayne@69
|
214 * need to update all info when window is first
|
jpayne@69
|
215 * mapped.
|
jpayne@69
|
216 * WM_UPDATE_PENDING - non-zero means a call to UpdateGeometryInfo
|
jpayne@69
|
217 * has already been scheduled for this window; no
|
jpayne@69
|
218 * need to schedule another one.
|
jpayne@69
|
219 * WM_NEGATIVE_X - non-zero means x-coordinate is measured in
|
jpayne@69
|
220 * pixels from right edge of screen, rather than
|
jpayne@69
|
221 * from left edge.
|
jpayne@69
|
222 * WM_NEGATIVE_Y - non-zero means y-coordinate is measured in
|
jpayne@69
|
223 * pixels up from bottom of screen, rather than
|
jpayne@69
|
224 * down from top.
|
jpayne@69
|
225 * WM_UPDATE_SIZE_HINTS - non-zero means that new size hints need to be
|
jpayne@69
|
226 * propagated to window manager.
|
jpayne@69
|
227 * WM_SYNC_PENDING - set to non-zero while waiting for the window
|
jpayne@69
|
228 * manager to respond to some state change.
|
jpayne@69
|
229 * WM_VROOT_OFFSET_STALE - non-zero means that (x,y) offset information
|
jpayne@69
|
230 * about the virtual root window is stale and
|
jpayne@69
|
231 * needs to be fetched fresh from the X server.
|
jpayne@69
|
232 * WM_ABOUT_TO_MAP - non-zero means that the window is about to be
|
jpayne@69
|
233 * mapped by TkWmMapWindow. This is used by
|
jpayne@69
|
234 * UpdateGeometryInfo to modify its behavior.
|
jpayne@69
|
235 * WM_MOVE_PENDING - non-zero means the application has requested a
|
jpayne@69
|
236 * new position for the window, but it hasn't
|
jpayne@69
|
237 * been reflected through the window manager yet.
|
jpayne@69
|
238 * WM_COLORMAPS_EXPLICIT - non-zero means the colormap windows were set
|
jpayne@69
|
239 * explicitly via "wm colormapwindows".
|
jpayne@69
|
240 * WM_ADDED_TOPLEVEL_COLORMAP - non-zero means that when "wm colormapwindows"
|
jpayne@69
|
241 * was called the top-level itself wasn't
|
jpayne@69
|
242 * specified, so we added it implicitly at the
|
jpayne@69
|
243 * end of the list.
|
jpayne@69
|
244 * WM_WIDTH_NOT_RESIZABLE - non-zero means that we're not supposed to
|
jpayne@69
|
245 * allow the user to change the width of the
|
jpayne@69
|
246 * window (controlled by "wm resizable" command).
|
jpayne@69
|
247 * WM_HEIGHT_NOT_RESIZABLE - non-zero means that we're not supposed to
|
jpayne@69
|
248 * allow the user to change the height of the
|
jpayne@69
|
249 * window (controlled by "wm resizable" command).
|
jpayne@69
|
250 */
|
jpayne@69
|
251
|
jpayne@69
|
252 #define WM_NEVER_MAPPED 0x0001
|
jpayne@69
|
253 #define WM_UPDATE_PENDING 0x0002
|
jpayne@69
|
254 #define WM_NEGATIVE_X 0x0004
|
jpayne@69
|
255 #define WM_NEGATIVE_Y 0x0008
|
jpayne@69
|
256 #define WM_UPDATE_SIZE_HINTS 0x0010
|
jpayne@69
|
257 #define WM_SYNC_PENDING 0x0020
|
jpayne@69
|
258 #define WM_VROOT_OFFSET_STALE 0x0040
|
jpayne@69
|
259 #define WM_ABOUT_TO_MAP 0x0080
|
jpayne@69
|
260 #define WM_MOVE_PENDING 0x0100
|
jpayne@69
|
261 #define WM_COLORMAPS_EXPLICIT 0x0200
|
jpayne@69
|
262 #define WM_ADDED_TOPLEVEL_COLORMAP 0x0400
|
jpayne@69
|
263 #define WM_WIDTH_NOT_RESIZABLE 0x0800
|
jpayne@69
|
264 #define WM_HEIGHT_NOT_RESIZABLE 0x1000
|
jpayne@69
|
265 #define WM_TOPMOST 0x2000
|
jpayne@69
|
266 #define WM_FULLSCREEN 0x4000
|
jpayne@69
|
267 #define WM_TRANSPARENT 0x8000
|
jpayne@69
|
268
|
jpayne@69
|
269 #endif /* _TKMACWM */
|
jpayne@69
|
270
|
jpayne@69
|
271 /*
|
jpayne@69
|
272 * Local Variables:
|
jpayne@69
|
273 * mode: objc
|
jpayne@69
|
274 * c-basic-offset: 4
|
jpayne@69
|
275 * fill-column: 79
|
jpayne@69
|
276 * coding: utf-8
|
jpayne@69
|
277 * End:
|
jpayne@69
|
278 */
|