Improve dockapp recognition
[wmaker-crm.git] / src / screen.h
blob51edd5355c546f53c29177c9600eda880e635bc3
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
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 <WINGs/WUtil.h>
31 #define WTB_LEFT 0
32 #define WTB_RIGHT 1
34 #define WTB_FOCUSED 0
35 #define WTB_UNFOCUSED 2
36 #define WTB_PFOCUSED 4
37 #define WTB_MENU 6
40 typedef struct {
41 WMRect *screens;
42 int count; /* screen count, 0 = inactive */
43 int primary_head; /* main working screen */
44 } WXineramaInfo;
48 /* an area of the screen reserved by some window */
49 typedef struct WReservedArea {
50 WArea area;
51 Window window;
52 struct WReservedArea *next;
53 } WReservedArea;
56 typedef struct WAppIconChain {
57 struct WAppIcon *aicon;
58 struct WAppIconChain *next;
59 } WAppIconChain;
63 * each WScreen is saved into a context associated with it's root window
65 typedef struct _WScreen {
66 int screen; /* screen number */
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 WXineramaInfo xine_info;
89 Window no_focus_win; /* window to get focus when nobody
90 * else can do it */
92 struct WWindow *focused_window; /* window that has the focus
93 * Use this list if you want to
94 * traverse the entire window list
97 WMArray *selected_windows;
99 WMArray *fakeGroupLeaders; /* list of fake window group ids */
101 struct WAppIcon *app_icon_list; /* list of all app-icons on screen */
103 struct WApplication *wapp_list; /* list of all aplications */
105 WMBag *stacking_list; /* bag of lists of windows
106 * in stacking order.
107 * Indexed by window level
108 * and each list on the array
109 * is ordered from the topmost to
110 * the lowest window
113 int window_count; /* number of windows in window_list */
115 int workspace_count; /* number of workspaces */
117 struct WWorkspace **workspaces; /* workspace array */
119 int current_workspace; /* current workspace number */
122 WReservedArea *reservedAreas; /* used to build totalUsableArea */
124 WArea *usableArea; /* area of the workspace where
125 * we can put windows on, as defined
126 * by other clients (not us) */
127 WArea *totalUsableArea; /* same as above, but including
128 * the dock and other stuff */
130 WMColor *black;
131 WMColor *white;
132 WMColor *gray;
133 WMColor *darkGray;
135 /* shortcuts for the pixels of the above colors. just for convenience */
136 WMPixel black_pixel;
137 WMPixel white_pixel;
138 WMPixel light_pixel;
139 WMPixel dark_pixel;
141 Pixmap stipple_bitmap;
142 Pixmap transp_stipple; /* for making holes in icon masks for
143 * transparent icon simulation */
144 WMFont *title_font; /* default font for the titlebars */
145 WMFont *menu_title_font; /* font for menu titlebars */
146 WMFont *menu_entry_font; /* font for menu items */
147 WMFont *icon_title_font; /* for icon titles */
148 WMFont *clip_title_font; /* for clip titles */
149 WMFont *info_text_font; /* text on things like geometry
150 * hint boxes */
152 XFontStruct *tech_draw_font; /* font for tech draw style geom view
153 needs to be a core font so we can
154 use it with a XORing GC */
156 WMFont *workspace_name_font;
158 WMColor *select_color;
159 WMColor *select_text_color;
160 /* foreground colors */
161 WMColor *window_title_color[3]; /* window titlebar text (foc, unfoc, pfoc)*/
162 WMColor *menu_title_color[3]; /* menu titlebar text */
163 WMColor *clip_title_color[2]; /* clip title text */
164 WMColor *mtext_color; /* menu item text */
165 WMColor *dtext_color; /* disabled menu item text */
167 WMPixel line_pixel;
168 WMPixel frame_border_pixel; /* frame border */
171 union WTexture *menu_title_texture[3];/* menu titlebar texture (tex, -, -) */
172 union WTexture *window_title_texture[3]; /* win textures (foc, unfoc, pfoc) */
173 union WTexture *resizebar_texture[3];/* window resizebar texture (tex, -, -) */
175 union WTexture *menu_item_texture; /* menu item texture */
177 struct WTexSolid *menu_item_auxtexture; /* additional texture to draw menu
178 * cascade arrows */
179 struct WTexSolid *icon_title_texture;/* icon titles */
181 struct WTexSolid *widget_texture;
183 struct WTexSolid *icon_back_texture; /* icon back color for shadowing */
186 WMColor *icon_title_color; /* icon title color */
188 GC icon_select_gc;
190 GC frame_gc; /* gc for resize/move frame (root) */
191 GC line_gc; /* gc for drawing XORed lines (root) */
192 GC copy_gc; /* gc for XCopyArea() */
193 GC stipple_gc; /* gc for stippled filling */
194 GC draw_gc; /* gc for drawing misc things */
195 GC mono_gc; /* gc for 1 bit drawables */
197 struct WPixmap *b_pixmaps[PRED_BPIXMAPS]; /* internal pixmaps for buttons*/
198 struct WPixmap *menu_radio_indicator;/* left menu indicator */
199 struct WPixmap *menu_check_indicator;/* left menu indicator for checkmark */
200 struct WPixmap *menu_mini_indicator; /* for miniwindow */
201 struct WPixmap *menu_hide_indicator; /* for hidden window */
202 struct WPixmap *menu_shade_indicator; /* for shaded window */
203 int app_menu_x, app_menu_y; /* position for application menus */
205 struct WMenu *root_menu; /* root window menu */
206 struct WMenu *switch_menu; /* window list menu */
207 struct WMenu *workspace_menu; /* workspace operation */
208 struct WMenu *window_menu; /* window command menu */
209 struct WMenu *icon_menu; /* icon/appicon menu */
210 struct WMenu *workspace_submenu; /* workspace list for window_menu */
212 struct WDock *dock; /* the application dock */
213 struct WPixmap *dock_dots; /* 3 dots for the Dock */
214 Window dock_shadow; /* shadow for dock buttons */
215 struct WAppIcon *clip_icon; /* The clip main icon */
216 struct WMenu *clip_menu; /* Menu for clips */
217 struct WMenu *clip_submenu; /* Workspace list for clips */
218 struct WMenu *clip_options; /* Options for Clip */
219 struct WMenu *clip_ws_menu; /* workspace menu for clip */
220 struct WDock *last_dock;
221 WAppIconChain *global_icons; /* for omnipresent icons chain in clip */
222 int global_icon_count; /* How many global icons do we have */
224 Window clip_balloon; /* window for workspace name */
226 int keymove_tick;
228 #ifdef GRADIENT_CLIP_ARROW
229 Pixmap clip_arrow_gradient;
230 #endif
232 struct RContext *rcontext; /* wrlib context */
234 WMScreen *wmscreen; /* for widget library */
236 struct RImage *icon_tile;
237 struct RImage *clip_tile;
238 Pixmap icon_tile_pixmap; /* for app supplied icons */
240 Pixmap def_icon_pixmap; /* default icons */
241 Pixmap def_ticon_pixmap;
243 struct WDialogData *dialog_data;
246 struct W_GeometryView *gview; /* size/position view */
248 /* state and other informations */
249 short cascade_index; /* for cascade window placement */
251 WMPropList *session_state;
253 /* for double-click detection */
254 Time last_click_time;
255 Window last_click_window;
256 int last_click_button;
258 /* balloon help data */
259 struct _WBalloon *balloon;
261 /* workspace name data */
262 Window workspace_name;
263 WMHandlerID *workspace_name_timer;
264 struct WorkspaceNameData *workspace_name_data;
266 /* for raise-delay */
267 WMHandlerID *autoRaiseTimer;
268 Window autoRaiseWindow; /* window that is scheduled to be
269 * raised */
271 /* for window shortcuts */
272 WMArray *shortcutWindows[MAX_WINDOW_SHORTCUTS];
274 #ifdef XDND
275 char *xdestring;
276 #endif
278 struct NetData *netdata;
280 int helper_fd;
281 pid_t helper_pid;
283 struct {
284 unsigned int startup:1; /* during window manager startup */
285 unsigned int regenerate_icon_textures:1;
286 unsigned int dnd_data_convertion_status:1;
287 unsigned int root_menu_changed_shortcuts:1;
288 unsigned int added_workspace_menu:1;
289 unsigned int added_windows_menu:1;
290 unsigned int startup2:1; /* startup phase 2 */
291 unsigned int supports_tiff:1;
292 unsigned int clip_balloon_mapped:1;
293 unsigned int next_click_is_not_double:1;
294 unsigned int backimage_helper_launched:1;
295 /* some client has issued a WM_COLORMAP_NOTIFY */
296 unsigned int colormap_stuff_blocked:1;
297 unsigned int doing_alt_tab:1;
298 unsigned int jump_back_pending:1;
299 unsigned int ignore_focus_events:1;
300 } flags;
301 } WScreen;
305 WScreen *wScreenInit(int screen_number);
306 void wScreenSaveState(WScreen *scr);
307 void wScreenRestoreState(WScreen *scr);
309 int wScreenBringInside(WScreen *scr, int *x, int *y, int width, int height);
310 int wScreenKeepInside(WScreen *scr, int *x, int *y, int width, int height);
313 /* in startup.c */
314 WScreen *wScreenWithNumber(int i);
315 WScreen *wScreenForRootWindow(Window window); /* window must be valid */
316 WScreen *wScreenSearchForRootWindow(Window window);
317 WScreen *wScreenForWindow(Window window); /* slower than above functions */
319 void wScreenFinish(WScreen *scr);
321 void wScreenUpdateUsableArea(WScreen *scr);
323 #endif