New option for enabling alternative half-maximized window movement.
[wmaker-crm.git] / src / screen.h
blobae1d642c550917a24d2c4d592b83e091b8de560d
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>
31 typedef struct {
32 WMRect *screens;
33 int count; /* screen count, 0 = inactive */
34 int primary_head; /* main working screen */
35 } WXineramaInfo;
39 /* an area of the screen reserved by some window */
40 typedef struct WReservedArea {
41 WArea area;
42 Window window;
43 struct WReservedArea *next;
44 } WReservedArea;
47 typedef struct WAppIconChain {
48 struct WAppIcon *aicon;
49 struct WAppIconChain *next;
50 } WAppIconChain;
53 /* Drawers, which are docks, really */
54 typedef struct WDrawerChain {
55 struct WDock *adrawer;
56 struct WDrawerChain *next;
57 } WDrawerChain;
60 * each WScreen is saved into a context associated with it's root window
62 typedef struct _WScreen {
63 int screen; /* screen number */
64 Window info_window; /* for our window manager info stuff */
65 #ifdef USE_ICCCM_WMREPLACE
66 Atom sn_atom; /* window manager selection */
67 #endif
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
96 struct WWindow *bfs_focused_window; /* window that had focus before
97 * another window entered fullscreen
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 */
123 int last_workspace; /* last used workspace number */
126 WReservedArea *reservedAreas; /* used to build totalUsableArea */
128 WArea *usableArea; /* area of the workspace where
129 * we can put windows on, as defined
130 * by other clients (not us) */
131 WArea *totalUsableArea; /* same as above, but including
132 * the dock and other stuff */
134 WMColor *black;
135 WMColor *white;
136 WMColor *gray;
137 WMColor *darkGray;
139 /* shortcuts for the pixels of the above colors. just for convenience */
140 WMPixel black_pixel;
141 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 WMFont *title_font; /* default font for the titlebars */
149 WMFont *menu_title_font; /* font for menu titlebars */
150 WMFont *menu_entry_font; /* font for menu items */
151 WMFont *icon_title_font; /* for icon titles */
152 WMFont *clip_title_font; /* for clip titles */
153 WMFont *info_text_font; /* text on things like geometry
154 * hint boxes */
156 XFontStruct *tech_draw_font; /* font for tech draw style geom view
157 needs to be a core font so we can
158 use it with a XORing GC */
160 WMFont *workspace_name_font;
162 WMColor *select_color;
163 WMColor *select_text_color;
164 /* foreground colors */
165 WMColor *window_title_color[3]; /* window titlebar text (foc, unfoc, pfoc)*/
166 WMColor *menu_title_color[3]; /* menu titlebar text */
167 WMColor *clip_title_color[2]; /* clip title text */
168 WMColor *mtext_color; /* menu item text */
169 WMColor *dtext_color; /* disabled menu item text */
171 int frame_border_width;
172 WMColor *frame_border_color;
173 WMColor *frame_focused_border_color;
174 WMColor *frame_selected_border_color;
176 WMPixel line_pixel;
177 WMPixel frame_border_pixel; /* frame border */
178 WMPixel frame_focused_border_pixel; /* frame border */
179 WMPixel frame_selected_border_pixel;/* frame border */
182 union WTexture *menu_title_texture[3];/* menu titlebar texture (tex, -, -) */
183 union WTexture *window_title_texture[3]; /* win textures (foc, unfoc, pfoc) */
184 union WTexture *resizebar_texture[3];/* window resizebar texture (tex, -, -) */
186 union WTexture *menu_item_texture; /* menu item texture */
188 struct WTexSolid *menu_item_auxtexture; /* additional texture to draw menu
189 * cascade arrows */
190 struct WTexSolid *icon_title_texture;/* icon titles */
192 struct WTexSolid *widget_texture;
194 struct WTexSolid *icon_back_texture; /* icon back color for shadowing */
197 WMColor *icon_title_color; /* icon title color */
199 GC icon_select_gc;
201 GC frame_gc; /* gc for resize/move frame (root) */
202 GC line_gc; /* gc for drawing XORed lines (root) */
203 GC copy_gc; /* gc for XCopyArea() */
204 GC stipple_gc; /* gc for stippled filling */
205 GC draw_gc; /* gc for drawing misc things */
206 GC mono_gc; /* gc for 1 bit drawables */
208 struct WPixmap *b_pixmaps[PRED_BPIXMAPS]; /* internal pixmaps for buttons*/
209 struct WPixmap *menu_radio_indicator;/* left menu indicator */
210 struct WPixmap *menu_check_indicator;/* left menu indicator for checkmark */
211 struct WPixmap *menu_mini_indicator; /* for miniwindow */
212 struct WPixmap *menu_hide_indicator; /* for hidden window */
213 struct WPixmap *menu_shade_indicator; /* for shaded window */
214 int app_menu_x, app_menu_y; /* position for application menus */
216 struct WMenu *root_menu; /* root window menu */
217 struct WMenu *switch_menu; /* window list menu */
218 struct WMenu *workspace_menu; /* workspace operation */
219 struct WMenu *window_menu; /* window command menu */
220 struct WMenu *icon_menu; /* icon/appicon menu */
221 struct WMenu *workspace_submenu; /* workspace list for window_menu */
223 struct WDock *dock; /* the application dock */
224 struct WMenu *dock_pos_menu; /* Dock position menu */
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, or the dock's, if they are merged */
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 WMenu *drawer_menu; /* Menu for drawers */
233 struct WDock *last_dock;
234 WAppIconChain *global_icons; /* for omnipresent icons chain in clip */
235 int global_icon_count; /* How many global icons do we have */
236 WDrawerChain *drawers; /* Chain of drawers */
237 /* Cache the following two informations, as they are used quite a lot */
238 int drawer_count; /* Nb of drawers that */
239 struct WDock *attracting_drawer; /* The drawer that auto-attracts icons, or NULL */
241 struct RContext *rcontext; /* wrlib context */
243 WMScreen *wmscreen; /* for widget library */
245 struct RImage *icon_tile;
246 struct RImage *clip_tile; /* tile with arrows to change workspace */
247 struct RImage *drawer_tile; /* tile for a drawer (tile + arrow) */
248 Pixmap icon_tile_pixmap; /* For app supplied icons */
250 struct RImage *def_icon_rimage; /* Default RImage icon */
252 struct WDialogData *dialog_data;
254 struct W_GeometryView *gview; /* size/position view */
256 /* state and other informations */
257 short cascade_index; /* for cascade window placement */
259 WMPropList *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 */
279 /* for window shortcuts */
280 WMArray *shortcutWindows[MAX_WINDOW_SHORTCUTS];
282 #ifdef USE_DOCK_XDND
283 char *xdestring;
284 #endif
286 struct NetData *netdata;
288 int helper_fd;
289 pid_t helper_pid;
291 struct {
292 unsigned int startup:1; /* during window manager startup */
293 unsigned int regenerate_icon_textures:1;
294 unsigned int dnd_data_convertion_status:1;
295 unsigned int root_menu_changed_shortcuts:1;
296 unsigned int added_workspace_menu:1;
297 unsigned int added_windows_menu:1;
298 unsigned int startup2:1; /* startup phase 2 */
299 unsigned int next_click_is_not_double:1;
300 unsigned int backimage_helper_launched:1;
301 /* some client has issued a WM_COLORMAP_NOTIFY */
302 unsigned int colormap_stuff_blocked:1;
303 unsigned int doing_alt_tab:1;
304 unsigned int jump_back_pending:1;
305 unsigned int ignore_focus_events:1;
306 } flags;
307 } WScreen;
311 WScreen *wScreenInit(int screen_number);
312 void wScreenSaveState(WScreen *scr);
313 void wScreenRestoreState(WScreen *scr);
315 int wScreenBringInside(WScreen *scr, int *x, int *y, int width, int height);
316 int wScreenKeepInside(WScreen *scr, int *x, int *y, int width, int height);
319 /* in startup.c */
320 WScreen *wScreenWithNumber(int i);
321 WScreen *wScreenForRootWindow(Window window); /* window must be valid */
322 WScreen *wScreenForWindow(Window window); /* slower than above functions */
324 void wScreenFinish(WScreen *scr);
325 void wScreenUpdateUsableArea(WScreen *scr);
327 void create_logo_image(WScreen *scr);
328 #endif