various bug fixes
[wmaker-crm.git] / src / screen.h
blobe9befa3b988718da3075ebd576880f6b6afbc2dc
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 <sys/types.h>
29 #ifdef XDE_DND
30 #include <gdk/gdk.h>
31 #endif
33 #include <proplist.h>
36 typedef struct WFont {
37 #ifndef I18N_MB
38 XFontStruct *font;
39 #else
40 XFontSet font;
41 #endif
42 short height;
43 short y;
44 } WFont;
47 #define WTB_LEFT 0
48 #define WTB_RIGHT 1
50 #define WTB_FOCUSED 0
51 #define WTB_UNFOCUSED 2
52 #define WTB_PFOCUSED 4
53 #define WTB_MENU 6
55 #ifdef GNOME_STUFF
56 /* an area of the screen reserved by some window */
57 typedef struct WReservedArea {
58 WArea area;
59 Window window;
60 struct WReservedArea *next;
61 } WReservedArea;
62 #endif
67 * each WScreen is saved into a context associated with it's root window
69 typedef struct _WScreen {
70 int screen; /* screen number */
72 #if 0
73 Atom managerAtom; /* WM_Sn atom for manager selection */
74 Window managerWindow; /* window for manager selection */
75 #endif
76 Window info_window; /* for our window manager info stuff */
78 int scr_width; /* size of the screen */
79 int scr_height;
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. */
92 Visual *w_visual;
93 int w_depth;
94 Colormap w_colormap; /* our colormap */
96 Window no_focus_win; /* window to get focus when nobody
97 * else can do it */
99 struct WWindow *focused_window; /* window that has the focus
100 * Use this list if you want to
101 * traverse the entire window list
104 struct LinkedList *selected_windows;
106 struct WAppIcon *app_icon_list; /* list of all app-icons on screen */
108 struct WApplication *wapp_list; /* list of all aplications */
110 struct _WCoreWindow *stacking_list[MAX_WINDOW_LEVELS];
111 /* array of lists of windows
112 * in stacking order.
113 * The array order is in window level
114 * order and each list on the array
115 * is ordered from the topmost to
116 * the lowest window
118 /* int window_level_count[MAX_WINDOW_LEVELS];*/
119 int window_count; /* number of windows in window_list */
121 int workspace_count; /* number of workspaces */
123 struct WWorkspace **workspaces; /* workspace array */
125 int current_workspace; /* current workspace number */
128 #ifdef GNOME_STUFF
129 WReservedArea *reservedAreas; /* used to build totalUsableArea */
130 #endif
132 WArea usableArea; /* area of the workspace where
133 * we can put windows on, as defined
134 * by other clients (not us) */
135 WArea totalUsableArea; /* same as above, but including
136 * the dock and other stuff */
139 WMPixel black_pixel;
140 WMPixel white_pixel;
142 WMPixel light_pixel;
143 WMPixel dark_pixel;
145 Pixmap stipple_bitmap;
146 Pixmap transp_stipple; /* for making holes in icon masks for
147 * transparent icon simulation */
148 WFont *title_font; /* default font for the titlebars */
149 WFont *menu_title_font; /* font for menu titlebars */
150 WFont *menu_entry_font; /* font for menu items */
151 WFont *icon_title_font; /* for icon titles */
152 WFont *clip_title_font; /* for clip titles */
153 WFont *info_text_font; /* text on things like geometry
154 * hint boxes */
155 WFont *workspace_name_font;
157 WMPixel select_pixel;
158 WMPixel select_text_pixel;
159 /* foreground colors */
160 #ifdef TITLE_TEXT_SHADOW
161 WMPixel window_title_pixel[6];
162 WMPixel menu_title_pixel[6]; /* menu titlebar text */
163 #else /* !TITLE_TEXT_SHADOW */
164 WMPixel window_title_pixel[3]; /* window titlebar text (foc, unfoc, pfoc)*/
165 WMPixel menu_title_pixel[3]; /* menu titlebar text */
166 #endif /* !TITLE_TEXT_SHADOW */
167 WMPixel clip_title_pixel[2]; /* clip title text */
168 WMPixel mtext_pixel; /* menu item text */
169 WMPixel dtext_pixel; /* disabled menu item text */
170 WMPixel line_pixel;
171 WMPixel frame_border_pixel; /* frame border */
173 union WTexture *menu_title_texture[3];/* menu titlebar texture (tex, -, -) */
174 union WTexture *window_title_texture[3]; /* win textures (foc, unfoc, pfoc) */
175 union WTexture *resizebar_texture[3];/* window resizebar texture (tex, -, -) */
177 union WTexture *menu_item_texture; /* menu item texture */
179 struct WTexSolid *menu_item_auxtexture; /* additional texture to draw menu
180 * cascade arrows */
181 struct WTexSolid *icon_title_texture;/* icon titles */
183 struct WTexSolid *widget_texture;
185 struct WTexSolid *icon_back_texture; /* icon back color for shadowing */
187 GC window_title_gc; /* window title text GC */
188 GC menu_title_gc; /* menu titles */
190 GC icon_title_gc; /* icon title background */
191 GC clip_title_gc; /* clip title */
192 GC menu_entry_gc; /* menu entries */
193 GC select_menu_gc; /* selected menu entries */
194 GC disabled_menu_entry_gc; /* disabled menu entries */
195 GC info_text_gc; /* for size/position display */
196 GC icon_select_gc;
198 GC frame_gc; /* gc for resize/move frame (root) */
199 GC line_gc; /* gc for drawing XORed lines (root) */
200 GC copy_gc; /* gc for XCopyArea() */
201 GC stipple_gc; /* gc for stippled filling */
202 GC draw_gc; /* gc for drawing misc things */
203 GC mono_gc; /* gc for 1 bit drawables */
205 #ifndef NEWSTUFF
206 struct WPixmap *b_pixmaps[PRED_BPIXMAPS]; /* internal pixmaps for buttons*/
207 #endif
208 struct WPixmap *menu_radio_indicator;/* left menu indicator */
209 struct WPixmap *menu_check_indicator;/* left menu indicator for checkmark */
210 struct WPixmap *menu_mini_indicator; /* for miniwindow */
211 struct WPixmap *menu_hide_indicator; /* for hidden window */
212 struct WPixmap *menu_shade_indicator; /* for shaded window */
213 int app_menu_x, app_menu_y; /* position for application menus */
215 #ifndef LITE
216 struct WMenu *root_menu; /* root window menu */
217 struct WMenu *switch_menu; /* window list menu */
218 #endif
219 struct WMenu *workspace_menu; /* workspace operation */
220 struct WMenu *window_menu; /* window command menu */
221 struct WMenu *icon_menu; /* icon/appicon menu */
222 struct WMenu *workspace_submenu; /* workspace list for window_menu */
224 struct WDock *dock; /* the application dock */
225 struct WPixmap *dock_dots; /* 3 dots for the Dock */
226 Window dock_shadow; /* shadow for dock buttons */
227 struct WAppIcon *clip_icon; /* The clip main icon */
228 struct WMenu *clip_menu; /* Menu for clips */
229 struct WMenu *clip_submenu; /* Workspace list for clips */
230 struct WMenu *clip_options; /* Options for Clip */
231 struct WMenu *clip_ws_menu; /* workspace menu for clip */
232 struct WDock *last_dock;
234 Window clip_balloon; /* window for workspace name */
236 Window geometry_display; /* displays the geometry during
237 * window resize, move etc. */
238 unsigned int geometry_display_width;
239 unsigned int geometry_display_height;
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;
259 #ifdef NEWSTUFF
260 struct RImage *button_images[2][PRED_BPIXMAPS];/* scaled tbar btn images */
261 #endif
263 /* state and other informations */
264 short cascade_index; /* for cascade window placement */
266 proplist_t session_state;
268 /* for double-click detection */
269 Time last_click_time;
270 Window last_click_window;
271 int last_click_button;
273 /* balloon help data */
274 struct _WBalloon *balloon;
276 /* workspace name data */
277 Window workspace_name;
278 WMHandlerID *workspace_name_timer;
279 struct WorkspaceNameData *workspace_name_data;
281 /* for raise-delay */
282 WMHandlerID *autoRaiseTimer;
283 Window autoRaiseWindow; /* window that is scheduled to be
284 * raised */
287 Window scrolledFMaximize; /* full maximized window which was
288 scrolled down for titlebar access */
290 /* for window shortcuts */
291 struct WWindow *shortcutWindow[MAX_WINDOW_SHORTCUTS];
293 #ifdef XDE_DND
294 char *xdestring;
295 #endif
297 #ifdef KWM_HINTS
298 Window kwm_dock;
299 #endif
301 int helper_fd;
302 pid_t helper_pid;
304 struct {
305 unsigned int startup:1; /* during window manager startup */
306 unsigned int regenerate_icon_textures:1;
307 unsigned int dnd_data_convertion_status:1;
308 unsigned int root_menu_changed_shortcuts:1;
309 unsigned int added_workspace_menu:1;
310 unsigned int startup2:1; /* startup phase 2 */
311 unsigned int supports_tiff:1;
312 unsigned int clip_balloon_mapped:1;
313 unsigned int next_click_is_not_double:1;
314 unsigned int backimage_helper_launched:1;
315 /* some client has issued a WM_COLORMAP_NOTIFY */
316 unsigned int colormap_stuff_blocked:1;
317 unsigned int doing_alt_tab:1;
318 #ifdef KWM_HINTS
319 unsigned int kwm_syncing_name:1;
320 unsigned int kwm_syncing_count:1;
321 #endif
322 } flags;
323 } WScreen;
326 #define WSS_ROOTMENU (1<<0)
327 #define WSS_SWITCHMENU (1<<1)
328 #define WSS_WSMENU (1<<2)
330 /* changes must update wSaveScreenState/getWorkspaceState */
331 typedef struct WWorkspaceState {
332 int flags;
333 int workspace;
334 #if 0 /* obsoleted by saving menus position in WMState */
335 int menu_x, menu_y;
336 int smenu_x, smenu_y;
337 int wmenu_x, wmenu_y;
338 #endif
339 } WWorkspaceState;
342 WScreen *wScreenInit(int screen_number);
343 void wScreenSaveState(WScreen *scr);
344 void wScreenRestoreState(WScreen *scr);
346 int wScreenBringInside(WScreen *scr, int *x, int *y, int width, int height);
348 /* in startup.c */
349 WScreen *wScreenWithNumber(int i);
350 WScreen *wScreenForRootWindow(Window window); /* window must be valid */
351 WScreen *wScreenSearchForRootWindow(Window window);
352 WScreen *wScreenForWindow(Window window); /* slower than above functions */
354 void wScreenFinish(WScreen *scr);
356 void wScreenUpdateUsableArea(WScreen *scr);
358 #endif