cvsimport
[fvwm.git] / fvwm / screen.h
blob40aaf2cf6b0db4a39e24666aa5f678518585c307
1 /* -*-c-*- */
2 /* This module is based on Twm, but has been siginificantly modified
3 * by Rob Nation
4 */
5 /* Copyright 1989 Massachusetts Institute of Technology
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation for any purpose and without fee is hereby granted, provided
9 * that the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
11 * documentation, and that the name of M.I.T. not be used in advertising
12 * or publicity pertaining to distribution of the software without specific,
13 * written prior permission. M.I.T. makes no representations about the
14 * suitability of this software for any purpose. It is provided "as is"
15 * without express or implied warranty.
17 * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
19 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
21 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
22 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
27 * fvwm per-screen data include file
31 #ifndef _SCREEN_
32 #define _SCREEN_
34 #include "libs/flist.h"
35 #include "libs/Bindings.h"
37 #define SIZE_HINDENT 5
38 #define SIZE_VINDENT 3
40 /* colormap focus styes */
41 #define COLORMAP_FOLLOWS_MOUSE 1 /* default */
42 #define COLORMAP_FOLLOWS_FOCUS 2
44 /* title bar multi pixmap parts */
45 /* those which can be used as UseTitleStyle should be enum first */
46 typedef enum {
47 TBMP_NONE = -1,
48 TBMP_MAIN,
49 TBMP_LEFT_MAIN,
50 TBMP_RIGHT_MAIN,
51 TBMP_LEFT_BUTTONS,
52 TBMP_RIGHT_BUTTONS,
53 TBMP_UNDER_TEXT,
54 TBMP_LEFT_OF_TEXT,
55 TBMP_RIGHT_OF_TEXT,
56 TBMP_LEFT_END,
57 TBMP_RIGHT_END,
58 TBMP_BUTTONS,
59 TBMP_NUM_PIXMAPS
60 } TbmpParts;
62 /* title bar multi pixmap parts which can be use for UseTitleStyle */
63 typedef enum {
64 UTS_TBMP_NONE = -1,
65 UTS_TBMP_MAIN,
66 UTS_TBMP_LEFT_MAIN,
67 UTS_TBMP_RIGHT_MAIN,
68 UTS_TBMP_LEFT_BUTTONS,
69 UTS_TBMP_RIGHT_BUTTONS,
70 UTS_TBMP_NUM_PIXMAPS
71 } UtsTbmpParts;
73 typedef struct
75 int cs;
76 int alpha_percent;
77 } FvwmAcs;
79 typedef struct
81 Window win;
82 int isMapped;
83 /* command which is executed when the pan frame is entered */
84 char *command;
85 /* command which is executed when the pan frame is left*/
86 char *command_leave;
87 } PanFrame;
89 typedef enum
91 /* button types */
92 DefaultVectorButton,
93 VectorButton,
94 SimpleButton,
95 GradientButton,
96 PixmapButton,
97 TiledPixmapButton,
98 StretchedPixmapButton,
99 AdjustedPixmapButton,
100 ShrunkPixmapButton,
101 MultiPixmap,
102 MiniIconButton,
103 SolidButton,
104 ColorsetButton
105 } DecorFaceType;
107 typedef enum
109 JUST_CENTER = 0,
110 JUST_LEFT = 1,
111 JUST_TOP = 1,
112 JUST_RIGHT = 2,
113 JUST_BOTTOM = 2,
114 JUST_MASK = 3
115 } JustificationType;
117 typedef struct
119 unsigned face_type : 4;
120 struct
122 unsigned h_justification : 2;
123 unsigned v_justification : 2;
124 #define DFS_BUTTON_IS_UP 0
125 #define DFS_BUTTON_IS_FLAT 1
126 #define DFS_BUTTON_IS_SUNK 2
127 #define DFS_BUTTON_MASK 3
128 unsigned int button_relief : 2;
129 /* not used in border styles */
130 unsigned int use_title_style : 1;
131 unsigned int use_border_style : 1;
132 /* only used in border styles */
133 unsigned int has_hidden_handles : 1;
134 unsigned int has_no_inset : 1;
135 } flags;
136 } DecorFaceStyle;
138 #define DFS_FACE_TYPE(dfs) ((dfs).face_type)
139 #define DFS_FLAGS(dfs) ((dfs).flags)
140 #define DFS_H_JUSTIFICATION(dfs) ((dfs).flags.h_justification)
141 #define DFS_V_JUSTIFICATION(dfs) ((dfs).flags.v_justification)
142 #define DFS_BUTTON_RELIEF(dfs) ((dfs).flags.button_relief)
143 #define DFS_USE_TITLE_STYLE(dfs) ((dfs).flags.use_title_style)
144 #define DFS_USE_BORDER_STYLE(dfs) ((dfs).flags.use_border_style)
145 #define DFS_HAS_HIDDEN_HANDLES(dfs) ((dfs).flags.has_hidden_handles)
146 #define DFS_HAS_NO_INSET(dfs) ((dfs).flags.has_no_inset)
148 typedef struct DecorFace
150 DecorFaceStyle style;
151 struct
153 FvwmPicture *p;
154 struct {
155 FvwmPicture **pixmaps;
156 unsigned short stretch_flags;
157 FvwmAcs *acs;
158 Pixel *pixels;
159 unsigned short solid_flags;
160 } mp;
161 struct
163 int cs;
164 int alpha_percent;
165 } acs;
166 Pixel back;
167 struct
169 int npixels;
170 XColor *xcs;
171 int do_dither;
172 Pixel *d_pixels;
173 int d_npixels;
174 char gradient_type;
175 } grad;
176 struct vector_coords
178 int num;
179 signed char *x;
180 signed char *y;
181 signed char *xoff;
182 signed char *yoff;
183 signed char *c;
184 unsigned use_fgbg : 1;
185 } vector;
186 } u;
188 struct DecorFace *next;
190 struct
192 unsigned has_changed : 1;
193 } flags;
194 } DecorFace;
196 typedef enum
198 BS_All = -1,
199 BS_ActiveUp,
200 BS_ActiveDown,
201 BS_InactiveUp,
202 BS_InactiveDown,
203 BS_ToggledActiveUp,
204 BS_ToggledActiveDown,
205 BS_ToggledInactiveUp,
206 BS_ToggledInactiveDown,
207 BS_MaxButtonState,
208 BS_MaxButtonStateMask = BS_MaxButtonState - 1,
209 BS_Active,
210 BS_Inactive,
211 BS_ToggledActive,
212 BS_ToggledInactive,
213 BS_AllNormal,
214 BS_AllToggled,
215 BS_AllActive,
216 BS_AllInactive,
217 BS_AllUp,
218 BS_AllDown,
219 BS_AllActiveUp,
220 BS_AllActiveDown,
221 BS_AllInactiveUp,
222 BS_AllInactiveDown,
223 BS_MaxButtonStateName
224 } ButtonState;
226 #define BS_MASK_DOWN (1 << 0)
227 #define BS_MASK_INACTIVE (1 << 1)
228 #define BS_MASK_TOGGLED (1 << 2)
230 typedef enum
232 /* The first five are used in title buttons. These can't be
233 * renumbered without extending the mwm_decor_flags member below and
234 * adapting the style structure. */
235 MWM_DECOR_MENU = 0x1,
236 MWM_DECOR_MINIMIZE = 0x2,
237 MWM_DECOR_MAXIMIZE = 0x4,
238 MWM_DECOR_SHADE = 0x8,
239 MWM_DECOR_STICK = 0x10,
240 /* --- */
241 MWM_DECOR_BORDER = 0x20,
242 MWM_DECOR_RESIZEH = 0x40,
243 MWM_DECOR_TITLE = 0x80,
244 MWM_DECOR_ALL = 0x100,
245 MWM_DECOR_EVERYTHING = 0xff
246 } mwm_flags;
248 typedef struct
250 unsigned just : 2; /* was JustificationType : 2 */
251 int layer;
252 struct
254 unsigned has_changed : 1;
255 mwm_flags mwm_decor_flags : 9;
256 /* Support {ButtonStyle <number> - Layer 4} construction, so
257 * button can be rendered 'pressed in' when the window is
258 * assigned to a particular layer. */
259 unsigned has_layer : 1;
260 } flags;
261 DecorFace state[BS_MaxButtonState];
262 } TitleButton;
264 #define TB_FLAGS(tb) ((tb).flags)
265 #define TB_STATE(tb) ((tb).state)
266 #define TB_JUSTIFICATION(tb) ((tb).just)
267 #define TB_LAYER(tb) ((tb).layer)
268 #define TB_MWM_DECOR_FLAGS(tb) ((tb).flags.mwm_decor_flags)
269 #define TB_HAS_CHANGED(tb) \
270 (!!((tb).flags.has_changed))
271 #define TB_HAS_MWM_DECOR_MENU(tb) \
272 (!!((tb).flags.mwm_decor_flags & MWM_DECOR_MENU))
273 #define TB_HAS_MWM_DECOR_MINIMIZE(tb) \
274 (!!((tb).flags.mwm_decor_flags & MWM_DECOR_MINIMIZE))
275 #define TB_HAS_MWM_DECOR_MAXIMIZE(tb) \
276 (!!((tb).flags.mwm_decor_flags & MWM_DECOR_MAXIMIZE))
277 #define TB_HAS_MWM_DECOR_SHADE(tb) \
278 (!!((tb).flags.mwm_decor_flags & MWM_DECOR_SHADE))
279 #define TB_HAS_MWM_DECOR_STICK(tb) \
280 (!!((tb).flags.mwm_decor_flags & MWM_DECOR_STICK))
282 typedef struct FvwmDecor
284 #ifdef USEDECOR
285 char *tag; /* general style tag */
286 #endif
287 int title_height; /* explicitly specified title bar height */
288 int min_title_height;
289 /* titlebar buttons */
290 TitleButton buttons[NUMBER_OF_TITLE_BUTTONS];
291 TitleButton titlebar;
292 struct BorderStyle
294 DecorFace active, inactive;
295 } BorderStyle;
296 #ifdef USEDECOR
297 struct FvwmDecor *next; /* additional user-defined styles */
298 #endif
299 struct
301 unsigned has_changed : 1;
302 unsigned has_title_height_changed : 1;
303 } flags;
304 } FvwmDecor;
306 typedef struct DesktopsInfo
308 int desk;
309 char *name;
311 struct
313 int x;
314 int y;
315 int width;
316 int height;
317 } ewmh_working_area;
318 struct
320 int x;
321 int y;
322 int width;
323 int height;
324 } ewmh_dyn_working_area;
326 struct DesktopsInfo *next;
327 } DesktopsInfo;
329 typedef struct ScreenInfo
331 unsigned long screen;
332 Screen *pscreen;
333 /* number of screens on display */
334 int NumberOfScreens;
335 /* my copy of DisplayWidth(dpy, screen) */
336 int MyDisplayWidth;
337 /* my copy of DisplayHeight(dpy, screen) */
338 int MyDisplayHeight;
340 /* the head of the fvwm window list */
341 FvwmWindow FvwmRoot;
342 /* the root window */
343 Window Root;
344 /* the resize dimensions window */
345 Window SizeWindow;
346 /* Window which will own focus when no other windows have it */
347 Window NoFocusWin;
349 flist *FWScheduledForDestroy;
351 PanFrame PanFrameTop;
352 PanFrame PanFrameLeft;
353 PanFrame PanFrameRight;
354 PanFrame PanFrameBottom;
356 /*dark gray pattern for shaded out menu items*/
357 Pixmap gray_bitmap;
358 /* dark gray pattern for inactive borders */
359 Pixmap gray_pixmap;
360 /* light gray pattern for inactive borders */
361 Pixmap light_gray_pixmap;
362 /* light gray pattern for sticky borders */
363 Pixmap sticky_gray_pixmap;
365 Binding *AllBindings;
367 /* current push level to install root colormap windows */
368 int root_pushes;
369 /* current push level to install fvwm colormap windows */
370 int fvwm_pushes;
371 /* saved window to install when pushes drops to zero */
372 const FvwmWindow *pushed_window;
373 Cursor *FvwmCursors;
374 /* context where we display the busy cursor */
375 int BusyCursor;
376 /* Icon to use when no other icons are found */
377 char *DefaultIcon;
379 int TopLayer;
380 int DefaultLayer;
381 int BottomLayer;
383 struct FvwmFunction *functions;
385 /* font structure */
386 FlocaleFont *DefaultFont;
388 /* GC for transparency masks */
389 GC TransMaskGC;
390 /* don't change the order */
391 Pixel StdFore, StdBack, StdHilite, StdShadow;
392 GC StdGC;
393 GC StdReliefGC;
394 GC StdShadowGC;
396 /* A scratch 1x1x1 pixmap */
397 Pixmap ScratchMonoPixmap;
398 /* GC for drawing into depth 1 drawables */
399 GC MonoGC;
400 /* A scratch 1x1xalpha_depth pixmap */
401 Pixmap ScratchAlphaPixmap;
402 /* GC for drawing into depth alpha_depth drawables */
403 GC AlphaGC;
406 /* GC to draw lines for move and resize */
407 GC XorGC;
408 GC ScratchGC1;
409 GC ScratchGC2;
410 GC ScratchGC3;
411 GC ScratchGC4;
412 GC TitleGC;
413 GC BordersGC;
414 /* minimum width of size window */
415 int SizeStringWidth;
417 /* decoration style(s) */
418 FvwmDecor DefaultDecor;
419 FvwmDecor *cur_decor;
421 /* number of left-side title-bar buttons */
422 int nr_left_buttons;
423 /* number of right-side title-bar buttons */
424 int nr_right_buttons;
426 /* the fvwm window that is highlighted except for networking delays,
427 * this is the window which REALLY has the focus */
428 FvwmWindow *Hilite;
429 /* None, if the focus is nowhere or on an fvwm managed window. Set to
430 * id of otherwindow with focus otherwise */
431 Window UnknownWinFocused;
432 /* The window that the UnknownWinFocused window stole the focus from.
434 Window StolenFocusWin;
435 FvwmWindow *focus_in_pending_window;
436 /* #pixels to scroll on screen edge */
437 int EdgeScrollX;
438 /* #pixels to scroll on screen edge */
439 int EdgeScrollY;
440 /* buttons to grab in click to focus mode */
441 unsigned short buttons2grab;
442 int NumBoxes;
443 /* values used for CascadePlacement */
444 int cascade_x;
445 int cascade_y;
446 FvwmWindow *cascade_window;
447 /* Max location for top left of virt desk*/
448 int VxMax;
449 int VyMax;
450 /* Current loc for top left of virt desk */
451 int Vx;
452 int Vy;
454 /*Max button-click delay for Function built-in*/
455 int ClickTime;
456 /* resistance to scrolling in desktop */
457 int ScrollDelay;
458 int MoveThreshold;
459 int OpaqueSize;
460 /* The current desktop number */
461 int CurrentDesk;
462 /* colormap focus style */
463 int ColormapFocus;
464 /* Limit on colors used in pixmaps */
465 int ColorLimit;
466 /* Default Colorset used by feedback window */
467 int DefaultColorset;
469 int use_backing_store;
471 /* some additional global options which will probably become window
472 * specific options later on: */
473 struct
475 unsigned do_debug_cr_motion_method : 1;
476 unsigned do_disable_configure_notify : 1;
477 unsigned do_display_new_window_names : 1;
478 unsigned do_enable_ewmh_iconic_state_workaround : 1;
479 unsigned do_enable_flickering_qt_dialogs_workaround : 1;
480 unsigned do_enable_qt_drag_n_drop_workaround : 1;
481 unsigned do_explain_window_placement : 1;
482 unsigned do_install_root_cmap : 1;
483 unsigned do_raise_over_unmanaged : 1;
484 unsigned is_modality_evil : 1;
485 unsigned is_raise_hack_needed : 1;
486 } bo; /* bug workaround control options */
487 struct
489 unsigned do_emulate_mwm : 1;
490 unsigned do_emulate_win : 1;
491 unsigned do_hide_position_window : 1;
492 unsigned do_hide_resize_window : 1;
493 unsigned use_active_down_buttons : 1;
494 unsigned use_inactive_buttons : 1;
495 unsigned use_inactive_down_buttons : 1;
496 } gs; /* global style structure */
497 struct
499 unsigned are_functions_silent : 1;
500 unsigned are_windows_captured : 1;
501 unsigned do_edge_wrap_x : 1;
502 unsigned do_edge_wrap_y : 1;
503 unsigned do_need_style_list_update : 1;
504 unsigned do_need_window_update : 1;
505 unsigned do_save_under : 1;
506 unsigned has_default_color_changed : 1;
507 unsigned has_default_font_changed : 1;
508 unsigned has_mouse_binding_changed : 1;
509 unsigned has_nr_buttons_changed : 1;
510 unsigned has_xinerama_state_changed : 1;
511 unsigned is_executing_complex_function : 1;
512 unsigned is_executing_menu_function : 1;
513 unsigned is_map_desk_in_progress : 1;
514 unsigned is_pointer_on_this_screen : 1;
515 unsigned is_single_screen : 1;
516 unsigned is_window_scheduled_for_destroy : 1;
517 unsigned is_wire_frame_displayed : 1;
518 } flags;
520 /* info for some desktops; the first entries should be generic info
521 * correct for any desktop not in the list */
522 DesktopsInfo *Desktops;
523 /* the window of desktop type if any */
524 FvwmWindow *EwmhDesktop;
525 struct
527 last_added_item_t type;
528 void *item;
529 } last_added_item;
530 } ScreenInfo;
532 /* A macro to to simplify he "ewmh desktop code" */
533 #define IS_EWMH_DESKTOP(win) \
534 (Scr.EwmhDesktop && win == Scr.EwmhDesktop->wins.client)
535 #define IS_EWMH_DESKTOP_FW(fwin) \
536 (fwin && Scr.EwmhDesktop && Scr.EwmhDesktop == fwin)
537 /* Macro which gets specific decor or default decor.
538 * This saves an indirection in case you don't want
539 * the UseDecor mechanism. */
540 #ifdef USEDECOR
541 #define GetDecor(window,part) ((window)->decor->part)
542 #else
543 #define GetDecor(window,part) (Scr.DefaultDecor.part)
544 #endif
546 /* some protos for the decoration structures */
547 void LoadDefaultButton(DecorFace *bf, int i);
548 void ResetAllButtons(FvwmDecor *decor);
549 void DestroyAllButtons(FvwmDecor *decor);
551 void simplify_style_list(void);
554 * Diverts a style definition to an FvwmDecor structure (veliaa@rpi.edu)
556 void AddToDecor(F_CMD_ARGS, FvwmDecor *decor);
558 extern ScreenInfo Scr;
560 #endif /* _SCREEN_ */