tkMacOSXWm.h 10 KB

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