2 /* This module is based on Twm, but has been siginificantly modified
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
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 */
62 /* title bar multi pixmap parts which can be use for UseTitleStyle */
68 UTS_TBMP_LEFT_BUTTONS
,
69 UTS_TBMP_RIGHT_BUTTONS
,
83 /* command which is executed when the pan frame is entered */
85 /* command which is executed when the pan frame is left*/
98 StretchedPixmapButton
,
119 unsigned face_type
: 4;
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;
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
;
155 FvwmPicture
**pixmaps
;
156 unsigned short stretch_flags
;
159 unsigned short solid_flags
;
184 unsigned use_fgbg
: 1;
188 struct DecorFace
*next
;
192 unsigned has_changed
: 1;
204 BS_ToggledActiveDown
,
205 BS_ToggledInactiveUp
,
206 BS_ToggledInactiveDown
,
208 BS_MaxButtonStateMask
= BS_MaxButtonState
- 1,
223 BS_MaxButtonStateName
226 #define BS_MASK_DOWN (1 << 0)
227 #define BS_MASK_INACTIVE (1 << 1)
228 #define BS_MASK_TOGGLED (1 << 2)
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,
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
250 unsigned just
: 2; /* was JustificationType : 2 */
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;
261 DecorFace state
[BS_MaxButtonState
];
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
285 char *tag
; /* general style tag */
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
;
294 DecorFace active
, inactive
;
297 struct FvwmDecor
*next
; /* additional user-defined styles */
301 unsigned has_changed
: 1;
302 unsigned has_title_height_changed
: 1;
306 typedef struct DesktopsInfo
324 } ewmh_dyn_working_area
;
326 struct DesktopsInfo
*next
;
329 typedef struct ScreenInfo
331 unsigned long screen
;
333 /* number of screens on display */
335 /* my copy of DisplayWidth(dpy, screen) */
337 /* my copy of DisplayHeight(dpy, screen) */
340 /* the head of the fvwm window list */
342 /* the root window */
344 /* the resize dimensions window */
346 /* Window which will own focus when no other windows have it */
349 flist
*FWScheduledForDestroy
;
351 PanFrame PanFrameTop
;
352 PanFrame PanFrameLeft
;
353 PanFrame PanFrameRight
;
354 PanFrame PanFrameBottom
;
356 /*dark gray pattern for shaded out menu items*/
358 /* dark gray pattern for inactive borders */
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 */
369 /* current push level to install fvwm colormap windows */
371 /* saved window to install when pushes drops to zero */
372 const FvwmWindow
*pushed_window
;
374 /* context where we display the busy cursor */
376 /* Icon to use when no other icons are found */
383 struct FvwmFunction
*functions
;
386 FlocaleFont
*DefaultFont
;
388 /* GC for transparency masks */
390 /* don't change the order */
391 Pixel StdFore
, StdBack
, StdHilite
, StdShadow
;
396 /* A scratch 1x1x1 pixmap */
397 Pixmap ScratchMonoPixmap
;
398 /* GC for drawing into depth 1 drawables */
400 /* A scratch 1x1xalpha_depth pixmap */
401 Pixmap ScratchAlphaPixmap
;
402 /* GC for drawing into depth alpha_depth drawables */
406 /* GC to draw lines for move and resize */
414 /* minimum width of size window */
417 /* decoration style(s) */
418 FvwmDecor DefaultDecor
;
419 FvwmDecor
*cur_decor
;
421 /* number of left-side title-bar 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 */
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 */
438 /* #pixels to scroll on screen edge */
440 /* buttons to grab in click to focus mode */
441 unsigned short buttons2grab
;
443 /* values used for CascadePlacement */
446 FvwmWindow
*cascade_window
;
447 /* Max location for top left of virt desk*/
450 /* Current loc for top left of virt desk */
454 /*Max button-click delay for Function built-in*/
456 /* resistance to scrolling in desktop */
460 /* The current desktop number */
462 /* colormap focus style */
464 /* Limit on colors used in pixmaps */
466 /* Default Colorset used by feedback window */
469 int use_backing_store
;
471 /* some additional global options which will probably become window
472 * specific options later on: */
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 */
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 */
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;
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
;
527 last_added_item_t type
;
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. */
541 #define GetDecor(window,part) ((window)->decor->part)
543 #define GetDecor(window,part) (Scr.DefaultDecor.part)
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_ */