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
39 extern Bool has_randr
;
40 extern int randr_event_base
;
45 int count
; /* screen count, 0 = inactive */
46 int primary_head
; /* main working screen */
51 /* an area of the screen reserved by some window */
52 typedef struct WReservedArea
{
55 struct WReservedArea
*next
;
59 typedef struct WAppIconChain
{
60 struct WAppIcon
*aicon
;
61 struct WAppIconChain
*next
;
65 /* Drawers, which are docks, really */
66 typedef struct WDrawerChain
{
67 struct WDock
*adrawer
;
68 struct WDrawerChain
*next
;
72 * each WScreen is saved into a context associated with it's root window
74 typedef struct _WScreen
{
75 int screen
; /* screen number */
76 Window info_window
; /* for our window manager info stuff */
78 int scr_width
; /* size of the screen */
81 Window root_win
; /* root window of screen */
82 int depth
; /* depth of the default visual */
83 Colormap colormap
; /* root colormap */
84 int root_colormap_install_count
;
85 struct WWindow
*original_cmap_window
; /* colormap before installing
86 * root colormap temporarily */
87 struct WWindow
*cmap_window
;
88 Colormap current_colormap
;
90 Window w_win
; /* window to use as drawable
91 * for new GCs, pixmaps etc. */
94 Colormap w_colormap
; /* our colormap */
96 WXineramaInfo xine_info
;
98 Window no_focus_win
; /* window to get focus when nobody
101 struct WWindow
*focused_window
; /* window that has the focus
102 * Use this list if you want to
103 * traverse the entire window list
106 WMArray
*selected_windows
;
108 WMArray
*fakeGroupLeaders
; /* list of fake window group ids */
110 struct WAppIcon
*app_icon_list
; /* list of all app-icons on screen */
112 struct WApplication
*wapp_list
; /* list of all aplications */
114 WMBag
*stacking_list
; /* bag of lists of windows
116 * Indexed by window level
117 * and each list on the array
118 * is ordered from the topmost to
122 int window_count
; /* number of windows in window_list */
124 int workspace_count
; /* number of workspaces */
126 struct WWorkspace
**workspaces
; /* workspace array */
128 int current_workspace
; /* current workspace number */
129 int last_workspace
; /* last used workspace number */
132 WReservedArea
*reservedAreas
; /* used to build totalUsableArea */
134 WArea
*usableArea
; /* area of the workspace where
135 * we can put windows on, as defined
136 * by other clients (not us) */
137 WArea
*totalUsableArea
; /* same as above, but including
138 * the dock and other stuff */
145 /* shortcuts for the pixels of the above colors. just for convenience */
151 Pixmap stipple_bitmap
;
152 Pixmap transp_stipple
; /* for making holes in icon masks for
153 * transparent icon simulation */
154 WMFont
*title_font
; /* default font for the titlebars */
155 WMFont
*menu_title_font
; /* font for menu titlebars */
156 WMFont
*menu_entry_font
; /* font for menu items */
157 WMFont
*icon_title_font
; /* for icon titles */
158 WMFont
*clip_title_font
; /* for clip titles */
159 WMFont
*info_text_font
; /* text on things like geometry
162 XFontStruct
*tech_draw_font
; /* font for tech draw style geom view
163 needs to be a core font so we can
164 use it with a XORing GC */
166 WMColor
*select_color
;
167 WMColor
*select_text_color
;
168 /* foreground colors */
169 WMColor
*window_title_color
[3]; /* window titlebar text (foc, unfoc, pfoc)*/
170 WMColor
*menu_title_color
[3]; /* menu titlebar text */
171 WMColor
*clip_title_color
[2]; /* clip title text */
172 WMColor
*mtext_color
; /* menu item text */
173 WMColor
*dtext_color
; /* disabled menu item text */
175 int frame_border_width
;
176 WMColor
*frame_border_color
;
177 WMColor
*frame_selected_border_color
;
180 WMPixel frame_border_pixel
; /* frame border */
181 WMPixel frame_selected_border_pixel
;/* frame border */
184 union WTexture
*menu_title_texture
[3];/* menu titlebar texture (tex, -, -) */
185 union WTexture
*window_title_texture
[3]; /* win textures (foc, unfoc, pfoc) */
186 union WTexture
*resizebar_texture
[3];/* window resizebar texture (tex, -, -) */
188 union WTexture
*menu_item_texture
; /* menu item texture */
190 struct WTexSolid
*menu_item_auxtexture
; /* additional texture to draw menu
192 struct WTexSolid
*icon_title_texture
;/* icon titles */
194 struct WTexSolid
*widget_texture
;
196 struct WTexSolid
*icon_back_texture
; /* icon back color for shadowing */
199 WMColor
*icon_title_color
; /* icon title color */
203 GC frame_gc
; /* gc for resize/move frame (root) */
204 GC line_gc
; /* gc for drawing XORed lines (root) */
205 GC copy_gc
; /* gc for XCopyArea() */
206 GC stipple_gc
; /* gc for stippled filling */
207 GC draw_gc
; /* gc for drawing misc things */
208 GC mono_gc
; /* gc for 1 bit drawables */
210 struct WPixmap
*b_pixmaps
[PRED_BPIXMAPS
]; /* internal pixmaps for buttons*/
211 struct WPixmap
*menu_radio_indicator
;/* left menu indicator */
212 struct WPixmap
*menu_check_indicator
;/* left menu indicator for checkmark */
213 struct WPixmap
*menu_mini_indicator
; /* for miniwindow */
214 struct WPixmap
*menu_hide_indicator
; /* for hidden window */
215 struct WPixmap
*menu_shade_indicator
; /* for shaded window */
216 int app_menu_x
, app_menu_y
; /* position for application menus */
218 struct WMenu
*root_menu
; /* root window menu */
219 struct WMenu
*switch_menu
; /* window list menu */
220 struct WMenu
*workspace_menu
; /* workspace operation */
221 struct WMenu
*window_menu
; /* window command menu */
222 struct WMenu
*icon_menu
; /* icon/appicon menu */
223 struct WMenu
*workspace_submenu
; /* workspace list for window_menu */
225 struct WDock
*dock
; /* the application dock */
226 struct WMenu
*dock_pos_menu
; /* Dock position menu */
227 struct WPixmap
*dock_dots
; /* 3 dots for the Dock */
228 Window dock_shadow
; /* shadow for dock buttons */
229 struct WAppIcon
*clip_icon
; /* The clip main icon, or the dock's, if they are merged */
230 struct WMenu
*clip_menu
; /* Menu for clips */
231 struct WMenu
*clip_submenu
; /* Workspace list for clips */
232 struct WMenu
*clip_options
; /* Options for Clip */
233 struct WMenu
*clip_ws_menu
; /* workspace menu for clip */
234 struct WMenu
*drawer_menu
; /* Menu for drawers */
235 struct WDock
*last_dock
;
236 WAppIconChain
*global_icons
; /* for omnipresent icons chain in clip */
237 int global_icon_count
; /* How many global icons do we have */
238 WDrawerChain
*drawers
; /* Chain of drawers */
239 /* Cache the following two informations, as they are used quite a lot */
240 int drawer_count
; /* Nb of drawers that */
241 struct WDock
*attracting_drawer
; /* The drawer that auto-attracts icons, or NULL */
244 struct RContext
*rcontext
; /* wrlib context */
246 WMScreen
*wmscreen
; /* for widget library */
248 struct RImage
*icon_tile
;
249 struct RImage
*clip_tile
; /* tile with arrows to change workspace */
250 struct RImage
*drawer_tile
; /* tile for a drawer (tile + arrow) */
251 Pixmap icon_tile_pixmap
; /* For app supplied icons */
253 struct RImage
*def_icon_rimage
; /* Default RImage icon */
255 struct WDialogData
*dialog_data
;
257 struct W_GeometryView
*gview
; /* size/position view */
259 /* state and other informations */
260 short cascade_index
; /* for cascade window placement */
262 WMPropList
*session_state
;
264 /* for double-click detection */
265 Time last_click_time
;
266 Window last_click_window
;
267 int last_click_button
;
269 /* balloon help data */
270 struct _WBalloon
*balloon
;
272 /* workspace name data */
273 Window workspace_name
;
274 WMHandlerID
*workspace_name_timer
;
275 struct WorkspaceNameData
*workspace_name_data
;
277 /* for raise-delay */
278 WMHandlerID
*autoRaiseTimer
;
279 Window autoRaiseWindow
; /* window that is scheduled to be
282 /* for window shortcuts */
283 WMArray
*shortcutWindows
[MAX_WINDOW_SHORTCUTS
];
289 struct NetData
*netdata
;
295 unsigned int startup
:1; /* during window manager startup */
296 unsigned int regenerate_icon_textures
:1;
297 unsigned int dnd_data_convertion_status
:1;
298 unsigned int root_menu_changed_shortcuts
:1;
299 unsigned int added_workspace_menu
:1;
300 unsigned int added_windows_menu
:1;
301 unsigned int startup2
:1; /* startup phase 2 */
302 unsigned int next_click_is_not_double
:1;
303 unsigned int backimage_helper_launched
:1;
304 /* some client has issued a WM_COLORMAP_NOTIFY */
305 unsigned int colormap_stuff_blocked
:1;
306 unsigned int doing_alt_tab
:1;
307 unsigned int jump_back_pending
:1;
308 unsigned int ignore_focus_events
:1;
314 WScreen
*wScreenInit(int screen_number
);
315 void wScreenSaveState(WScreen
*scr
);
316 void wScreenRestoreState(WScreen
*scr
);
318 int wScreenBringInside(WScreen
*scr
, int *x
, int *y
, int width
, int height
);
319 int wScreenKeepInside(WScreen
*scr
, int *x
, int *y
, int width
, int height
);
323 WScreen
*wScreenWithNumber(int i
);
324 WScreen
*wScreenForRootWindow(Window window
); /* window must be valid */
325 WScreen
*wScreenForWindow(Window window
); /* slower than above functions */
327 void wScreenFinish(WScreen
*scr
);
328 void wScreenUpdateUsableArea(WScreen
*scr
);
330 void create_logo_image(WScreen
*scr
);