1 /** 2 * \file 3 * TwmWindow struct definition. 4 * 5 * This previously lived in ctwm.h, but was moved out here to make it a 6 * bit easier to scan either this struct or all the other stuff in 7 * ctwm.h, without so much rooting around. It's \#include'd in ctwm.h, 8 * and shouldn't be included elsewhere; it's split out purely for 9 * dev ease. 10 */ 11 #ifndef _CTWM_TWM_WINDOW_STRUCT_H 12 #define _CTWM_TWM_WINDOW_STRUCT_H 13 14 /* Needed for doxygen to get at the #define's for config (like EMWH) */ 15 #ifdef DOXYGEN 16 # include "ctwm_config.h" 17 #endif 18 19 20 /** 21 * Info and control for every X Window we take over. 22 * 23 * As a window manager, our job is to... y'know. Manage windows. Every 24 * other window on the screen we wrap and control (as well as a few of 25 * our internal windows) gets one of these structs put around it to hold 26 * the various config and state info we track about it. They get put 27 * into various linked lists for each screen and workspace, and 28 * references get stashed in X Contexts so we can find the window that 29 * events happen on. 30 * 31 * Much of this is initially setup in AddWindow() when we find out about 32 * and take over a window. 33 */ 34 struct TwmWindow { 35 struct TwmWindow *next; ///< Next TwmWindow on the Screen 36 struct TwmWindow *prev; ///< Previous TwmWindow on the Screen 37 38 /// OTP control info for stacking. Created in OtpAdd(). 39 OtpWinList *otp; 40 41 /// The actual X Window handle 42 Window w; 43 44 /// Original window border width before we took it over and made our 45 /// own bordering. This comes from the XWindowAttributes we get from 46 /// XGetWindowAttributes(). 47 int old_bw; 48 49 /** 50 * \defgroup win_frame Window frame bits 51 * These fields are related to the "frame" window; the decoration we 52 * put around the application's own window (the thing in TwmWindow.w 53 * above) to display borders, titlebars, etc. 54 * @{ 55 */ 56 Window frame; ///< The X window for the overall frame 57 Window title_w; ///< The title bar Window 58 Window hilite_wl; ///< Left hilite window in titlebar 59 Window hilite_wr; ///< Right hilite window in titlebar 60 Window lolite_wl; ///< Left lolite window in titlebar 61 Window lolite_wr; ///< Right lolite window in titlebar 62 63 /// Current resize cursor. This changes depending on where on the 64 /// frame you are, if we're making them. \sa 65 /// ScreenInfo.BorderCursors 66 Cursor curcurs; 67 68 /// Pixmap to which the border is set to when window isn't focused. 69 /// \sa TwmWindow.borderC \sa SetFocusVisualAttributes() 70 /// \todo See the XXX in SetFocusVisualAttributes() 71 Pixmap gray; 72 73 /// @} 74 75 struct Icon *icon; ///< The current icon. \sa CreateIconWindow() 76 name_list *iconslist; ///< The current list of potential icons 77 78 /// \addtogroup win_frame Window frame bits 79 /// @{ 80 int frame_x; ///< X position on screen of frame 81 int frame_y; ///< Y position on screen of frame 82 unsigned int frame_width; ///< Width of frame 83 unsigned int frame_height; ///< Height of frame 84 85 /// 2d border width. \sa ScreenInfo.BorderWidth 86 int frame_bw; 87 /// 3d border width. \sa ScreenInfo.ThreeDBorderWidth 88 int frame_bw3D; 89 90 int actual_frame_x; ///< Saved frame_x when squeezed 91 int actual_frame_y; ///< Saved frame_y when squeezed 92 unsigned int actual_frame_width; ///< Saved frame_width when squeezed 93 unsigned int actual_frame_height; ///< Saved frame_height when squeezed 94 95 /// X coord of window title relative to title_w. 96 /// \sa ComputeTitleLocation() 97 int title_x; 98 /// Y coord of window title relative to title_w. 99 /// \sa ComputeTitleLocation() 100 int title_y; 101 102 unsigned int title_height; ///< Height of the full title bar 103 unsigned int title_width; ///< Width of the full title bar 104 105 /// @} 106 107 char *name; ///< Current window name. Points into TwmWindow::names. 108 char *icon_name; ///< Current icon name. Points into TwmWindow::names. 109 110 /// Various sources of window/icon names. These are the values from 111 /// the various window properties we look at to get the results. The 112 /// TwmWindow::name and TwmWindow::icon_name point to the currently 113 /// active element in here. 114 struct _names { 115 char *ctwm_wm_name; ///< Name from override CTWM_WM_NAME property 116 #ifdef EWMH 117 char *net_wm_name; ///< Name from EWMH _NET_WM_NAME property 118 #endif 119 char *wm_name; ///< Name from ICCCM WM_NAME property 120 121 /// Icon name from override CTWM_WM_ICON_NAME property 122 char *ctwm_wm_icon_name; 123 #ifdef EWMH 124 /// Icon name from EWMH _NET_WM_ICON_NAME property 125 char *net_wm_icon_name; 126 #endif 127 char *wm_icon_name; ///< Icon name from WM_ICON_NAME property 128 129 /// Whether an icon name property has been set. Since we default 130 /// the icon name to the window name when nothing is given, this 131 /// flag allows the window-name-setting code to know when it 132 /// needs to re-kick the icon-name-setting. 133 bool icon_set; 134 } names; ///< \copydoc TwmWindow::_names 135 136 /// \addtogroup win_frame Window frame bits 137 /// @{ 138 139 /// Position of window title text, relative to title_w. Starts from 140 /// \ref title_x, but may be pushed over due to TitleJustification 141 /// config. 142 int name_x; 143 unsigned int name_width; ///< width of name text 144 int highlightxl; ///< Position of \ref hilite_wl and \ref lolite_wl 145 int highlightxr; ///< Position of \ref hilite_wr and \ref lolite_wr 146 int rightx; ///< Position of of right titlebar buttons 147 /// @} 148 149 /// Window attributes from XGetWindowAttributes() 150 XWindowAttributes attr; 151 /// Window size hints. From WM_NORMAL_HINTS property. 152 /// \sa GetWindowSizeHints() 153 XSizeHints hints; 154 /// Window manager hints. From WM_HINTS property, filled in via 155 /// XGetWMHints(). 156 XWMHints *wmhints; 157 Window group; ///< Window group, from WM hints. 158 XClassHint class; ///< Window class info. From XGetClassHint(). 159 160 /// List of the icon managers the window is in. \sa AddIconManager() 161 struct WList *iconmanagerlist; 162 163 ColorPair borderC; ///< ColorPair for focused window borders 164 ColorPair border_tile; ///< ColorPair for non-focused window borders 165 ColorPair title; ///< ColorPair for various other titlebar bits 166 167 /// Has the window ever been iconified? 168 /// \todo This is almost write-only, and the one reader seems bogus 169 /// in light of what it does. Investigate further and possibly 170 /// remove. 171 bool iconified; 172 173 bool isicon; ///< Is the window an icon now ? 174 bool icon_on; ///< Is the icon visible 175 bool mapped; ///< Is the window mapped ? 176 bool squeezed; ///< Is the window squeezed ? 177 bool auto_raise; ///< Should we auto-raise this window ? 178 bool auto_lower; ///< Should we auto-lower this window ? 179 bool forced; ///< Has had an icon forced upon it 180 bool icon_moved; ///< User explicitly moved the icon 181 bool highlight; ///< Should highlight this window 182 bool stackmode; ///< Honor stackmode requests. \sa ScreenInfo.StackMode 183 bool iconify_by_unmapping; ///< Unmap window to iconify it 184 bool isiconmgr; ///< This is an icon manager window 185 bool iswspmgr; ///< This is a workspace manager window 186 bool isoccupy; ///< This is an Occupy window 187 188 bool istransient; ///< This is a transient window 189 /// What window it's transient for. From XGetTransientForHint() and 190 /// XM_TRANSIENT_FOR property. 191 Window transientfor; 192 193 bool titlehighlight; ///< Should I highlight the title bar? 194 195 /// Pointer to the icon manager structure, for windows that are icon 196 /// managers. Currently also set for some other window types to 197 /// various things, but is only ever used for icon manager windows 198 /// (\ref isiconmgr = true). 199 struct IconMgr *iconmgrp; 200 201 int save_frame_x; ///< x position of frame (saved from zoom) 202 int save_frame_y; ///< y position of frame (saved from zoom) 203 unsigned int save_frame_width; ///< width of frame (saved from zoom) 204 unsigned int save_frame_height; ///< height of frame (saved from zoom) 205 int zoomed; ///< ZOOM_NONE || function causing zoom 206 bool wShaped; ///< This window is Shape'd 207 /// Which protocols this window handles. From WM_PROTOCOLS property 208 /// via XGetWMProtocols() 209 unsigned long protocols; 210 Colormaps cmaps; ///< colormaps for this application 211 /// Button windows in the titlebar. \ingroup win_frame 212 TBWindow *titlebuttons; 213 SqueezeInfo *squeeze_info; ///< Control info for title squeezing 214 bool squeeze_info_copied; ///< Should ->squeeze_info be free()'d? 215 216 /// Window ring connectivity 217 struct _ring { 218 struct TwmWindow *next; ///< Next window in the ring 219 struct TwmWindow *prev; ///< Previous window in the ring 220 bool cursor_valid; ///< Whether curs_x and curs_y are usable 221 int curs_x; ///< Stored cursor position in the window 222 int curs_y; ///< Stored cursor position in the window 223 } ring; ///< \copydoc TwmWindow::_ring 224 // x-ref ScreenInfo.InfoWindow about doxygen hackery 225 226 // Many of these are just the window's particular casing of various 227 // config params, inherited from the screen's info. In most cases, 228 // they're essentially a read-only cache. 229 bool OpaqueMove; ///< Move opaquely. \sa ScreenInfo.DoOpaqueMove 230 bool OpaqueResize; ///< Resize opaquely. \sa ScreenInfo.DoOpaqueResize 231 bool UnmapByMovingFarAway; ///< \sa ScreenInfo.UnmapByMovingFarAway 232 bool AutoSqueeze; ///< \sa ScreenInfo.AutoSqueeze 233 bool StartSqueezed; ///< \sa ScreenInfo.StartSqueezed 234 bool AlwaysSqueezeToGravity; ///< \sa ScreenInfo.AlwaysSqueezeToGravity 235 bool DontSetInactive; ///< \sa ScreenInfo.DontSetInactive 236 237 bool hasfocusvisible; ///< The window visibly has focus 238 239 int occupation; ///< Workspaces the window is in (bitmap) 240 241 Image *HiliteImage; ///< Titlebar hilite backround. \ingroup win_frame 242 Image *LoliteImage; ///< Titlebar lolite backround. \ingroup win_frame 243 244 /// WindowRegion containing this window. \todo Write-only? Reap? 245 WindowRegion *wr; 246 WindowBox *winbox; ///< WindowBox containing this window. 247 bool iswinbox; ///< This is a WindowBox window. 248 249 /// Saved window geometry. Used in f.savegeometry and 250 /// f.restoregeometry. 251 struct _savegeometry { 252 int x; ///< Saved x coord 253 int y; ///< Saved y coord 254 unsigned int width; ///< Saved width 255 unsigned int height; ///< Saved height 256 } savegeometry; ///< \copydoc TwmWindow::_savegeometry 257 258 /// Where the window is currently mapped (may be NULL) 259 struct VirtualScreen *vs; 260 /// Where the window is parented. Always set. 261 struct VirtualScreen *parent_vs; 262 263 /// Where the window would be. Used only by f.showbackground. 264 /// \sa ShowBackground() 265 struct VirtualScreen *savevs; 266 267 /// Has \ref TwmWindow::name ever changed? Used only in session saving. 268 bool nameChanged; 269 /// Has \ref TwmWindow::attr width ever changed? Used only in sessions. 270 bool widthEverChangedByUser; 271 /// Has \ref TwmWindow::attr height ever changed? Used only in sessions. 272 bool heightEverChangedByUser; 273 274 #ifdef EWMH 275 EwmhWindowType ewmhWindowType; ///< EWMH-defined window type 276 int ewmhFlags; ///< EWMH-defined window stats. Mostly from _NET_WM_STATE. 277 #endif /* EWMH */ 278 }; 279 280 #endif /* _CTWM_TWM_WINDOW_STRUCT_H */ 281