twm_window_struct.h revision 0bbfda8a
10bbfda8aSnia/** 20bbfda8aSnia * \file 30bbfda8aSnia * TwmWindow struct definition. 40bbfda8aSnia * 50bbfda8aSnia * This previously lived in ctwm.h, but was moved out here to make it a 60bbfda8aSnia * bit easier to scan either this struct or all the other stuff in 70bbfda8aSnia * ctwm.h, without so much rooting around. It's \#include'd in ctwm.h, 80bbfda8aSnia * and shouldn't be included elsewhere; it's split out purely for 90bbfda8aSnia * dev ease. 100bbfda8aSnia */ 110bbfda8aSnia#ifndef _CTWM_TWM_WINDOW_STRUCT_H 120bbfda8aSnia#define _CTWM_TWM_WINDOW_STRUCT_H 130bbfda8aSnia 140bbfda8aSnia/* Needed for doxygen to get at the #define's for config (like EMWH) */ 150bbfda8aSnia#ifdef DOXYGEN 160bbfda8aSnia# include "ctwm_config.h" 170bbfda8aSnia#endif 180bbfda8aSnia 190bbfda8aSnia 200bbfda8aSnia/** 210bbfda8aSnia * Info and control for every X Window we take over. 220bbfda8aSnia * 230bbfda8aSnia * As a window manager, our job is to... y'know. Manage windows. Every 240bbfda8aSnia * other window on the screen we wrap and control (as well as a few of 250bbfda8aSnia * our internal windows) gets one of these structs put around it to hold 260bbfda8aSnia * the various config and state info we track about it. They get put 270bbfda8aSnia * into various linked lists for each screen and workspace, and 280bbfda8aSnia * references get stashed in X Contexts so we can find the window that 290bbfda8aSnia * events happen on. 300bbfda8aSnia * 310bbfda8aSnia * Much of this is initially setup in AddWindow() when we find out about 320bbfda8aSnia * and take over a window. 330bbfda8aSnia */ 340bbfda8aSniastruct TwmWindow { 350bbfda8aSnia struct TwmWindow *next; ///< Next TwmWindow on the Screen 360bbfda8aSnia struct TwmWindow *prev; ///< Previous TwmWindow on the Screen 370bbfda8aSnia 380bbfda8aSnia /// OTP control info for stacking. Created in OtpAdd(). 390bbfda8aSnia OtpWinList *otp; 400bbfda8aSnia 410bbfda8aSnia /// The actual X Window handle 420bbfda8aSnia Window w; 430bbfda8aSnia 440bbfda8aSnia /// Original window border width before we took it over and made our 450bbfda8aSnia /// own bordering. This comes from the XWindowAttributes we get from 460bbfda8aSnia /// XGetWindowAttributes(). 470bbfda8aSnia int old_bw; 480bbfda8aSnia 490bbfda8aSnia /** 500bbfda8aSnia * \defgroup win_frame Window frame bits 510bbfda8aSnia * These fields are related to the "frame" window; the decoration we 520bbfda8aSnia * put around the application's own window (the thing in TwmWindow.w 530bbfda8aSnia * above) to display borders, titlebars, etc. 540bbfda8aSnia * @{ 550bbfda8aSnia */ 560bbfda8aSnia Window frame; ///< The X window for the overall frame 570bbfda8aSnia Window title_w; ///< The title bar Window 580bbfda8aSnia Window hilite_wl; ///< Left hilite window in titlebar 590bbfda8aSnia Window hilite_wr; ///< Right hilite window in titlebar 600bbfda8aSnia Window lolite_wl; ///< Left lolite window in titlebar 610bbfda8aSnia Window lolite_wr; ///< Right lolite window in titlebar 620bbfda8aSnia 630bbfda8aSnia /// Current resize cursor. This changes depending on where on the 640bbfda8aSnia /// frame you are, if we're making them. \sa 650bbfda8aSnia /// ScreenInfo.BorderCursors 660bbfda8aSnia Cursor curcurs; 670bbfda8aSnia 680bbfda8aSnia /// Pixmap to which the border is set to when window isn't focused. 690bbfda8aSnia /// \sa TwmWindow.borderC \sa SetFocusVisualAttributes() 700bbfda8aSnia /// \todo See the XXX in SetFocusVisualAttributes() 710bbfda8aSnia Pixmap gray; 720bbfda8aSnia 730bbfda8aSnia /// @} 740bbfda8aSnia 750bbfda8aSnia struct Icon *icon; ///< The current icon. \sa CreateIconWindow() 760bbfda8aSnia name_list *iconslist; ///< The current list of potential icons 770bbfda8aSnia 780bbfda8aSnia /// \addtogroup win_frame Window frame bits 790bbfda8aSnia /// @{ 800bbfda8aSnia int frame_x; ///< X position on screen of frame 810bbfda8aSnia int frame_y; ///< Y position on screen of frame 820bbfda8aSnia unsigned int frame_width; ///< Width of frame 830bbfda8aSnia unsigned int frame_height; ///< Height of frame 840bbfda8aSnia 850bbfda8aSnia /// 2d border width. \sa ScreenInfo.BorderWidth 860bbfda8aSnia int frame_bw; 870bbfda8aSnia /// 3d border width. \sa ScreenInfo.ThreeDBorderWidth 880bbfda8aSnia int frame_bw3D; 890bbfda8aSnia 900bbfda8aSnia int actual_frame_x; ///< Saved frame_x when squeezed 910bbfda8aSnia int actual_frame_y; ///< Saved frame_y when squeezed 920bbfda8aSnia unsigned int actual_frame_width; ///< Saved frame_width when squeezed 930bbfda8aSnia unsigned int actual_frame_height; ///< Saved frame_height when squeezed 940bbfda8aSnia 950bbfda8aSnia /// X coord of window title relative to title_w. 960bbfda8aSnia /// \sa ComputeTitleLocation() 970bbfda8aSnia int title_x; 980bbfda8aSnia /// Y coord of window title relative to title_w. 990bbfda8aSnia /// \sa ComputeTitleLocation() 1000bbfda8aSnia int title_y; 1010bbfda8aSnia 1020bbfda8aSnia unsigned int title_height; ///< Height of the full title bar 1030bbfda8aSnia unsigned int title_width; ///< Width of the full title bar 1040bbfda8aSnia 1050bbfda8aSnia /// @} 1060bbfda8aSnia 1070bbfda8aSnia char *name; ///< Current window name. Points into TwmWindow::names. 1080bbfda8aSnia char *icon_name; ///< Current icon name. Points into TwmWindow::names. 1090bbfda8aSnia 1100bbfda8aSnia /// Various sources of window/icon names. These are the values from 1110bbfda8aSnia /// the various window properties we look at to get the results. The 1120bbfda8aSnia /// TwmWindow::name and TwmWindow::icon_name point to the currently 1130bbfda8aSnia /// active element in here. 1140bbfda8aSnia struct _names { 1150bbfda8aSnia char *ctwm_wm_name; ///< Name from override CTWM_WM_NAME property 1160bbfda8aSnia#ifdef EWMH 1170bbfda8aSnia char *net_wm_name; ///< Name from EWMH _NET_WM_NAME property 1180bbfda8aSnia#endif 1190bbfda8aSnia char *wm_name; ///< Name from ICCCM WM_NAME property 1200bbfda8aSnia 1210bbfda8aSnia /// Icon name from override CTWM_WM_ICON_NAME property 1220bbfda8aSnia char *ctwm_wm_icon_name; 1230bbfda8aSnia#ifdef EWMH 1240bbfda8aSnia /// Icon name from EWMH _NET_WM_ICON_NAME property 1250bbfda8aSnia char *net_wm_icon_name; 1260bbfda8aSnia#endif 1270bbfda8aSnia char *wm_icon_name; ///< Icon name from WM_ICON_NAME property 1280bbfda8aSnia 1290bbfda8aSnia /// Whether an icon name property has been set. Since we default 1300bbfda8aSnia /// the icon name to the window name when nothing is given, this 1310bbfda8aSnia /// flag allows the window-name-setting code to know when it 1320bbfda8aSnia /// needs to re-kick the icon-name-setting. 1330bbfda8aSnia bool icon_set; 1340bbfda8aSnia } names; ///< \copydoc TwmWindow::_names 1350bbfda8aSnia 1360bbfda8aSnia /// \addtogroup win_frame Window frame bits 1370bbfda8aSnia /// @{ 1380bbfda8aSnia 1390bbfda8aSnia /// Position of window title text, relative to title_w. Starts from 1400bbfda8aSnia /// \ref title_x, but may be pushed over due to TitleJustification 1410bbfda8aSnia /// config. 1420bbfda8aSnia int name_x; 1430bbfda8aSnia unsigned int name_width; ///< width of name text 1440bbfda8aSnia int highlightxl; ///< Position of \ref hilite_wl and \ref lolite_wl 1450bbfda8aSnia int highlightxr; ///< Position of \ref hilite_wr and \ref lolite_wr 1460bbfda8aSnia int rightx; ///< Position of of right titlebar buttons 1470bbfda8aSnia /// @} 1480bbfda8aSnia 1490bbfda8aSnia /// Window attributes from XGetWindowAttributes() 1500bbfda8aSnia XWindowAttributes attr; 1510bbfda8aSnia /// Window size hints. From WM_NORMAL_HINTS property. 1520bbfda8aSnia /// \sa GetWindowSizeHints() 1530bbfda8aSnia XSizeHints hints; 1540bbfda8aSnia /// Window manager hints. From WM_HINTS property, filled in via 1550bbfda8aSnia /// XGetWMHints(). 1560bbfda8aSnia XWMHints *wmhints; 1570bbfda8aSnia Window group; ///< Window group, from WM hints. 1580bbfda8aSnia XClassHint class; ///< Window class info. From XGetClassHint(). 1590bbfda8aSnia 1600bbfda8aSnia /// List of the icon managers the window is in. \sa AddIconManager() 1610bbfda8aSnia struct WList *iconmanagerlist; 1620bbfda8aSnia 1630bbfda8aSnia ColorPair borderC; ///< ColorPair for focused window borders 1640bbfda8aSnia ColorPair border_tile; ///< ColorPair for non-focused window borders 1650bbfda8aSnia ColorPair title; ///< ColorPair for various other titlebar bits 1660bbfda8aSnia 1670bbfda8aSnia /// Has the window ever been iconified? 1680bbfda8aSnia /// \todo This is almost write-only, and the one reader seems bogus 1690bbfda8aSnia /// in light of what it does. Investigate further and possibly 1700bbfda8aSnia /// remove. 1710bbfda8aSnia bool iconified; 1720bbfda8aSnia 1730bbfda8aSnia bool isicon; ///< Is the window an icon now ? 1740bbfda8aSnia bool icon_on; ///< Is the icon visible 1750bbfda8aSnia bool mapped; ///< Is the window mapped ? 1760bbfda8aSnia bool squeezed; ///< Is the window squeezed ? 1770bbfda8aSnia bool auto_raise; ///< Should we auto-raise this window ? 1780bbfda8aSnia bool auto_lower; ///< Should we auto-lower this window ? 1790bbfda8aSnia bool forced; ///< Has had an icon forced upon it 1800bbfda8aSnia bool icon_moved; ///< User explicitly moved the icon 1810bbfda8aSnia bool highlight; ///< Should highlight this window 1820bbfda8aSnia bool stackmode; ///< Honor stackmode requests. \sa ScreenInfo.StackMode 1830bbfda8aSnia bool iconify_by_unmapping; ///< Unmap window to iconify it 1840bbfda8aSnia bool isiconmgr; ///< This is an icon manager window 1850bbfda8aSnia bool iswspmgr; ///< This is a workspace manager window 1860bbfda8aSnia bool isoccupy; ///< This is an Occupy window 1870bbfda8aSnia 1880bbfda8aSnia bool istransient; ///< This is a transient window 1890bbfda8aSnia /// What window it's transient for. From XGetTransientForHint() and 1900bbfda8aSnia /// XM_TRANSIENT_FOR property. 1910bbfda8aSnia Window transientfor; 1920bbfda8aSnia 1930bbfda8aSnia bool titlehighlight; ///< Should I highlight the title bar? 1940bbfda8aSnia 1950bbfda8aSnia /// Pointer to the icon manager structure, for windows that are icon 1960bbfda8aSnia /// managers. Currently also set for some other window types to 1970bbfda8aSnia /// various things, but is only ever used for icon manager windows 1980bbfda8aSnia /// (\ref isiconmgr = true). 1990bbfda8aSnia struct IconMgr *iconmgrp; 2000bbfda8aSnia 2010bbfda8aSnia int save_frame_x; ///< x position of frame (saved from zoom) 2020bbfda8aSnia int save_frame_y; ///< y position of frame (saved from zoom) 2030bbfda8aSnia unsigned int save_frame_width; ///< width of frame (saved from zoom) 2040bbfda8aSnia unsigned int save_frame_height; ///< height of frame (saved from zoom) 2050bbfda8aSnia int zoomed; ///< ZOOM_NONE || function causing zoom 2060bbfda8aSnia bool wShaped; ///< This window is Shape'd 2070bbfda8aSnia /// Which protocols this window handles. From WM_PROTOCOLS property 2080bbfda8aSnia /// via XGetWMProtocols() 2090bbfda8aSnia unsigned long protocols; 2100bbfda8aSnia Colormaps cmaps; ///< colormaps for this application 2110bbfda8aSnia /// Button windows in the titlebar. \ingroup win_frame 2120bbfda8aSnia TBWindow *titlebuttons; 2130bbfda8aSnia SqueezeInfo *squeeze_info; ///< Control info for title squeezing 2140bbfda8aSnia bool squeeze_info_copied; ///< Should ->squeeze_info be free()'d? 2150bbfda8aSnia 2160bbfda8aSnia /// Window ring connectivity 2170bbfda8aSnia struct _ring { 2180bbfda8aSnia struct TwmWindow *next; ///< Next window in the ring 2190bbfda8aSnia struct TwmWindow *prev; ///< Previous window in the ring 2200bbfda8aSnia bool cursor_valid; ///< Whether curs_x and curs_y are usable 2210bbfda8aSnia int curs_x; ///< Stored cursor position in the window 2220bbfda8aSnia int curs_y; ///< Stored cursor position in the window 2230bbfda8aSnia } ring; ///< \copydoc TwmWindow::_ring 2240bbfda8aSnia // x-ref ScreenInfo.InfoWindow about doxygen hackery 2250bbfda8aSnia 2260bbfda8aSnia // Many of these are just the window's particular casing of various 2270bbfda8aSnia // config params, inherited from the screen's info. In most cases, 2280bbfda8aSnia // they're essentially a read-only cache. 2290bbfda8aSnia bool OpaqueMove; ///< Move opaquely. \sa ScreenInfo.DoOpaqueMove 2300bbfda8aSnia bool OpaqueResize; ///< Resize opaquely. \sa ScreenInfo.DoOpaqueResize 2310bbfda8aSnia bool UnmapByMovingFarAway; ///< \sa ScreenInfo.UnmapByMovingFarAway 2320bbfda8aSnia bool AutoSqueeze; ///< \sa ScreenInfo.AutoSqueeze 2330bbfda8aSnia bool StartSqueezed; ///< \sa ScreenInfo.StartSqueezed 2340bbfda8aSnia bool AlwaysSqueezeToGravity; ///< \sa ScreenInfo.AlwaysSqueezeToGravity 2350bbfda8aSnia bool DontSetInactive; ///< \sa ScreenInfo.DontSetInactive 2360bbfda8aSnia 2370bbfda8aSnia bool hasfocusvisible; ///< The window visibly has focus 2380bbfda8aSnia 2390bbfda8aSnia int occupation; ///< Workspaces the window is in (bitmap) 2400bbfda8aSnia 2410bbfda8aSnia Image *HiliteImage; ///< Titlebar hilite backround. \ingroup win_frame 2420bbfda8aSnia Image *LoliteImage; ///< Titlebar lolite backround. \ingroup win_frame 2430bbfda8aSnia 2440bbfda8aSnia /// WindowRegion containing this window. \todo Write-only? Reap? 2450bbfda8aSnia WindowRegion *wr; 2460bbfda8aSnia WindowBox *winbox; ///< WindowBox containing this window. 2470bbfda8aSnia bool iswinbox; ///< This is a WindowBox window. 2480bbfda8aSnia 2490bbfda8aSnia /// Saved window geometry. Used in f.savegeometry and 2500bbfda8aSnia /// f.restoregeometry. 2510bbfda8aSnia struct _savegeometry { 2520bbfda8aSnia int x; ///< Saved x coord 2530bbfda8aSnia int y; ///< Saved y coord 2540bbfda8aSnia unsigned int width; ///< Saved width 2550bbfda8aSnia unsigned int height; ///< Saved height 2560bbfda8aSnia } savegeometry; ///< \copydoc TwmWindow::_savegeometry 2570bbfda8aSnia 2580bbfda8aSnia /// Where the window is currently mapped (may be NULL) 2590bbfda8aSnia struct VirtualScreen *vs; 2600bbfda8aSnia /// Where the window is parented. Always set. 2610bbfda8aSnia struct VirtualScreen *parent_vs; 2620bbfda8aSnia 2630bbfda8aSnia /// Where the window would be. Used only by f.showbackground. 2640bbfda8aSnia /// \sa ShowBackground() 2650bbfda8aSnia struct VirtualScreen *savevs; 2660bbfda8aSnia 2670bbfda8aSnia /// Has \ref TwmWindow::name ever changed? Used only in session saving. 2680bbfda8aSnia bool nameChanged; 2690bbfda8aSnia /// Has \ref TwmWindow::attr width ever changed? Used only in sessions. 2700bbfda8aSnia bool widthEverChangedByUser; 2710bbfda8aSnia /// Has \ref TwmWindow::attr height ever changed? Used only in sessions. 2720bbfda8aSnia bool heightEverChangedByUser; 2730bbfda8aSnia 2740bbfda8aSnia#ifdef EWMH 2750bbfda8aSnia EwmhWindowType ewmhWindowType; ///< EWMH-defined window type 2760bbfda8aSnia int ewmhFlags; ///< EWMH-defined window stats. Mostly from _NET_WM_STATE. 2770bbfda8aSnia#endif /* EWMH */ 2780bbfda8aSnia}; 2790bbfda8aSnia 2800bbfda8aSnia#endif /* _CTWM_TWM_WINDOW_STRUCT_H */ 281