jpayne@69: /* jpayne@69: * tkMacOSXWm.h -- jpayne@69: * jpayne@69: * Declarations of Macintosh specific window manager structures. jpayne@69: * jpayne@69: * Copyright 2001-2009, Apple Inc. jpayne@69: * Copyright (c) 2006-2009 Daniel A. Steffen jpayne@69: * jpayne@69: * See the file "license.terms" for information on usage and redistribution of jpayne@69: * this file, and for a DISCLAIMER OF ALL WARRANTIES. jpayne@69: */ jpayne@69: jpayne@69: #ifndef _TKMACWM jpayne@69: #define _TKMACWM jpayne@69: jpayne@69: #include "tkMacOSXInt.h" jpayne@69: #include "tkMenu.h" jpayne@69: jpayne@69: /* jpayne@69: * A data structure of the following type holds information for each window jpayne@69: * manager protocol (such as WM_DELETE_WINDOW) for which a handler (i.e. a Tcl jpayne@69: * command) has been defined for a particular top-level window. jpayne@69: */ jpayne@69: jpayne@69: typedef struct ProtocolHandler { jpayne@69: Atom protocol; /* Identifies the protocol. */ jpayne@69: struct ProtocolHandler *nextPtr; jpayne@69: /* Next in list of protocol handlers for the jpayne@69: * same top-level window, or NULL for end of jpayne@69: * list. */ jpayne@69: Tcl_Interp *interp; /* Interpreter in which to invoke command. */ jpayne@69: char* command; /* Tcl command to invoke when a client message jpayne@69: * for this protocol arrives. The actual size jpayne@69: * of the structure varies to accommodate the jpayne@69: * needs of the actual command. THIS MUST BE jpayne@69: * THE LAST FIELD OF THE STRUCTURE. */ jpayne@69: } ProtocolHandler; jpayne@69: jpayne@69: /* The following data structure is used in the TkWmInfo to maintain a list of all of the jpayne@69: * transient windows belonging to a given container. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Transient { jpayne@69: TkWindow *winPtr; jpayne@69: int flags; jpayne@69: struct Transient *nextPtr; jpayne@69: } Transient; jpayne@69: jpayne@69: #define WITHDRAWN_BY_CONTAINER 0x1 jpayne@69: #define WITHDRAWN_BY_MASTER 0x1 jpayne@69: jpayne@69: /* jpayne@69: * A data structure of the following type holds window-manager-related jpayne@69: * information for each top-level window in an application. jpayne@69: */ jpayne@69: jpayne@69: typedef struct TkWmInfo { jpayne@69: TkWindow *winPtr; /* Pointer to main Tk information for this jpayne@69: * window. */ jpayne@69: Window reparent; /* If the window has been reparented, this jpayne@69: * gives the ID of the ancestor of the window jpayne@69: * that is a child of the root window (may not jpayne@69: * be window's immediate parent). If the window jpayne@69: * isn't reparented, this has the value jpayne@69: * None. */ jpayne@69: Tk_Uid titleUid; /* Title to display in window caption. If NULL, jpayne@69: * use name of widget. */ jpayne@69: char *iconName; /* Name to display in icon. */ jpayne@69: Tk_Window container; /* Container window for TRANSIENT_FOR property, jpayne@69: * or None. */ jpayne@69: XWMHints hints; /* Various pieces of information for window jpayne@69: * manager. */ jpayne@69: char *leaderName; /* Path name of leader of window group jpayne@69: * (corresponds to hints.window_group). jpayne@69: * Malloc-ed. Note: this field doesn't get jpayne@69: * updated if leader is destroyed. */ jpayne@69: Tk_Window icon; /* Window to use as icon for this window, or jpayne@69: * NULL. */ jpayne@69: Tk_Window iconFor; /* Window for which this window is icon, or jpayne@69: * NULL if this isn't an icon for anyone. */ jpayne@69: Transient *transientPtr; /* First item in a list of all transient windows jpayne@69: * belonging to this window, or NULL if there jpayne@69: * are no transients. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used to construct an XSizeHints structure for the window jpayne@69: * manager: jpayne@69: */ jpayne@69: jpayne@69: int sizeHintsFlags; /* Flags word for XSizeHints structure. If the jpayne@69: * PBaseSize flag is set then the window is jpayne@69: * gridded; otherwise it isn't gridded. */ jpayne@69: int minWidth, minHeight; /* Minimum dimensions of window, in grid units, jpayne@69: * not pixels. */ jpayne@69: int maxWidth, maxHeight; /* Maximum dimensions of window, in grid units, jpayne@69: * not pixels. */ jpayne@69: Tk_Window gridWin; /* Identifies the window that controls gridding jpayne@69: * for this top-level, or NULL if the top-level jpayne@69: * isn't currently gridded. */ jpayne@69: int widthInc, heightInc; /* Increments for size changes (# pixels per jpayne@69: * step). */ jpayne@69: struct { jpayne@69: int x; /* numerator */ jpayne@69: int y; /* denominator */ jpayne@69: } minAspect, maxAspect; /* Min/max aspect ratios for window. */ jpayne@69: int reqGridWidth, reqGridHeight; jpayne@69: /* The dimensions of the window (in grid units) jpayne@69: * requested through the geometry manager. */ jpayne@69: int gravity; /* Desired window gravity. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used to manage the size and location of a window. jpayne@69: */ jpayne@69: jpayne@69: int width, height; /* Desired dimensions of window, specified in jpayne@69: * grid units. These values are set by the "wm jpayne@69: * geometry" command and by ConfigureNotify jpayne@69: * events (for when wm resizes window). -1 jpayne@69: * means user hasn't requested dimensions. */ jpayne@69: int x, y; /* Desired X and Y coordinates for window. jpayne@69: * These values are set by "wm geometry", plus jpayne@69: * by ConfigureNotify events (when wm moves jpayne@69: * window). These numbers are different than jpayne@69: * the numbers stored in winPtr->changes jpayne@69: * because (a) they could be measured from the jpayne@69: * right or bottom edge of the screen (see jpayne@69: * WM_NEGATIVE_X and WM_NEGATIVE_Y flags) and jpayne@69: * (b) if the window has been reparented then jpayne@69: * they refer to the parent rather than the jpayne@69: * window itself. */ jpayne@69: int parentWidth, parentHeight; jpayne@69: /* Width and height of reparent, in pixels jpayne@69: * *including border*. If window hasn't been jpayne@69: * reparented then these will be the outer jpayne@69: * dimensions of the window, including jpayne@69: * border. */ jpayne@69: int xInParent, yInParent; /* Offset of window within reparent, measured jpayne@69: * from upper-left outer corner of parent's jpayne@69: * border to upper-left outer corner of child's jpayne@69: * border. If not reparented then these are jpayne@69: * zero. */ jpayne@69: int configX, configY; /* x,y position of toplevel when window is jpayne@69: * switched into fullscreen state, */ jpayne@69: int configWidth, configHeight; jpayne@69: /* Dimensions passed to last request that we jpayne@69: * issued to change geometry of window. Used to jpayne@69: * eliminate redundant resize operations. */ jpayne@69: jpayne@69: /* jpayne@69: * Information about the virtual root window for this top-level, if there jpayne@69: * is one. jpayne@69: */ jpayne@69: jpayne@69: Window vRoot; /* Virtual root window for this top-level, or jpayne@69: * None if there is no virtual root window jpayne@69: * (i.e. just use the screen's root). */ jpayne@69: int vRootX, vRootY; /* Position of the virtual root inside the root jpayne@69: * window. If the WM_VROOT_OFFSET_STALE flag is jpayne@69: * set then this information may be incorrect jpayne@69: * and needs to be refreshed from the OS. If jpayne@69: * vRoot is None then these values are both jpayne@69: * 0. */ jpayne@69: unsigned int vRootWidth, vRootHeight; jpayne@69: /* Dimensions of the virtual root window. If jpayne@69: * vRoot is None, gives the dimensions of the jpayne@69: * containing screen. This information is never jpayne@69: * stale, even though vRootX and vRootY can jpayne@69: * be. */ jpayne@69: jpayne@69: /* jpayne@69: * List of children of the toplevel which have private colormaps. jpayne@69: */ jpayne@69: jpayne@69: TkWindow **cmapList; /* Array of window with private colormaps. */ jpayne@69: int cmapCount; /* Number of windows in array. */ jpayne@69: jpayne@69: /* jpayne@69: * Miscellaneous information. jpayne@69: */ jpayne@69: jpayne@69: ProtocolHandler *protPtr; /* First in list of protocol handlers for this jpayne@69: * window (NULL means none). */ jpayne@69: Tcl_Obj *commandObj; /* The command (guaranteed to be a list) for jpayne@69: * the WM_COMMAND property. NULL means nothing jpayne@69: * available. */ jpayne@69: char *clientMachine; /* String to store in WM_CLIENT_MACHINE jpayne@69: * property, or NULL. */ jpayne@69: int flags; /* Miscellaneous flags, defined below. */ jpayne@69: jpayne@69: /* jpayne@69: * Macintosh information. jpayne@69: */ jpayne@69: jpayne@69: WindowClass macClass; jpayne@69: UInt64 attributes, configAttributes; jpayne@69: TkWindow *scrollWinPtr; /* Ptr to scrollbar handling grow widget. */ jpayne@69: TkMenu *menuPtr; jpayne@69: NSWindow *window; jpayne@69: jpayne@69: /* jpayne@69: * Space to cache current window state when window becomes Fullscreen. jpayne@69: */ jpayne@69: jpayne@69: unsigned long cachedStyle; jpayne@69: unsigned long cachedPresentation; jpayne@69: NSRect cachedBounds; jpayne@69: jpayne@69: } WmInfo; jpayne@69: jpayne@69: /* jpayne@69: * Flag values for WmInfo structures: jpayne@69: * jpayne@69: * WM_NEVER_MAPPED - non-zero means window has never been mapped; jpayne@69: * need to update all info when window is first jpayne@69: * mapped. jpayne@69: * WM_UPDATE_PENDING - non-zero means a call to UpdateGeometryInfo jpayne@69: * has already been scheduled for this window; no jpayne@69: * need to schedule another one. jpayne@69: * WM_NEGATIVE_X - non-zero means x-coordinate is measured in jpayne@69: * pixels from right edge of screen, rather than jpayne@69: * from left edge. jpayne@69: * WM_NEGATIVE_Y - non-zero means y-coordinate is measured in jpayne@69: * pixels up from bottom of screen, rather than jpayne@69: * down from top. jpayne@69: * WM_UPDATE_SIZE_HINTS - non-zero means that new size hints need to be jpayne@69: * propagated to window manager. jpayne@69: * WM_SYNC_PENDING - set to non-zero while waiting for the window jpayne@69: * manager to respond to some state change. jpayne@69: * WM_VROOT_OFFSET_STALE - non-zero means that (x,y) offset information jpayne@69: * about the virtual root window is stale and jpayne@69: * needs to be fetched fresh from the X server. jpayne@69: * WM_ABOUT_TO_MAP - non-zero means that the window is about to be jpayne@69: * mapped by TkWmMapWindow. This is used by jpayne@69: * UpdateGeometryInfo to modify its behavior. jpayne@69: * WM_MOVE_PENDING - non-zero means the application has requested a jpayne@69: * new position for the window, but it hasn't jpayne@69: * been reflected through the window manager yet. jpayne@69: * WM_COLORMAPS_EXPLICIT - non-zero means the colormap windows were set jpayne@69: * explicitly via "wm colormapwindows". jpayne@69: * WM_ADDED_TOPLEVEL_COLORMAP - non-zero means that when "wm colormapwindows" jpayne@69: * was called the top-level itself wasn't jpayne@69: * specified, so we added it implicitly at the jpayne@69: * end of the list. jpayne@69: * WM_WIDTH_NOT_RESIZABLE - non-zero means that we're not supposed to jpayne@69: * allow the user to change the width of the jpayne@69: * window (controlled by "wm resizable" command). jpayne@69: * WM_HEIGHT_NOT_RESIZABLE - non-zero means that we're not supposed to jpayne@69: * allow the user to change the height of the jpayne@69: * window (controlled by "wm resizable" command). jpayne@69: */ jpayne@69: jpayne@69: #define WM_NEVER_MAPPED 0x0001 jpayne@69: #define WM_UPDATE_PENDING 0x0002 jpayne@69: #define WM_NEGATIVE_X 0x0004 jpayne@69: #define WM_NEGATIVE_Y 0x0008 jpayne@69: #define WM_UPDATE_SIZE_HINTS 0x0010 jpayne@69: #define WM_SYNC_PENDING 0x0020 jpayne@69: #define WM_VROOT_OFFSET_STALE 0x0040 jpayne@69: #define WM_ABOUT_TO_MAP 0x0080 jpayne@69: #define WM_MOVE_PENDING 0x0100 jpayne@69: #define WM_COLORMAPS_EXPLICIT 0x0200 jpayne@69: #define WM_ADDED_TOPLEVEL_COLORMAP 0x0400 jpayne@69: #define WM_WIDTH_NOT_RESIZABLE 0x0800 jpayne@69: #define WM_HEIGHT_NOT_RESIZABLE 0x1000 jpayne@69: #define WM_TOPMOST 0x2000 jpayne@69: #define WM_FULLSCREEN 0x4000 jpayne@69: #define WM_TRANSPARENT 0x8000 jpayne@69: jpayne@69: #endif /* _TKMACWM */ jpayne@69: jpayne@69: /* jpayne@69: * Local Variables: jpayne@69: * mode: objc jpayne@69: * c-basic-offset: 4 jpayne@69: * fill-column: 79 jpayne@69: * coding: utf-8 jpayne@69: * End: jpayne@69: */