Make window border size configurable.
[wmaker-crm.git] / src / screen.h
blob5f44555dc47e495e11f3bb9563425f744f21341e
1 /*
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.
21 #ifndef WMSCREEN_H_
22 #define WMSCREEN_H_
24 #include "wconfig.h"
25 #include "WindowMaker.h"
26 #include <sys/types.h>
28 #include <WINGs/WUtil.h>
30 #define WTB_LEFT 0
31 #define WTB_RIGHT 1
33 #define WTB_FOCUSED 0
34 #define WTB_UNFOCUSED 2
35 #define WTB_PFOCUSED 4
36 #define WTB_MENU 6
38 #ifdef HAVE_XRANDR
39 Bool has_randr;
40 int randr_event_base;
41 #endif
43 typedef struct {
44 WMRect *screens;
45 int count; /* screen count, 0 = inactive */
46 int primary_head; /* main working screen */
47 } WXineramaInfo;
51 /* an area of the screen reserved by some window */
52 typedef struct WReservedArea {
53 WArea area;
54 Window window;
55 struct WReservedArea *next;
56 } WReservedArea;
59 typedef struct WAppIconChain {
60 struct WAppIcon *aicon;
61 struct WAppIconChain *next;
62 } WAppIconChain;
66 * each WScreen is saved into a context associated with it's root window
68 typedef struct _WScreen {
69 int screen; /* screen number */
70 Window info_window; /* for our window manager info stuff */
72 int scr_width; /* size of the screen */
73 int scr_height;
75 Window root_win; /* root window of screen */
76 int depth; /* depth of the default visual */
77 Colormap colormap; /* root colormap */
78 int root_colormap_install_count;
79 struct WWindow *original_cmap_window; /* colormap before installing
80 * root colormap temporarily */
81 struct WWindow *cmap_window;
82 Colormap current_colormap;
84 Window w_win; /* window to use as drawable
85 * for new GCs, pixmaps etc. */
86 Visual *w_visual;
87 int w_depth;
88 Colormap w_colormap; /* our colormap */
90 WXineramaInfo xine_info;
92 Window no_focus_win; /* window to get focus when nobody
93 * else can do it */
95 struct WWindow *focused_window; /* window that has the focus
96 * Use this list if you want to
97 * traverse the entire window list
100 WMArray *selected_windows;
102 WMArray *fakeGroupLeaders; /* list of fake window group ids */
104 struct WAppIcon *app_icon_list; /* list of all app-icons on screen */
106 struct WApplication *wapp_list; /* list of all aplications */
108 WMBag *stacking_list; /* bag of lists of windows
109 * in stacking order.
110 * Indexed by window level
111 * and each list on the array
112 * is ordered from the topmost to
113 * the lowest window
116 int window_count; /* number of windows in window_list */
118 int workspace_count; /* number of workspaces */
120 struct WWorkspace **workspaces; /* workspace array */
122 int current_workspace; /* current workspace number */
125 WReservedArea *reservedAreas; /* used to build totalUsableArea */
127 WArea *usableArea; /* area of the workspace where
128 * we can put windows on, as defined
129 * by other clients (not us) */
130 WArea *totalUsableArea; /* same as above, but including
131 * the dock and other stuff */
133 WMColor *black;
134 WMColor *white;
135 WMColor *gray;
136 WMColor *darkGray;
138 /* shortcuts for the pixels of the above colors. just for convenience */
139 WMPixel black_pixel;
140 WMPixel white_pixel;
141 WMPixel light_pixel;
142 WMPixel dark_pixel;
144 Pixmap stipple_bitmap;
145 Pixmap transp_stipple; /* for making holes in icon masks for
146 * transparent icon simulation */
147 WMFont *title_font; /* default font for the titlebars */
148 WMFont *menu_title_font; /* font for menu titlebars */
149 WMFont *menu_entry_font; /* font for menu items */
150 WMFont *icon_title_font; /* for icon titles */
151 WMFont *clip_title_font; /* for clip titles */
152 WMFont *info_text_font; /* text on things like geometry
153 * hint boxes */
155 XFontStruct *tech_draw_font; /* font for tech draw style geom view
156 needs to be a core font so we can
157 use it with a XORing GC */
159 WMFont *workspace_name_font;
161 WMColor *select_color;
162 WMColor *select_text_color;
163 /* foreground colors */
164 WMColor *window_title_color[3]; /* window titlebar text (foc, unfoc, pfoc)*/
165 WMColor *menu_title_color[3]; /* menu titlebar text */
166 WMColor *clip_title_color[2]; /* clip title text */
167 WMColor *mtext_color; /* menu item text */
168 WMColor *dtext_color; /* disabled menu item text */
170 int frame_border_width;
171 WMColor *frame_border_color;
172 WMColor *frame_selected_border_color;
174 WMPixel line_pixel;
175 WMPixel frame_border_pixel; /* frame border */
176 WMPixel frame_selected_border_pixel;/* frame border */
179 union WTexture *menu_title_texture[3];/* menu titlebar texture (tex, -, -) */
180 union WTexture *window_title_texture[3]; /* win textures (foc, unfoc, pfoc) */
181 union WTexture *resizebar_texture[3];/* window resizebar texture (tex, -, -) */
183 union WTexture *menu_item_texture; /* menu item texture */
185 struct WTexSolid *menu_item_auxtexture; /* additional texture to draw menu
186 * cascade arrows */
187 struct WTexSolid *icon_title_texture;/* icon titles */
189 struct WTexSolid *widget_texture;
191 struct WTexSolid *icon_back_texture; /* icon back color for shadowing */
194 WMColor *icon_title_color; /* icon title color */
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 struct WPixmap *b_pixmaps[PRED_BPIXMAPS]; /* internal pixmaps for buttons*/
206 struct WPixmap *menu_radio_indicator;/* left menu indicator */
207 struct WPixmap *menu_check_indicator;/* left menu indicator for checkmark */
208 struct WPixmap *menu_mini_indicator; /* for miniwindow */
209 struct WPixmap *menu_hide_indicator; /* for hidden window */
210 struct WPixmap *menu_shade_indicator; /* for shaded window */
211 int app_menu_x, app_menu_y; /* position for application menus */
213 struct WMenu *root_menu; /* root window menu */
214 struct WMenu *switch_menu; /* window list menu */
215 struct WMenu *workspace_menu; /* workspace operation */
216 struct WMenu *window_menu; /* window command menu */
217 struct WMenu *icon_menu; /* icon/appicon menu */
218 struct WMenu *workspace_submenu; /* workspace list for window_menu */
220 struct WDock *dock; /* the application dock */
221 struct WPixmap *dock_dots; /* 3 dots for the Dock */
222 Window dock_shadow; /* shadow for dock buttons */
223 struct WAppIcon *clip_icon; /* The clip main icon */
224 struct WMenu *clip_menu; /* Menu for clips */
225 struct WMenu *clip_submenu; /* Workspace list for clips */
226 struct WMenu *clip_options; /* Options for Clip */
227 struct WMenu *clip_ws_menu; /* workspace menu for clip */
228 struct WDock *last_dock;
229 WAppIconChain *global_icons; /* for omnipresent icons chain in clip */
230 int global_icon_count; /* How many global icons do we have */
232 Window clip_balloon; /* window for workspace name */
234 int keymove_tick;
235 struct RContext *rcontext; /* wrlib context */
237 WMScreen *wmscreen; /* for widget library */
239 struct RImage *icon_tile;
240 struct RImage *clip_tile;
242 Pixmap icon_tile_pixmap; /* For app supplied icons */
244 struct RImage *def_icon_rimage; /* Default RImage icon */
246 struct WDialogData *dialog_data;
248 struct W_GeometryView *gview; /* size/position view */
250 /* state and other informations */
251 short cascade_index; /* for cascade window placement */
253 WMPropList *session_state;
255 /* for double-click detection */
256 Time last_click_time;
257 Window last_click_window;
258 int last_click_button;
260 /* balloon help data */
261 struct _WBalloon *balloon;
263 /* workspace name data */
264 Window workspace_name;
265 WMHandlerID *workspace_name_timer;
266 struct WorkspaceNameData *workspace_name_data;
268 /* for raise-delay */
269 WMHandlerID *autoRaiseTimer;
270 Window autoRaiseWindow; /* window that is scheduled to be
271 * raised */
273 /* for window shortcuts */
274 WMArray *shortcutWindows[MAX_WINDOW_SHORTCUTS];
276 #ifdef XDND
277 char *xdestring;
278 #endif
280 struct NetData *netdata;
282 int helper_fd;
283 pid_t helper_pid;
285 struct {
286 unsigned int startup:1; /* during window manager startup */
287 unsigned int regenerate_icon_textures:1;
288 unsigned int dnd_data_convertion_status:1;
289 unsigned int root_menu_changed_shortcuts:1;
290 unsigned int added_workspace_menu:1;
291 unsigned int added_windows_menu:1;
292 unsigned int startup2:1; /* startup phase 2 */
293 unsigned int supports_tiff:1;
294 unsigned int next_click_is_not_double:1;
295 unsigned int backimage_helper_launched:1;
296 /* some client has issued a WM_COLORMAP_NOTIFY */
297 unsigned int colormap_stuff_blocked:1;
298 unsigned int doing_alt_tab:1;
299 unsigned int jump_back_pending:1;
300 unsigned int ignore_focus_events:1;
301 } flags;
302 } WScreen;
306 WScreen *wScreenInit(int screen_number);
307 void wScreenSaveState(WScreen *scr);
308 void wScreenRestoreState(WScreen *scr);
310 int wScreenBringInside(WScreen *scr, int *x, int *y, int width, int height);
311 int wScreenKeepInside(WScreen *scr, int *x, int *y, int width, int height);
314 /* in startup.c */
315 WScreen *wScreenWithNumber(int i);
316 WScreen *wScreenForRootWindow(Window window); /* window must be valid */
317 WScreen *wScreenSearchForRootWindow(Window window);
318 WScreen *wScreenForWindow(Window window); /* slower than above functions */
320 void wScreenFinish(WScreen *scr);
321 void wScreenUpdateUsableArea(WScreen *scr);
323 void create_logo_image(WScreen *scr);
324 #endif