2 * Window Maker window manager
4 * Copyright (c) 1997, 1998 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
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
26 #include "WindowMaker.h"
28 #include <sys/types.h>
37 #define WTB_UNFOCUSED 2
38 #define WTB_PFOCUSED 4
42 /* an area of the screen reserved by some window */
43 typedef struct WReservedArea
{
46 struct WReservedArea
*next
;
51 typedef struct WAppIconChain
{
52 struct WAppIcon
*aicon
;
53 struct WAppIconChain
*next
;
58 * each WScreen is saved into a context associated with it's root window
60 typedef struct _WScreen
{
61 int screen
; /* screen number */
64 Atom managerAtom
; /* WM_Sn atom for manager selection */
65 Window managerWindow
; /* window for manager selection */
67 Window info_window
; /* for our window manager info stuff */
69 int scr_width
; /* size of the screen */
72 #ifdef VIRTUAL_DESKTOP
73 Window virtual_edge_u
;
74 Window virtual_edge_d
;
75 Window virtual_edge_l
;
76 Window virtual_edge_r
;
79 Window root_win
; /* root window of screen */
80 int depth
; /* depth of the default visual */
81 Colormap colormap
; /* root colormap */
82 int root_colormap_install_count
;
83 struct WWindow
*original_cmap_window
; /* colormap before installing
84 * root colormap temporarily */
85 struct WWindow
*cmap_window
;
86 Colormap current_colormap
;
88 Window w_win
; /* window to use as drawable
89 * for new GCs, pixmaps etc. */
92 Colormap w_colormap
; /* our colormap */
94 Window no_focus_win
; /* window to get focus when nobody
97 struct WWindow
*focused_window
; /* window that has the focus
98 * Use this list if you want to
99 * traverse the entire window list
102 WMBag
*selected_windows
;
104 struct WAppIcon
*app_icon_list
; /* list of all app-icons on screen */
106 struct WApplication
*wapp_list
; /* list of all aplications */
108 WMBag
*stacking_list
; /* bag of lists of windows
110 * Indexed by window level
111 * and each list on the array
112 * is ordered from the topmost to
116 int window_count
; /* number of windows in window_list */
118 int workspace_count
; /* number of workspaces */
120 struct WWorkspace
**workspaces
; /* workspace array */
122 int current_workspace
; /* current workspace number */
126 WReservedArea
*reservedAreas
; /* used to build totalUsableArea */
129 WArea usableArea
; /* area of the workspace where
130 * we can put windows on, as defined
131 * by other clients (not us) */
132 WArea totalUsableArea
; /* same as above, but including
133 * the dock and other stuff */
142 Pixmap stipple_bitmap
;
143 Pixmap transp_stipple
; /* for making holes in icon masks for
144 * transparent icon simulation */
145 WMFont
*title_font
; /* default font for the titlebars */
146 WMFont
*menu_title_font
; /* font for menu titlebars */
147 WMFont
*menu_entry_font
; /* font for menu items */
148 WMFont
*icon_title_font
; /* for icon titles */
149 WMFont
*clip_title_font
; /* for clip titles */
150 WMFont
*info_text_font
; /* text on things like geometry
152 WMFont
*workspace_name_font
;
154 WMPixel select_pixel
;
155 WMPixel select_text_pixel
;
156 /* foreground colors */
157 WMPixel window_title_pixel
[3]; /* window titlebar text (foc, unfoc, pfoc)*/
158 WMPixel menu_title_pixel
[3]; /* menu titlebar text */
159 WMPixel clip_title_pixel
[2]; /* clip title text */
160 WMPixel mtext_pixel
; /* menu item text */
161 WMPixel dtext_pixel
; /* disabled menu item text */
163 WMPixel frame_border_pixel
; /* frame border */
164 #ifdef DRAWSTRING_PLUGIN
165 WFunction
*drawstring_func
[W_STRING_MEMBERS
];
166 /* ftitle, utitle, ptitle, mtitle, mtext */
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 */
184 GC window_title_gc
; /* window title text GC */
185 GC menu_title_gc
; /* menu titles */
187 GC icon_title_gc
; /* icon title background */
188 GC clip_title_gc
; /* clip title */
189 GC menu_entry_gc
; /* menu entries */
190 GC select_menu_gc
; /* selected menu entries */
191 GC disabled_menu_entry_gc
; /* disabled menu entries */
192 GC info_text_gc
; /* for size/position display */
195 GC frame_gc
; /* gc for resize/move frame (root) */
196 GC line_gc
; /* gc for drawing XORed lines (root) */
197 GC copy_gc
; /* gc for XCopyArea() */
198 GC stipple_gc
; /* gc for stippled filling */
199 GC draw_gc
; /* gc for drawing misc things */
200 GC mono_gc
; /* gc for 1 bit drawables */
203 struct WPixmap
*b_pixmaps
[PRED_BPIXMAPS
]; /* internal pixmaps for buttons*/
205 struct WPixmap
*menu_radio_indicator
;/* left menu indicator */
206 struct WPixmap
*menu_check_indicator
;/* left menu indicator for checkmark */
207 struct WPixmap
*menu_mini_indicator
; /* for miniwindow */
208 struct WPixmap
*menu_hide_indicator
; /* for hidden window */
209 struct WPixmap
*menu_shade_indicator
; /* for shaded window */
210 int app_menu_x
, app_menu_y
; /* position for application menus */
213 struct WMenu
*root_menu
; /* root window menu */
214 struct WMenu
*switch_menu
; /* window list menu */
216 struct WMenu
*workspace_menu
; /* workspace operation */
217 struct WMenu
*window_menu
; /* window command menu */
218 struct WMenu
*icon_menu
; /* icon/appicon menu */
219 struct WMenu
*workspace_submenu
; /* workspace list for window_menu */
221 struct WDock
*dock
; /* the application dock */
222 struct WPixmap
*dock_dots
; /* 3 dots for the Dock */
223 Window dock_shadow
; /* shadow for dock buttons */
224 struct WAppIcon
*clip_icon
; /* The clip main icon */
225 struct WMenu
*clip_menu
; /* Menu for clips */
226 struct WMenu
*clip_submenu
; /* Workspace list for clips */
227 struct WMenu
*clip_options
; /* Options for Clip */
228 struct WMenu
*clip_ws_menu
; /* workspace menu for clip */
229 struct WDock
*last_dock
;
230 WAppIconChain
*global_icons
; /* for omnipresent icons chain in clip */
231 int global_icon_count
; /* How many global icons do we have */
233 Window clip_balloon
; /* window for workspace name */
237 #ifdef GRADIENT_CLIP_ARROW
238 Pixmap clip_arrow_gradient
;
241 struct RContext
*rcontext
; /* wrlib context */
243 WMScreen
*wmscreen
; /* for widget library */
245 struct RImage
*icon_tile
;
246 struct RImage
*clip_tile
;
247 Pixmap icon_tile_pixmap
; /* for app supplied icons */
249 Pixmap def_icon_pixmap
; /* default icons */
250 Pixmap def_ticon_pixmap
;
252 struct WDialogData
*dialog_data
;
255 struct W_GeometryView
*gview
; /* size/position view */
258 struct RImage
*button_images
[2][PRED_BPIXMAPS
];/* scaled tbar btn images */
261 /* state and other informations */
262 short cascade_index
; /* for cascade window placement */
264 proplist_t session_state
;
266 /* for double-click detection */
267 Time last_click_time
;
268 Window last_click_window
;
269 int last_click_button
;
271 /* balloon help data */
272 struct _WBalloon
*balloon
;
274 /* workspace name data */
275 Window workspace_name
;
276 WMHandlerID
*workspace_name_timer
;
277 struct WorkspaceNameData
*workspace_name_data
;
279 /* for raise-delay */
280 WMHandlerID
*autoRaiseTimer
;
281 Window autoRaiseWindow
; /* window that is scheduled to be
285 Window scrolledFMaximize
; /* full maximized window which was
286 scrolled down for titlebar access */
288 /* for window shortcuts */
289 WMBag
*shortcutWindows
[MAX_WINDOW_SHORTCUTS
];
303 unsigned int startup
:1; /* during window manager startup */
304 unsigned int regenerate_icon_textures
:1;
305 unsigned int dnd_data_convertion_status
:1;
306 unsigned int root_menu_changed_shortcuts
:1;
307 unsigned int added_workspace_menu
:1;
308 unsigned int startup2
:1; /* startup phase 2 */
309 unsigned int supports_tiff
:1;
310 unsigned int clip_balloon_mapped
:1;
311 unsigned int next_click_is_not_double
:1;
312 unsigned int backimage_helper_launched
:1;
313 /* some client has issued a WM_COLORMAP_NOTIFY */
314 unsigned int colormap_stuff_blocked
:1;
315 unsigned int doing_alt_tab
:1;
316 unsigned int jump_back_pending
:1;
318 unsigned int kwm_syncing_name
:1;
319 unsigned int kwm_syncing_count
:1;
325 #define WSS_ROOTMENU (1<<0)
326 #define WSS_SWITCHMENU (1<<1)
327 #define WSS_WSMENU (1<<2)
329 /* changes must update wSaveScreenState/getWorkspaceState */
330 typedef struct WWorkspaceState
{
333 #if 0 /* obsoleted by saving menus position in WMState */
335 int smenu_x
, smenu_y
;
336 int wmenu_x
, wmenu_y
;
341 WScreen
*wScreenInit(int screen_number
);
342 void wScreenSaveState(WScreen
*scr
);
343 void wScreenRestoreState(WScreen
*scr
);
345 int wScreenBringInside(WScreen
*scr
, int *x
, int *y
, int width
, int height
);
348 WScreen
*wScreenWithNumber(int i
);
349 WScreen
*wScreenForRootWindow(Window window
); /* window must be valid */
350 WScreen
*wScreenSearchForRootWindow(Window window
);
351 WScreen
*wScreenForWindow(Window window
); /* slower than above functions */
353 void wScreenFinish(WScreen
*scr
);
355 void wScreenUpdateUsableArea(WScreen
*scr
);