Initial revision
[wmaker-crm.git] / src / screen.h
blob0f18df46a60485d9ebe2a8cae8a077927803974a
1 /*
2 * WindowMaker 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 #include <proplist.h>
31 typedef struct WFont {
32 #ifndef I18N_MB
33 XFontStruct *font;
34 #else
35 XFontSet font;
36 #endif
37 short height;
38 short y;
39 } WFont;
41 #ifdef EXPERIMENTAL
42 typedef struct {
43 Pixmap pixmap; /* None means use pixel */
44 WMPixel pixel;
45 proplist_t spec; /* retained */
46 pid_t pid; /* If !=0, process ID of wmsetbg that
47 * is rendering the pixmap for this
48 * texture. Set to 0 when finishes */
49 } WWorkspaceTexture;
50 #endif /* EXPERIMENTAL */
53 #define WTB_LEFT 0
54 #define WTB_RIGHT 1
56 #define WTB_FOCUSED 0
57 #define WTB_UNFOCUSED 2
58 #define WTB_PFOCUSED 4
59 #define WTB_MENU 6
63 * each WScreen is saved into a context associated with it's root window
65 typedef struct _WScreen {
66 int screen; /* screen number */
68 int scr_width; /* size of the screen */
69 int scr_height;
71 Window root_win; /* root window of screen */
72 int depth; /* depth of the default visual */
73 Colormap colormap; /* root colormap */
74 int root_colormap_install_count;
75 struct WWindow *original_cmap_window; /* colormap before installing
76 * root colormap temporarily */
77 struct WWindow *cmap_window;
78 Colormap current_colormap;
80 Window w_win; /* window to use as drawable
81 * for new GCs, pixmaps etc. */
82 Visual *w_visual;
83 int w_depth;
84 Colormap w_colormap; /* our colormap */
86 Window no_focus_win; /* window to get focus when nobody
87 * else can do it */
89 struct WWindow *focused_window; /* window that has the focus
90 * Use this list if you want to
91 * traverse the entire window list
94 struct WAppIcon *app_icon_list; /* list of all app-icons on screen */
96 struct WApplication *wapp_list; /* list of all aplications */
98 struct _WCoreWindow *stacking_list[MAX_WINDOW_LEVELS];
99 /* array of lists of windows
100 * in stacking order.
101 * The array order is in window level
102 * order and each list on the array
103 * is ordered from the topmost to
104 * the lowest window
106 int window_level_count[MAX_WINDOW_LEVELS];
107 int window_count; /* number of windows in window_list */
109 #ifdef EXPERIMENTAL
110 WWorkspaceTexture *defaultTexture;
111 WWorkspaceTexture **wspaceTextures;
112 int wspaceTextureCount;
113 #endif /* EXPERIMENTAL */
115 int workspace_count; /* number of workspaces */
116 struct WWorkspace **workspaces; /* workspace array */
117 int current_workspace; /* current workspace number */
119 WMPixel black_pixel;
120 WMPixel white_pixel;
122 WMPixel light_pixel;
123 WMPixel dark_pixel;
125 Pixmap stipple_bitmap;
126 Pixmap transp_stipple; /* for making holes in icon masks for
127 * transparent icon simulation */
128 WFont *title_font; /* default font for the titlebars */
129 WFont *menu_title_font; /* font for menu titlebars */
130 WFont *menu_entry_font; /* font for menu items */
131 WFont *icon_title_font; /* for icon titles */
132 WFont *clip_title_font; /* for clip titles */
133 WFont *info_text_font; /* text on things like geometry
134 * hint boxes */
136 WMPixel select_pixel;
137 WMPixel select_text_pixel;
138 /* foreground colors */
139 WMPixel window_title_pixel[3]; /* window titlebar text (foc, unfoc, pfoc)*/
140 WMPixel menu_title_pixel[3]; /* menu titlebar text */
141 WMPixel clip_title_pixel[2]; /* clip title text */
142 WMPixel mtext_pixel; /* menu item text */
143 WMPixel dtext_pixel; /* disabled menu item text */
144 WMPixel line_pixel;
145 WMPixel frame_border_pixel; /* frame border */
147 union WTexture *menu_title_texture[3];/* menu titlebar texture (tex, -, -) */
148 union WTexture *window_title_texture[3]; /* win textures (foc, unfoc, pfoc) */
149 struct WTexSolid *resizebar_texture[3];/* window resizebar texture (tex, -, -) */
151 union WTexture *menu_item_texture; /* menu item texture */
153 struct WTexSolid *menu_item_auxtexture; /* additional texture to draw menu
154 * cascade arrows */
155 struct WTexSolid *icon_title_texture;/* icon titles */
157 struct WTexSolid *widget_texture;
159 struct WTexSolid *icon_back_texture; /* icon back color for shadowing */
161 GC window_title_gc; /* window title text GC */
162 GC menu_title_gc; /* menu titles */
164 GC icon_title_gc; /* icon title background */
165 GC clip_title_gc; /* clip title */
166 GC menu_entry_gc; /* menu entries */
167 GC select_menu_gc; /* selected menu entries */
168 GC disabled_menu_entry_gc; /* disabled menu entries */
169 GC info_text_gc; /* for size/position display */
171 GC frame_gc; /* gc for resize/move frame (root) */
172 GC line_gc; /* gc for drawing XORed lines (root) */
173 GC copy_gc; /* gc for XCopyArea() */
174 GC stipple_gc; /* gc for stippled filling */
175 GC icon_select_gc;
176 GC draw_gc; /* gc for drawing misc things */
178 struct WPixmap *b_pixmaps[PRED_BPIXMAPS]; /* internal pixmaps for buttons*/
179 struct WPixmap *menu_radio_indicator;/* left menu indicator */
180 struct WPixmap *menu_check_indicator;/* left menu indicator for checkmark */
181 struct WPixmap *menu_mini_indicator; /* for miniwindow */
182 struct WPixmap *menu_hide_indicator; /* for hidden window */
183 struct WPixmap *menu_shade_indicator; /* for shaded window */
184 int app_menu_x, app_menu_y; /* position for application menus */
186 struct WMenu *root_menu; /* root window menu */
187 struct WMenu *workspace_menu; /* workspace operation */
188 struct WMenu *switch_menu; /* window list menu */
189 struct WMenu *window_menu; /* window command menu */
190 struct WMenu *icon_menu; /* icon/appicon menu */
191 struct WMenu *workspace_submenu; /* workspace list for window_menu */
193 struct WDock *dock; /* the application dock */
194 struct WPixmap *dock_dots; /* 3 dots for the Dock */
195 Window dock_shadow; /* shadow for dock buttons */
196 struct WAppIcon *clip_icon; /* The clip main icon */
197 struct WMenu *clip_menu; /* Menu for clips */
198 struct WMenu *clip_submenu; /* Workspace list for clips */
199 struct WMenu *clip_options; /* Options for Clip */
200 struct WMenu *clip_ws_menu; /* workspace menu for clip */
201 struct WDock *last_dock;
203 Window clip_balloon; /* window for workspace name */
205 Window geometry_display; /* displays the geometry during
206 * window resize, move etc. */
207 unsigned int geometry_display_width;
208 unsigned int geometry_display_height;
210 struct RContext *rcontext;
212 WMScreen *wmscreen; /* for widget library */
214 struct RImage *icon_tile;
215 struct RImage *clip_tile;
216 Pixmap icon_tile_pixmap; /* for app supplied icons */
218 Pixmap def_icon_pixmap; /* default icons */
219 Pixmap def_ticon_pixmap;
221 struct WDialogData *dialog_data;
223 /* state and other informations */
224 short cascade_index; /* for cascade window placement */
226 proplist_t session_state;
228 /* for double-click detection */
229 Time last_click_time;
230 Window last_click_window;
231 int last_click_button;
233 /* balloon help data */
234 struct _WBalloon *balloon;
236 /* for raise-delay */
237 WMHandlerID *autoRaiseTimer;
238 Window autoRaiseWindow; /* window that is scheduled to be
239 * raised */
241 struct {
242 unsigned int startup:1; /* during window manager startup */
243 unsigned int regenerate_icon_textures:1;
244 unsigned int dnd_data_convertion_status:1;
245 unsigned int root_menu_changed_shortcuts:1;
246 unsigned int added_workspace_menu:1;
247 unsigned int startup2:1; /* startup phase 2 */
248 unsigned int supports_tiff:1;
249 unsigned int clip_balloon_mapped:1;
250 unsigned int next_click_is_not_double:1;
251 } flags;
252 } WScreen;
255 #define WSS_ROOTMENU (1<<0)
256 #define WSS_SWITCHMENU (1<<1)
257 #define WSS_WSMENU (1<<2)
259 typedef struct WWorkspaceState {
260 int flags;
261 int workspace;
262 #if 0 /* obsoleted by saving menus position in WMState */
263 int menu_x, menu_y;
264 int smenu_x, smenu_y;
265 int wmenu_x, wmenu_y;
266 #endif
267 } WWorkspaceState;
270 WScreen *wScreenInit(int screen_number);
271 void wScreenSaveState(WScreen *scr);
272 void wScreenRestoreState(WScreen *scr);
274 int wScreenBringInside(WScreen *scr, int *x, int *y, int width, int height);
276 /* in startup.c */
277 WScreen *wScreenWithNumber(int i);
278 WScreen *wScreenForRootWindow(Window window); /* window must be valid */
279 WScreen *wScreenForWindow(Window window); /* slower than above functions */
281 #endif