1/* 2 * tkMacOSXWm.h -- 3 * 4 * Declarations of Macintosh specific window manager structures. 5 * 6 * Copyright 2001, Apple Computer, Inc. 7 * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net> 8 * 9 * See the file "license.terms" for information on usage and redistribution of 10 * this file, and for a DISCLAIMER OF ALL WARRANTIES. 11 * 12 * The following terms apply to all files originating from Apple 13 * Computer, Inc. ("Apple") and associated with the software 14 * unless explicitly disclaimed in individual files. 15 * 16 * 17 * Apple hereby grants permission to use, copy, modify, 18 * distribute, and license this software and its documentation 19 * for any purpose, provided that existing copyright notices are 20 * retained in all copies and that this notice is included 21 * verbatim in any distributions. No written agreement, license, 22 * or royalty fee is required for any of the authorized 23 * uses. Modifications to this software may be copyrighted by 24 * their authors and need not follow the licensing terms 25 * described here, provided that the new terms are clearly 26 * indicated on the first page of each file where they apply. 27 * 28 * 29 * IN NO EVENT SHALL APPLE, THE AUTHORS OR DISTRIBUTORS OF THE 30 * SOFTWARE BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, 31 * INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF 32 * THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, 33 * EVEN IF APPLE OR THE AUTHORS HAVE BEEN ADVISED OF THE 34 * POSSIBILITY OF SUCH DAMAGE. APPLE, THE AUTHORS AND 35 * DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, 36 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 37 * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS 38 * SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND APPLE,THE 39 * AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE 40 * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 41 * 42 * GOVERNMENT USE: If you are acquiring this software on behalf 43 * of the U.S. government, the Government shall have only 44 * "Restricted Rights" in the software and related documentation 45 * as defined in the Federal Acquisition Regulations (FARs) in 46 * Clause 52.227.19 (c) (2). If you are acquiring the software 47 * on behalf of the Department of Defense, the software shall be 48 * classified as "Commercial Computer Software" and the 49 * Government shall have only "Restricted Rights" as defined in 50 * Clause 252.227-7013 (c) (1) of DFARs. Notwithstanding the 51 * foregoing, the authors grant the U.S. Government and others 52 * acting in its behalf permission to use and distribute the 53 * software in accordance with the terms specified in this 54 * license. 55 * 56 * RCS: @(#) $Id: tkMacOSXWm.h,v 1.2.2.5 2007/04/29 02:26:51 das Exp $ 57 */ 58 59#ifndef _TKMACWM 60#define _TKMACWM 61 62#include "tkMacOSXInt.h" 63 64/* 65 * A data structure of the following type holds information for 66 * each window manager protocol (such as WM_DELETE_WINDOW) for 67 * which a handler (i.e. a Tcl command) has been defined for a 68 * particular top-level window. 69 */ 70 71typedef struct ProtocolHandler { 72 Atom protocol; /* Identifies the protocol. */ 73 struct ProtocolHandler *nextPtr; 74 /* Next in list of protocol handlers for 75 * the same top-level window, or NULL for 76 * end of list. */ 77 Tcl_Interp *interp; /* Interpreter in which to invoke command. */ 78 char command[4]; /* Tcl command to invoke when a client 79 * message for this protocol arrives. 80 * The actual size of the structure varies 81 * to accommodate the needs of the actual 82 * command. THIS MUST BE THE LAST FIELD OF 83 * THE STRUCTURE. */ 84} ProtocolHandler; 85 86#define HANDLER_SIZE(cmdLength) \ 87((unsigned) (sizeof(ProtocolHandler) - 3 + cmdLength)) 88 89/* 90 * A data structure of the following type holds window-manager-related 91 * information for each top-level window in an application. 92 */ 93 94typedef struct TkWmInfo { 95 TkWindow *winPtr; /* Pointer to main Tk information for 96 * this window. */ 97 Window reparent; /* If the window has been reparented, this 98 * gives the ID of the ancestor of the window 99 * that is a child of the root window (may 100 * not be window's immediate parent). If 101 * the window isn't reparented, this has the 102 * value None. */ 103 Tk_Uid titleUid; /* Title to display in window caption. If 104 * NULL, use name of widget. */ 105 char *iconName; /* Name to display in icon. */ 106 Window master; /* Master window for TRANSIENT_FOR property, 107 * or None. */ 108 XWMHints hints; /* Various pieces of information for 109 * window manager. */ 110 char *leaderName; /* Path name of leader of window group 111 * (corresponds to hints.window_group). 112 * Malloc-ed. Note: this field doesn't 113 * get updated if leader is destroyed. */ 114 char *masterWindowName; /* Path name of window specified as master 115 * in "wm transient" command, or NULL. 116 * Malloc-ed. Note: this field doesn't 117 * get updated if masterWindowName is 118 * destroyed. */ 119 Tk_Window icon; /* Window to use as icon for this window, 120 * or NULL. */ 121 Tk_Window iconFor; /* Window for which this window is icon, or 122 * NULL if this isn't an icon for anyone. */ 123 124 /* 125 * Information used to construct an XSizeHints structure for 126 * the window manager: 127 */ 128 129 int sizeHintsFlags; /* Flags word for XSizeHints structure. 130 * If the PBaseSize flag is set then the 131 * window is gridded; otherwise it isn't 132 * gridded. */ 133 int minWidth, minHeight; /* Minimum dimensions of window, in 134 * grid units, not pixels. */ 135 int maxWidth, maxHeight; /* Maximum dimensions of window, in 136 * grid units, not pixels. */ 137 Tk_Window gridWin; /* Identifies the window that controls 138 * gridding for this top-level, or NULL if 139 * the top-level isn't currently gridded. */ 140 int widthInc, heightInc; /* Increments for size changes (# pixels 141 * per step). */ 142 struct { 143 int x; /* numerator */ 144 int y; /* denominator */ 145 } minAspect, maxAspect; /* Min/max aspect ratios for window. */ 146 int reqGridWidth, reqGridHeight; 147 /* The dimensions of the window (in 148 * grid units) requested through 149 * the geometry manager. */ 150 int gravity; /* Desired window gravity. */ 151 152 /* 153 * Information used to manage the size and location of a window. 154 */ 155 156 int width, height; /* Desired dimensions of window, specified 157 * in grid units. These values are 158 * set by the "wm geometry" command and by 159 * ConfigureNotify events (for when wm 160 * resizes window). -1 means user hasn't 161 * requested dimensions. */ 162 int x, y; /* Desired X and Y coordinates for window. 163 * These values are set by "wm geometry", 164 * plus by ConfigureNotify events (when wm 165 * moves window). These numbers are 166 * different than the numbers stored in 167 * winPtr->changes because (a) they could be 168 * measured from the right or bottom edge 169 * of the screen (see WM_NEGATIVE_X and 170 * WM_NEGATIVE_Y flags) and (b) if the window 171 * has been reparented then they refer to the 172 * parent rather than the window itself. */ 173 int parentWidth, parentHeight; 174 /* Width and height of reparent, in pixels 175 * *including border*. If window hasn't been 176 * reparented then these will be the outer 177 * dimensions of the window, including 178 * border. */ 179 int xInParent, yInParent; /* Offset of window within reparent, measured 180 * from upper-left outer corner of parent's 181 * border to upper-left outer corner of child's 182 * border. If not reparented then these are 183 * zero. */ 184 int configX, configY; /* x,y position of toplevel when window is 185 * switched into fullscreen state, */ 186 int configWidth, configHeight; 187 /* Dimensions passed to last request that we 188 * issued to change geometry of window. Used 189 * to eliminate redundant resize operations. */ 190 191 /* 192 * Information about the virtual root window for this top-level, 193 * if there is one. 194 */ 195 196 Window vRoot; /* Virtual root window for this top-level, 197 * or None if there is no virtual root 198 * window (i.e. just use the screen's root). */ 199 int vRootX, vRootY; /* Position of the virtual root inside the 200 * root window. If the WM_VROOT_OFFSET_STALE 201 * flag is set then this information may be 202 * incorrect and needs to be refreshed from 203 * the X server. If vRoot is None then these 204 * values are both 0. */ 205 unsigned int vRootWidth, vRootHeight; 206 /* Dimensions of the virtual root window. 207 * If vRoot is None, gives the dimensions 208 * of the containing screen. This information 209 * is never stale, even though vRootX and 210 * vRootY can be. */ 211 212 /* 213 * List of children of the toplevel which have private colormaps. 214 */ 215 216 TkWindow **cmapList; /* Array of window with private colormaps. */ 217 int cmapCount; /* Number of windows in array. */ 218 219 /* 220 * Miscellaneous information. 221 */ 222 223 ProtocolHandler *protPtr; /* First in list of protocol handlers for 224 * this window (NULL means none). */ 225 int cmdArgc; /* Number of elements in cmdArgv below. */ 226 const char **cmdArgv; /* Array of strings to store in the 227 * WM_COMMAND property. NULL means nothing 228 * available. */ 229 char *clientMachine; /* String to store in WM_CLIENT_MACHINE 230 * property, or NULL. */ 231 int flags; /* Miscellaneous flags, defined below. */ 232 233 /* 234 * Macintosh information. 235 */ 236 WindowClass macClass; 237 WindowAttributes attributes, configAttributes; 238 TkWindow *scrollWinPtr; /* Ptr to scrollbar handling grow widget. */ 239 short style; /* Legacy window style. */ 240} WmInfo; 241 242 243/* 244 * Flag values for WmInfo structures: 245 * 246 * WM_NEVER_MAPPED - non-zero means window has never been 247 * mapped; need to update all info when 248 * window is first mapped. 249 * WM_UPDATE_PENDING - non-zero means a call to UpdateGeometryInfo 250 * has already been scheduled for this 251 * window; no need to schedule another one. 252 * WM_NEGATIVE_X - non-zero means x-coordinate is measured in 253 * pixels from right edge of screen, rather 254 * than from left edge. 255 * WM_NEGATIVE_Y - non-zero means y-coordinate is measured in 256 * pixels up from bottom of screen, rather than 257 * down from top. 258 * WM_UPDATE_SIZE_HINTS - non-zero means that new size hints need to be 259 * propagated to window manager. 260 * WM_SYNC_PENDING - set to non-zero while waiting for the window 261 * manager to respond to some state change. 262 * WM_VROOT_OFFSET_STALE - non-zero means that (x,y) offset information 263 * about the virtual root window is stale and 264 * needs to be fetched fresh from the X server. 265 * WM_ABOUT_TO_MAP - non-zero means that the window is about to 266 * be mapped by TkWmMapWindow. This is used 267 * by UpdateGeometryInfo to modify its behavior. 268 * WM_MOVE_PENDING - non-zero means the application has requested 269 * a new position for the window, but it hasn't 270 * been reflected through the window manager 271 * yet. 272 * WM_COLORMAPS_EXPLICIT - non-zero means the colormap windows were 273 * set explicitly via "wm colormapwindows". 274 * WM_ADDED_TOPLEVEL_COLORMAP - non-zero means that when "wm colormapwindows" 275 * was called the top-level itself wasn't 276 * specified, so we added it implicitly at 277 * the end of the list. 278 * WM_WIDTH_NOT_RESIZABLE - non-zero means that we're not supposed to 279 * allow the user to change the width of the 280 * window (controlled by "wm resizable" 281 * command). 282 * WM_HEIGHT_NOT_RESIZABLE - non-zero means that we're not supposed to 283 * allow the user to change the height of the 284 * window (controlled by "wm resizable" 285 * command). 286 */ 287 288#define WM_NEVER_MAPPED 0x0001 289#define WM_UPDATE_PENDING 0x0002 290#define WM_NEGATIVE_X 0x0004 291#define WM_NEGATIVE_Y 0x0008 292#define WM_UPDATE_SIZE_HINTS 0x0010 293#define WM_SYNC_PENDING 0x0020 294#define WM_VROOT_OFFSET_STALE 0x0040 295#define WM_ABOUT_TO_MAP 0x0080 296#define WM_MOVE_PENDING 0x0100 297#define WM_COLORMAPS_EXPLICIT 0x0200 298#define WM_ADDED_TOPLEVEL_COLORMAP 0x0400 299#define WM_WIDTH_NOT_RESIZABLE 0x0800 300#define WM_HEIGHT_NOT_RESIZABLE 0x1000 301#define WM_TOPMOST 0x2000 302#define WM_FULLSCREEN 0x4000 303#define WM_TRANSPARENT 0x8000 304 305#endif 306 307