small bugfixes.
[wmaker-crm.git] / src / screen.h
bloba4e6050e4ef3ab31d811d5eb627eb678aef47d2c
1 /*
2 * Window Maker window manager
3 *
4 * Copyright (c) 1997-2001 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 <sys/types.h>
29 #include <proplist.h>
31 #ifdef XINERAMA
32 #include <X11/Xinerama.h>
33 #endif
36 #define WTB_LEFT 0
37 #define WTB_RIGHT 1
39 #define WTB_FOCUSED 0
40 #define WTB_UNFOCUSED 2
41 #define WTB_PFOCUSED 4
42 #define WTB_MENU 6
44 #ifdef GNOME_STUFF
45 /* an area of the screen reserved by some window */
46 typedef struct WReservedArea {
47 WArea area;
48 Window window;
49 struct WReservedArea *next;
50 } WReservedArea;
51 #endif
54 typedef struct WAppIconChain {
55 struct WAppIcon *aicon;
56 struct WAppIconChain *next;
57 } WAppIconChain;
61 * each WScreen is saved into a context associated with it's root window
63 typedef struct _WScreen {
64 int screen; /* screen number */
66 #if 0
67 Atom managerAtom; /* WM_Sn atom for manager selection */
68 Window managerWindow; /* window for manager selection */
69 #endif
70 Window info_window; /* for our window manager info stuff */
72 int scr_width; /* size of the screen */
73 int scr_height;
75 #ifdef VIRTUAL_DESKTOP
76 Window virtual_edge_u;
77 Window virtual_edge_d;
78 Window virtual_edge_l;
79 Window virtual_edge_r;
80 #endif
82 Window root_win; /* root window of screen */
83 int depth; /* depth of the default visual */
84 Colormap colormap; /* root colormap */
85 int root_colormap_install_count;
86 struct WWindow *original_cmap_window; /* colormap before installing
87 * root colormap temporarily */
88 struct WWindow *cmap_window;
89 Colormap current_colormap;
91 Window w_win; /* window to use as drawable
92 * for new GCs, pixmaps etc. */
93 Visual *w_visual;
94 int w_depth;
95 Colormap w_colormap; /* our colormap */
97 #ifdef XINERAMA
98 XineramaScreenInfo *xine_screens;
99 int xine_count; /* 0 means not active */
100 int xine_primary_screen; /* main working screen */
101 #endif
103 Window no_focus_win; /* window to get focus when nobody
104 * else can do it */
106 struct WWindow *focused_window; /* window that has the focus
107 * Use this list if you want to
108 * traverse the entire window list
111 WMArray *selected_windows;
113 struct WAppIcon *app_icon_list; /* list of all app-icons on screen */
115 struct WApplication *wapp_list; /* list of all aplications */
117 WMBag *stacking_list; /* bag of lists of windows
118 * in stacking order.
119 * Indexed by window level
120 * and each list on the array
121 * is ordered from the topmost to
122 * the lowest window
125 int window_count; /* number of windows in window_list */
127 int workspace_count; /* number of workspaces */
129 struct WWorkspace **workspaces; /* workspace array */
131 int current_workspace; /* current workspace number */
134 #ifdef GNOME_STUFF
135 WReservedArea *reservedAreas; /* used to build totalUsableArea */
136 #endif
138 WArea usableArea; /* area of the workspace where
139 * we can put windows on, as defined
140 * by other clients (not us) */
141 WArea totalUsableArea; /* same as above, but including
142 * the dock and other stuff */
145 WMPixel black_pixel;
146 WMPixel white_pixel;
148 WMPixel light_pixel;
149 WMPixel dark_pixel;
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
160 * hint boxes */
161 WMFont *workspace_name_font;
163 WMPixel select_pixel;
164 WMPixel select_text_pixel;
165 /* foreground colors */
166 WMPixel window_title_pixel[3]; /* window titlebar text (foc, unfoc, pfoc)*/
167 WMPixel menu_title_pixel[3]; /* menu titlebar text */
168 WMPixel clip_title_pixel[2]; /* clip title text */
169 WMPixel mtext_pixel; /* menu item text */
170 WMPixel dtext_pixel; /* disabled menu item text */
171 WMPixel line_pixel;
172 WMPixel frame_border_pixel; /* frame border */
175 union WTexture *menu_title_texture[3];/* menu titlebar texture (tex, -, -) */
176 union WTexture *window_title_texture[3]; /* win textures (foc, unfoc, pfoc) */
177 union WTexture *resizebar_texture[3];/* window resizebar texture (tex, -, -) */
179 union WTexture *menu_item_texture; /* menu item texture */
181 struct WTexSolid *menu_item_auxtexture; /* additional texture to draw menu
182 * cascade arrows */
183 struct WTexSolid *icon_title_texture;/* icon titles */
185 struct WTexSolid *widget_texture;
187 struct WTexSolid *icon_back_texture; /* icon back color for shadowing */
189 GC window_title_gc; /* window title text GC */
190 GC menu_title_gc; /* menu titles */
192 GC icon_title_gc; /* icon title background */
193 GC clip_title_gc; /* clip title */
194 GC menu_entry_gc; /* menu entries */
195 GC select_menu_gc; /* selected menu entries */
196 GC disabled_menu_entry_gc; /* disabled menu entries */
197 GC info_text_gc; /* for size/position display */
198 GC icon_select_gc;
200 GC frame_gc; /* gc for resize/move frame (root) */
201 GC line_gc; /* gc for drawing XORed lines (root) */
202 GC copy_gc; /* gc for XCopyArea() */
203 GC stipple_gc; /* gc for stippled filling */
204 GC draw_gc; /* gc for drawing misc things */
205 GC mono_gc; /* gc for 1 bit drawables */
207 #ifndef NEWSTUFF
208 struct WPixmap *b_pixmaps[PRED_BPIXMAPS]; /* internal pixmaps for buttons*/
209 #endif
210 struct WPixmap *menu_radio_indicator;/* left menu indicator */
211 struct WPixmap *menu_check_indicator;/* left menu indicator for checkmark */
212 struct WPixmap *menu_mini_indicator; /* for miniwindow */
213 struct WPixmap *menu_hide_indicator; /* for hidden window */
214 struct WPixmap *menu_shade_indicator; /* for shaded window */
215 int app_menu_x, app_menu_y; /* position for application menus */
217 #ifndef LITE
218 struct WMenu *root_menu; /* root window menu */
219 struct WMenu *switch_menu; /* window list menu */
220 #endif
221 struct WMenu *workspace_menu; /* workspace operation */
222 struct WMenu *window_menu; /* window command menu */
223 struct WMenu *icon_menu; /* icon/appicon menu */
224 struct WMenu *workspace_submenu; /* workspace list for window_menu */
226 struct WDock *dock; /* the application dock */
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 */
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 WDock *last_dock;
235 WAppIconChain *global_icons; /* for omnipresent icons chain in clip */
236 int global_icon_count; /* How many global icons do we have */
238 Window clip_balloon; /* window for workspace name */
240 int keymove_tick;
242 #ifdef GRADIENT_CLIP_ARROW
243 Pixmap clip_arrow_gradient;
244 #endif
246 struct RContext *rcontext; /* wrlib context */
248 WMScreen *wmscreen; /* for widget library */
250 struct RImage *icon_tile;
251 struct RImage *clip_tile;
252 Pixmap icon_tile_pixmap; /* for app supplied icons */
254 Pixmap def_icon_pixmap; /* default icons */
255 Pixmap def_ticon_pixmap;
257 struct WDialogData *dialog_data;
260 struct W_GeometryView *gview; /* size/position view */
262 #ifdef NEWSTUFF
263 struct RImage *button_images[2][PRED_BPIXMAPS];/* scaled tbar btn images */
264 #endif
266 /* state and other informations */
267 short cascade_index; /* for cascade window placement */
269 proplist_t session_state;
271 /* for double-click detection */
272 Time last_click_time;
273 Window last_click_window;
274 int last_click_button;
276 /* balloon help data */
277 struct _WBalloon *balloon;
279 /* workspace name data */
280 Window workspace_name;
281 WMHandlerID *workspace_name_timer;
282 struct WorkspaceNameData *workspace_name_data;
284 /* for raise-delay */
285 WMHandlerID *autoRaiseTimer;
286 Window autoRaiseWindow; /* window that is scheduled to be
287 * raised */
290 Window scrolledFMaximize; /* full maximized window which was
291 scrolled down for titlebar access */
293 /* for window shortcuts */
294 WMArray *shortcutWindows[MAX_WINDOW_SHORTCUTS];
296 #ifdef XDND
297 char *xdestring;
298 #endif
300 #ifdef KWM_HINTS
301 Window kwm_dock;
302 #endif
304 int helper_fd;
305 pid_t helper_pid;
307 struct {
308 unsigned int startup:1; /* during window manager startup */
309 unsigned int regenerate_icon_textures:1;
310 unsigned int dnd_data_convertion_status:1;
311 unsigned int root_menu_changed_shortcuts:1;
312 unsigned int added_workspace_menu:1;
313 unsigned int added_windows_menu:1;
314 unsigned int startup2:1; /* startup phase 2 */
315 unsigned int supports_tiff:1;
316 unsigned int clip_balloon_mapped:1;
317 unsigned int next_click_is_not_double:1;
318 unsigned int backimage_helper_launched:1;
319 /* some client has issued a WM_COLORMAP_NOTIFY */
320 unsigned int colormap_stuff_blocked:1;
321 unsigned int doing_alt_tab:1;
322 unsigned int jump_back_pending:1;
323 #ifdef KWM_HINTS
324 unsigned int kwm_syncing_name:1;
325 unsigned int kwm_syncing_count:1;
326 #endif
327 } flags;
328 } WScreen;
331 #define WSS_ROOTMENU (1<<0)
332 #define WSS_SWITCHMENU (1<<1)
333 #define WSS_WSMENU (1<<2)
335 /* changes must update wSaveScreenState/getWorkspaceState */
336 typedef struct WWorkspaceState {
337 int flags;
338 int workspace;
339 #if 0 /* obsoleted by saving menus position in WMState */
340 int menu_x, menu_y;
341 int smenu_x, smenu_y;
342 int wmenu_x, wmenu_y;
343 #endif
344 } WWorkspaceState;
347 WScreen *wScreenInit(int screen_number);
348 void wScreenSaveState(WScreen *scr);
349 void wScreenRestoreState(WScreen *scr);
351 int wScreenBringInside(WScreen *scr, int *x, int *y, int width, int height);
353 /* in startup.c */
354 WScreen *wScreenWithNumber(int i);
355 WScreen *wScreenForRootWindow(Window window); /* window must be valid */
356 WScreen *wScreenSearchForRootWindow(Window window);
357 WScreen *wScreenForWindow(Window window); /* slower than above functions */
359 void wScreenFinish(WScreen *scr);
361 void wScreenUpdateUsableArea(WScreen *scr);
363 #endif