2 * Window Maker window manager
4 * Copyright (c) 1997-2003 Alfredo K. Kojima
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #include "WindowMaker.h"
26 #include <sys/types.h>
28 #include <WINGs/WUtil.h>
34 #define WTB_UNFOCUSED 2
35 #define WTB_PFOCUSED 4
41 int count
; /* screen count, 0 = inactive */
42 int primary_head
; /* main working screen */
47 /* an area of the screen reserved by some window */
48 typedef struct WReservedArea
{
51 struct WReservedArea
*next
;
55 typedef struct WAppIconChain
{
56 struct WAppIcon
*aicon
;
57 struct WAppIconChain
*next
;
62 * each WScreen is saved into a context associated with it's root window
64 typedef struct _WScreen
{
65 int screen
; /* screen number */
66 Window info_window
; /* for our window manager info stuff */
68 int scr_width
; /* size of the screen */
71 Window root_win
; /* root window of screen */
72 int depth
; /* depth of the default visual */
73 Colormap colormap
; /* root colormap */
74 int root_colormap_install_count
;
75 struct WWindow
*original_cmap_window
; /* colormap before installing
76 * root colormap temporarily */
77 struct WWindow
*cmap_window
;
78 Colormap current_colormap
;
80 Window w_win
; /* window to use as drawable
81 * for new GCs, pixmaps etc. */
84 Colormap w_colormap
; /* our colormap */
86 WXineramaInfo xine_info
;
88 Window no_focus_win
; /* window to get focus when nobody
91 struct WWindow
*focused_window
; /* window that has the focus
92 * Use this list if you want to
93 * traverse the entire window list
96 WMArray
*selected_windows
;
98 WMArray
*fakeGroupLeaders
; /* list of fake window group ids */
100 struct WAppIcon
*app_icon_list
; /* list of all app-icons on screen */
102 struct WApplication
*wapp_list
; /* list of all aplications */
104 WMBag
*stacking_list
; /* bag of lists of windows
106 * Indexed by window level
107 * and each list on the array
108 * is ordered from the topmost to
112 int window_count
; /* number of windows in window_list */
114 int workspace_count
; /* number of workspaces */
116 struct WWorkspace
**workspaces
; /* workspace array */
118 int current_workspace
; /* current workspace number */
121 WReservedArea
*reservedAreas
; /* used to build totalUsableArea */
123 WArea
*usableArea
; /* area of the workspace where
124 * we can put windows on, as defined
125 * by other clients (not us) */
126 WArea
*totalUsableArea
; /* same as above, but including
127 * the dock and other stuff */
134 /* shortcuts for the pixels of the above colors. just for convenience */
140 Pixmap stipple_bitmap
;
141 Pixmap transp_stipple
; /* for making holes in icon masks for
142 * transparent icon simulation */
143 WMFont
*title_font
; /* default font for the titlebars */
144 WMFont
*menu_title_font
; /* font for menu titlebars */
145 WMFont
*menu_entry_font
; /* font for menu items */
146 WMFont
*icon_title_font
; /* for icon titles */
147 WMFont
*clip_title_font
; /* for clip titles */
148 WMFont
*info_text_font
; /* text on things like geometry
151 XFontStruct
*tech_draw_font
; /* font for tech draw style geom view
152 needs to be a core font so we can
153 use it with a XORing GC */
155 WMFont
*workspace_name_font
;
157 WMColor
*select_color
;
158 WMColor
*select_text_color
;
159 /* foreground colors */
160 WMColor
*window_title_color
[3]; /* window titlebar text (foc, unfoc, pfoc)*/
161 WMColor
*menu_title_color
[3]; /* menu titlebar text */
162 WMColor
*clip_title_color
[2]; /* clip title text */
163 WMColor
*mtext_color
; /* menu item text */
164 WMColor
*dtext_color
; /* disabled menu item text */
167 WMPixel frame_border_pixel
; /* frame border */
170 union WTexture
*menu_title_texture
[3];/* menu titlebar texture (tex, -, -) */
171 union WTexture
*window_title_texture
[3]; /* win textures (foc, unfoc, pfoc) */
172 union WTexture
*resizebar_texture
[3];/* window resizebar texture (tex, -, -) */
174 union WTexture
*menu_item_texture
; /* menu item texture */
176 struct WTexSolid
*menu_item_auxtexture
; /* additional texture to draw menu
178 struct WTexSolid
*icon_title_texture
;/* icon titles */
180 struct WTexSolid
*widget_texture
;
182 struct WTexSolid
*icon_back_texture
; /* icon back color for shadowing */
185 WMColor
*icon_title_color
; /* icon title color */
189 GC frame_gc
; /* gc for resize/move frame (root) */
190 GC line_gc
; /* gc for drawing XORed lines (root) */
191 GC copy_gc
; /* gc for XCopyArea() */
192 GC stipple_gc
; /* gc for stippled filling */
193 GC draw_gc
; /* gc for drawing misc things */
194 GC mono_gc
; /* gc for 1 bit drawables */
196 struct WPixmap
*b_pixmaps
[PRED_BPIXMAPS
]; /* internal pixmaps for buttons*/
197 struct WPixmap
*menu_radio_indicator
;/* left menu indicator */
198 struct WPixmap
*menu_check_indicator
;/* left menu indicator for checkmark */
199 struct WPixmap
*menu_mini_indicator
; /* for miniwindow */
200 struct WPixmap
*menu_hide_indicator
; /* for hidden window */
201 struct WPixmap
*menu_shade_indicator
; /* for shaded window */
202 int app_menu_x
, app_menu_y
; /* position for application menus */
204 struct WMenu
*root_menu
; /* root window menu */
205 struct WMenu
*switch_menu
; /* window list menu */
206 struct WMenu
*workspace_menu
; /* workspace operation */
207 struct WMenu
*window_menu
; /* window command menu */
208 struct WMenu
*icon_menu
; /* icon/appicon menu */
209 struct WMenu
*workspace_submenu
; /* workspace list for window_menu */
211 struct WDock
*dock
; /* the application dock */
212 struct WPixmap
*dock_dots
; /* 3 dots for the Dock */
213 Window dock_shadow
; /* shadow for dock buttons */
214 struct WAppIcon
*clip_icon
; /* The clip main icon */
215 struct WMenu
*clip_menu
; /* Menu for clips */
216 struct WMenu
*clip_submenu
; /* Workspace list for clips */
217 struct WMenu
*clip_options
; /* Options for Clip */
218 struct WMenu
*clip_ws_menu
; /* workspace menu for clip */
219 struct WDock
*last_dock
;
220 WAppIconChain
*global_icons
; /* for omnipresent icons chain in clip */
221 int global_icon_count
; /* How many global icons do we have */
223 Window clip_balloon
; /* window for workspace name */
226 struct RContext
*rcontext
; /* wrlib context */
228 WMScreen
*wmscreen
; /* for widget library */
230 struct RImage
*icon_tile
;
231 struct RImage
*clip_tile
;
233 Pixmap icon_tile_pixmap
; /* For app supplied icons */
235 struct RImage
*def_icon_rimage
; /* Default RImage icon */
237 struct WDialogData
*dialog_data
;
239 struct W_GeometryView
*gview
; /* size/position view */
241 /* state and other informations */
242 short cascade_index
; /* for cascade window placement */
244 WMPropList
*session_state
;
246 /* for double-click detection */
247 Time last_click_time
;
248 Window last_click_window
;
249 int last_click_button
;
251 /* balloon help data */
252 struct _WBalloon
*balloon
;
254 /* workspace name data */
255 Window workspace_name
;
256 WMHandlerID
*workspace_name_timer
;
257 struct WorkspaceNameData
*workspace_name_data
;
259 /* for raise-delay */
260 WMHandlerID
*autoRaiseTimer
;
261 Window autoRaiseWindow
; /* window that is scheduled to be
264 /* for window shortcuts */
265 WMArray
*shortcutWindows
[MAX_WINDOW_SHORTCUTS
];
271 struct NetData
*netdata
;
277 unsigned int startup
:1; /* during window manager startup */
278 unsigned int regenerate_icon_textures
:1;
279 unsigned int dnd_data_convertion_status
:1;
280 unsigned int root_menu_changed_shortcuts
:1;
281 unsigned int added_workspace_menu
:1;
282 unsigned int added_windows_menu
:1;
283 unsigned int startup2
:1; /* startup phase 2 */
284 unsigned int supports_tiff
:1;
285 unsigned int next_click_is_not_double
:1;
286 unsigned int backimage_helper_launched
:1;
287 /* some client has issued a WM_COLORMAP_NOTIFY */
288 unsigned int colormap_stuff_blocked
:1;
289 unsigned int doing_alt_tab
:1;
290 unsigned int jump_back_pending
:1;
291 unsigned int ignore_focus_events
:1;
297 WScreen
*wScreenInit(int screen_number
);
298 void wScreenSaveState(WScreen
*scr
);
299 void wScreenRestoreState(WScreen
*scr
);
301 int wScreenBringInside(WScreen
*scr
, int *x
, int *y
, int width
, int height
);
302 int wScreenKeepInside(WScreen
*scr
, int *x
, int *y
, int width
, int height
);
306 WScreen
*wScreenWithNumber(int i
);
307 WScreen
*wScreenForRootWindow(Window window
); /* window must be valid */
308 WScreen
*wScreenSearchForRootWindow(Window window
);
309 WScreen
*wScreenForWindow(Window window
); /* slower than above functions */
311 void wScreenFinish(WScreen
*scr
);
312 void wScreenUpdateUsableArea(WScreen
*scr
);
314 void create_logo_image(WScreen
*scr
);