fixed many bugs, removed linked list
[wmaker-crm.git] / src / screen.h
blob78a27a6c642f6b1162d510d567343466d4d4a8b8
1 /*
2 * Window Maker window manager
3 *
4 * Copyright (c) 1997, 1998 Alfredo K. Kojima
5 *
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,
19 * USA.
22 #ifndef WMSCREEN_H_
23 #define WMSCREEN_H_
25 #include "wconfig.h"
26 #include "WindowMaker.h"
27 #include "plugin.h"
28 #include <sys/types.h>
30 #include <proplist.h>
33 #define WTB_LEFT 0
34 #define WTB_RIGHT 1
36 #define WTB_FOCUSED 0
37 #define WTB_UNFOCUSED 2
38 #define WTB_PFOCUSED 4
39 #define WTB_MENU 6
41 #ifdef GNOME_STUFF
42 /* an area of the screen reserved by some window */
43 typedef struct WReservedArea {
44 WArea area;
45 Window window;
46 struct WReservedArea *next;
47 } WReservedArea;
48 #endif
51 typedef struct WAppIconChain {
52 struct WAppIcon *aicon;
53 struct WAppIconChain *next;
54 } WAppIconChain;
58 * each WScreen is saved into a context associated with it's root window
60 typedef struct _WScreen {
61 int screen; /* screen number */
63 #if 0
64 Atom managerAtom; /* WM_Sn atom for manager selection */
65 Window managerWindow; /* window for manager selection */
66 #endif
67 Window info_window; /* for our window manager info stuff */
69 int scr_width; /* size of the screen */
70 int scr_height;
72 Window root_win; /* root window of screen */
73 int depth; /* depth of the default visual */
74 Colormap colormap; /* root colormap */
75 int root_colormap_install_count;
76 struct WWindow *original_cmap_window; /* colormap before installing
77 * root colormap temporarily */
78 struct WWindow *cmap_window;
79 Colormap current_colormap;
81 Window w_win; /* window to use as drawable
82 * for new GCs, pixmaps etc. */
83 Visual *w_visual;
84 int w_depth;
85 Colormap w_colormap; /* our colormap */
87 Window no_focus_win; /* window to get focus when nobody
88 * else can do it */
90 struct WWindow *focused_window; /* window that has the focus
91 * Use this list if you want to
92 * traverse the entire window list
95 WMBag *selected_windows;
97 struct WAppIcon *app_icon_list; /* list of all app-icons on screen */
99 struct WApplication *wapp_list; /* list of all aplications */
101 struct _WCoreWindow *stacking_list[MAX_WINDOW_LEVELS];
102 /* array of lists of windows
103 * in stacking order.
104 * The array order is in window level
105 * order and each list on the array
106 * is ordered from the topmost to
107 * the lowest window
109 /* int window_level_count[MAX_WINDOW_LEVELS];*/
110 int window_count; /* number of windows in window_list */
112 int workspace_count; /* number of workspaces */
114 struct WWorkspace **workspaces; /* workspace array */
116 int current_workspace; /* current workspace number */
119 #ifdef GNOME_STUFF
120 WReservedArea *reservedAreas; /* used to build totalUsableArea */
121 #endif
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 */
130 WMPixel black_pixel;
131 WMPixel white_pixel;
133 WMPixel light_pixel;
134 WMPixel dark_pixel;
136 Pixmap stipple_bitmap;
137 Pixmap transp_stipple; /* for making holes in icon masks for
138 * transparent icon simulation */
139 WMFont *title_font; /* default font for the titlebars */
140 WMFont *menu_title_font; /* font for menu titlebars */
141 WMFont *menu_entry_font; /* font for menu items */
142 WMFont *icon_title_font; /* for icon titles */
143 WMFont *clip_title_font; /* for clip titles */
144 WMFont *info_text_font; /* text on things like geometry
145 * hint boxes */
146 WMFont *workspace_name_font;
148 WMPixel select_pixel;
149 WMPixel select_text_pixel;
150 /* foreground colors */
151 WMPixel window_title_pixel[3]; /* window titlebar text (foc, unfoc, pfoc)*/
152 WMPixel menu_title_pixel[3]; /* menu titlebar text */
153 WMPixel clip_title_pixel[2]; /* clip title text */
154 WMPixel mtext_pixel; /* menu item text */
155 WMPixel dtext_pixel; /* disabled menu item text */
156 WMPixel line_pixel;
157 WMPixel frame_border_pixel; /* frame border */
158 #ifdef DRAWSTRING_PLUGIN
159 WFunction *drawstring_func[W_STRING_MEMBERS];
160 /* ftitle, utitle, ptitle, mtitle, mtext */
161 #endif
164 union WTexture *menu_title_texture[3];/* menu titlebar texture (tex, -, -) */
165 union WTexture *window_title_texture[3]; /* win textures (foc, unfoc, pfoc) */
166 union WTexture *resizebar_texture[3];/* window resizebar texture (tex, -, -) */
168 union WTexture *menu_item_texture; /* menu item texture */
170 struct WTexSolid *menu_item_auxtexture; /* additional texture to draw menu
171 * cascade arrows */
172 struct WTexSolid *icon_title_texture;/* icon titles */
174 struct WTexSolid *widget_texture;
176 struct WTexSolid *icon_back_texture; /* icon back color for shadowing */
178 GC window_title_gc; /* window title text GC */
179 GC menu_title_gc; /* menu titles */
181 GC icon_title_gc; /* icon title background */
182 GC clip_title_gc; /* clip title */
183 GC menu_entry_gc; /* menu entries */
184 GC select_menu_gc; /* selected menu entries */
185 GC disabled_menu_entry_gc; /* disabled menu entries */
186 GC info_text_gc; /* for size/position display */
187 GC icon_select_gc;
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 #ifndef NEWSTUFF
197 struct WPixmap *b_pixmaps[PRED_BPIXMAPS]; /* internal pixmaps for buttons*/
198 #endif
199 struct WPixmap *menu_radio_indicator;/* left menu indicator */
200 struct WPixmap *menu_check_indicator;/* left menu indicator for checkmark */
201 struct WPixmap *menu_mini_indicator; /* for miniwindow */
202 struct WPixmap *menu_hide_indicator; /* for hidden window */
203 struct WPixmap *menu_shade_indicator; /* for shaded window */
204 int app_menu_x, app_menu_y; /* position for application menus */
206 #ifndef LITE
207 struct WMenu *root_menu; /* root window menu */
208 struct WMenu *switch_menu; /* window list menu */
209 #endif
210 struct WMenu *workspace_menu; /* workspace operation */
211 struct WMenu *window_menu; /* window command menu */
212 struct WMenu *icon_menu; /* icon/appicon menu */
213 struct WMenu *workspace_submenu; /* workspace list for window_menu */
215 struct WDock *dock; /* the application dock */
216 struct WPixmap *dock_dots; /* 3 dots for the Dock */
217 Window dock_shadow; /* shadow for dock buttons */
218 struct WAppIcon *clip_icon; /* The clip main icon */
219 struct WMenu *clip_menu; /* Menu for clips */
220 struct WMenu *clip_submenu; /* Workspace list for clips */
221 struct WMenu *clip_options; /* Options for Clip */
222 struct WMenu *clip_ws_menu; /* workspace menu for clip */
223 struct WDock *last_dock;
224 WAppIconChain *global_icons; /* for omnipresent icons chain in clip */
225 int global_icon_count; /* How many global icons do we have */
227 Window clip_balloon; /* window for workspace name */
229 Window geometry_display; /* displays the geometry during
230 * window resize, move etc. */
231 unsigned int geometry_display_width;
232 unsigned int geometry_display_height;
233 int keymove_tick;
235 #ifdef GRADIENT_CLIP_ARROW
236 Pixmap clip_arrow_gradient;
237 #endif
239 struct RContext *rcontext; /* wrlib context */
241 WMScreen *wmscreen; /* for widget library */
243 struct RImage *icon_tile;
244 struct RImage *clip_tile;
245 Pixmap icon_tile_pixmap; /* for app supplied icons */
247 Pixmap def_icon_pixmap; /* default icons */
248 Pixmap def_ticon_pixmap;
250 struct WDialogData *dialog_data;
252 #ifdef NEWSTUFF
253 struct RImage *button_images[2][PRED_BPIXMAPS];/* scaled tbar btn images */
254 #endif
256 /* state and other informations */
257 short cascade_index; /* for cascade window placement */
259 proplist_t session_state;
261 /* for double-click detection */
262 Time last_click_time;
263 Window last_click_window;
264 int last_click_button;
266 /* balloon help data */
267 struct _WBalloon *balloon;
269 /* workspace name data */
270 Window workspace_name;
271 WMHandlerID *workspace_name_timer;
272 struct WorkspaceNameData *workspace_name_data;
274 /* for raise-delay */
275 WMHandlerID *autoRaiseTimer;
276 Window autoRaiseWindow; /* window that is scheduled to be
277 * raised */
280 Window scrolledFMaximize; /* full maximized window which was
281 scrolled down for titlebar access */
283 /* for window shortcuts */
284 struct WWindow *shortcutWindow[MAX_WINDOW_SHORTCUTS];
285 WMBag *shortcutSelectedWindows[MAX_WINDOW_SHORTCUTS];
287 #ifdef XDND
288 char *xdestring;
289 #endif
291 #ifdef KWM_HINTS
292 Window kwm_dock;
293 #endif
295 int helper_fd;
296 pid_t helper_pid;
298 struct {
299 unsigned int startup:1; /* during window manager startup */
300 unsigned int regenerate_icon_textures:1;
301 unsigned int dnd_data_convertion_status:1;
302 unsigned int root_menu_changed_shortcuts:1;
303 unsigned int added_workspace_menu:1;
304 unsigned int startup2:1; /* startup phase 2 */
305 unsigned int supports_tiff:1;
306 unsigned int clip_balloon_mapped:1;
307 unsigned int next_click_is_not_double:1;
308 unsigned int backimage_helper_launched:1;
309 /* some client has issued a WM_COLORMAP_NOTIFY */
310 unsigned int colormap_stuff_blocked:1;
311 unsigned int doing_alt_tab:1;
312 unsigned int jump_back_pending:1;
313 #ifdef KWM_HINTS
314 unsigned int kwm_syncing_name:1;
315 unsigned int kwm_syncing_count:1;
316 #endif
317 } flags;
318 } WScreen;
321 #define WSS_ROOTMENU (1<<0)
322 #define WSS_SWITCHMENU (1<<1)
323 #define WSS_WSMENU (1<<2)
325 /* changes must update wSaveScreenState/getWorkspaceState */
326 typedef struct WWorkspaceState {
327 int flags;
328 int workspace;
329 #if 0 /* obsoleted by saving menus position in WMState */
330 int menu_x, menu_y;
331 int smenu_x, smenu_y;
332 int wmenu_x, wmenu_y;
333 #endif
334 } WWorkspaceState;
337 WScreen *wScreenInit(int screen_number);
338 void wScreenSaveState(WScreen *scr);
339 void wScreenRestoreState(WScreen *scr);
341 int wScreenBringInside(WScreen *scr, int *x, int *y, int width, int height);
343 /* in startup.c */
344 WScreen *wScreenWithNumber(int i);
345 WScreen *wScreenForRootWindow(Window window); /* window must be valid */
346 WScreen *wScreenSearchForRootWindow(Window window);
347 WScreen *wScreenForWindow(Window window); /* slower than above functions */
349 void wScreenFinish(WScreen *scr);
351 void wScreenUpdateUsableArea(WScreen *scr);
353 #endif