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"
27 #include <sys/types.h>
36 typedef struct WFont
{
48 Pixmap pixmap
; /* None means use pixel */
50 proplist_t spec
; /* retained */
51 pid_t pid
; /* If !=0, process ID of wmsetbg that
52 * is rendering the pixmap for this
53 * texture. Set to 0 when finishes */
55 #endif /* EXPERIMENTAL */
62 #define WTB_UNFOCUSED 2
63 #define WTB_PFOCUSED 4
68 * each WScreen is saved into a context associated with it's root window
70 typedef struct _WScreen
{
71 int screen
; /* screen number */
73 int scr_width
; /* size of the screen */
76 Window root_win
; /* root window of screen */
77 int depth
; /* depth of the default visual */
78 Colormap colormap
; /* root colormap */
79 int root_colormap_install_count
;
80 struct WWindow
*original_cmap_window
; /* colormap before installing
81 * root colormap temporarily */
82 struct WWindow
*cmap_window
;
83 Colormap current_colormap
;
85 Window w_win
; /* window to use as drawable
86 * for new GCs, pixmaps etc. */
89 Colormap w_colormap
; /* our colormap */
91 Window no_focus_win
; /* window to get focus when nobody
94 struct WWindow
*focused_window
; /* window that has the focus
95 * Use this list if you want to
96 * traverse the entire window list
99 struct WAppIcon
*app_icon_list
; /* list of all app-icons on screen */
101 struct WApplication
*wapp_list
; /* list of all aplications */
103 struct _WCoreWindow
*stacking_list
[MAX_WINDOW_LEVELS
];
104 /* array of lists of windows
106 * The array order is in window level
107 * order and each list on the array
108 * is ordered from the topmost to
111 int window_level_count
[MAX_WINDOW_LEVELS
];
112 int window_count
; /* number of windows in window_list */
115 WWorkspaceTexture
*defaultTexture
;
116 WWorkspaceTexture
**wspaceTextures
;
117 int wspaceTextureCount
;
118 #endif /* EXPERIMENTAL */
120 int workspace_count
; /* number of workspaces */
121 struct WWorkspace
**workspaces
; /* workspace array */
122 int current_workspace
; /* current workspace number */
130 Pixmap stipple_bitmap
;
131 Pixmap transp_stipple
; /* for making holes in icon masks for
132 * transparent icon simulation */
133 WFont
*title_font
; /* default font for the titlebars */
134 WFont
*menu_title_font
; /* font for menu titlebars */
135 WFont
*menu_entry_font
; /* font for menu items */
136 WFont
*icon_title_font
; /* for icon titles */
137 WFont
*clip_title_font
; /* for clip titles */
138 WFont
*info_text_font
; /* text on things like geometry
141 WMPixel select_pixel
;
142 WMPixel select_text_pixel
;
143 /* foreground colors */
144 WMPixel window_title_pixel
[3]; /* window titlebar text (foc, unfoc, pfoc)*/
145 WMPixel menu_title_pixel
[3]; /* menu titlebar text */
146 WMPixel clip_title_pixel
[2]; /* clip title text */
147 WMPixel mtext_pixel
; /* menu item text */
148 WMPixel dtext_pixel
; /* disabled menu item text */
150 WMPixel frame_border_pixel
; /* frame border */
152 union WTexture
*menu_title_texture
[3];/* menu titlebar texture (tex, -, -) */
153 union WTexture
*window_title_texture
[3]; /* win textures (foc, unfoc, pfoc) */
154 struct WTexSolid
*resizebar_texture
[3];/* window resizebar texture (tex, -, -) */
156 union WTexture
*menu_item_texture
; /* menu item texture */
158 struct WTexSolid
*menu_item_auxtexture
; /* additional texture to draw menu
160 struct WTexSolid
*icon_title_texture
;/* icon titles */
162 struct WTexSolid
*widget_texture
;
164 struct WTexSolid
*icon_back_texture
; /* icon back color for shadowing */
166 GC window_title_gc
; /* window title text GC */
167 GC menu_title_gc
; /* menu titles */
169 GC icon_title_gc
; /* icon title background */
170 GC clip_title_gc
; /* clip title */
171 GC menu_entry_gc
; /* menu entries */
172 GC select_menu_gc
; /* selected menu entries */
173 GC disabled_menu_entry_gc
; /* disabled menu entries */
174 GC info_text_gc
; /* for size/position display */
176 GC frame_gc
; /* gc for resize/move frame (root) */
177 GC line_gc
; /* gc for drawing XORed lines (root) */
178 GC copy_gc
; /* gc for XCopyArea() */
179 GC stipple_gc
; /* gc for stippled filling */
181 GC draw_gc
; /* gc for drawing misc things */
183 struct WPixmap
*b_pixmaps
[PRED_BPIXMAPS
]; /* internal pixmaps for buttons*/
184 struct WPixmap
*menu_radio_indicator
;/* left menu indicator */
185 struct WPixmap
*menu_check_indicator
;/* left menu indicator for checkmark */
186 struct WPixmap
*menu_mini_indicator
; /* for miniwindow */
187 struct WPixmap
*menu_hide_indicator
; /* for hidden window */
188 struct WPixmap
*menu_shade_indicator
; /* for shaded window */
189 int app_menu_x
, app_menu_y
; /* position for application menus */
191 struct WMenu
*root_menu
; /* root window menu */
192 struct WMenu
*workspace_menu
; /* workspace operation */
193 struct WMenu
*switch_menu
; /* window list menu */
194 struct WMenu
*window_menu
; /* window command menu */
195 struct WMenu
*icon_menu
; /* icon/appicon menu */
196 struct WMenu
*workspace_submenu
; /* workspace list for window_menu */
198 struct WDock
*dock
; /* the application dock */
199 struct WPixmap
*dock_dots
; /* 3 dots for the Dock */
200 Window dock_shadow
; /* shadow for dock buttons */
201 struct WAppIcon
*clip_icon
; /* The clip main icon */
202 struct WMenu
*clip_menu
; /* Menu for clips */
203 struct WMenu
*clip_submenu
; /* Workspace list for clips */
204 struct WMenu
*clip_options
; /* Options for Clip */
205 struct WMenu
*clip_ws_menu
; /* workspace menu for clip */
206 struct WDock
*last_dock
;
208 Window clip_balloon
; /* window for workspace name */
210 Window geometry_display
; /* displays the geometry during
211 * window resize, move etc. */
212 unsigned int geometry_display_width
;
213 unsigned int geometry_display_height
;
215 struct RContext
*rcontext
;
217 WMScreen
*wmscreen
; /* for widget library */
219 struct RImage
*icon_tile
;
220 struct RImage
*clip_tile
;
221 Pixmap icon_tile_pixmap
; /* for app supplied icons */
223 Pixmap def_icon_pixmap
; /* default icons */
224 Pixmap def_ticon_pixmap
;
226 struct WDialogData
*dialog_data
;
228 /* state and other informations */
229 short cascade_index
; /* for cascade window placement */
231 proplist_t session_state
;
233 /* for double-click detection */
234 Time last_click_time
;
235 Window last_click_window
;
236 int last_click_button
;
238 /* balloon help data */
239 struct _WBalloon
*balloon
;
241 /* for raise-delay */
242 WMHandlerID
*autoRaiseTimer
;
243 Window autoRaiseWindow
; /* window that is scheduled to be
251 unsigned int startup
:1; /* during window manager startup */
252 unsigned int regenerate_icon_textures
:1;
253 unsigned int dnd_data_convertion_status
:1;
254 unsigned int root_menu_changed_shortcuts
:1;
255 unsigned int added_workspace_menu
:1;
256 unsigned int startup2
:1; /* startup phase 2 */
257 unsigned int supports_tiff
:1;
258 unsigned int clip_balloon_mapped
:1;
259 unsigned int next_click_is_not_double
:1;
264 #define WSS_ROOTMENU (1<<0)
265 #define WSS_SWITCHMENU (1<<1)
266 #define WSS_WSMENU (1<<2)
268 /* changes must update wSaveScreenState/getWorkspaceState */
269 typedef struct WWorkspaceState
{
272 #if 0 /* obsoleted by saving menus position in WMState */
274 int smenu_x
, smenu_y
;
275 int wmenu_x
, wmenu_y
;
280 WScreen
*wScreenInit(int screen_number
);
281 void wScreenSaveState(WScreen
*scr
);
282 void wScreenRestoreState(WScreen
*scr
);
284 int wScreenBringInside(WScreen
*scr
, int *x
, int *y
, int width
, int height
);
287 WScreen
*wScreenWithNumber(int i
);
288 WScreen
*wScreenForRootWindow(Window window
); /* window must be valid */
289 WScreen
*wScreenForWindow(Window window
); /* slower than above functions */