2 /* This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * This module was all original code
20 * Copyright 1993, Robert Nation
21 * You may use this code for any purpose, as long as the original
22 * copyright remains in the source code and all documentation
25 /* code for parsing the fvwm style command */
27 /* ---------------------------- included header files ---------------------- */
32 #include "libs/fvwmlib.h"
33 #include "libs/FScreen.h"
34 #include "libs/charmap.h"
35 #include "libs/modifiers.h"
36 #include "libs/ColorUtils.h"
37 #include "libs/Parse.h"
38 #include "libs/wild.h"
40 #include "execcontext.h"
48 #include "placement.h"
50 /* ---------------------------- local definitions -------------------------- */
52 #define SAFEFREE( p ) {if (p) {free(p);(p)=NULL;}}
54 /* ---------------------------- local macros ------------------------------- */
56 /* ---------------------------- imports ------------------------------------ */
58 /* ---------------------------- included code files ------------------------ */
60 /* ---------------------------- local types -------------------------------- */
62 /* ---------------------------- forward declarations ----------------------- */
64 /* ---------------------------- local variables ---------------------------- */
66 /* list of window names with attributes */
67 static window_style
*all_styles
= NULL
;
68 static window_style
*last_style_in_list
= NULL
;
70 /* ---------------------------- exported variables (globals) --------------- */
72 /* ---------------------------- local functions ---------------------------- */
74 static int blockor(char *dest
, char *blk1
, char *blk2
, int length
)
79 for (i
= 0; i
< length
; i
++)
81 dest
[i
] = (blk1
[i
] | blk2
[i
]);
85 return (result
) ? 1 : 0;
88 static int blockand(char *dest
, char *blk1
, char *blk2
, int length
)
93 for (i
= 0; i
< length
; i
++)
95 dest
[i
] = (blk1
[i
] & blk2
[i
]);
99 return (result
) ? 1 : 0;
102 static int blockunmask(char *dest
, char *blk1
, char *blk2
, int length
)
105 char result
= (char)0xff;
107 for (i
= 0; i
< length
; i
++)
109 dest
[i
] = (blk1
[i
] & ~blk2
[i
]);
113 return (result
) ? 1 : 0;
116 static int blockissubset(char *sub
, char *super
, int length
)
120 for (i
= 0; i
< length
; i
++)
122 if ((sub
[i
] & super
[i
]) != sub
[i
])
131 static int blocksintersect(char *blk1
, char *blk2
, int length
)
135 for (i
= 0; i
< length
; i
++)
137 if (blk1
[i
] & blk2
[i
])
146 static int style_ids_are_equal(style_id_t
*a
, style_id_t
*b
)
149 SID_GET_HAS_NAME(*a
) && SID_GET_HAS_NAME(*b
) &&
150 !strcmp(SID_GET_NAME(*a
), SID_GET_NAME(*b
)))
155 SID_GET_HAS_WINDOW_ID(*a
) && SID_GET_HAS_WINDOW_ID(*b
) &&
156 SID_GET_WINDOW_ID(*a
) == SID_GET_WINDOW_ID(*b
))
164 static int style_id_equals_id(window_style
*s
, style_id_t
* id
)
166 return style_ids_are_equal(&SGET_ID(*s
), id
);
169 static int styles_have_same_id(window_style
* s
, window_style
* t
)
171 return style_ids_are_equal(&SGET_ID(*s
), &SGET_ID(*t
));
174 static int fw_match_style_id(FvwmWindow
*fw
, style_id_t s_id
)
176 if (SID_GET_HAS_NAME(s_id
))
178 if (matchWildcards(SID_GET_NAME(s_id
), fw
->class.res_class
) ==
183 if (matchWildcards(SID_GET_NAME(s_id
), fw
->class.res_name
) ==
188 if (matchWildcards(SID_GET_NAME(s_id
), fw
->visible_name
) == 1)
192 if (matchWildcards(SID_GET_NAME(s_id
), fw
->name
.name
) == 1)
196 if (fw
->style_name
!= NULL
&&
197 matchWildcards(SID_GET_NAME(s_id
), fw
->style_name
) == 1)
202 if (SID_GET_HAS_WINDOW_ID(s_id
) &&
203 SID_GET_WINDOW_ID(s_id
) == (XID
)FW_W(fw
))
211 static int one_fw_can_match_both_ids(window_style
*s
, window_style
*t
)
213 if (SGET_ID_HAS_WINDOW_ID(*s
) && SGET_ID_HAS_WINDOW_ID(*t
) &&
214 SGET_WINDOW_ID(*s
) != SGET_WINDOW_ID(*t
))
222 static void remove_icon_boxes_from_style(window_style
*pstyle
)
224 if (SHAS_ICON_BOXES(&pstyle
->flags
))
226 free_icon_boxes(SGET_ICON_BOXES(*pstyle
));
227 pstyle
->flags
.has_icon_boxes
= 0;
228 SSET_ICON_BOXES(*pstyle
, NULL
);
234 static void copy_icon_boxes(icon_boxes
**pdest
, icon_boxes
*src
)
236 icon_boxes
*last
= NULL
;
240 /* copy the icon boxes */
241 for ( ; src
!= NULL
; src
= src
->next
)
243 temp
= (icon_boxes
*)safemalloc(sizeof(icon_boxes
));
244 memcpy(temp
, src
, sizeof(icon_boxes
));
254 /* Check word after IconFill to see if its "Top,Bottom,Left,Right" */
255 static int Get_TBLR(char *token
, unsigned char *IconFill
)
258 if (StrEquals(token
, "B") ||
259 StrEquals(token
, "BOT")||
260 StrEquals(token
, "BOTTOM"))
262 /* turn on bottom and verical */
263 *IconFill
= ICONFILLBOT
| ICONFILLHRZ
;
265 else if (StrEquals(token
, "T") ||
266 StrEquals(token
, "TOP"))
268 /* turn on vertical */
269 *IconFill
= ICONFILLHRZ
;
271 else if (StrEquals(token
, "R") ||
272 StrEquals(token
, "RGT") ||
273 StrEquals(token
, "RIGHT"))
275 /* turn on right bit */
276 *IconFill
= ICONFILLRGT
;
278 else if (StrEquals(token
, "L") ||
279 StrEquals(token
, "LFT") ||
280 StrEquals(token
, "LEFT"))
286 /* anything else is bad */
294 static void cleanup_style_defaults(window_style
*style
)
300 mask
= (char *)&(style
->flag_mask
);
301 dflt
= (char *)&(style
->flag_default
);
302 for (i
= 0; i
< sizeof(style_flags
); i
++)
310 /* merge_styles - For a matching style, merge window_style to window_style
313 * merged matching styles in callers window_style.
316 * merged_style - style resulting from the merge
317 * add_style - the style to be added into the merge_style
318 * do_free_src_and_alloc_copy
319 * - free allocated parts of merge_style that are replaced
320 * from add_style. Create a copy of of the replaced
321 * styles in allocated memory.
324 * The only trick here is that on and off flags/buttons are
325 * combined into the on flag/button. */
326 static void merge_styles(
327 window_style
*merged_style
, window_style
*add_style
,
328 Bool do_free_src_and_alloc_copy
)
337 char *merge_change_mask
;
338 char *add_change_mask
;
340 if (add_style
->flag_mask
.has_icon
)
342 if (do_free_src_and_alloc_copy
)
344 SAFEFREE(SGET_ICON_NAME(*merged_style
));
346 *merged_style
, (SGET_ICON_NAME(*add_style
)) ?
347 safestrdup(SGET_ICON_NAME(*add_style
)) : NULL
);
352 *merged_style
, SGET_ICON_NAME(*add_style
));
355 if (FMiniIconsSupported
&& add_style
->flag_mask
.has_mini_icon
)
357 if (do_free_src_and_alloc_copy
)
359 SAFEFREE(SGET_MINI_ICON_NAME(*merged_style
));
362 (SGET_MINI_ICON_NAME(*add_style
)) ?
363 safestrdup(SGET_MINI_ICON_NAME(*add_style
)) :
370 SGET_MINI_ICON_NAME(*add_style
));
374 if (add_style
->flag_mask
.has_decor
)
376 if (do_free_src_and_alloc_copy
)
378 SAFEFREE(SGET_DECOR_NAME(*merged_style
));
380 *merged_style
, (SGET_DECOR_NAME(*add_style
)) ?
381 safestrdup(SGET_DECOR_NAME(*add_style
)) :
387 *merged_style
, SGET_DECOR_NAME(*add_style
));
391 if (S_HAS_ICON_FONT(SCF(*add_style
)))
393 if (do_free_src_and_alloc_copy
)
395 SAFEFREE(SGET_ICON_FONT(*merged_style
));
397 *merged_style
, (SGET_ICON_FONT(*add_style
)) ?
398 safestrdup(SGET_ICON_FONT(*add_style
)) : NULL
);
403 *merged_style
, SGET_ICON_FONT(*add_style
));
406 if (S_HAS_WINDOW_FONT(SCF(*add_style
)))
408 if (do_free_src_and_alloc_copy
)
410 SAFEFREE(SGET_WINDOW_FONT(*merged_style
));
412 *merged_style
, (SGET_WINDOW_FONT(*add_style
)) ?
413 safestrdup(SGET_WINDOW_FONT(*add_style
)) :
419 *merged_style
, SGET_WINDOW_FONT(*add_style
));
422 if (add_style
->flags
.use_start_on_desk
)
424 SSET_START_DESK(*merged_style
, SGET_START_DESK(*add_style
));
426 *merged_style
, SGET_START_PAGE_X(*add_style
));
428 *merged_style
, SGET_START_PAGE_Y(*add_style
));
430 if (add_style
->flags
.use_start_on_screen
)
433 (*merged_style
, SGET_START_SCREEN(*add_style
));
435 if (add_style
->flag_mask
.has_color_fore
)
437 if (do_free_src_and_alloc_copy
)
439 SAFEFREE(SGET_FORE_COLOR_NAME(*merged_style
));
440 SSET_FORE_COLOR_NAME(
442 (SGET_FORE_COLOR_NAME(*add_style
)) ?
443 safestrdup(SGET_FORE_COLOR_NAME(*add_style
)) :
448 SSET_FORE_COLOR_NAME(
450 SGET_FORE_COLOR_NAME(*add_style
));
453 if (add_style
->flag_mask
.has_color_back
)
455 if (do_free_src_and_alloc_copy
)
457 SAFEFREE(SGET_BACK_COLOR_NAME(*merged_style
));
458 SSET_BACK_COLOR_NAME(
460 (SGET_BACK_COLOR_NAME(*add_style
)) ?
461 safestrdup(SGET_BACK_COLOR_NAME(*add_style
)) :
466 SSET_BACK_COLOR_NAME(
468 SGET_BACK_COLOR_NAME(*add_style
));
471 if (add_style
->flag_mask
.has_color_fore_hi
)
473 if (do_free_src_and_alloc_copy
)
475 SAFEFREE(SGET_FORE_COLOR_NAME_HI(*merged_style
));
476 SSET_FORE_COLOR_NAME_HI(
478 (SGET_FORE_COLOR_NAME_HI(*add_style
)) ?
480 SGET_FORE_COLOR_NAME_HI(*add_style
)) :
485 SSET_FORE_COLOR_NAME_HI(
487 SGET_FORE_COLOR_NAME_HI(*add_style
));
490 if (add_style
->flag_mask
.has_color_back_hi
)
492 if (do_free_src_and_alloc_copy
)
494 SAFEFREE(SGET_BACK_COLOR_NAME_HI(*merged_style
));
495 SSET_BACK_COLOR_NAME_HI(
497 (SGET_BACK_COLOR_NAME_HI(*add_style
)) ?
499 SGET_BACK_COLOR_NAME_HI(*add_style
)) :
504 SSET_BACK_COLOR_NAME_HI(
506 SGET_BACK_COLOR_NAME_HI(*add_style
));
509 if (add_style
->flags
.has_border_width
)
512 *merged_style
, SGET_BORDER_WIDTH(*add_style
));
514 if (add_style
->flags
.has_handle_width
)
517 *merged_style
, SGET_HANDLE_WIDTH(*add_style
));
519 if (add_style
->flags
.has_icon_size_limits
)
522 *merged_style
, SGET_MIN_ICON_WIDTH(*add_style
));
523 SSET_MIN_ICON_HEIGHT(
524 *merged_style
, SGET_MIN_ICON_HEIGHT(*add_style
));
526 *merged_style
, SGET_MAX_ICON_WIDTH(*add_style
));
527 SSET_MAX_ICON_HEIGHT(
528 *merged_style
, SGET_MAX_ICON_HEIGHT(*add_style
));
529 SSET_ICON_RESIZE_TYPE(
530 *merged_style
, SGET_ICON_RESIZE_TYPE(*add_style
));
532 if (add_style
->flags
.has_min_window_size
)
534 SSET_MIN_WINDOW_WIDTH(
535 *merged_style
, SGET_MIN_WINDOW_WIDTH(*add_style
));
536 SSET_MIN_WINDOW_HEIGHT(
537 *merged_style
, SGET_MIN_WINDOW_HEIGHT(*add_style
));
539 if (add_style
->flags
.has_max_window_size
)
541 SSET_MAX_WINDOW_WIDTH(
542 *merged_style
, SGET_MAX_WINDOW_WIDTH(*add_style
));
543 SSET_MAX_WINDOW_HEIGHT(
544 *merged_style
, SGET_MAX_WINDOW_HEIGHT(*add_style
));
546 if (add_style
->flags
.has_icon_background_relief
)
548 SSET_ICON_BACKGROUND_RELIEF(
550 SGET_ICON_BACKGROUND_RELIEF(*add_style
));
552 if (add_style
->flags
.has_icon_background_padding
)
554 SSET_ICON_BACKGROUND_PADDING(
556 SGET_ICON_BACKGROUND_PADDING(*add_style
));
558 if (add_style
->flags
.has_icon_title_relief
)
560 SSET_ICON_TITLE_RELIEF(
561 *merged_style
, SGET_ICON_TITLE_RELIEF(*add_style
));
563 if (add_style
->flags
.has_window_shade_steps
)
565 SSET_WINDOW_SHADE_STEPS(
566 *merged_style
, SGET_WINDOW_SHADE_STEPS(*add_style
));
568 if (add_style
->flags
.has_snap_attraction
)
571 *merged_style
, SGET_SNAP_PROXIMITY(*add_style
));
573 *merged_style
, SGET_SNAP_MODE(*add_style
));
575 if (add_style
->flags
.has_snap_grid
)
578 *merged_style
, SGET_SNAP_GRID_X(*add_style
));
580 *merged_style
, SGET_SNAP_GRID_Y(*add_style
));
582 if (add_style
->flags
.has_edge_delay_ms_move
)
584 SSET_EDGE_DELAY_MS_MOVE(
585 *merged_style
, SGET_EDGE_DELAY_MS_MOVE(*add_style
));
587 if (add_style
->flags
.has_edge_delay_ms_resize
)
589 SSET_EDGE_DELAY_MS_RESIZE(
590 *merged_style
, SGET_EDGE_DELAY_MS_RESIZE(*add_style
));
592 if (add_style
->flags
.has_edge_resistance_move
)
594 SSET_EDGE_RESISTANCE_MOVE(
595 *merged_style
, SGET_EDGE_RESISTANCE_MOVE(*add_style
));
597 if (add_style
->flags
.has_edge_resistance_xinerama_move
)
599 SSET_EDGE_RESISTANCE_XINERAMA_MOVE(
601 SGET_EDGE_RESISTANCE_XINERAMA_MOVE(*add_style
));
604 /* Note: Only one style cmd can define a window's iconboxes, the last
605 * one encountered. */
606 if (SHAS_ICON_BOXES(&add_style
->flag_mask
))
608 /* If style has iconboxes */
610 if (do_free_src_and_alloc_copy
)
612 remove_icon_boxes_from_style(merged_style
);
614 &SGET_ICON_BOXES(*merged_style
),
615 SGET_ICON_BOXES(*add_style
));
620 *merged_style
, SGET_ICON_BOXES(*add_style
));
623 if (add_style
->flags
.use_layer
)
625 SSET_LAYER(*merged_style
, SGET_LAYER(*add_style
));
627 if (add_style
->flags
.do_start_shaded
)
629 SSET_STARTS_SHADED_DIR(
630 *merged_style
, SGET_STARTS_SHADED_DIR(*add_style
));
632 if (add_style
->flags
.use_colorset
)
634 SSET_COLORSET(*merged_style
, SGET_COLORSET(*add_style
));
636 if (add_style
->flags
.use_colorset_hi
)
638 SSET_COLORSET_HI(*merged_style
, SGET_COLORSET_HI(*add_style
));
640 if (add_style
->flags
.use_border_colorset
)
642 SSET_BORDER_COLORSET(
643 *merged_style
, SGET_BORDER_COLORSET(*add_style
));
645 if (add_style
->flags
.use_border_colorset_hi
)
647 SSET_BORDER_COLORSET_HI(
648 *merged_style
,SGET_BORDER_COLORSET_HI(*add_style
));
650 if (add_style
->flags
.use_icon_title_colorset
)
652 SSET_ICON_TITLE_COLORSET(
653 *merged_style
,SGET_ICON_TITLE_COLORSET(*add_style
));
655 if (add_style
->flags
.use_icon_title_colorset_hi
)
657 SSET_ICON_TITLE_COLORSET_HI(
658 *merged_style
,SGET_ICON_TITLE_COLORSET_HI(*add_style
));
660 if (add_style
->flags
.use_icon_background_colorset
)
662 SSET_ICON_BACKGROUND_COLORSET(
663 *merged_style
,SGET_ICON_BACKGROUND_COLORSET(
666 if (add_style
->flags
.has_placement_penalty
)
668 SSET_NORMAL_PLACEMENT_PENALTY(
670 SGET_NORMAL_PLACEMENT_PENALTY(*add_style
));
671 SSET_ONTOP_PLACEMENT_PENALTY(
673 SGET_ONTOP_PLACEMENT_PENALTY(*add_style
));
674 SSET_ICON_PLACEMENT_PENALTY(
675 *merged_style
, SGET_ICON_PLACEMENT_PENALTY(
677 SSET_STICKY_PLACEMENT_PENALTY(
679 SGET_STICKY_PLACEMENT_PENALTY(*add_style
));
680 SSET_BELOW_PLACEMENT_PENALTY(
682 SGET_BELOW_PLACEMENT_PENALTY(*add_style
));
683 SSET_EWMH_STRUT_PLACEMENT_PENALTY(
685 SGET_EWMH_STRUT_PLACEMENT_PENALTY(*add_style
));
687 if (add_style
->flags
.has_placement_percentage_penalty
)
689 SSET_99_PLACEMENT_PERCENTAGE_PENALTY(
691 SGET_99_PLACEMENT_PERCENTAGE_PENALTY(*add_style
));
692 SSET_95_PLACEMENT_PERCENTAGE_PENALTY(
694 SGET_95_PLACEMENT_PERCENTAGE_PENALTY(*add_style
));
695 SSET_85_PLACEMENT_PERCENTAGE_PENALTY(
697 SGET_85_PLACEMENT_PERCENTAGE_PENALTY(*add_style
));
698 SSET_75_PLACEMENT_PERCENTAGE_PENALTY(
700 SGET_75_PLACEMENT_PERCENTAGE_PENALTY(*add_style
));
702 if (add_style
->flags
.has_placement_position_string
)
704 SAFEFREE(SGET_PLACEMENT_POSITION_STRING(*merged_style
));
705 SSET_PLACEMENT_POSITION_STRING(
707 strdup(SGET_PLACEMENT_POSITION_STRING(*add_style
)));
709 if (add_style
->flags
.has_initial_map_command_string
)
711 SAFEFREE(SGET_INITIAL_MAP_COMMAND_STRING(*merged_style
));
712 SSET_INITIAL_MAP_COMMAND_STRING(
714 strdup(SGET_INITIAL_MAP_COMMAND_STRING(*add_style
)));
716 /* merge the style flags */
719 *** This must be the last thing that is done in this function! */
720 merge_flags
= (char *)&(merged_style
->flags
);
721 add_flags
= (char *)&(add_style
->flags
);
722 merge_mask
= (char *)&(merged_style
->flag_mask
);
723 add_mask
= (char *)&(add_style
->flag_mask
);
724 merge_dflt
= (char *)&(merged_style
->flag_default
);
725 add_dflt
= (char *)&(add_style
->flag_default
);
726 merge_change_mask
= (char *)&(merged_style
->change_mask
);
727 add_change_mask
= (char *)&(add_style
->change_mask
);
728 for (i
= 0; i
< sizeof(style_flags
); i
++)
732 /* overwrite set styles */
733 merge_flags
[i
] |= (add_flags
[i
] & add_mask
[i
]);
734 merge_flags
[i
] &= (add_flags
[i
] | ~add_mask
[i
]);
735 /* overwrite default values */
736 m
= add_dflt
[i
] & ~add_mask
[i
] & ~merge_mask
[i
];
737 merge_flags
[i
] |= (add_flags
[i
] & m
);
738 merge_flags
[i
] &= (add_flags
[i
] | ~m
);
739 /* overwrite even weaker default values */
740 m
= ~add_dflt
[i
] & ~add_mask
[i
] & ~merge_dflt
[i
] &
742 merge_flags
[i
] |= (add_flags
[i
] & m
);
743 merge_flags
[i
] &= (add_flags
[i
] | ~m
);
745 merge_change_mask
[i
] &= ~(add_mask
[i
]);
746 merge_change_mask
[i
] |= add_change_mask
[i
];
747 merge_mask
[i
] |= add_mask
[i
];
748 merge_dflt
[i
] |= add_dflt
[i
];
749 merge_dflt
[i
] &= ~merge_mask
[i
];
751 merged_style
->has_style_changed
|= add_style
->has_style_changed
;
756 static void free_style(window_style
*style
)
758 /* Free contents of style */
759 SAFEFREE(SGET_NAME(*style
));
760 SAFEFREE(SGET_BACK_COLOR_NAME(*style
));
761 SAFEFREE(SGET_FORE_COLOR_NAME(*style
));
762 SAFEFREE(SGET_BACK_COLOR_NAME_HI(*style
));
763 SAFEFREE(SGET_FORE_COLOR_NAME_HI(*style
));
764 SAFEFREE(SGET_DECOR_NAME(*style
));
765 SAFEFREE(SGET_ICON_FONT(*style
));
766 SAFEFREE(SGET_WINDOW_FONT(*style
));
767 SAFEFREE(SGET_ICON_NAME(*style
));
768 SAFEFREE(SGET_MINI_ICON_NAME(*style
));
769 remove_icon_boxes_from_style(style
);
770 SAFEFREE(SGET_PLACEMENT_POSITION_STRING(*style
));
771 SAFEFREE(SGET_INITIAL_MAP_COMMAND_STRING(*style
));
776 /* Frees only selected members of a style; adjusts the flag_mask and
777 * change_mask appropriately. */
778 static void free_style_mask(window_style
*style
, style_flags
*mask
)
780 style_flags local_mask
;
783 /* mask out all bits that are not set in the target style */
785 blockand((char *)pmask
, (char *)&style
->flag_mask
, (char *)mask
,
786 sizeof(style_flags
));
788 /* Free contents of style */
789 if (pmask
->has_color_back
)
791 SAFEFREE(SGET_BACK_COLOR_NAME(*style
));
793 if (pmask
->has_color_fore
)
795 SAFEFREE(SGET_FORE_COLOR_NAME(*style
));
797 if (pmask
->has_color_back_hi
)
799 SAFEFREE(SGET_BACK_COLOR_NAME_HI(*style
));
801 if (pmask
->has_color_fore_hi
)
803 SAFEFREE(SGET_FORE_COLOR_NAME_HI(*style
));
805 if (pmask
->has_decor
)
807 SAFEFREE(SGET_DECOR_NAME(*style
));
809 if (pmask
->common
.has_icon_font
)
811 SAFEFREE(SGET_ICON_FONT(*style
));
813 if (pmask
->common
.has_window_font
)
815 SAFEFREE(SGET_WINDOW_FONT(*style
));
819 SAFEFREE(SGET_ICON_NAME(*style
));
821 if (pmask
->has_mini_icon
)
823 SAFEFREE(SGET_MINI_ICON_NAME(*style
));
825 if (pmask
->has_icon_boxes
)
827 remove_icon_boxes_from_style(style
);
829 /* remove styles from definitiion */
830 blockunmask((char *)&style
->flag_mask
, (char *)&style
->flag_mask
,
831 (char *)pmask
, sizeof(style_flags
));
832 blockunmask((char *)&style
->flag_default
, (char *)&style
->flag_default
,
833 (char *)pmask
, sizeof(style_flags
));
834 blockunmask((char *)&style
->change_mask
, (char *)&style
->change_mask
,
835 (char *)pmask
, sizeof(style_flags
));
840 static void add_style_to_list(window_style
*new_style
)
842 /* This used to contain logic that returned if the style didn't contain
843 * anything. I don't see why we should bother. dje.
845 * used to merge duplicate entries, but that is no longer
846 * appropriate since conflicting styles are possible, and the
847 * last match should win! */
849 if (last_style_in_list
!= NULL
)
851 /* not first entry in list chain this entry to the list */
852 SSET_NEXT_STYLE(*last_style_in_list
, new_style
);
856 /* first entry in list set the list root pointer. */
857 all_styles
= new_style
;
859 SSET_PREV_STYLE(*new_style
, last_style_in_list
);
860 SSET_NEXT_STYLE(*new_style
, NULL
);
861 last_style_in_list
= new_style
;
862 Scr
.flags
.do_need_style_list_update
= 1;
867 static void remove_style_from_list(window_style
*style
, Bool do_free_style
)
872 prev
= SGET_PREV_STYLE(*style
);
873 next
= SGET_NEXT_STYLE(*style
);
876 /* first style in list */
881 /* not first style in list */
882 SSET_NEXT_STYLE(*prev
, next
);
886 /* last style in list */
887 last_style_in_list
= prev
;
891 SSET_PREV_STYLE(*next
, prev
);
900 static int remove_all_of_style_from_list(style_id_t style_id
)
902 window_style
*nptr
= all_styles
;
906 /* loop though styles */
909 next
= SGET_NEXT_STYLE(*nptr
);
910 /* Check if it's to be wiped */
911 if (style_id_equals_id(nptr
, &style_id
))
913 remove_style_from_list(nptr
, True
);
923 static int __simplify_style_list(void)
929 * Remove styles that are completely overridden by later
930 * style definitions. At the same time...
932 * Merge styles with the same name if there are no
933 * conflicting styles with other names set in between. */
935 cur
= last_style_in_list
, has_modified
= 0; cur
;
936 cur
= SGET_PREV_STYLE(*cur
))
938 style_flags dummyflags
;
939 /* incremental flags set in styles with the same name */
940 style_flags sumflags
;
941 style_flags sumdflags
;
942 /* incremental flags set in styles with other names */
943 style_flags interflags
;
946 memset(&interflags
, 0, sizeof(style_flags
));
947 memcpy(&sumflags
, &cur
->flag_mask
, sizeof(style_flags
));
948 memcpy(&sumdflags
, &cur
->flag_default
, sizeof(style_flags
));
949 cmp
= SGET_PREV_STYLE(*cur
);
952 if (!styles_have_same_id(cur
, cmp
))
954 if (one_fw_can_match_both_ids(cur
, cmp
))
956 blockor((char *)&interflags
,
958 (char *)&cmp
->flag_mask
,
959 sizeof(style_flags
));
960 blockor((char *)&interflags
,
962 (char *)&cmp
->flag_default
,
963 sizeof(style_flags
));
965 cmp
= SGET_PREV_STYLE(*cmp
);
969 (char *)&cmp
->flag_mask
,
971 sizeof(style_flags
)) &&
973 (char *)&cmp
->flag_default
,
975 sizeof(style_flags
)))
977 /* The style is a subset of later style
978 * definitions; nuke it */
979 window_style
*tmp
= SGET_PREV_STYLE(*cmp
);
980 remove_style_from_list(cmp
, True
);
985 /* remove all styles that are overridden later from the
987 blockor((char *)&dummyflags
,
990 sizeof(style_flags
));
991 free_style_mask(cmp
, &dummyflags
);
994 (char *)&cmp
->flag_mask
,
996 sizeof(style_flags
)) &&
998 (char *)&cmp
->flag_default
,
1000 sizeof(style_flags
)))
1002 /* merge old style into new style */
1003 window_style
*tmp
= SGET_PREV_STYLE(*cmp
);
1004 window_style
*prev
= SGET_PREV_STYLE(*cur
);
1005 window_style
*next
= SGET_NEXT_STYLE(*cur
);
1007 /* Add the style to the set */
1008 blockor((char *)&sumflags
,
1010 (char *)&cmp
->flag_mask
,
1011 sizeof(style_flags
));
1012 blockor((char *)&sumdflags
,
1014 (char *)&cmp
->flag_default
,
1015 sizeof(style_flags
));
1016 /* merge cmp into cur and delete it
1018 merge_styles(cmp
, cur
, True
);
1020 memcpy(cur
, cmp
, sizeof(window_style
));
1021 /* restore fields overwritten by memcpy */
1022 SSET_PREV_STYLE(*cur
, prev
);
1023 SSET_NEXT_STYLE(*cur
, next
);
1024 /* remove the style without freeing the
1026 remove_style_from_list(cmp
, False
);
1027 /* release the style structure */
1034 (char *)&cur
->flag_mask
,
1035 (char *)&interflags
,
1036 sizeof(style_flags
)) &&
1038 (char *)&cur
->flag_default
,
1039 (char *)&interflags
,
1040 sizeof(style_flags
)))
1042 /* merge new style into old style */
1043 window_style
*tmp
= SGET_PREV_STYLE(*cmp
);
1045 /* Add the style to the set */
1046 blockor((char *)&sumflags
,
1048 (char *)&cur
->flag_mask
,
1049 sizeof(style_flags
));
1050 blockor((char *)&sumdflags
,
1052 (char *)&cur
->flag_default
,
1053 sizeof(style_flags
));
1054 /* merge cur into cmp and delete it
1056 merge_styles(cmp
, cur
, True
);
1057 remove_style_from_list(cur
, True
);
1061 memset(&interflags
, 0, sizeof(style_flags
));
1066 /* Add it to the set of interfering styles. */
1067 blockor((char *)&interflags
,
1068 (char *)&interflags
,
1069 (char *)&cmp
->flag_mask
,
1070 sizeof(style_flags
));
1071 blockor((char *)&interflags
,
1072 (char *)&interflags
,
1073 (char *)&cmp
->flag_default
,
1074 sizeof(style_flags
));
1075 cmp
= SGET_PREV_STYLE(*cmp
);
1080 return has_modified
;
1083 static void style_set_old_focus_policy(window_style
*ps
, int policy
)
1091 FPS_FOCUS_ENTER(S_FOCUS_POLICY(SCF(*ps
)), 0);
1092 FPS_UNFOCUS_LEAVE(S_FOCUS_POLICY(SCF(*ps
)), 0);
1093 FPS_FOCUS_CLICK_CLIENT(S_FOCUS_POLICY(SCF(*ps
)), 1);
1094 FPS_FOCUS_CLICK_DECOR(S_FOCUS_POLICY(SCF(*ps
)), 1);
1095 FPS_FOCUS_CLICK_ICON(S_FOCUS_POLICY(SCF(*ps
)), 1);
1096 FPS_FOCUS_BY_FUNCTION(S_FOCUS_POLICY(SCF(*ps
)), 1);
1097 FPS_FOCUS_BY_PROGRAM(fp
, 1);
1098 FPS_GRAB_FOCUS(fp
, 1);
1099 FPS_RELEASE_FOCUS(fp
, 1);
1100 FPS_RAISE_FOCUSED_CLIENT_CLICK(fp
, 1);
1101 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(fp
, 1);
1102 FPS_RAISE_FOCUSED_DECOR_CLICK(fp
, 1);
1103 FPS_RAISE_UNFOCUSED_DECOR_CLICK(fp
, 1);
1104 FPS_PASS_FOCUS_CLICK(fp
, 1);
1105 FPS_PASS_RAISE_CLICK(fp
, 1);
1106 FPS_ALLOW_FUNC_FOCUS_CLICK(fp
, 1);
1107 FPS_ALLOW_FUNC_RAISE_CLICK(fp
, 1);
1108 FPS_WARP_POINTER_ON_FOCUS_FUNC(fp
, 0);
1112 FPS_FOCUS_ENTER(S_FOCUS_POLICY(SCF(*ps
)), 1);
1113 FPS_UNFOCUS_LEAVE(S_FOCUS_POLICY(SCF(*ps
)), 1);
1114 FPS_FOCUS_CLICK_CLIENT(S_FOCUS_POLICY(SCF(*ps
)), 0);
1115 FPS_FOCUS_CLICK_DECOR(S_FOCUS_POLICY(SCF(*ps
)), 0);
1116 FPS_FOCUS_CLICK_ICON(S_FOCUS_POLICY(SCF(*ps
)), 0);
1117 FPS_FOCUS_BY_FUNCTION(S_FOCUS_POLICY(SCF(*ps
)), 1);
1118 FPS_FOCUS_BY_PROGRAM(fp
, 1);
1119 FPS_GRAB_FOCUS(fp
, 0);
1120 FPS_RELEASE_FOCUS(fp
, 0);
1121 FPS_RAISE_FOCUSED_CLIENT_CLICK(fp
, 0);
1122 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(fp
, 0);
1123 FPS_RAISE_FOCUSED_DECOR_CLICK(fp
, 0);
1124 FPS_RAISE_UNFOCUSED_DECOR_CLICK(fp
, 0);
1125 FPS_PASS_FOCUS_CLICK(fp
, 1);
1126 FPS_PASS_RAISE_CLICK(fp
, 1);
1127 FPS_ALLOW_FUNC_FOCUS_CLICK(fp
, 0);
1128 FPS_ALLOW_FUNC_RAISE_CLICK(fp
, 0);
1129 FPS_WARP_POINTER_ON_FOCUS_FUNC(fp
, 1);
1133 FPS_FOCUS_ENTER(S_FOCUS_POLICY(SCF(*ps
)), 1);
1134 FPS_UNFOCUS_LEAVE(S_FOCUS_POLICY(SCF(*ps
)), 0);
1135 FPS_FOCUS_CLICK_CLIENT(S_FOCUS_POLICY(SCF(*ps
)), 0);
1136 FPS_FOCUS_CLICK_DECOR(S_FOCUS_POLICY(SCF(*ps
)), 0);
1137 FPS_FOCUS_CLICK_ICON(S_FOCUS_POLICY(SCF(*ps
)), 0);
1138 FPS_FOCUS_BY_FUNCTION(S_FOCUS_POLICY(SCF(*ps
)), 1);
1139 FPS_FOCUS_BY_PROGRAM(fp
, 1);
1140 FPS_GRAB_FOCUS(fp
, 0);
1141 FPS_RELEASE_FOCUS(fp
, 1);
1142 FPS_RAISE_FOCUSED_CLIENT_CLICK(fp
, 0);
1143 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(fp
, 0);
1144 FPS_RAISE_FOCUSED_DECOR_CLICK(fp
, 0);
1145 FPS_RAISE_UNFOCUSED_DECOR_CLICK(fp
, 0);
1146 FPS_PASS_FOCUS_CLICK(fp
, 1);
1147 FPS_PASS_RAISE_CLICK(fp
, 1);
1148 FPS_ALLOW_FUNC_FOCUS_CLICK(fp
, 0);
1149 FPS_ALLOW_FUNC_RAISE_CLICK(fp
, 0);
1150 FPS_WARP_POINTER_ON_FOCUS_FUNC(fp
, 1);
1154 FPS_FOCUS_ENTER(S_FOCUS_POLICY(SCF(*ps
)), 0);
1155 FPS_UNFOCUS_LEAVE(S_FOCUS_POLICY(SCF(*ps
)), 0);
1156 FPS_FOCUS_CLICK_CLIENT(S_FOCUS_POLICY(SCF(*ps
)), 0);
1157 FPS_FOCUS_CLICK_DECOR(S_FOCUS_POLICY(SCF(*ps
)), 0);
1158 FPS_FOCUS_CLICK_ICON(S_FOCUS_POLICY(SCF(*ps
)), 0);
1159 FPS_FOCUS_BY_FUNCTION(S_FOCUS_POLICY(SCF(*ps
)), 0);
1160 FPS_FOCUS_BY_PROGRAM(fp
, 1);
1161 FPS_GRAB_FOCUS(fp
, 0);
1162 FPS_RELEASE_FOCUS(fp
, 0);
1163 FPS_RAISE_FOCUSED_CLIENT_CLICK(fp
, 0);
1164 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(fp
, 0);
1165 FPS_RAISE_FOCUSED_DECOR_CLICK(fp
, 0);
1166 FPS_RAISE_UNFOCUSED_DECOR_CLICK(fp
, 0);
1167 FPS_PASS_FOCUS_CLICK(fp
, 1);
1168 FPS_PASS_RAISE_CLICK(fp
, 1);
1169 FPS_ALLOW_FUNC_FOCUS_CLICK(fp
, 1);
1170 FPS_ALLOW_FUNC_RAISE_CLICK(fp
, 1);
1171 FPS_WARP_POINTER_ON_FOCUS_FUNC(fp
, 0);
1174 FPS_FOCUS_ENTER(S_FOCUS_POLICY(SCM(*ps
)), 1);
1175 FPS_FOCUS_ENTER(S_FOCUS_POLICY(SCC(*ps
)), 1);
1176 FPS_UNFOCUS_LEAVE(S_FOCUS_POLICY(SCM(*ps
)), 1);
1177 FPS_UNFOCUS_LEAVE(S_FOCUS_POLICY(SCC(*ps
)), 1);
1178 FPS_FOCUS_CLICK_CLIENT(S_FOCUS_POLICY(SCM(*ps
)), 1);
1179 FPS_FOCUS_CLICK_CLIENT(S_FOCUS_POLICY(SCC(*ps
)), 1);
1180 FPS_FOCUS_CLICK_DECOR(S_FOCUS_POLICY(SCM(*ps
)), 1);
1181 FPS_FOCUS_CLICK_DECOR(S_FOCUS_POLICY(SCC(*ps
)), 1);
1182 FPS_FOCUS_CLICK_ICON(S_FOCUS_POLICY(SCM(*ps
)), 1);
1183 FPS_FOCUS_CLICK_ICON(S_FOCUS_POLICY(SCC(*ps
)), 1);
1184 FPS_FOCUS_BY_FUNCTION(S_FOCUS_POLICY(SCM(*ps
)), 1);
1185 FPS_FOCUS_BY_FUNCTION(S_FOCUS_POLICY(SCC(*ps
)), 1);
1187 if (!FP_DO_FOCUS_BY_PROGRAM(S_FOCUS_POLICY(SCM(*ps
))))
1189 FPS_FOCUS_BY_PROGRAM(
1190 S_FOCUS_POLICY(SCF(*ps
)), FP_DO_FOCUS_BY_PROGRAM(fp
));
1191 FPS_FOCUS_BY_PROGRAM(S_FOCUS_POLICY(SCD(*ps
)), 1);
1192 FPS_FOCUS_BY_PROGRAM(S_FOCUS_POLICY(SCC(*ps
)), 1);
1194 if (!FP_DO_GRAB_FOCUS(S_FOCUS_POLICY(SCM(*ps
))))
1196 FPS_GRAB_FOCUS(S_FOCUS_POLICY(SCF(*ps
)), FP_DO_GRAB_FOCUS(fp
));
1197 FPS_GRAB_FOCUS(S_FOCUS_POLICY(SCD(*ps
)), 1);
1198 FPS_GRAB_FOCUS(S_FOCUS_POLICY(SCC(*ps
)), 1);
1200 if (!FP_DO_RELEASE_FOCUS(S_FOCUS_POLICY(SCM(*ps
))))
1203 S_FOCUS_POLICY(SCF(*ps
)), FP_DO_RELEASE_FOCUS(fp
));
1204 FPS_RELEASE_FOCUS(S_FOCUS_POLICY(SCD(*ps
)), 1);
1205 FPS_RELEASE_FOCUS(S_FOCUS_POLICY(SCC(*ps
)), 1);
1207 if (!FP_DO_RAISE_FOCUSED_CLIENT_CLICK(S_FOCUS_POLICY(SCM(*ps
))))
1209 FPS_RAISE_FOCUSED_CLIENT_CLICK(
1210 S_FOCUS_POLICY(SCF(*ps
)),
1211 FP_DO_RAISE_FOCUSED_CLIENT_CLICK(fp
));
1212 FPS_RAISE_FOCUSED_CLIENT_CLICK(S_FOCUS_POLICY(SCD(*ps
)), 1);
1213 FPS_RAISE_FOCUSED_CLIENT_CLICK(S_FOCUS_POLICY(SCC(*ps
)), 1);
1215 if (!FP_DO_RAISE_UNFOCUSED_CLIENT_CLICK(S_FOCUS_POLICY(SCM(*ps
))))
1217 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(
1218 S_FOCUS_POLICY(SCF(*ps
)),
1219 FP_DO_RAISE_UNFOCUSED_CLIENT_CLICK(fp
));
1220 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(S_FOCUS_POLICY(SCD(*ps
)), 1);
1221 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(S_FOCUS_POLICY(SCC(*ps
)), 1);
1223 if (!FP_DO_RAISE_FOCUSED_DECOR_CLICK(S_FOCUS_POLICY(SCM(*ps
))))
1225 FPS_RAISE_FOCUSED_DECOR_CLICK(
1226 S_FOCUS_POLICY(SCF(*ps
)),
1227 FP_DO_RAISE_FOCUSED_DECOR_CLICK(fp
));
1228 FPS_RAISE_FOCUSED_DECOR_CLICK(S_FOCUS_POLICY(SCD(*ps
)), 1);
1229 FPS_RAISE_FOCUSED_DECOR_CLICK(S_FOCUS_POLICY(SCC(*ps
)), 1);
1231 if (!FP_DO_RAISE_UNFOCUSED_DECOR_CLICK(S_FOCUS_POLICY(SCM(*ps
))))
1233 FPS_RAISE_UNFOCUSED_DECOR_CLICK(
1234 S_FOCUS_POLICY(SCF(*ps
)),
1235 FP_DO_RAISE_UNFOCUSED_DECOR_CLICK(fp
));
1236 FPS_RAISE_UNFOCUSED_DECOR_CLICK(S_FOCUS_POLICY(SCD(*ps
)), 1);
1237 FPS_RAISE_UNFOCUSED_DECOR_CLICK(S_FOCUS_POLICY(SCC(*ps
)), 1);
1239 if (!FP_DO_PASS_FOCUS_CLICK(S_FOCUS_POLICY(SCM(*ps
))))
1241 FPS_PASS_FOCUS_CLICK(
1242 S_FOCUS_POLICY(SCF(*ps
)), FP_DO_PASS_FOCUS_CLICK(fp
));
1243 FPS_PASS_FOCUS_CLICK(S_FOCUS_POLICY(SCD(*ps
)), 1);
1244 FPS_PASS_FOCUS_CLICK(S_FOCUS_POLICY(SCC(*ps
)), 1);
1246 if (!FP_DO_PASS_RAISE_CLICK(S_FOCUS_POLICY(SCM(*ps
))))
1248 FPS_PASS_RAISE_CLICK(
1249 S_FOCUS_POLICY(SCF(*ps
)), FP_DO_PASS_RAISE_CLICK(fp
));
1250 FPS_PASS_RAISE_CLICK(S_FOCUS_POLICY(SCD(*ps
)), 1);
1251 FPS_PASS_RAISE_CLICK(S_FOCUS_POLICY(SCC(*ps
)), 1);
1253 if (!FP_DO_ALLOW_FUNC_FOCUS_CLICK(S_FOCUS_POLICY(SCM(*ps
))))
1255 FPS_ALLOW_FUNC_FOCUS_CLICK(
1256 S_FOCUS_POLICY(SCF(*ps
)),
1257 FP_DO_ALLOW_FUNC_FOCUS_CLICK(fp
));
1258 FPS_ALLOW_FUNC_FOCUS_CLICK(S_FOCUS_POLICY(SCD(*ps
)), 1);
1259 FPS_ALLOW_FUNC_FOCUS_CLICK(S_FOCUS_POLICY(SCC(*ps
)), 1);
1261 if (!FP_DO_ALLOW_FUNC_RAISE_CLICK(S_FOCUS_POLICY(SCM(*ps
))))
1263 FPS_ALLOW_FUNC_RAISE_CLICK(
1264 S_FOCUS_POLICY(SCF(*ps
)),
1265 FP_DO_ALLOW_FUNC_RAISE_CLICK(fp
));
1266 FPS_ALLOW_FUNC_RAISE_CLICK(S_FOCUS_POLICY(SCD(*ps
)), 1);
1267 FPS_ALLOW_FUNC_RAISE_CLICK(S_FOCUS_POLICY(SCC(*ps
)), 1);
1269 if (!FP_DO_WARP_POINTER_ON_FOCUS_FUNC(
1270 S_FOCUS_POLICY(SCM(*ps
))))
1272 FPS_WARP_POINTER_ON_FOCUS_FUNC(
1273 S_FOCUS_POLICY(SCF(*ps
)),
1274 FP_DO_WARP_POINTER_ON_FOCUS_FUNC(fp
));
1275 FPS_WARP_POINTER_ON_FOCUS_FUNC(S_FOCUS_POLICY(SCD(*ps
)), 1);
1276 FPS_WARP_POINTER_ON_FOCUS_FUNC(S_FOCUS_POLICY(SCC(*ps
)), 1);
1278 if (!FP_DO_SORT_WINDOWLIST_BY(S_FOCUS_POLICY(SCM(*ps
))))
1280 FPS_SORT_WINDOWLIST_BY(
1281 S_FOCUS_POLICY(SCF(*ps
)),
1282 FP_DO_SORT_WINDOWLIST_BY(fp
));
1283 FPS_SORT_WINDOWLIST_BY(S_FOCUS_POLICY(SCD(*ps
)), 1);
1284 FPS_SORT_WINDOWLIST_BY(S_FOCUS_POLICY(SCC(*ps
)), 1);
1290 static char *style_parse_button_style(
1291 window_style
*ps
, char *button_string
, int on
)
1297 GetIntegerArguments(button_string
, &rest
, &button
, 1);
1298 button
= BUTTON_INDEX(button
);
1299 if (button
< 0 || button
>= NUMBER_OF_TITLE_BUTTONS
)
1303 "Button and NoButton styles require an argument");
1309 ps
->flags
.is_button_disabled
&= ~(1 << button
);
1310 ps
->flag_mask
.is_button_disabled
|= (1 << button
);
1311 ps
->change_mask
.is_button_disabled
|= (1 << button
);
1315 ps
->flags
.is_button_disabled
|= (1 << button
);
1316 ps
->flag_mask
.is_button_disabled
|= (1 << button
);
1317 ps
->change_mask
.is_button_disabled
|= (1 << button
);
1324 static Bool
style_parse_focus_policy_style(
1325 char *option
, char *rest
, char **ret_rest
, Bool is_reversed
,
1326 focus_policy_t
*f
, focus_policy_t
*m
, focus_policy_t
*c
)
1329 "SortWindowlistByFocus",
1330 "FocusClickButtons",
1331 "FocusClickModifiers",
1332 "ClickRaisesFocused",
1333 "ClickDecorRaisesFocused",
1334 "ClickIconRaisesFocused",
1335 "ClickRaisesUnfocused",
1336 "ClickDecorRaisesUnfocused",
1337 "ClickIconRaisesUnfocused",
1339 "ClickDecorToFocus",
1345 "FocusByFunctionWarpPointer",
1349 "IgnoreFocusClickMotion",
1350 "IgnoreRaiseClickMotion",
1351 "AllowFocusClickFunction",
1352 "AllowRaiseClickFunction",
1354 "GrabFocusTransient",
1355 "OverrideGrabFocus",
1357 "ReleaseFocusTransient",
1358 "OverrideReleaseFocus",
1373 GetNextTokenIndex(option
, optlist
, 0, &index
);
1377 /* SortWindowlistByFocus */
1378 FPS_SORT_WINDOWLIST_BY(
1380 FPOL_SORT_WL_BY_FOCUS
: FPOL_SORT_WL_BY_OPEN
);
1381 FPS_SORT_WINDOWLIST_BY(*m
, 1);
1382 FPS_SORT_WINDOWLIST_BY(*c
, 1);
1385 /* FocusClickButtons */
1391 token
= PeekToken(rest
, ret_rest
);
1393 for ( ; token
!= NULL
&& isdigit(*token
); token
++)
1405 else if (button
> NUMBER_OF_EXTENDED_MOUSE_BUTTONS
)
1411 val
|= (1 << (button
- 1));
1414 if (token
!= NULL
&& *token
!= 0)
1417 ERR
, "style_parse_focus_policy_style",
1418 "illegal mouse button '%c'", *token
);
1419 val
= DEF_FP_MOUSE_BUTTONS
;
1423 val
= DEF_FP_MOUSE_BUTTONS
;
1425 FPS_MOUSE_BUTTONS(*f
, val
);
1426 FPS_MOUSE_BUTTONS(*m
, ~0);
1427 FPS_MOUSE_BUTTONS(*c
, ~0);
1430 /* FocusClickModifiers */
1436 token
= PeekToken(rest
, ret_rest
);
1437 if (token
== NULL
||
1438 modifiers_string_to_modmask(token
, &val
) == 1)
1440 val
= DEF_FP_MODIFIERS
;
1442 if (val
& AnyModifier
)
1444 val
= FPOL_ANY_MODIFIER
;
1446 FPS_MODIFIERS(*f
, val
);
1447 FPS_MODIFIERS(*m
, ~0);
1448 FPS_MODIFIERS(*c
, ~0);
1451 /* ClickRaisesFocused */
1452 FPS_RAISE_FOCUSED_CLIENT_CLICK(*f
, val
);
1453 FPS_RAISE_FOCUSED_CLIENT_CLICK(*m
, 1);
1454 FPS_RAISE_FOCUSED_CLIENT_CLICK(*c
, 1);
1457 /* ClickDecorRaisesFocused */
1458 FPS_RAISE_FOCUSED_DECOR_CLICK(*f
, val
);
1459 FPS_RAISE_FOCUSED_DECOR_CLICK(*m
, 1);
1460 FPS_RAISE_FOCUSED_DECOR_CLICK(*c
, 1);
1463 /* ClickIconRaisesFocused */
1464 FPS_RAISE_FOCUSED_ICON_CLICK(*f
, val
);
1465 FPS_RAISE_FOCUSED_ICON_CLICK(*m
, 1);
1466 FPS_RAISE_FOCUSED_ICON_CLICK(*c
, 1);
1469 /* ClickRaisesUnfocused */
1470 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(*f
, val
);
1471 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(*m
, 1);
1472 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(*c
, 1);
1475 /* ClickDecorRaisesUnfocused */
1476 FPS_RAISE_UNFOCUSED_DECOR_CLICK(*f
, val
);
1477 FPS_RAISE_UNFOCUSED_DECOR_CLICK(*m
, 1);
1478 FPS_RAISE_UNFOCUSED_DECOR_CLICK(*c
, 1);
1481 /* ClickIconRaisesUnfocused */
1482 FPS_RAISE_UNFOCUSED_ICON_CLICK(*f
, val
);
1483 FPS_RAISE_UNFOCUSED_ICON_CLICK(*m
, 1);
1484 FPS_RAISE_UNFOCUSED_ICON_CLICK(*c
, 1);
1488 FPS_FOCUS_CLICK_CLIENT(*f
, val
);
1489 FPS_FOCUS_CLICK_CLIENT(*m
, 1);
1490 FPS_FOCUS_CLICK_CLIENT(*c
, 1);
1493 /* ClickDecorToFocus */
1494 FPS_FOCUS_CLICK_DECOR(*f
, val
);
1495 FPS_FOCUS_CLICK_DECOR(*m
, 1);
1496 FPS_FOCUS_CLICK_DECOR(*c
, 1);
1499 /* ClickIconToFocus */
1500 FPS_FOCUS_CLICK_ICON(*f
, val
);
1501 FPS_FOCUS_CLICK_ICON(*m
, 1);
1502 FPS_FOCUS_CLICK_ICON(*c
, 1);
1506 FPS_FOCUS_ENTER(*f
, val
);
1507 FPS_FOCUS_ENTER(*m
, 1);
1508 FPS_FOCUS_ENTER(*c
, 1);
1511 /* LeaveToUnfocus */
1512 FPS_UNFOCUS_LEAVE(*f
, val
);
1513 FPS_UNFOCUS_LEAVE(*m
, 1);
1514 FPS_UNFOCUS_LEAVE(*c
, 1);
1517 /* FocusByProgram */
1518 FPS_FOCUS_BY_PROGRAM(*f
, val
);
1519 FPS_FOCUS_BY_PROGRAM(*m
, 1);
1520 FPS_FOCUS_BY_PROGRAM(*c
, 1);
1523 /* FocusByFunction */
1524 FPS_FOCUS_BY_FUNCTION(*f
, val
);
1525 FPS_FOCUS_BY_FUNCTION(*m
, 1);
1526 FPS_FOCUS_BY_FUNCTION(*c
, 1);
1529 /* FocusByFunctionWarpPointer */
1530 FPS_WARP_POINTER_ON_FOCUS_FUNC(*f
, val
);
1531 FPS_WARP_POINTER_ON_FOCUS_FUNC(*m
, 1);
1532 FPS_WARP_POINTER_ON_FOCUS_FUNC(*c
, 1);
1536 FPS_LENIENT(*f
, val
);
1541 /* PassFocusClick */
1542 FPS_PASS_FOCUS_CLICK(*f
, val
);
1543 FPS_PASS_FOCUS_CLICK(*m
, 1);
1544 FPS_PASS_FOCUS_CLICK(*c
, 1);
1547 /* PassRaiseClick */
1548 FPS_PASS_RAISE_CLICK(*f
, val
);
1549 FPS_PASS_RAISE_CLICK(*m
, 1);
1550 FPS_PASS_RAISE_CLICK(*c
, 1);
1553 /* IgnoreFocusClickMotion */
1554 FPS_IGNORE_FOCUS_CLICK_MOTION(*f
, val
);
1555 FPS_IGNORE_FOCUS_CLICK_MOTION(*m
, 1);
1556 FPS_IGNORE_FOCUS_CLICK_MOTION(*c
, 1);
1559 /* IgnoreRaiseClickMotion */
1560 FPS_IGNORE_RAISE_CLICK_MOTION(*f
, val
);
1561 FPS_IGNORE_RAISE_CLICK_MOTION(*m
, 1);
1562 FPS_IGNORE_RAISE_CLICK_MOTION(*c
, 1);
1565 /* AllowFocusClickFunction */
1566 FPS_ALLOW_FUNC_FOCUS_CLICK(*f
, val
);
1567 FPS_ALLOW_FUNC_FOCUS_CLICK(*m
, 1);
1568 FPS_ALLOW_FUNC_FOCUS_CLICK(*c
, 1);
1571 /* AllowRaiseClickFunction */
1572 FPS_ALLOW_FUNC_RAISE_CLICK(*f
, val
);
1573 FPS_ALLOW_FUNC_RAISE_CLICK(*m
, 1);
1574 FPS_ALLOW_FUNC_RAISE_CLICK(*c
, 1);
1578 FPS_GRAB_FOCUS(*f
, val
);
1579 FPS_GRAB_FOCUS(*m
, 1);
1580 FPS_GRAB_FOCUS(*c
, 1);
1583 /* GrabFocusTransient */
1584 FPS_GRAB_FOCUS_TRANSIENT(*f
, val
);
1585 FPS_GRAB_FOCUS_TRANSIENT(*m
, 1);
1586 FPS_GRAB_FOCUS_TRANSIENT(*c
, 1);
1589 /* OverrideGrabFocus */
1590 FPS_OVERRIDE_GRAB_FOCUS(*f
, val
);
1591 FPS_OVERRIDE_GRAB_FOCUS(*m
, 1);
1592 FPS_OVERRIDE_GRAB_FOCUS(*c
, 1);
1596 FPS_RELEASE_FOCUS(*f
, val
);
1597 FPS_RELEASE_FOCUS(*m
, 1);
1598 FPS_RELEASE_FOCUS(*c
, 1);
1601 /* ReleaseFocusTransient */
1602 FPS_RELEASE_FOCUS_TRANSIENT(*f
, val
);
1603 FPS_RELEASE_FOCUS_TRANSIENT(*m
, 1);
1604 FPS_RELEASE_FOCUS_TRANSIENT(*c
, 1);
1607 /* OverrideReleaseFocus */
1608 FPS_OVERRIDE_RELEASE_FOCUS(*f
, val
);
1609 FPS_OVERRIDE_RELEASE_FOCUS(*m
, 1);
1610 FPS_OVERRIDE_RELEASE_FOCUS(*c
, 1);
1620 static char *style_parse_icon_size_style(
1621 char *option
, char *rest
, window_style
*ps
)
1626 option
= PeekToken(rest
, NULL
);
1627 if (StrEquals(option
, "Stretched"))
1629 SSET_ICON_RESIZE_TYPE(*ps
, ICON_RESIZE_TYPE_STRETCHED
);
1630 option
= PeekToken(rest
, &rest
);
1632 else if (StrEquals(option
, "Adjusted"))
1634 SSET_ICON_RESIZE_TYPE(*ps
, ICON_RESIZE_TYPE_ADJUSTED
);
1635 option
= PeekToken(rest
, &rest
);
1637 else if (StrEquals(option
, "Shrunk"))
1639 SSET_ICON_RESIZE_TYPE(*ps
, ICON_RESIZE_TYPE_SHRUNK
);
1640 option
= PeekToken(rest
, &rest
);
1644 SSET_ICON_RESIZE_TYPE(*ps
, ICON_RESIZE_TYPE_NONE
);
1647 switch (GetIntegerArguments(rest
, &rest
, vals
, 4))
1650 /* No arguments results in default values */
1651 vals
[0] = vals
[1] = UNSPECIFIED_ICON_DIMENSION
;
1654 /* Max and min values are the same */
1659 /* Validate values */
1660 for (i
= 0; i
< 4; i
++)
1662 int use_default
= 0;
1664 if (vals
[i
] != UNSPECIFIED_ICON_DIMENSION
&&
1665 (vals
[i
] < MIN_ALLOWABLE_ICON_DIMENSION
||
1666 vals
[i
] > MAX_ALLOWABLE_ICON_DIMENSION
))
1670 "IconSize dimension (%d) not in valid"
1672 vals
[i
], MIN_ALLOWABLE_ICON_DIMENSION
,
1673 MAX_ALLOWABLE_ICON_DIMENSION
);
1677 /* User requests default value for this dimension */
1678 else if (vals
[i
] == UNSPECIFIED_ICON_DIMENSION
)
1685 /* Set default value for this dimension. The
1686 * first two indexes refer to min values, the
1687 * latter two to max values. */
1688 vals
[i
] = i
< 2 ? MIN_ALLOWABLE_ICON_DIMENSION
:
1689 MAX_ALLOWABLE_ICON_DIMENSION
;
1692 SSET_MIN_ICON_WIDTH(*ps
, vals
[0]);
1693 SSET_MIN_ICON_HEIGHT(*ps
, vals
[1]);
1694 SSET_MAX_ICON_WIDTH(*ps
, vals
[2]);
1695 SSET_MAX_ICON_HEIGHT(*ps
, vals
[3]);
1697 ps
->flags
.has_icon_size_limits
= 1;
1698 ps
->flag_mask
.has_icon_size_limits
= 1;
1699 ps
->change_mask
.has_icon_size_limits
= 1;
1704 "IconSize requires exactly 0, 2 or 4"
1705 " numerical arguments");
1712 static char *style_parse_icon_box_style(
1713 icon_boxes
**ret_ib
, char *option
, char *rest
, window_style
*ps
)
1715 icon_boxes
*IconBoxes
= NULL
;
1716 Bool is_screen_given
= False
;
1721 option
= PeekToken(rest
, NULL
);
1722 if (!option
|| StrEquals(option
, "none"))
1724 option
= PeekToken(rest
, &rest
);
1725 /* delete icon boxes from style */
1726 if (SGET_ICON_BOXES(*ps
))
1728 remove_icon_boxes_from_style(ps
);
1733 /* disable default icon box */
1734 S_SET_DO_IGNORE_ICON_BOXES(SCF(*ps
), 1);
1738 /* use default icon box */
1739 S_SET_DO_IGNORE_ICON_BOXES(SCF(*ps
), 0);
1741 S_SET_DO_IGNORE_ICON_BOXES(SCM(*ps
), 1);
1742 S_SET_DO_IGNORE_ICON_BOXES(SCC(*ps
), 1);
1743 ps
->flags
.has_icon_boxes
= 0;
1744 ps
->flag_mask
.has_icon_boxes
= 1;
1745 ps
->change_mask
.has_icon_boxes
= 1;
1749 /* otherwise try to parse the icon box */
1750 IconBoxes
= (icon_boxes
*)safemalloc(sizeof(icon_boxes
));
1752 memset(IconBoxes
, 0, sizeof(icon_boxes
));
1753 IconBoxes
->IconScreen
= FSCREEN_GLOBAL
;
1755 IconBoxes
->IconGrid
[0] = 3;
1757 IconBoxes
->IconGrid
[1] = 3;
1759 /* check for screen (for 4 numbers) */
1760 if (StrEquals(option
, "screen"))
1762 is_screen_given
= True
;
1763 option
= PeekToken(rest
, &rest
); /* skip screen */
1764 option
= PeekToken(rest
, &rest
); /* get the screen spec */
1765 IconBoxes
->IconScreen
=
1766 FScreenGetScreenArgument(option
, FSCREEN_SPEC_PRIMARY
);
1769 /* try for 4 numbers x y x y */
1770 num
= GetIntegerArguments(rest
, NULL
, val
, 4);
1775 for (i
= 0; i
< 4; i
++)
1777 /* make sure the value fits into a short */
1778 if (val
[i
] < -32768)
1786 IconBoxes
->IconBox
[i
] = val
[i
];
1787 /* If leading minus sign */
1788 option
= PeekToken(rest
, &rest
);
1789 if (option
[0] == '-')
1791 IconBoxes
->IconSign
[i
]='-';
1792 } /* end leading minus sign */
1794 /* Note: here there is no test for valid co-ords, use geom */
1796 else if (is_screen_given
)
1798 /* screen-spec is given but not 4 numbers */
1801 "IconBox requires 4 numbers if screen is given!"
1802 " Invalid: <%s>.", option
);
1805 /* forget about it */
1810 /* Not 4 numeric args dje */
1811 /* bigger than =32767x32767+32767+32767 */
1817 /* read in 1 word w/o advancing */
1818 option
= PeekToken(rest
, NULL
);
1824 if (l
> 0 && l
< 24)
1827 option
= PeekToken(rest
, &rest
);
1828 /* if word found, not too long */
1829 geom_flags
= FScreenParseGeometryWithScreen(
1830 option
, &IconBoxes
->IconBox
[0],
1831 &IconBoxes
->IconBox
[1], (unsigned int*)&width
,
1832 (unsigned int*)&height
,
1833 &IconBoxes
->IconScreen
);
1834 if (width
== 0 || !(geom_flags
& WidthValue
))
1836 /* zero width is invalid */
1839 "IconBox requires 4 numbers or"
1840 " geometry! Invalid string <%s>.",
1844 /* forget about it */
1849 /* got valid iconbox geom */
1850 if (geom_flags
& XNegative
)
1852 IconBoxes
->IconBox
[0] =
1854 IconBoxes
->IconBox
[0] -
1856 /* save for later */
1857 IconBoxes
->IconSign
[0]='-';
1858 IconBoxes
->IconSign
[2]='-';
1860 if (geom_flags
& YNegative
)
1862 IconBoxes
->IconBox
[1] =
1864 IconBoxes
->IconBox
[1]
1866 /* save for later */
1867 IconBoxes
->IconSign
[1]='-';
1868 IconBoxes
->IconSign
[3]='-';
1870 /* x + wid = right x */
1871 IconBoxes
->IconBox
[2] =
1872 width
+ IconBoxes
->IconBox
[0];
1873 /* y + height = bottom y */
1874 IconBoxes
->IconBox
[3] =
1875 height
+ IconBoxes
->IconBox
[1];
1876 } /* end icon geom worked */
1880 /* no word or too long; drop the box */
1882 /* forget about it */
1884 } /* end word found, not too long */
1885 } /* end not 4 args */
1886 /* If we created an IconBox, put it in the chain. */
1890 if (SGET_ICON_BOXES(*ps
) == 0)
1892 /* first one, chain to root */
1893 SSET_ICON_BOXES(*ps
, IconBoxes
);
1897 /* else not first one, add to end of chain */
1898 (*ret_ib
)->next
= IconBoxes
;
1899 } /* end not first one */
1900 /* new current box. save for grid */
1901 (*ret_ib
) = IconBoxes
;
1902 } /* end no error */
1903 S_SET_DO_IGNORE_ICON_BOXES(SCF(*ps
), 0);
1904 S_SET_DO_IGNORE_ICON_BOXES(SCM(*ps
), 1);
1905 S_SET_DO_IGNORE_ICON_BOXES(SCC(*ps
), 1);
1906 ps
->flags
.has_icon_boxes
= !!(SGET_ICON_BOXES(*ps
));
1907 ps
->flag_mask
.has_icon_boxes
= 1;
1908 ps
->change_mask
.has_icon_boxes
= 1;
1913 static char *style_parse_icon_grid_style(
1914 char *option
, char *rest
, window_style
*ps
, icon_boxes
*ib
)
1920 /* The grid always affects the prior iconbox */
1923 /* If no current box */
1926 "IconGrid must follow an IconBox in same Style"
1930 /* have a place to grid */
1932 num
= GetIntegerArguments(rest
, &rest
, val
, 2);
1933 if (num
!= 2 || val
[0] < 1 || val
[1] < 1)
1937 "IconGrid needs 2 numbers > 0. Got %d numbers."
1938 " x=%d y=%d!", num
, val
[0], val
[1]);
1940 ib
->IconGrid
[0] = 3;
1941 ib
->IconGrid
[1] = 3;
1945 for (i
= 0; i
< 2; i
++)
1947 ib
->IconGrid
[i
] = val
[i
];
1949 } /* end bad grid */
1954 static char *style_parse_icon_fill_style(
1955 char *option
, char *rest
, window_style
*ps
, icon_boxes
*ib
)
1957 /* first type direction parsed */
1958 unsigned char IconFill_1
;
1959 /* second type direction parsed */
1960 unsigned char IconFill_2
;
1962 /* direction to fill iconbox */
1963 /* The fill always affects the prior iconbox */
1966 /* If no current box */
1969 "IconFill must follow an IconBox in same Style"
1973 /* have a place to fill */
1974 option
= PeekToken(rest
, &rest
);
1975 /* top/bot/lft/rgt */
1976 if (!option
|| Get_TBLR(option
, &IconFill_1
) == 0)
1985 "IconFill must be followed by T|B|R|L, found"
1989 /* first word valid */
1991 /* read in second word */
1992 option
= PeekToken(rest
, &rest
);
1993 /* top/bot/lft/rgt */
1994 if (!option
|| Get_TBLR(option
, &IconFill_2
) == 0)
2003 "IconFill must be followed by T|B|R|L,"
2004 " found %s.", option
);
2007 if ((IconFill_1
& ICONFILLHRZ
) == (IconFill_2
& ICONFILLHRZ
))
2011 "IconFill must specify a horizontal"
2012 " and vertical direction.");
2016 /* merge in flags */
2017 ib
->IconFlags
|= IconFill_1
;
2018 /* ignore horiz in 2nd arg */
2019 IconFill_2
&= ~ICONFILLHRZ
;
2020 /* merge in flags */
2021 ib
->IconFlags
|= IconFill_2
;
2026 static Bool
style_parse_one_style_option(
2027 char *token
, char *rest
, char **ret_rest
, char *prefix
,
2028 window_style
*ps
, icon_boxes
**cur_ib
)
2030 window_style
*add_style
;
2031 /* work area for button number */
2034 int tmpno
[3] = { -1, -1, -1 };
2039 char *token_l
= NULL
;
2043 while (token
[0] == '!')
2048 if (prefix
!= NULL
&& *prefix
!= 0)
2053 if (strncasecmp(token
, prefix
, l
) != 0)
2055 /* add missing prefix */
2056 token_l
= (char *)safemalloc(l
+ strlen(token
) + 1);
2057 strcpy(token_l
, prefix
);
2058 strcat(token_l
, token
);
2062 switch (tolower(token
[0]))
2065 if (StrEquals(token
, "ACTIVEPLACEMENT"))
2067 ps
->flags
.placement_mode
&= (~PLACE_RANDOM
);
2068 ps
->flag_mask
.placement_mode
|= PLACE_RANDOM
;
2069 ps
->change_mask
.placement_mode
|= PLACE_RANDOM
;
2071 else if (StrEquals(token
, "ACTIVEPLACEMENTHONORSSTARTSONPAGE"))
2073 ps
->flags
.manual_placement_honors_starts_on_page
= on
;
2074 ps
->flag_mask
.manual_placement_honors_starts_on_page
=
2076 ps
->change_mask
.manual_placement_honors_starts_on_page
2080 token
, "ACTIVEPLACEMENTIGNORESSTARTSONPAGE"))
2082 ps
->flags
.manual_placement_honors_starts_on_page
= !on
;
2083 ps
->flag_mask
.manual_placement_honors_starts_on_page
=
2085 ps
->change_mask
.manual_placement_honors_starts_on_page
2088 else if (StrEquals(token
, "AllowRestack"))
2090 S_SET_DO_IGNORE_RESTACK(SCF(*ps
), !on
);
2091 S_SET_DO_IGNORE_RESTACK(SCM(*ps
), 1);
2092 S_SET_DO_IGNORE_RESTACK(SCC(*ps
), 1);
2094 else if (StrEquals(token
, "AllowMaximizeFixedSize"))
2096 S_SET_MAXIMIZE_FIXED_SIZE_DISALLOWED(SCF(*ps
), !on
);
2097 S_SET_MAXIMIZE_FIXED_SIZE_DISALLOWED(SCM(*ps
), 1);
2098 S_SET_MAXIMIZE_FIXED_SIZE_DISALLOWED(SCC(*ps
), 1);
2107 if (StrEquals(token
, "BackColor"))
2109 rest
= GetNextToken(rest
, &token
);
2112 SAFEFREE(SGET_BACK_COLOR_NAME(*ps
));
2113 SSET_BACK_COLOR_NAME(*ps
, token
);
2114 ps
->flags
.has_color_back
= 1;
2115 ps
->flag_mask
.has_color_back
= 1;
2116 ps
->change_mask
.has_color_back
= 1;
2117 ps
->flags
.use_colorset
= 0;
2118 ps
->flag_mask
.use_colorset
= 1;
2119 ps
->change_mask
.use_colorset
= 1;
2124 ERR
, "style_parse_on_estyle_option",
2125 "Style BackColor requires color"
2129 else if (StrEquals(token
, "Button"))
2131 rest
= style_parse_button_style(ps
, rest
, on
);
2133 else if (StrEquals(token
, "BorderWidth"))
2135 if (GetIntegerArguments(rest
, &rest
, val
, 1))
2137 SSET_BORDER_WIDTH(*ps
, (short)*val
);
2138 ps
->flags
.has_border_width
= 1;
2139 ps
->flag_mask
.has_border_width
= 1;
2140 ps
->change_mask
.has_border_width
= 1;
2144 ps
->flags
.has_border_width
= 0;
2145 ps
->flag_mask
.has_border_width
= 1;
2146 ps
->change_mask
.has_border_width
= 1;
2149 else if (StrEquals(token
, "BackingStore"))
2151 ps
->flags
.use_backing_store
= BACKINGSTORE_ON
;
2152 ps
->flag_mask
.use_backing_store
= BACKINGSTORE_MASK
;
2153 ps
->change_mask
.use_backing_store
= BACKINGSTORE_MASK
;
2155 else if (StrEquals(token
, "BackingStoreOff"))
2157 ps
->flags
.use_backing_store
= BACKINGSTORE_OFF
;
2158 ps
->flag_mask
.use_backing_store
= BACKINGSTORE_MASK
;
2159 ps
->change_mask
.use_backing_store
= BACKINGSTORE_MASK
;
2161 else if (StrEquals(token
, "BackingStoreWindowDefault"))
2163 ps
->flags
.use_backing_store
= BACKINGSTORE_DEFAULT
;
2164 ps
->flag_mask
.use_backing_store
= BACKINGSTORE_MASK
;
2165 ps
->change_mask
.use_backing_store
= BACKINGSTORE_MASK
;
2167 else if (StrEquals(token
, "BorderColorset"))
2170 GetIntegerArguments(rest
, &rest
, val
, 1);
2171 SSET_BORDER_COLORSET(*ps
, *val
);
2172 alloc_colorset(*val
);
2173 ps
->flags
.use_border_colorset
= (*val
>= 0);
2174 ps
->flag_mask
.use_border_colorset
= 1;
2175 ps
->change_mask
.use_border_colorset
= 1;
2177 else if (StrEquals(token
, "BottomTitleRotated"))
2179 S_SET_IS_BOTTOM_TITLE_ROTATED(SCF(*ps
), on
);
2180 S_SET_IS_BOTTOM_TITLE_ROTATED(SCM(*ps
), 1);
2181 S_SET_IS_BOTTOM_TITLE_ROTATED(SCC(*ps
), 1);
2183 else if (StrEquals(token
, "BottomTitleNotRotated"))
2185 S_SET_IS_BOTTOM_TITLE_ROTATED(SCF(*ps
), !on
);
2186 S_SET_IS_BOTTOM_TITLE_ROTATED(SCM(*ps
), 1);
2187 S_SET_IS_BOTTOM_TITLE_ROTATED(SCC(*ps
), 1);
2189 else if (StrEquals(token
, "Borders"))
2191 S_SET_HAS_NO_BORDER(SCF(*ps
), !on
);
2192 S_SET_HAS_NO_BORDER(SCM(*ps
), 1);
2193 S_SET_HAS_NO_BORDER(SCC(*ps
), 1);
2202 if (StrEquals(token
, "CascadePlacement"))
2204 ps
->flags
.placement_mode
= PLACE_CASCADE
;
2205 ps
->flag_mask
.placement_mode
= PLACE_MASK
;
2206 ps
->change_mask
.placement_mode
= PLACE_MASK
;
2208 else if (StrEquals(token
, "CLEVERPLACEMENT"))
2210 ps
->flags
.placement_mode
|= PLACE_CLEVER
;
2211 ps
->flag_mask
.placement_mode
|= PLACE_CLEVER
;
2212 ps
->change_mask
.placement_mode
|= PLACE_CLEVER
;
2214 else if (StrEquals(token
, "CleverPlacementOff"))
2216 ps
->flags
.placement_mode
&= (~PLACE_CLEVER
);
2217 ps
->flag_mask
.placement_mode
|= PLACE_CLEVER
;
2218 ps
->change_mask
.placement_mode
|= PLACE_CLEVER
;
2220 else if (StrEquals(token
, "CaptureHonorsStartsOnPage"))
2222 ps
->flags
.capture_honors_starts_on_page
= on
;
2223 ps
->flag_mask
.capture_honors_starts_on_page
= 1;
2224 ps
->change_mask
.capture_honors_starts_on_page
= 1;
2226 else if (StrEquals(token
, "CaptureIgnoresStartsonPage"))
2228 ps
->flags
.capture_honors_starts_on_page
= !on
;
2229 ps
->flag_mask
.capture_honors_starts_on_page
= 1;
2230 ps
->change_mask
.capture_honors_starts_on_page
= 1;
2232 else if (StrEquals(token
, "ColorSet"))
2235 GetIntegerArguments(rest
, &rest
, val
, 1);
2240 SSET_COLORSET(*ps
, *val
);
2241 alloc_colorset(*val
);
2242 ps
->flags
.use_colorset
= (*val
>= 0);
2243 ps
->flag_mask
.use_colorset
= 1;
2244 ps
->change_mask
.use_colorset
= 1;
2246 else if (StrEquals(token
, "Color"))
2251 next
= GetNextToken(rest
, &token
);
2255 ERR
, "style_parse_one_style_option",
2256 "Color Style requires a color"
2260 if (strncasecmp(token
, "rgb:", 4) == 0)
2265 /* spool to third '/' */
2266 for (i
= 0, s
= token
+ 4; *s
&& i
< 3; s
++)
2277 /* spool to third '/' in original
2279 for (i
= 0, s
= rest
; *s
&& i
< 3; s
++)
2292 next
= DoGetNextToken(
2293 rest
, &token
, NULL
, ",/", &c
);
2296 SAFEFREE(SGET_FORE_COLOR_NAME(*ps
));
2297 SSET_FORE_COLOR_NAME(*ps
, token
);
2298 ps
->flags
.has_color_fore
= 1;
2299 ps
->flag_mask
.has_color_fore
= 1;
2300 ps
->change_mask
.has_color_fore
= 1;
2301 ps
->flags
.use_colorset
= 0;
2302 ps
->flag_mask
.use_colorset
= 1;
2303 ps
->change_mask
.use_colorset
= 1;
2308 while (rest
&& *rest
&&
2309 isspace((unsigned char)*rest
) &&
2310 *rest
!= ',' && *rest
!= '/')
2320 rest
=GetNextToken(rest
, &token
);
2324 ERR
, "style_parse_one_style_option",
2325 "Color Style called with incomplete"
2326 " color argument.");
2329 SAFEFREE(SGET_BACK_COLOR_NAME(*ps
));
2330 SSET_BACK_COLOR_NAME(*ps
, token
);
2331 ps
->flags
.has_color_back
= 1;
2332 ps
->flag_mask
.has_color_back
= 1;
2333 ps
->change_mask
.has_color_back
= 1;
2336 else if (StrEquals(token
, "CirculateSkipIcon"))
2338 S_SET_DO_CIRCULATE_SKIP_ICON(SCF(*ps
), on
);
2339 S_SET_DO_CIRCULATE_SKIP_ICON(SCM(*ps
), 1);
2340 S_SET_DO_CIRCULATE_SKIP_ICON(SCC(*ps
), 1);
2342 else if (StrEquals(token
, "CirculateSkipShaded"))
2344 S_SET_DO_CIRCULATE_SKIP_SHADED(SCF(*ps
), on
);
2345 S_SET_DO_CIRCULATE_SKIP_SHADED(SCM(*ps
), 1);
2346 S_SET_DO_CIRCULATE_SKIP_SHADED(SCC(*ps
), 1);
2348 else if (StrEquals(token
, "CirculateHitShaded"))
2350 S_SET_DO_CIRCULATE_SKIP_SHADED(SCF(*ps
), !on
);
2351 S_SET_DO_CIRCULATE_SKIP_SHADED(SCM(*ps
), 1);
2352 S_SET_DO_CIRCULATE_SKIP_SHADED(SCC(*ps
), 1);
2354 else if (StrEquals(token
, "CirculateHitIcon"))
2356 S_SET_DO_CIRCULATE_SKIP_ICON(SCF(*ps
), !on
);
2357 S_SET_DO_CIRCULATE_SKIP_ICON(SCM(*ps
), 1);
2358 S_SET_DO_CIRCULATE_SKIP_ICON(SCC(*ps
), 1);
2360 else if (StrEquals(token
, "ClickToFocus"))
2362 style_set_old_focus_policy(ps
, 0);
2364 else if (StrEquals(token
, "ClickToFocusPassesClick"))
2366 FPS_PASS_FOCUS_CLICK(S_FOCUS_POLICY(SCF(*ps
)), on
);
2367 FPS_PASS_FOCUS_CLICK(S_FOCUS_POLICY(SCM(*ps
)), 1);
2368 FPS_PASS_FOCUS_CLICK(S_FOCUS_POLICY(SCC(*ps
)), 1);
2369 FPS_PASS_RAISE_CLICK(S_FOCUS_POLICY(SCF(*ps
)), on
);
2370 FPS_PASS_RAISE_CLICK(S_FOCUS_POLICY(SCM(*ps
)), 1);
2371 FPS_PASS_RAISE_CLICK(S_FOCUS_POLICY(SCC(*ps
)), 1);
2373 else if (StrEquals(token
, "ClickToFocusPassesClickOff"))
2375 FPS_PASS_FOCUS_CLICK(S_FOCUS_POLICY(SCF(*ps
)), !on
);
2376 FPS_PASS_FOCUS_CLICK(S_FOCUS_POLICY(SCM(*ps
)), 1);
2377 FPS_PASS_FOCUS_CLICK(S_FOCUS_POLICY(SCC(*ps
)), 1);
2378 FPS_PASS_RAISE_CLICK(S_FOCUS_POLICY(SCF(*ps
)), !on
);
2379 FPS_PASS_RAISE_CLICK(S_FOCUS_POLICY(SCM(*ps
)), 1);
2380 FPS_PASS_RAISE_CLICK(S_FOCUS_POLICY(SCC(*ps
)), 1);
2382 else if (StrEquals(token
, "ClickToFocusRaises"))
2384 FPS_RAISE_FOCUSED_CLIENT_CLICK(
2385 S_FOCUS_POLICY(SCF(*ps
)), on
);
2386 FPS_RAISE_FOCUSED_CLIENT_CLICK(
2387 S_FOCUS_POLICY(SCM(*ps
)), 1);
2388 FPS_RAISE_FOCUSED_CLIENT_CLICK(
2389 S_FOCUS_POLICY(SCC(*ps
)), 1);
2390 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(
2391 S_FOCUS_POLICY(SCF(*ps
)), on
);
2392 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(
2393 S_FOCUS_POLICY(SCM(*ps
)), 1);
2394 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(
2395 S_FOCUS_POLICY(SCC(*ps
)), 1);
2397 else if (StrEquals(token
, "ClickToFocusRaisesOff"))
2399 FPS_RAISE_FOCUSED_CLIENT_CLICK(
2400 S_FOCUS_POLICY(SCF(*ps
)), !on
);
2401 FPS_RAISE_FOCUSED_CLIENT_CLICK(
2402 S_FOCUS_POLICY(SCM(*ps
)), 1);
2403 FPS_RAISE_FOCUSED_CLIENT_CLICK(
2404 S_FOCUS_POLICY(SCC(*ps
)), 1);
2405 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(
2406 S_FOCUS_POLICY(SCF(*ps
)), !on
);
2407 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(
2408 S_FOCUS_POLICY(SCM(*ps
)), 1);
2409 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(
2410 S_FOCUS_POLICY(SCC(*ps
)), 1);
2412 else if (StrEquals(token
, "CirculateSkip"))
2414 S_SET_DO_CIRCULATE_SKIP(SCF(*ps
), on
);
2415 S_SET_DO_CIRCULATE_SKIP(SCM(*ps
), 1);
2416 S_SET_DO_CIRCULATE_SKIP(SCC(*ps
), 1);
2418 else if (StrEquals(token
, "CirculateHit"))
2420 S_SET_DO_CIRCULATE_SKIP(SCF(*ps
), !on
);
2421 S_SET_DO_CIRCULATE_SKIP(SCM(*ps
), 1);
2422 S_SET_DO_CIRCULATE_SKIP(SCC(*ps
), 1);
2424 else if (StrEquals(token
, "Closable"))
2426 S_SET_IS_UNCLOSABLE(SCF(*ps
), !on
);
2427 S_SET_IS_UNCLOSABLE(SCM(*ps
), 1);
2428 S_SET_IS_UNCLOSABLE(SCC(*ps
), 1);
2437 if (StrEquals(token
, "DepressableBorder"))
2439 S_SET_HAS_DEPRESSABLE_BORDER(SCF(*ps
), on
);
2440 S_SET_HAS_DEPRESSABLE_BORDER(SCM(*ps
), 1);
2441 S_SET_HAS_DEPRESSABLE_BORDER(SCC(*ps
), 1);
2443 else if (StrEquals(token
, "DecorateTransient"))
2445 ps
->flags
.do_decorate_transient
= on
;
2446 ps
->flag_mask
.do_decorate_transient
= 1;
2447 ps
->change_mask
.do_decorate_transient
= 1;
2449 else if (StrEquals(token
, "DumbPlacement"))
2451 ps
->flags
.placement_mode
&= (~PLACE_SMART
);
2452 ps
->flag_mask
.placement_mode
|= PLACE_SMART
;
2453 ps
->change_mask
.placement_mode
|= PLACE_SMART
;
2455 else if (StrEquals(token
, "DONTRAISETRANSIENT"))
2457 S_SET_DO_RAISE_TRANSIENT(SCF(*ps
), !on
);
2458 S_SET_DO_RAISE_TRANSIENT(SCM(*ps
), 1);
2459 S_SET_DO_RAISE_TRANSIENT(SCC(*ps
), 1);
2461 else if (StrEquals(token
, "DONTLOWERTRANSIENT"))
2463 S_SET_DO_LOWER_TRANSIENT(SCF(*ps
), !on
);
2464 S_SET_DO_LOWER_TRANSIENT(SCM(*ps
), 1);
2465 S_SET_DO_LOWER_TRANSIENT(SCC(*ps
), 1);
2467 else if (StrEquals(token
, "DontStackTransientParent"))
2469 S_SET_DO_STACK_TRANSIENT_PARENT(SCF(*ps
), !on
);
2470 S_SET_DO_STACK_TRANSIENT_PARENT(SCM(*ps
), 1);
2471 S_SET_DO_STACK_TRANSIENT_PARENT(SCC(*ps
), 1);
2480 if (StrEquals(token
, "ExactWindowName"))
2482 S_SET_USE_INDEXED_WINDOW_NAME(SCF(*ps
), !on
);
2483 S_SET_USE_INDEXED_WINDOW_NAME(SCM(*ps
), 1);
2484 S_SET_USE_INDEXED_WINDOW_NAME(SCC(*ps
), 1);
2486 else if (StrEquals(token
, "ExactIconName"))
2488 S_SET_USE_INDEXED_ICON_NAME(SCF(*ps
), !on
);
2489 S_SET_USE_INDEXED_ICON_NAME(SCM(*ps
), 1);
2490 S_SET_USE_INDEXED_ICON_NAME(SCC(*ps
), 1);
2492 else if (StrEquals(token
, "EdgeMoveResistance"))
2496 unsigned has_xinerama_move
;
2498 num
= GetIntegerArguments(rest
, &rest
, val
, 2);
2502 has_xinerama_move
= 0;
2507 has_xinerama_move
= 1;
2514 has_xinerama_move
= 0;
2524 ps
->flags
.has_edge_resistance_move
= has_move
;
2525 ps
->flag_mask
.has_edge_resistance_move
= 1;
2526 ps
->change_mask
.has_edge_resistance_move
= 1;
2527 SSET_EDGE_RESISTANCE_MOVE(*ps
, val
[0]);
2528 ps
->flags
.has_edge_resistance_xinerama_move
=
2530 ps
->flag_mask
.has_edge_resistance_xinerama_move
= 1;
2531 ps
->change_mask
.has_edge_resistance_xinerama_move
= 1;
2532 SSET_EDGE_RESISTANCE_XINERAMA_MOVE(*ps
, val
[1]);
2534 else if (StrEquals(token
, "EdgeMoveDelay"))
2536 if (GetIntegerArguments(rest
, &rest
, val
, 1))
2538 SSET_EDGE_DELAY_MS_MOVE(*ps
, (short)*val
);
2539 ps
->flags
.has_edge_delay_ms_move
= 1;
2540 ps
->flag_mask
.has_edge_delay_ms_move
= 1;
2541 ps
->change_mask
.has_edge_delay_ms_move
= 1;
2545 ps
->flags
.has_edge_delay_ms_move
= 0;
2546 ps
->flag_mask
.has_edge_delay_ms_move
= 1;
2547 ps
->change_mask
.has_edge_delay_ms_move
= 1;
2550 else if (StrEquals(token
, "EdgeResizeDelay"))
2552 if (GetIntegerArguments(rest
, &rest
, val
, 1))
2554 SSET_EDGE_DELAY_MS_RESIZE(*ps
, (short)*val
);
2555 ps
->flags
.has_edge_delay_ms_resize
= 1;
2556 ps
->flag_mask
.has_edge_delay_ms_resize
= 1;
2557 ps
->change_mask
.has_edge_delay_ms_resize
= 1;
2561 ps
->flags
.has_edge_delay_ms_resize
= 0;
2562 ps
->flag_mask
.has_edge_delay_ms_resize
= 1;
2563 ps
->change_mask
.has_edge_delay_ms_resize
= 1;
2568 found
= EWMH_CMD_Style(token
, ps
, on
);
2573 if (strncasecmp(token
, "fp", 2) == 0)
2575 /* parse focus policy options */
2576 found
= style_parse_focus_policy_style(
2577 token
+ 2, rest
, &rest
, (on
) ? False
: True
,
2578 &S_FOCUS_POLICY(SCF(*ps
)),
2579 &S_FOCUS_POLICY(SCM(*ps
)),
2580 &S_FOCUS_POLICY(SCC(*ps
)));
2582 else if (StrEquals(token
, "Font"))
2584 SAFEFREE(SGET_WINDOW_FONT(*ps
));
2585 rest
= GetNextToken(rest
, &token
);
2586 SSET_WINDOW_FONT(*ps
, token
);
2587 S_SET_HAS_WINDOW_FONT(SCF(*ps
), (token
!= NULL
));
2588 S_SET_HAS_WINDOW_FONT(SCM(*ps
), 1);
2589 S_SET_HAS_WINDOW_FONT(SCC(*ps
), 1);
2592 else if (StrEquals(token
, "ForeColor"))
2594 rest
= GetNextToken(rest
, &token
);
2597 SAFEFREE(SGET_FORE_COLOR_NAME(*ps
));
2598 SSET_FORE_COLOR_NAME(*ps
, token
);
2599 ps
->flags
.has_color_fore
= 1;
2600 ps
->flag_mask
.has_color_fore
= 1;
2601 ps
->change_mask
.has_color_fore
= 1;
2602 ps
->flags
.use_colorset
= 0;
2603 ps
->flag_mask
.use_colorset
= 1;
2604 ps
->change_mask
.use_colorset
= 1;
2609 ERR
, "style_parse_one_style_option",
2610 "ForeColor Style needs color argument"
2614 else if (StrEquals(token
, "FVWMBUTTONS"))
2616 S_SET_HAS_MWM_BUTTONS(SCF(*ps
), !on
);
2617 S_SET_HAS_MWM_BUTTONS(SCM(*ps
), 1);
2618 S_SET_HAS_MWM_BUTTONS(SCC(*ps
), 1);
2620 else if (StrEquals(token
, "FVWMBORDER"))
2622 S_SET_HAS_MWM_BORDER(SCF(*ps
), !on
);
2623 S_SET_HAS_MWM_BORDER(SCM(*ps
), 1);
2624 S_SET_HAS_MWM_BORDER(SCC(*ps
), 1);
2626 else if (StrEquals(token
, "FocusFollowsMouse"))
2628 style_set_old_focus_policy(ps
, 1);
2630 else if (StrEquals(token
, "FirmBorder"))
2632 S_SET_HAS_DEPRESSABLE_BORDER(SCF(*ps
), !on
);
2633 S_SET_HAS_DEPRESSABLE_BORDER(SCM(*ps
), 1);
2634 S_SET_HAS_DEPRESSABLE_BORDER(SCC(*ps
), 1);
2636 else if (StrEquals(token
, "FixedPosition") ||
2637 StrEquals(token
, "FixedUSPosition"))
2639 S_SET_IS_FIXED(SCF(*ps
), on
);
2640 S_SET_IS_FIXED(SCM(*ps
), 1);
2641 S_SET_IS_FIXED(SCC(*ps
), 1);
2643 else if (StrEquals(token
, "FixedPPosition"))
2645 S_SET_IS_FIXED_PPOS(SCF(*ps
), on
);
2646 S_SET_IS_FIXED_PPOS(SCM(*ps
), 1);
2647 S_SET_IS_FIXED_PPOS(SCC(*ps
), 1);
2649 else if (StrEquals(token
, "FixedSize") ||
2650 StrEquals(token
, "FixedUSSize"))
2652 S_SET_IS_SIZE_FIXED(SCF(*ps
), on
);
2653 S_SET_IS_SIZE_FIXED(SCM(*ps
), 1);
2654 S_SET_IS_SIZE_FIXED(SCC(*ps
), 1);
2656 else if (StrEquals(token
, "FixedPSize"))
2658 S_SET_IS_PSIZE_FIXED(SCF(*ps
), on
);
2659 S_SET_IS_PSIZE_FIXED(SCM(*ps
), 1);
2660 S_SET_IS_PSIZE_FIXED(SCC(*ps
), 1);
2669 if (StrEquals(token
, "GrabFocusOff"))
2671 FPS_GRAB_FOCUS(S_FOCUS_POLICY(SCF(*ps
)), !on
);
2672 FPS_GRAB_FOCUS(S_FOCUS_POLICY(SCM(*ps
)), 1);
2673 FPS_GRAB_FOCUS(S_FOCUS_POLICY(SCC(*ps
)), 1);
2675 else if (StrEquals(token
, "GrabFocus"))
2677 FPS_GRAB_FOCUS(S_FOCUS_POLICY(SCF(*ps
)), on
);
2678 FPS_GRAB_FOCUS(S_FOCUS_POLICY(SCM(*ps
)), 1);
2679 FPS_GRAB_FOCUS(S_FOCUS_POLICY(SCC(*ps
)), 1);
2681 else if (StrEquals(token
, "GrabFocusTransientOff"))
2683 FPS_GRAB_FOCUS_TRANSIENT(
2684 S_FOCUS_POLICY(SCF(*ps
)), !on
);
2685 FPS_GRAB_FOCUS_TRANSIENT(S_FOCUS_POLICY(SCM(*ps
)), 1);
2686 FPS_GRAB_FOCUS_TRANSIENT(S_FOCUS_POLICY(SCC(*ps
)), 1);
2688 else if (StrEquals(token
, "GrabFocusTransient"))
2690 FPS_GRAB_FOCUS_TRANSIENT(S_FOCUS_POLICY(SCF(*ps
)), on
);
2691 FPS_GRAB_FOCUS_TRANSIENT(S_FOCUS_POLICY(SCM(*ps
)), 1);
2692 FPS_GRAB_FOCUS_TRANSIENT(S_FOCUS_POLICY(SCC(*ps
)), 1);
2694 else if (StrEquals(token
, "GNOMEIgnoreHints"))
2696 S_SET_DO_IGNORE_GNOME_HINTS(SCF(*ps
), on
);
2697 S_SET_DO_IGNORE_GNOME_HINTS(SCM(*ps
), 1);
2698 S_SET_DO_IGNORE_GNOME_HINTS(SCC(*ps
), 1);
2700 else if (StrEquals(token
, "GNOMEUseHints"))
2702 S_SET_DO_IGNORE_GNOME_HINTS(SCF(*ps
), !on
);
2703 S_SET_DO_IGNORE_GNOME_HINTS(SCM(*ps
), 1);
2704 S_SET_DO_IGNORE_GNOME_HINTS(SCC(*ps
), 1);
2713 if (StrEquals(token
, "HintOverride"))
2715 S_SET_HAS_MWM_OVERRIDE(SCF(*ps
), on
);
2716 S_SET_HAS_MWM_OVERRIDE(SCM(*ps
), 1);
2717 S_SET_HAS_MWM_OVERRIDE(SCC(*ps
), 1);
2719 else if (StrEquals(token
, "Handles"))
2721 ps
->flags
.has_no_handles
= !on
;
2722 ps
->flag_mask
.has_no_handles
= 1;
2723 ps
->change_mask
.has_no_handles
= 1;
2725 else if (StrEquals(token
, "HandleWidth"))
2727 if (GetIntegerArguments(rest
, &rest
, val
, 1))
2729 SSET_HANDLE_WIDTH(*ps
, (short)*val
);
2730 ps
->flags
.has_handle_width
= 1;
2731 ps
->flag_mask
.has_handle_width
= 1;
2732 ps
->change_mask
.has_handle_width
= 1;
2736 ps
->flags
.has_handle_width
= 0;
2737 ps
->flag_mask
.has_handle_width
= 1;
2738 ps
->change_mask
.has_handle_width
= 1;
2741 else if (StrEquals(token
, "HilightFore"))
2743 rest
= GetNextToken(rest
, &token
);
2746 SAFEFREE(SGET_FORE_COLOR_NAME_HI(*ps
));
2747 SSET_FORE_COLOR_NAME_HI(*ps
, token
);
2748 ps
->flags
.has_color_fore_hi
= 1;
2749 ps
->flag_mask
.has_color_fore_hi
= 1;
2750 ps
->change_mask
.has_color_fore_hi
= 1;
2751 ps
->flags
.use_colorset_hi
= 0;
2752 ps
->flag_mask
.use_colorset_hi
= 1;
2753 ps
->change_mask
.use_colorset_hi
= 1;
2758 ERR
, "style_parse_one_style_option",
2759 "HilightFore Style needs color"
2763 else if (StrEquals(token
, "HilightBack"))
2765 rest
= GetNextToken(rest
, &token
);
2768 SAFEFREE(SGET_BACK_COLOR_NAME_HI(*ps
));
2769 SSET_BACK_COLOR_NAME_HI(*ps
, token
);
2770 ps
->flags
.has_color_back_hi
= 1;
2771 ps
->flag_mask
.has_color_back_hi
= 1;
2772 ps
->change_mask
.has_color_back_hi
= 1;
2773 ps
->flags
.use_colorset_hi
= 0;
2774 ps
->flag_mask
.use_colorset_hi
= 1;
2775 ps
->change_mask
.use_colorset_hi
= 1;
2780 ERR
, "style_parse_one_style_option",
2781 "HilightBack Style needs color"
2785 else if (StrEquals(token
, "HilightColorset"))
2788 GetIntegerArguments(rest
, &rest
, val
, 1);
2789 SSET_COLORSET_HI(*ps
, *val
);
2790 alloc_colorset(*val
);
2791 ps
->flags
.use_colorset_hi
= (*val
>= 0);
2792 ps
->flag_mask
.use_colorset_hi
= 1;
2793 ps
->change_mask
.use_colorset_hi
= 1;
2795 else if (StrEquals(token
, "HilightBorderColorset"))
2798 GetIntegerArguments(rest
, &rest
, val
, 1);
2799 SSET_BORDER_COLORSET_HI(*ps
, *val
);
2800 alloc_colorset(*val
);
2801 ps
->flags
.use_border_colorset_hi
= (*val
>= 0);
2802 ps
->flag_mask
.use_border_colorset_hi
= 1;
2803 ps
->change_mask
.use_border_colorset_hi
= 1;
2805 else if (StrEquals(token
, "HilightIconTitleColorset"))
2808 GetIntegerArguments(rest
, &rest
, val
, 1);
2809 SSET_ICON_TITLE_COLORSET_HI(*ps
, *val
);
2810 alloc_colorset(*val
);
2811 ps
->flags
.use_icon_title_colorset_hi
= (*val
>= 0);
2812 ps
->flag_mask
.use_icon_title_colorset_hi
= 1;
2813 ps
->change_mask
.use_icon_title_colorset_hi
= 1;
2822 if (StrEquals(token
, "Icon"))
2826 rest
= GetNextToken(rest
, &token
);
2828 SAFEFREE(SGET_ICON_NAME(*ps
));
2829 SSET_ICON_NAME(*ps
,token
);
2830 ps
->flags
.has_icon
= (token
!= NULL
);
2831 ps
->flag_mask
.has_icon
= 1;
2832 ps
->change_mask
.has_icon
= 1;
2834 S_SET_IS_ICON_SUPPRESSED(SCF(*ps
), 0);
2835 S_SET_IS_ICON_SUPPRESSED(SCM(*ps
), 1);
2836 S_SET_IS_ICON_SUPPRESSED(SCC(*ps
), 1);
2840 S_SET_IS_ICON_SUPPRESSED(SCF(*ps
), 1);
2841 S_SET_IS_ICON_SUPPRESSED(SCM(*ps
), 1);
2842 S_SET_IS_ICON_SUPPRESSED(SCC(*ps
), 1);
2845 else if (StrEquals(token
, "IconBackgroundColorset"))
2848 GetIntegerArguments(rest
, &rest
, val
, 1);
2849 SSET_ICON_BACKGROUND_COLORSET(*ps
, *val
);
2850 alloc_colorset(*val
);
2851 ps
->flags
.use_icon_background_colorset
= (*val
>= 0);
2852 ps
->flag_mask
.use_icon_background_colorset
= 1;
2853 ps
->change_mask
.use_icon_background_colorset
= 1;
2855 else if (StrEquals(token
, "IconBackgroundPadding"))
2857 *val
= ICON_BACKGROUND_PADDING
;
2858 GetIntegerArguments(rest
, &rest
, val
, 1);
2867 SSET_ICON_BACKGROUND_PADDING(*ps
, (unsigned char)*val
);
2868 ps
->flags
.has_icon_background_padding
= 1;
2869 ps
->flag_mask
.has_icon_background_padding
= 1;
2870 ps
->change_mask
.has_icon_background_padding
= 1;
2872 else if (StrEquals(token
, "IconBackgroundRelief"))
2874 *val
= ICON_RELIEF_WIDTH
;
2875 GetIntegerArguments(rest
, &rest
, val
, 1);
2884 SSET_ICON_BACKGROUND_RELIEF(*ps
, (signed char)*val
);
2885 ps
->flags
.has_icon_background_relief
= 1;
2886 ps
->flag_mask
.has_icon_background_relief
= 1;
2887 ps
->change_mask
.has_icon_background_relief
= 1;
2889 else if (StrEquals(token
, "IconFont"))
2891 SAFEFREE(SGET_ICON_FONT(*ps
));
2892 rest
= GetNextToken(rest
, &token
);
2893 SSET_ICON_FONT(*ps
, token
);
2894 S_SET_HAS_ICON_FONT(SCF(*ps
), (token
!= NULL
));
2895 S_SET_HAS_ICON_FONT(SCM(*ps
), 1);
2896 S_SET_HAS_ICON_FONT(SCC(*ps
), 1);
2899 else if (StrEquals(token
, "IconOverride"))
2901 S_SET_ICON_OVERRIDE(SCF(*ps
), ICON_OVERRIDE
);
2902 S_SET_ICON_OVERRIDE(SCM(*ps
), ICON_OVERRIDE_MASK
);
2903 S_SET_ICON_OVERRIDE(SCC(*ps
), ICON_OVERRIDE_MASK
);
2905 else if (StrEquals(token
, "IgnoreRestack"))
2907 S_SET_DO_IGNORE_RESTACK(SCF(*ps
), on
);
2908 S_SET_DO_IGNORE_RESTACK(SCM(*ps
), 1);
2909 S_SET_DO_IGNORE_RESTACK(SCC(*ps
), 1);
2911 else if (StrEquals(token
, "IconTitle"))
2913 S_SET_HAS_NO_ICON_TITLE(SCF(*ps
), !on
);
2914 S_SET_HAS_NO_ICON_TITLE(SCM(*ps
), 1);
2915 S_SET_HAS_NO_ICON_TITLE(SCC(*ps
), 1);
2917 else if (StrEquals(token
, "IconTitleColorset"))
2920 GetIntegerArguments(rest
,&rest
, val
, 1);
2921 SSET_ICON_TITLE_COLORSET(*ps
, *val
);
2922 alloc_colorset(*val
);
2923 ps
->flags
.use_icon_title_colorset
= (*val
>= 0);
2924 ps
->flag_mask
.use_icon_title_colorset
= 1;
2925 ps
->change_mask
.use_icon_title_colorset
= 1;
2927 else if (StrEquals(token
, "IconTitleRelief"))
2929 *val
= ICON_RELIEF_WIDTH
;
2930 GetIntegerArguments(rest
, &rest
, val
, 1);
2939 SSET_ICON_TITLE_RELIEF(*ps
, (signed char)*val
);
2940 ps
->flags
.has_icon_title_relief
= 1;
2941 ps
->flag_mask
.has_icon_title_relief
= 1;
2942 ps
->change_mask
.has_icon_title_relief
= 1;
2944 else if (StrEquals(token
, "IconSize"))
2946 rest
= style_parse_icon_size_style(token
, rest
, ps
);
2948 else if (StrEquals(token
, "IconBox"))
2950 rest
= style_parse_icon_box_style(cur_ib
, token
, rest
,
2952 } /* end iconbox parameter */
2953 else if (StrEquals(token
, "ICONGRID"))
2955 rest
= style_parse_icon_grid_style(token
, rest
, ps
,
2958 else if (StrEquals(token
, "ICONFILL"))
2960 rest
= style_parse_icon_fill_style(token
, rest
, ps
,
2962 } /* end iconfill */
2963 else if (StrEquals(token
, "IconifyWindowGroups"))
2965 S_SET_DO_ICONIFY_WINDOW_GROUPS(SCF(*ps
), on
);
2966 S_SET_DO_ICONIFY_WINDOW_GROUPS(SCM(*ps
), 1);
2967 S_SET_DO_ICONIFY_WINDOW_GROUPS(SCC(*ps
), 1);
2969 else if (StrEquals(token
, "IconifyWindowGroupsOff"))
2971 S_SET_DO_ICONIFY_WINDOW_GROUPS(SCF(*ps
), !on
);
2972 S_SET_DO_ICONIFY_WINDOW_GROUPS(SCM(*ps
), 1);
2973 S_SET_DO_ICONIFY_WINDOW_GROUPS(SCC(*ps
), 1);
2975 else if (StrEquals(token
, "Iconifiable"))
2977 S_SET_IS_UNICONIFIABLE(SCF(*ps
), !on
);
2978 S_SET_IS_UNICONIFIABLE(SCM(*ps
), 1);
2979 S_SET_IS_UNICONIFIABLE(SCC(*ps
), 1);
2981 else if (StrEquals(token
, "IndexedWindowName"))
2983 S_SET_USE_INDEXED_WINDOW_NAME(SCF(*ps
), on
);
2984 S_SET_USE_INDEXED_WINDOW_NAME(SCM(*ps
), 1);
2985 S_SET_USE_INDEXED_WINDOW_NAME(SCC(*ps
), 1);
2987 else if (StrEquals(token
, "IndexedIconName"))
2989 S_SET_USE_INDEXED_ICON_NAME(SCF(*ps
), on
);
2990 S_SET_USE_INDEXED_ICON_NAME(SCM(*ps
), 1);
2991 S_SET_USE_INDEXED_ICON_NAME(SCC(*ps
), 1);
2993 else if (StrEquals(token
, "InitialMapCommand"))
2997 s
= (rest
!= NULL
) ? strdup(rest
) : NULL
;
2998 SSET_INITIAL_MAP_COMMAND_STRING(*ps
, s
);
2999 ps
->flags
.has_initial_map_command_string
= on
;
3000 ps
->flag_mask
.has_initial_map_command_string
= on
;
3001 ps
->change_mask
.has_initial_map_command_string
= 1;
3002 rest
= NULL
; /* consume the entire string */
3021 if (StrEquals(token
, "KeepWindowGroupsOnDesk"))
3023 S_SET_DO_USE_WINDOW_GROUP_HINT(SCF(*ps
), on
);
3024 S_SET_DO_USE_WINDOW_GROUP_HINT(SCM(*ps
), 1);
3025 S_SET_DO_USE_WINDOW_GROUP_HINT(SCC(*ps
), 1);
3034 if (StrEquals(token
, "LeftTitleRotatedCW"))
3036 S_SET_IS_LEFT_TITLE_ROTATED_CW(SCF(*ps
), on
);
3037 S_SET_IS_LEFT_TITLE_ROTATED_CW(SCM(*ps
), 1);
3038 S_SET_IS_LEFT_TITLE_ROTATED_CW(SCC(*ps
), 1);
3040 else if (StrEquals(token
, "LeftTitleRotatedCCW"))
3042 S_SET_IS_LEFT_TITLE_ROTATED_CW(SCF(*ps
), !on
);
3043 S_SET_IS_LEFT_TITLE_ROTATED_CW(SCM(*ps
), 1);
3044 S_SET_IS_LEFT_TITLE_ROTATED_CW(SCC(*ps
), 1);
3046 else if (StrEquals(token
, "Lenience"))
3048 FPS_LENIENT(S_FOCUS_POLICY(SCF(*ps
)), on
);
3049 FPS_LENIENT(S_FOCUS_POLICY(SCM(*ps
)), 1);
3050 FPS_LENIENT(S_FOCUS_POLICY(SCC(*ps
)), 1);
3052 else if (StrEquals(token
, "Layer"))
3055 if (GetIntegerArguments(rest
, &rest
, val
, 1) &&
3058 fvwm_msg(ERR
, "style_parse_one_style_option",
3059 "Layer must be positive or zero.");
3063 SSET_LAYER(*ps
, -9);
3064 /* mark layer unset */
3065 ps
->flags
.use_layer
= 0;
3066 ps
->flag_mask
.use_layer
= 1;
3067 ps
->change_mask
.use_layer
= 1;
3071 SSET_LAYER(*ps
, *val
);
3072 ps
->flags
.use_layer
= 1;
3073 ps
->flag_mask
.use_layer
= 1;
3074 ps
->change_mask
.use_layer
= 1;
3077 else if (StrEquals(token
, "LOWERTRANSIENT"))
3079 S_SET_DO_LOWER_TRANSIENT(SCF(*ps
), on
);
3080 S_SET_DO_LOWER_TRANSIENT(SCM(*ps
), 1);
3081 S_SET_DO_LOWER_TRANSIENT(SCC(*ps
), 1);
3090 if (StrEquals(token
, "ManualPlacement"))
3092 ps
->flags
.placement_mode
= PLACE_MANUAL
;
3093 ps
->flag_mask
.placement_mode
= PLACE_MASK
;
3094 ps
->change_mask
.placement_mode
= PLACE_MASK
;
3096 else if (StrEquals(token
, "ManualPlacementHonorsStartsOnPage"))
3098 ps
->flags
.manual_placement_honors_starts_on_page
= on
;
3099 ps
->flag_mask
.manual_placement_honors_starts_on_page
=
3101 ps
->change_mask
.manual_placement_honors_starts_on_page
3105 token
, "ManualPlacementIgnoresStartsOnPage"))
3107 ps
->flags
.manual_placement_honors_starts_on_page
= !on
;
3108 ps
->flag_mask
.manual_placement_honors_starts_on_page
=
3110 ps
->change_mask
.manual_placement_honors_starts_on_page
3113 else if (StrEquals(token
, "Maximizable"))
3115 S_SET_IS_UNMAXIMIZABLE(SCF(*ps
), !on
);
3116 S_SET_IS_UNMAXIMIZABLE(SCM(*ps
), 1);
3117 S_SET_IS_UNMAXIMIZABLE(SCC(*ps
), 1);
3119 else if (StrEquals(token
, "MinOverlapPlacement"))
3121 ps
->flags
.placement_mode
= PLACE_MINOVERLAP
;
3122 ps
->flag_mask
.placement_mode
= PLACE_MASK
;
3123 ps
->change_mask
.placement_mode
= PLACE_MASK
;
3125 else if (StrEquals(token
, "MinOverlapPercentPlacement"))
3127 ps
->flags
.placement_mode
= PLACE_MINOVERLAPPERCENT
;
3128 ps
->flag_mask
.placement_mode
= PLACE_MASK
;
3129 ps
->change_mask
.placement_mode
= PLACE_MASK
;
3131 else if (StrEquals(token
, "MinOverlapPlacementPenalties"))
3133 float f
[6] = {-1, -1, -1, -1, -1, -1};
3137 if (on
!= 0 && rest
!= NULL
)
3140 rest
, "%f %f %f %f %f %f", &f
[0],
3141 &f
[1], &f
[2], &f
[3], &f
[4], &f
[5]);
3142 for (i
=0; i
< num
; i
++)
3144 PeekToken(rest
,&rest
);
3154 ERR
, "style_parse_one_style_option",
3155 "Bad argument to MinOverlap"
3156 "PlacementPenalties: %s", rest
);
3160 pl_penalty_struct
*p
;
3162 p
= SGET_PLACEMENT_PENALTY_PTR(*ps
);
3163 *p
= default_pl_penalty
;
3167 (*ps
).pl_penalty
.normal
= f
[0];
3171 (*ps
).pl_penalty
.ontop
= f
[1];
3175 (*ps
).pl_penalty
.icon
= f
[2];
3179 (*ps
).pl_penalty
.sticky
= f
[3];
3183 (*ps
).pl_penalty
.below
= f
[4];
3187 (*ps
).pl_penalty
.strut
= f
[5];
3189 ps
->flags
.has_placement_penalty
= 1;
3190 ps
->flag_mask
.has_placement_penalty
= 1;
3191 ps
->change_mask
.has_placement_penalty
= 1;
3194 token
, "MinOverlapPercentPlacementPenalties"))
3201 num
= GetIntegerArguments(rest
, &rest
, val
, 4);
3202 for (i
=0; i
< num
; i
++)
3211 ERR
, "style_parse_one_style_option",
3212 "Bad argument to MinOverlapPercent"
3213 "PlacementPenalties: %s", rest
);
3217 pl_percent_penalty_struct
*p
;
3219 p
= SGET_PLACEMENT_PERCENTAGE_PENALTY_PTR(*ps
);
3220 *p
= default_pl_percent_penalty
;
3224 (*ps
).pl_percent_penalty
.p99
= val
[0];
3228 (*ps
).pl_percent_penalty
.p95
= val
[1];
3232 (*ps
).pl_percent_penalty
.p85
= val
[2];
3236 (*ps
).pl_percent_penalty
.p75
= val
[3];
3238 ps
->flags
.has_placement_percentage_penalty
= 1;
3239 ps
->flag_mask
.has_placement_percentage_penalty
= 1;
3240 ps
->change_mask
.has_placement_percentage_penalty
= 1;
3242 else if (StrEquals(token
, "MwmButtons"))
3244 S_SET_HAS_MWM_BUTTONS(SCF(*ps
), on
);
3245 S_SET_HAS_MWM_BUTTONS(SCM(*ps
), 1);
3246 S_SET_HAS_MWM_BUTTONS(SCC(*ps
), 1);
3248 else if (StrEquals(token
, "MiniIcon"))
3250 if (!FMiniIconsSupported
)
3254 rest
= GetNextToken(rest
, &token
);
3257 SAFEFREE(SGET_MINI_ICON_NAME(*ps
));
3258 SSET_MINI_ICON_NAME(*ps
, token
);
3259 ps
->flags
.has_mini_icon
= 1;
3260 ps
->flag_mask
.has_mini_icon
= 1;
3261 ps
->change_mask
.has_mini_icon
= 1;
3266 ERR
, "style_parse_one_style_option",
3267 "MiniIcon Style requires an Argument");
3270 else if (StrEquals(token
, "MwmBorder"))
3272 S_SET_HAS_MWM_BORDER(SCF(*ps
), on
);
3273 S_SET_HAS_MWM_BORDER(SCM(*ps
), 1);
3274 S_SET_HAS_MWM_BORDER(SCC(*ps
), 1);
3276 else if (StrEquals(token
, "MwmDecor"))
3278 ps
->flags
.has_mwm_decor
= on
;
3279 ps
->flag_mask
.has_mwm_decor
= 1;
3280 ps
->change_mask
.has_mwm_decor
= 1;
3282 else if (StrEquals(token
, "MwmFunctions"))
3284 ps
->flags
.has_mwm_functions
= on
;
3285 ps
->flag_mask
.has_mwm_functions
= 1;
3286 ps
->change_mask
.has_mwm_functions
= 1;
3288 else if (StrEquals(token
, "MouseFocus"))
3290 style_set_old_focus_policy(ps
, 1);
3292 else if (StrEquals(token
, "MouseFocusClickRaises"))
3294 FPS_RAISE_FOCUSED_CLIENT_CLICK(
3295 S_FOCUS_POLICY(SCF(*ps
)), on
);
3296 FPS_RAISE_FOCUSED_CLIENT_CLICK(
3297 S_FOCUS_POLICY(SCM(*ps
)), 1);
3298 FPS_RAISE_FOCUSED_CLIENT_CLICK(
3299 S_FOCUS_POLICY(SCC(*ps
)), 1);
3300 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(
3301 S_FOCUS_POLICY(SCF(*ps
)), on
);
3302 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(
3303 S_FOCUS_POLICY(SCM(*ps
)), 1);
3304 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(
3305 S_FOCUS_POLICY(SCC(*ps
)), 1);
3307 else if (StrEquals(token
, "MouseFocusClickRaisesOff"))
3309 FPS_RAISE_FOCUSED_CLIENT_CLICK(
3310 S_FOCUS_POLICY(SCF(*ps
)), !on
);
3311 FPS_RAISE_FOCUSED_CLIENT_CLICK(
3312 S_FOCUS_POLICY(SCM(*ps
)), 1);
3313 FPS_RAISE_FOCUSED_CLIENT_CLICK(
3314 S_FOCUS_POLICY(SCC(*ps
)), 1);
3315 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(
3316 S_FOCUS_POLICY(SCF(*ps
)), !on
);
3317 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(
3318 S_FOCUS_POLICY(SCM(*ps
)), 1);
3319 FPS_RAISE_UNFOCUSED_CLIENT_CLICK(
3320 S_FOCUS_POLICY(SCC(*ps
)), 1);
3322 else if (StrEquals(token
, "MinWindowSize"))
3329 num
= GetTwoArguments(
3330 rest
, &val1
, &val2
, &val1_unit
, &val2_unit
);
3331 rest
= SkipNTokens(rest
, num
);
3339 val1
= val1
* val1_unit
/ 100;
3340 val2
= val2
* val2_unit
/ 100;
3350 SSET_MIN_WINDOW_WIDTH(*ps
, val1
);
3351 SSET_MIN_WINDOW_HEIGHT(*ps
, val2
);
3352 ps
->flags
.has_min_window_size
= 1;
3353 ps
->flag_mask
.has_min_window_size
= 1;
3354 ps
->change_mask
.has_min_window_size
= 1;
3356 else if (StrEquals(token
, "MaxWindowSize"))
3363 num
= GetTwoArguments(
3364 rest
, &val1
, &val2
, &val1_unit
, &val2_unit
);
3365 rest
= SkipNTokens(rest
, num
);
3368 val1
= DEFAULT_MAX_MAX_WINDOW_WIDTH
;
3369 val2
= DEFAULT_MAX_MAX_WINDOW_HEIGHT
;
3373 val1
= val1
* val1_unit
/ 100;
3374 val2
= val2
* val2_unit
/ 100;
3376 if (val1
< DEFAULT_MIN_MAX_WINDOW_WIDTH
)
3378 val1
= DEFAULT_MIN_MAX_WINDOW_WIDTH
;
3380 if (val1
> DEFAULT_MAX_MAX_WINDOW_WIDTH
|| val1
<= 0)
3382 val1
= DEFAULT_MAX_MAX_WINDOW_WIDTH
;
3384 if (val2
< DEFAULT_MIN_MAX_WINDOW_HEIGHT
)
3386 val2
= DEFAULT_MIN_MAX_WINDOW_HEIGHT
;
3388 if (val2
> DEFAULT_MAX_MAX_WINDOW_HEIGHT
|| val2
<= 0)
3390 val2
= DEFAULT_MAX_MAX_WINDOW_HEIGHT
;
3392 SSET_MAX_WINDOW_WIDTH(*ps
, val1
);
3393 SSET_MAX_WINDOW_HEIGHT(*ps
, val2
);
3394 ps
->flags
.has_max_window_size
= 1;
3395 ps
->flag_mask
.has_max_window_size
= 1;
3396 ps
->change_mask
.has_max_window_size
= 1;
3398 else if (StrEquals(token
, "MoveByProgramMethod"))
3401 char *methodlist
[] = {
3408 i
= GetTokenIndex(rest
, methodlist
, 0, &rest
);
3411 i
= WS_CR_MOTION_METHOD_AUTO
;
3413 SCR_MOTION_METHOD(&ps
->flags
) = i
;
3414 SCR_MOTION_METHOD(&ps
->flag_mask
) =
3415 WS_CR_MOTION_METHOD_MASK
;
3416 SCR_MOTION_METHOD(&ps
->change_mask
) =
3417 WS_CR_MOTION_METHOD_MASK
;
3426 if (StrEquals(token
, "NoActiveIconOverride"))
3428 S_SET_ICON_OVERRIDE(SCF(*ps
), NO_ACTIVE_ICON_OVERRIDE
);
3429 S_SET_ICON_OVERRIDE(SCM(*ps
), ICON_OVERRIDE_MASK
);
3430 S_SET_ICON_OVERRIDE(SCC(*ps
), ICON_OVERRIDE_MASK
);
3432 else if (StrEquals(token
, "NoIconOverride"))
3434 S_SET_ICON_OVERRIDE(SCF(*ps
), NO_ICON_OVERRIDE
);
3435 S_SET_ICON_OVERRIDE(SCM(*ps
), ICON_OVERRIDE_MASK
);
3436 S_SET_ICON_OVERRIDE(SCC(*ps
), ICON_OVERRIDE_MASK
);
3438 else if (StrEquals(token
, "NoIconTitle"))
3440 S_SET_HAS_NO_ICON_TITLE(SCF(*ps
), on
);
3441 S_SET_HAS_NO_ICON_TITLE(SCM(*ps
), 1);
3442 S_SET_HAS_NO_ICON_TITLE(SCC(*ps
), 1);
3444 else if (StrEquals(token
, "NOICON"))
3446 S_SET_IS_ICON_SUPPRESSED(SCF(*ps
), on
);
3447 S_SET_IS_ICON_SUPPRESSED(SCM(*ps
), 1);
3448 S_SET_IS_ICON_SUPPRESSED(SCC(*ps
), 1);
3450 else if (StrEquals(token
, "NOTITLE"))
3452 ps
->flags
.has_no_title
= on
;
3453 ps
->flag_mask
.has_no_title
= 1;
3454 ps
->change_mask
.has_no_title
= 1;
3456 else if (StrEquals(token
, "NoPPosition"))
3458 ps
->flags
.use_no_pposition
= on
;
3459 ps
->flag_mask
.use_no_pposition
= 1;
3460 ps
->change_mask
.use_no_pposition
= 1;
3462 else if (StrEquals(token
, "NoUSPosition"))
3464 ps
->flags
.use_no_usposition
= on
;
3465 ps
->flag_mask
.use_no_usposition
= 1;
3466 ps
->change_mask
.use_no_usposition
= 1;
3468 else if (StrEquals(token
, "NoTransientPPosition"))
3470 ps
->flags
.use_no_transient_pposition
= on
;
3471 ps
->flag_mask
.use_no_transient_pposition
= 1;
3472 ps
->change_mask
.use_no_transient_pposition
= 1;
3474 else if (StrEquals(token
, "NoTransientUSPosition"))
3476 ps
->flags
.use_no_transient_usposition
= on
;
3477 ps
->flag_mask
.use_no_transient_usposition
= 1;
3478 ps
->change_mask
.use_no_transient_usposition
= 1;
3480 else if (StrEquals(token
, "NoIconPosition"))
3482 S_SET_USE_ICON_POSITION_HINT(SCF(*ps
), !on
);
3483 S_SET_USE_ICON_POSITION_HINT(SCM(*ps
), 1);
3484 S_SET_USE_ICON_POSITION_HINT(SCC(*ps
), 1);
3486 else if (StrEquals(token
, "NakedTransient"))
3488 ps
->flags
.do_decorate_transient
= !on
;
3489 ps
->flag_mask
.do_decorate_transient
= 1;
3490 ps
->change_mask
.do_decorate_transient
= 1;
3492 else if (StrEquals(token
, "NODECORHINT"))
3494 ps
->flags
.has_mwm_decor
= !on
;
3495 ps
->flag_mask
.has_mwm_decor
= 1;
3496 ps
->change_mask
.has_mwm_decor
= 1;
3498 else if (StrEquals(token
, "NOFUNCHINT"))
3500 ps
->flags
.has_mwm_functions
= !on
;
3501 ps
->flag_mask
.has_mwm_functions
= 1;
3502 ps
->change_mask
.has_mwm_functions
= 1;
3504 else if (StrEquals(token
, "NOOVERRIDE"))
3506 S_SET_HAS_MWM_OVERRIDE(SCF(*ps
), !on
);
3507 S_SET_HAS_MWM_OVERRIDE(SCM(*ps
), 1);
3508 S_SET_HAS_MWM_OVERRIDE(SCC(*ps
), 1);
3510 else if (StrEquals(token
, "NORESIZEOVERRIDE") ||
3511 StrEquals(token
, "NORESIZEHINTOVERRIDE"))
3513 S_SET_HAS_OVERRIDE_SIZE(SCF(*ps
), !on
);
3514 S_SET_HAS_OVERRIDE_SIZE(SCM(*ps
), 1);
3515 S_SET_HAS_OVERRIDE_SIZE(SCC(*ps
), 1);
3517 else if (StrEquals(token
, "NOHANDLES"))
3519 ps
->flags
.has_no_handles
= on
;
3520 ps
->flag_mask
.has_no_handles
= 1;
3521 ps
->change_mask
.has_no_handles
= 1;
3523 else if (StrEquals(token
, "NOLENIENCE"))
3525 FPS_LENIENT(S_FOCUS_POLICY(SCF(*ps
)), !on
);
3526 FPS_LENIENT(S_FOCUS_POLICY(SCM(*ps
)), 1);
3527 FPS_LENIENT(S_FOCUS_POLICY(SCC(*ps
)), 1);
3529 else if (StrEquals(token
, "NoButton"))
3531 rest
= style_parse_button_style(ps
, rest
, !on
);
3533 else if (StrEquals(token
, "NOOLDECOR"))
3535 ps
->flags
.has_ol_decor
= !on
;
3536 ps
->flag_mask
.has_ol_decor
= 1;
3537 ps
->change_mask
.has_ol_decor
= 1;
3539 else if (StrEquals(token
, "NeverFocus"))
3541 style_set_old_focus_policy(ps
, 3);
3550 if (StrEquals(token
, "OLDECOR"))
3552 ps
->flags
.has_ol_decor
= on
;
3553 ps
->flag_mask
.has_ol_decor
= 1;
3554 ps
->change_mask
.has_ol_decor
= 1;
3556 else if (StrEquals(token
, "Opacity"))
3558 ps
->flags
.use_parent_relative
= !on
;
3559 ps
->flag_mask
.use_parent_relative
= 1;
3560 ps
->change_mask
.use_parent_relative
= 1;
3569 if (StrEquals(token
, "PositionPlacement"))
3573 ps
->flags
.placement_mode
= PLACE_POSITION
;
3574 ps
->flag_mask
.placement_mode
= PLACE_MASK
;
3575 ps
->change_mask
.placement_mode
= PLACE_MASK
;
3576 s
= (rest
!= NULL
) ? strdup(rest
) : NULL
;
3577 rest
= NULL
; /* consume the entire string */
3578 SSET_PLACEMENT_POSITION_STRING(*ps
, s
);
3579 ps
->flags
.has_placement_position_string
= 1;
3580 ps
->flag_mask
.has_placement_position_string
= 1;
3581 ps
->change_mask
.has_placement_position_string
= 1;
3583 else if (StrEquals(token
, "ParentalRelativity"))
3585 ps
->flags
.use_parent_relative
= on
;
3586 ps
->flag_mask
.use_parent_relative
= 1;
3587 ps
->change_mask
.use_parent_relative
= 1;
3606 if (StrEquals(token
, "RAISETRANSIENT"))
3608 S_SET_DO_RAISE_TRANSIENT(SCF(*ps
), on
);
3609 S_SET_DO_RAISE_TRANSIENT(SCM(*ps
), 1);
3610 S_SET_DO_RAISE_TRANSIENT(SCC(*ps
), 1);
3612 else if (StrEquals(token
, "RANDOMPLACEMENT"))
3614 ps
->flags
.placement_mode
|= PLACE_RANDOM
;
3615 ps
->flag_mask
.placement_mode
|= PLACE_RANDOM
;
3616 ps
->change_mask
.placement_mode
|= PLACE_RANDOM
;
3618 else if (StrEquals(token
, "RECAPTUREHONORSSTARTSONPAGE"))
3620 ps
->flags
.recapture_honors_starts_on_page
= on
;
3621 ps
->flag_mask
.recapture_honors_starts_on_page
= 1;
3622 ps
->change_mask
.recapture_honors_starts_on_page
= 1;
3624 else if (StrEquals(token
, "RECAPTUREIGNORESSTARTSONPAGE"))
3626 ps
->flags
.recapture_honors_starts_on_page
= !on
;
3627 ps
->flag_mask
.recapture_honors_starts_on_page
= 1;
3628 ps
->change_mask
.recapture_honors_starts_on_page
= 1;
3630 else if (StrEquals(token
, "RESIZEHINTOVERRIDE"))
3632 S_SET_HAS_OVERRIDE_SIZE(SCF(*ps
), on
);
3633 S_SET_HAS_OVERRIDE_SIZE(SCM(*ps
), 1);
3634 S_SET_HAS_OVERRIDE_SIZE(SCC(*ps
), 1);
3636 else if (StrEquals(token
, "ResizeOpaque"))
3638 S_SET_DO_RESIZE_OPAQUE(SCF(*ps
), on
);
3639 S_SET_DO_RESIZE_OPAQUE(SCM(*ps
), 1);
3640 S_SET_DO_RESIZE_OPAQUE(SCC(*ps
), 1);
3642 else if (StrEquals(token
, "ResizeOutline"))
3644 S_SET_DO_RESIZE_OPAQUE(SCF(*ps
), !on
);
3645 S_SET_DO_RESIZE_OPAQUE(SCM(*ps
), 1);
3646 S_SET_DO_RESIZE_OPAQUE(SCC(*ps
), 1);
3648 else if (StrEquals(token
, "RightTitleRotatedCW"))
3650 S_SET_IS_RIGHT_TITLE_ROTATED_CW(SCF(*ps
), on
);
3651 S_SET_IS_RIGHT_TITLE_ROTATED_CW(SCM(*ps
), 1);
3652 S_SET_IS_RIGHT_TITLE_ROTATED_CW(SCC(*ps
), 1);
3654 else if (StrEquals(token
, "RightTitleRotatedCCW"))
3656 S_SET_IS_RIGHT_TITLE_ROTATED_CW(SCF(*ps
), !on
);
3657 S_SET_IS_RIGHT_TITLE_ROTATED_CW(SCM(*ps
), 1);
3658 S_SET_IS_RIGHT_TITLE_ROTATED_CW(SCC(*ps
), 1);
3667 if (StrEquals(token
, "SMARTPLACEMENT"))
3669 ps
->flags
.placement_mode
|= PLACE_SMART
;
3670 ps
->flag_mask
.placement_mode
|= PLACE_SMART
;
3671 ps
->change_mask
.placement_mode
|= PLACE_SMART
;
3673 else if (StrEquals(token
, "SkipMapping"))
3675 S_SET_DO_NOT_SHOW_ON_MAP(SCF(*ps
), on
);
3676 S_SET_DO_NOT_SHOW_ON_MAP(SCM(*ps
), 1);
3677 S_SET_DO_NOT_SHOW_ON_MAP(SCC(*ps
), 1);
3679 else if (StrEquals(token
, "ShowMapping"))
3681 S_SET_DO_NOT_SHOW_ON_MAP(SCF(*ps
), !on
);
3682 S_SET_DO_NOT_SHOW_ON_MAP(SCM(*ps
), 1);
3683 S_SET_DO_NOT_SHOW_ON_MAP(SCC(*ps
), 1);
3685 else if (StrEquals(token
, "StackTransientParent"))
3687 S_SET_DO_STACK_TRANSIENT_PARENT(SCF(*ps
), on
);
3688 S_SET_DO_STACK_TRANSIENT_PARENT(SCM(*ps
), 1);
3689 S_SET_DO_STACK_TRANSIENT_PARENT(SCC(*ps
), 1);
3691 else if (StrEquals(token
, "StickyIcon"))
3693 S_SET_IS_ICON_STICKY_ACROSS_PAGES(SCF(*ps
), on
);
3694 S_SET_IS_ICON_STICKY_ACROSS_PAGES(SCM(*ps
), 1);
3695 S_SET_IS_ICON_STICKY_ACROSS_PAGES(SCC(*ps
), 1);
3696 S_SET_IS_ICON_STICKY_ACROSS_DESKS(SCF(*ps
), on
);
3697 S_SET_IS_ICON_STICKY_ACROSS_DESKS(SCM(*ps
), 1);
3698 S_SET_IS_ICON_STICKY_ACROSS_DESKS(SCC(*ps
), 1);
3700 else if (StrEquals(token
, "StickyAcrossPagesIcon"))
3702 S_SET_IS_ICON_STICKY_ACROSS_PAGES(SCF(*ps
), on
);
3703 S_SET_IS_ICON_STICKY_ACROSS_PAGES(SCM(*ps
), 1);
3704 S_SET_IS_ICON_STICKY_ACROSS_PAGES(SCC(*ps
), 1);
3706 else if (StrEquals(token
, "StickyAcrossDesksIcon"))
3708 S_SET_IS_ICON_STICKY_ACROSS_DESKS(SCF(*ps
), on
);
3709 S_SET_IS_ICON_STICKY_ACROSS_DESKS(SCM(*ps
), 1);
3710 S_SET_IS_ICON_STICKY_ACROSS_DESKS(SCC(*ps
), 1);
3712 else if (StrEquals(token
, "SlipperyIcon"))
3714 S_SET_IS_ICON_STICKY_ACROSS_PAGES(SCF(*ps
), !on
);
3715 S_SET_IS_ICON_STICKY_ACROSS_PAGES(SCM(*ps
), 1);
3716 S_SET_IS_ICON_STICKY_ACROSS_PAGES(SCC(*ps
), 1);
3717 S_SET_IS_ICON_STICKY_ACROSS_DESKS(SCF(*ps
), !on
);
3718 S_SET_IS_ICON_STICKY_ACROSS_DESKS(SCM(*ps
), 1);
3719 S_SET_IS_ICON_STICKY_ACROSS_DESKS(SCC(*ps
), 1);
3721 else if (StrEquals(token
, "SloppyFocus"))
3723 style_set_old_focus_policy(ps
, 2);
3725 else if (StrEquals(token
, "StartIconic"))
3727 ps
->flags
.do_start_iconic
= on
;
3728 ps
->flag_mask
.do_start_iconic
= 1;
3729 ps
->change_mask
.do_start_iconic
= 1;
3731 else if (StrEquals(token
, "StartNormal"))
3733 ps
->flags
.do_start_iconic
= !on
;
3734 ps
->flag_mask
.do_start_iconic
= 1;
3735 ps
->change_mask
.do_start_iconic
= 1;
3737 else if (StrEquals(token
, "StaysOnBottom"))
3740 *ps
, (on
) ? Scr
.BottomLayer
: Scr
.DefaultLayer
);
3741 ps
->flags
.use_layer
= 1;
3742 ps
->flag_mask
.use_layer
= 1;
3743 ps
->change_mask
.use_layer
= 1;
3745 else if (StrEquals(token
, "StaysOnTop"))
3748 *ps
, (on
) ? Scr
.BottomLayer
: Scr
.DefaultLayer
);
3749 SSET_LAYER(*ps
, Scr
.TopLayer
);
3750 ps
->flags
.use_layer
= 1;
3751 ps
->flag_mask
.use_layer
= 1;
3752 ps
->change_mask
.use_layer
= 1;
3754 else if (StrEquals(token
, "StaysPut"))
3756 SSET_LAYER(*ps
, Scr
.DefaultLayer
);
3757 ps
->flags
.use_layer
= 1;
3758 ps
->flag_mask
.use_layer
= 1;
3759 ps
->change_mask
.use_layer
= 1;
3761 else if (StrEquals(token
, "Sticky"))
3763 S_SET_IS_STICKY_ACROSS_PAGES(SCF(*ps
), on
);
3764 S_SET_IS_STICKY_ACROSS_PAGES(SCM(*ps
), 1);
3765 S_SET_IS_STICKY_ACROSS_PAGES(SCC(*ps
), 1);
3766 S_SET_IS_STICKY_ACROSS_DESKS(SCF(*ps
), on
);
3767 S_SET_IS_STICKY_ACROSS_DESKS(SCM(*ps
), 1);
3768 S_SET_IS_STICKY_ACROSS_DESKS(SCC(*ps
), 1);
3770 else if (StrEquals(token
, "StickyAcrossPages"))
3772 S_SET_IS_STICKY_ACROSS_PAGES(SCF(*ps
), on
);
3773 S_SET_IS_STICKY_ACROSS_PAGES(SCM(*ps
), 1);
3774 S_SET_IS_STICKY_ACROSS_PAGES(SCC(*ps
), 1);
3776 else if (StrEquals(token
, "StickyAcrossDesks"))
3778 S_SET_IS_STICKY_ACROSS_DESKS(SCF(*ps
), on
);
3779 S_SET_IS_STICKY_ACROSS_DESKS(SCM(*ps
), 1);
3780 S_SET_IS_STICKY_ACROSS_DESKS(SCC(*ps
), 1);
3782 else if (StrEquals(token
, "StickyStippledTitle"))
3784 S_SET_HAS_NO_STICKY_STIPPLED_TITLE(SCF(*ps
), !on
);
3785 S_SET_HAS_NO_STICKY_STIPPLED_TITLE(SCM(*ps
), 1);
3786 S_SET_HAS_NO_STICKY_STIPPLED_TITLE(SCC(*ps
), 1);
3788 else if (StrEquals(token
, "StickyStippledIconTitle"))
3790 S_SET_HAS_NO_STICKY_STIPPLED_ICON_TITLE(SCF(*ps
), !on
);
3791 S_SET_HAS_NO_STICKY_STIPPLED_ICON_TITLE(SCM(*ps
), 1);
3792 S_SET_HAS_NO_STICKY_STIPPLED_ICON_TITLE(SCC(*ps
), 1);
3794 else if (StrEquals(token
, "Slippery"))
3796 S_SET_IS_STICKY_ACROSS_PAGES(SCF(*ps
), !on
);
3797 S_SET_IS_STICKY_ACROSS_PAGES(SCM(*ps
), 1);
3798 S_SET_IS_STICKY_ACROSS_PAGES(SCC(*ps
), 1);
3799 S_SET_IS_STICKY_ACROSS_DESKS(SCF(*ps
), !on
);
3800 S_SET_IS_STICKY_ACROSS_DESKS(SCM(*ps
), 1);
3801 S_SET_IS_STICKY_ACROSS_DESKS(SCC(*ps
), 1);
3803 else if (StrEquals(token
, "STARTSONDESK"))
3805 spargs
= GetIntegerArguments(rest
, NULL
, tmpno
, 1);
3808 PeekToken(rest
,&rest
);
3809 ps
->flags
.use_start_on_desk
= 1;
3810 ps
->flag_mask
.use_start_on_desk
= 1;
3811 ps
->change_mask
.use_start_on_desk
= 1;
3812 /* RBW - 11/20/1998 - allow for the special
3815 *ps
, (tmpno
[0] > -1) ?
3816 tmpno
[0] + 1 : tmpno
[0]);
3820 fvwm_msg(ERR
,"style_parse_one_style_option",
3821 "bad StartsOnDesk arg: %s", rest
);
3824 /* StartsOnPage is like StartsOnDesk-Plus */
3825 else if (StrEquals(token
, "STARTSONPAGE"))
3828 spargs
= GetIntegerArguments(rest
, &ret_rest
,
3830 if (spargs
== 1 || spargs
== 3)
3832 /* We have a desk no., with or without page. */
3833 /* RBW - 11/20/1998 - allow for the special
3835 /* Desk is now actual + 1 */
3837 *ps
, (tmpno
[0] > -1) ?
3838 tmpno
[0] + 1 : tmpno
[0]);
3840 if (spargs
== 2 || spargs
== 3)
3844 /* RBW - 11/20/1998 - allow for the
3845 * special case of -1 */
3847 *ps
, (tmpno
[1] > -1) ?
3848 tmpno
[1] + 1 : tmpno
[1]);
3850 *ps
, (tmpno
[2] > -1) ?
3851 tmpno
[2] + 1 : tmpno
[2]);
3856 *ps
, (tmpno
[0] > -1) ?
3857 tmpno
[0] + 1 : tmpno
[0]);
3859 *ps
, (tmpno
[1] > -1) ?
3860 tmpno
[1] + 1 : tmpno
[1]);
3863 if (spargs
< 1 || spargs
> 3)
3865 fvwm_msg(ERR
, "style_parse_one_style_option",
3866 "bad StartsOnPage args: %s", rest
);
3870 ps
->flags
.use_start_on_desk
= 1;
3871 ps
->flag_mask
.use_start_on_desk
= 1;
3872 ps
->change_mask
.use_start_on_desk
= 1;
3876 else if (StrEquals(token
, "STARTSONPAGEINCLUDESTRANSIENTS"))
3878 ps
->flags
.use_start_on_page_for_transient
= on
;
3879 ps
->flag_mask
.use_start_on_page_for_transient
= 1;
3880 ps
->change_mask
.use_start_on_page_for_transient
= 1;
3882 else if (StrEquals(token
, "STARTSONPAGEIGNORESTRANSIENTS"))
3884 ps
->flags
.use_start_on_page_for_transient
= !on
;
3885 ps
->flag_mask
.use_start_on_page_for_transient
= 1;
3886 ps
->change_mask
.use_start_on_page_for_transient
= 1;
3888 else if (StrEquals(token
, "StartsOnScreen"))
3892 tmpno
[0] = FScreenGetScreenArgument(rest
, 'c');
3893 PeekToken(rest
,&rest
);
3894 ps
->flags
.use_start_on_screen
= 1;
3895 ps
->flag_mask
.use_start_on_screen
= 1;
3896 ps
->change_mask
.use_start_on_screen
= 1;
3897 SSET_START_SCREEN(*ps
, tmpno
[0]);
3901 ps
->flags
.use_start_on_screen
= 0;
3902 ps
->flag_mask
.use_start_on_screen
= 1;
3903 ps
->change_mask
.use_start_on_screen
= 1;
3906 else if (StrEquals(token
, "STARTSANYWHERE"))
3908 ps
->flags
.use_start_on_desk
= 0;
3909 ps
->flag_mask
.use_start_on_desk
= 1;
3910 ps
->change_mask
.use_start_on_desk
= 1;
3912 else if (StrEquals(token
, "STARTSLOWERED"))
3914 ps
->flags
.do_start_lowered
= on
;
3915 ps
->flag_mask
.do_start_lowered
= 1;
3916 ps
->change_mask
.do_start_lowered
= 1;
3918 else if (StrEquals(token
, "STARTSRAISED"))
3920 ps
->flags
.do_start_lowered
= !on
;
3921 ps
->flag_mask
.do_start_lowered
= 1;
3922 ps
->change_mask
.do_start_lowered
= 1;
3924 else if (StrEquals(token
, "StartShaded"))
3926 token
= PeekToken(rest
, &rest
);
3930 direction_t direction
;
3932 direction
= gravity_parse_dir_argument(
3933 token
, &token
, DIR_NONE
);
3934 if (direction
>= 0 && direction
<= DIR_MASK
)
3936 SSET_STARTS_SHADED_DIR(*ps
, direction
);
3942 "style_parse_one_style_option",
3943 "Option: %s is not valid with"
3944 " StartShaded", token
);
3949 SSET_STARTS_SHADED_DIR(*ps
, DIR_N
);
3951 ps
->flags
.do_start_shaded
= on
;
3952 ps
->flag_mask
.do_start_shaded
= 1;
3953 ps
->change_mask
.do_start_shaded
= 1;
3955 else if (StrEquals(token
, "SaveUnder"))
3957 ps
->flags
.do_save_under
= on
;
3958 ps
->flag_mask
.do_save_under
= 1;
3959 ps
->change_mask
.do_save_under
= 1;
3961 else if (StrEquals(token
, "SaveUnderOff"))
3963 ps
->flags
.do_save_under
= !on
;
3964 ps
->flag_mask
.do_save_under
= 1;
3965 ps
->change_mask
.do_save_under
= 1;
3967 else if (StrEquals(token
, "StippledTitle"))
3969 S_SET_HAS_STIPPLED_TITLE(SCF(*ps
), on
);
3970 S_SET_HAS_STIPPLED_TITLE(SCM(*ps
), 1);
3971 S_SET_HAS_STIPPLED_TITLE(SCC(*ps
), 1);
3973 else if (StrEquals(token
, "StippledTitleOff"))
3975 S_SET_HAS_STIPPLED_TITLE(SCF(*ps
), !on
);
3976 S_SET_HAS_STIPPLED_TITLE(SCM(*ps
), 1);
3977 S_SET_HAS_STIPPLED_TITLE(SCC(*ps
), 1);
3979 else if (StrEquals(token
, "StippledIconTitle"))
3981 S_SET_HAS_STIPPLED_ICON_TITLE(SCF(*ps
), on
);
3982 S_SET_HAS_STIPPLED_ICON_TITLE(SCM(*ps
), 1);
3983 S_SET_HAS_STIPPLED_ICON_TITLE(SCC(*ps
), 1);
3985 else if (StrEquals(token
, "ScatterWindowGroups"))
3987 S_SET_DO_USE_WINDOW_GROUP_HINT(SCF(*ps
), !on
);
3988 S_SET_DO_USE_WINDOW_GROUP_HINT(SCM(*ps
), 1);
3989 S_SET_DO_USE_WINDOW_GROUP_HINT(SCC(*ps
), 1);
3991 else if (StrEquals(token
, "State"))
3994 unsigned int states
;
3996 spargs
= GetIntegerArguments(rest
, NULL
, tmpno
, 1);
3997 if (spargs
== 1 && tmpno
[0] >= 0 && tmpno
[0] <= 31)
3999 PeekToken(rest
,&rest
);
4000 states
= S_USER_STATES(SCF(*ps
));
4001 mask
= (1 << tmpno
[0]);
4010 S_SET_USER_STATES(SCF(*ps
), states
);
4011 S_ADD_USER_STATES(SCM(*ps
), mask
);
4012 S_ADD_USER_STATES(SCC(*ps
), mask
);
4017 ERR
,"style_parse_one_style_option",
4018 "bad State arg: %s", rest
);
4021 else if (StrEquals(token
, "SnapAttraction"))
4030 snap_proximity
= DEFAULT_SNAP_ATTRACTION
;
4031 snap_mode
= DEFAULT_SNAP_ATTRACTION_MODE
;
4033 GetIntegerArguments(
4034 rest
, &rest
, &val
, 1) != 1)
4040 snap_proximity
= val
;
4046 token
= PeekToken(rest
, &rest
);
4051 if (StrEquals(token
, "All"))
4053 snap_mode
= SNAP_ICONS
| SNAP_WINDOWS
;
4054 token
= PeekToken(rest
, &rest
);
4056 else if (StrEquals(token
, "None"))
4058 snap_mode
= SNAP_NONE
;
4059 token
= PeekToken(rest
, &rest
);
4061 else if (StrEquals(token
, "SameType"))
4063 snap_mode
= SNAP_SAME
;
4064 token
= PeekToken(rest
, &rest
);
4066 else if (StrEquals(token
, "Icons"))
4068 snap_mode
= SNAP_ICONS
;
4069 token
= PeekToken(rest
, &rest
);
4071 else if (StrEquals(token
, "Windows"))
4073 snap_mode
= SNAP_WINDOWS
;
4074 token
= PeekToken(rest
, &rest
);
4080 if (StrEquals(token
, "Screen"))
4082 snap_mode
|= SNAP_SCREEN
;
4084 else if (StrEquals(token
, "ScreenWindows"))
4086 snap_mode
|= SNAP_SCREEN_WINDOWS
;
4088 else if (StrEquals(token
, "ScreenIcons"))
4090 snap_mode
|= SNAP_SCREEN_ICONS
;
4092 else if (StrEquals(token
, "ScreenAll"))
4094 snap_mode
|= SNAP_SCREEN_ALL
;
4097 ps
->flags
.has_snap_attraction
= 1;
4098 ps
->flag_mask
.has_snap_attraction
= 1;
4099 ps
->change_mask
.has_snap_attraction
= 1;
4100 SSET_SNAP_PROXIMITY(*ps
, snap_proximity
);
4101 SSET_SNAP_MODE(*ps
, snap_mode
);
4103 else if (StrEquals(token
, "SnapGrid"))
4107 num
= GetIntegerArguments(rest
, &rest
, val
, 2);
4110 val
[0] = DEFAULT_SNAP_GRID_X
;
4111 val
[1] = DEFAULT_SNAP_GRID_Y
;
4115 val
[0] = DEFAULT_SNAP_GRID_X
;
4119 val
[1] = DEFAULT_SNAP_GRID_Y
;
4121 ps
->flags
.has_snap_grid
= 1;
4122 ps
->flag_mask
.has_snap_grid
= 1;
4123 ps
->change_mask
.has_snap_grid
= 1;
4124 SSET_SNAP_GRID_X(*ps
, val
[0]);
4125 SSET_SNAP_GRID_Y(*ps
, val
[1]);
4134 if (StrEquals(token
, "TileCascadePlacement"))
4136 ps
->flags
.placement_mode
= PLACE_TILECASCADE
;
4137 ps
->flag_mask
.placement_mode
= PLACE_MASK
;
4138 ps
->change_mask
.placement_mode
= PLACE_MASK
;
4140 else if (StrEquals(token
, "TileManualPlacement"))
4142 ps
->flags
.placement_mode
= PLACE_TILEMANUAL
;
4143 ps
->flag_mask
.placement_mode
= PLACE_MASK
;
4144 ps
->change_mask
.placement_mode
= PLACE_MASK
;
4146 else if (StrEquals(token
, "Title"))
4148 ps
->flags
.has_no_title
= !on
;
4149 ps
->flag_mask
.has_no_title
= 1;
4150 ps
->change_mask
.has_no_title
= 1;
4152 else if (StrEquals(token
, "TitleAtBottom"))
4154 S_SET_TITLE_DIR(SCF(*ps
), DIR_S
);
4155 S_SET_TITLE_DIR(SCM(*ps
), DIR_MAJOR_MASK
);
4156 S_SET_TITLE_DIR(SCC(*ps
), DIR_MAJOR_MASK
);
4158 else if (StrEquals(token
, "TitleAtTop"))
4160 S_SET_TITLE_DIR(SCF(*ps
), DIR_N
);
4161 S_SET_TITLE_DIR(SCM(*ps
), DIR_MAJOR_MASK
);
4162 S_SET_TITLE_DIR(SCC(*ps
), DIR_MAJOR_MASK
);
4164 else if (StrEquals(token
, "TitleAtLeft"))
4166 S_SET_TITLE_DIR(SCF(*ps
), DIR_W
);
4167 S_SET_TITLE_DIR(SCM(*ps
), DIR_MAJOR_MASK
);
4168 S_SET_TITLE_DIR(SCC(*ps
), DIR_MAJOR_MASK
);
4170 else if (StrEquals(token
, "TitleAtRight"))
4172 S_SET_TITLE_DIR(SCF(*ps
), DIR_E
);
4173 S_SET_TITLE_DIR(SCM(*ps
), DIR_MAJOR_MASK
);
4174 S_SET_TITLE_DIR(SCC(*ps
), DIR_MAJOR_MASK
);
4176 else if (StrEquals(token
, "TopTitleRotated"))
4178 S_SET_IS_TOP_TITLE_ROTATED(SCF(*ps
), on
);
4179 S_SET_IS_TOP_TITLE_ROTATED(SCM(*ps
), 1);
4180 S_SET_IS_TOP_TITLE_ROTATED(SCC(*ps
), 1);
4182 else if (StrEquals(token
, "TopTitleNotRotated"))
4184 S_SET_IS_TOP_TITLE_ROTATED(SCF(*ps
), !on
);
4185 S_SET_IS_TOP_TITLE_ROTATED(SCM(*ps
), 1);
4186 S_SET_IS_TOP_TITLE_ROTATED(SCC(*ps
), 1);
4195 if (StrEquals(token
, "UsePPosition"))
4197 ps
->flags
.use_no_pposition
= !on
;
4198 ps
->flag_mask
.use_no_pposition
= 1;
4199 ps
->change_mask
.use_no_pposition
= 1;
4201 else if (StrEquals(token
, "UseUSPosition"))
4203 ps
->flags
.use_no_usposition
= !on
;
4204 ps
->flag_mask
.use_no_usposition
= 1;
4205 ps
->change_mask
.use_no_usposition
= 1;
4207 else if (StrEquals(token
, "UseTransientPPosition"))
4209 ps
->flags
.use_no_transient_pposition
= !on
;
4210 ps
->flag_mask
.use_no_transient_pposition
= 1;
4211 ps
->change_mask
.use_no_transient_pposition
= 1;
4213 else if (StrEquals(token
, "UseTransientUSPosition"))
4215 ps
->flags
.use_no_transient_usposition
= !on
;
4216 ps
->flag_mask
.use_no_transient_usposition
= 1;
4217 ps
->change_mask
.use_no_transient_usposition
= 1;
4219 else if (StrEquals(token
, "UseIconPosition"))
4221 S_SET_USE_ICON_POSITION_HINT(SCF(*ps
), on
);
4222 S_SET_USE_ICON_POSITION_HINT(SCM(*ps
), 1);
4223 S_SET_USE_ICON_POSITION_HINT(SCC(*ps
), 1);
4225 else if (StrEquals(token
, "UseTitleDecorRotation"))
4227 S_SET_USE_TITLE_DECOR_ROTATION(SCF(*ps
), on
);
4228 S_SET_USE_TITLE_DECOR_ROTATION(SCM(*ps
), 1);
4229 S_SET_USE_TITLE_DECOR_ROTATION(SCC(*ps
), 1);
4232 else if (StrEquals(token
, "UseDecor"))
4234 SAFEFREE(SGET_DECOR_NAME(*ps
));
4235 rest
= GetNextToken(rest
, &token
);
4236 SSET_DECOR_NAME(*ps
, token
);
4237 ps
->flags
.has_decor
= (token
!= NULL
);
4238 ps
->flag_mask
.has_decor
= 1;
4239 ps
->change_mask
.has_decor
= 1;
4242 else if (StrEquals(token
, "UseStyle"))
4246 token
= PeekToken(rest
, &rest
);
4249 fvwm_msg(ERR
, "style_parse_one_style_option",
4250 "UseStyle needs an argument");
4254 /* changed to accum multiple Style definitions
4255 * (veliaa@rpi.edu) */
4256 for (add_style
= all_styles
; add_style
;
4257 add_style
= SGET_NEXT_STYLE(*add_style
))
4259 if (SGET_ID_HAS_NAME(*add_style
) &&
4260 StrEquals(token
, SGET_NAME(*add_style
)))
4264 merge_styles(ps
, add_style
, True
);
4265 } /* end found matching style */
4266 } /* end looking at all styles */
4267 /* move forward one word */
4271 ERR
, "style_parse_one_style_option",
4272 "UseStyle: %s style not found", token
);
4275 else if (StrEquals(token
, "Unmanaged"))
4277 ps
->flags
.is_unmanaged
= on
;
4278 ps
->flag_mask
.is_unmanaged
= 1;
4279 ps
->change_mask
.is_unmanaged
= 1;
4288 if (StrEquals(token
, "VariablePosition") ||
4289 StrEquals(token
, "VariableUSPosition"))
4291 S_SET_IS_FIXED(SCF(*ps
), !on
);
4292 S_SET_IS_FIXED(SCM(*ps
), 1);
4293 S_SET_IS_FIXED(SCC(*ps
), 1);
4295 else if (StrEquals(token
, "VariablePPosition"))
4297 S_SET_IS_FIXED_PPOS(SCF(*ps
), !on
);
4298 S_SET_IS_FIXED_PPOS(SCM(*ps
), 1);
4299 S_SET_IS_FIXED_PPOS(SCC(*ps
), 1);
4301 else if (StrEquals(token
, "VariableSize") ||
4302 StrEquals(token
, "VariableUSSize"))
4304 S_SET_IS_SIZE_FIXED(SCF(*ps
), !on
);
4305 S_SET_IS_SIZE_FIXED(SCM(*ps
), 1);
4306 S_SET_IS_SIZE_FIXED(SCC(*ps
), 1);
4308 else if (StrEquals(token
, "VariablePSize"))
4310 S_SET_IS_PSIZE_FIXED(SCF(*ps
), !on
);
4311 S_SET_IS_PSIZE_FIXED(SCM(*ps
), 1);
4312 S_SET_IS_PSIZE_FIXED(SCC(*ps
), 1);
4321 if (StrEquals(token
, "WindowListSkip"))
4323 S_SET_DO_WINDOW_LIST_SKIP(SCF(*ps
), on
);
4324 S_SET_DO_WINDOW_LIST_SKIP(SCM(*ps
), 1);
4325 S_SET_DO_WINDOW_LIST_SKIP(SCC(*ps
), 1);
4327 else if (StrEquals(token
, "WindowListHit"))
4329 S_SET_DO_WINDOW_LIST_SKIP(SCF(*ps
), !on
);
4330 S_SET_DO_WINDOW_LIST_SKIP(SCM(*ps
), 1);
4331 S_SET_DO_WINDOW_LIST_SKIP(SCC(*ps
), 1);
4333 else if (StrEquals(token
, "WindowShadeSteps"))
4339 n
= GetOnePercentArgument(rest
, &val
, &unit
);
4346 PeekToken(rest
,&rest
);
4348 /* we have a 'pixel' suffix if unit != 0; negative
4349 * values mean pixels */
4350 val
= (unit
!= 0) ? -val
: val
;
4351 ps
->flags
.has_window_shade_steps
= 1;
4352 ps
->flag_mask
.has_window_shade_steps
= 1;
4353 ps
->change_mask
.has_window_shade_steps
= 1;
4354 SSET_WINDOW_SHADE_STEPS(*ps
, val
);
4356 else if (StrEquals(token
, "WindowShadeScrolls"))
4358 S_SET_DO_SHRINK_WINDOWSHADE(SCF(*ps
), !on
);
4359 S_SET_DO_SHRINK_WINDOWSHADE(SCM(*ps
), 1);
4360 S_SET_DO_SHRINK_WINDOWSHADE(SCC(*ps
), 1);
4362 else if (StrEquals(token
, "WindowShadeShrinks"))
4364 S_SET_DO_SHRINK_WINDOWSHADE(SCF(*ps
), on
);
4365 S_SET_DO_SHRINK_WINDOWSHADE(SCM(*ps
), 1);
4366 S_SET_DO_SHRINK_WINDOWSHADE(SCC(*ps
), 1);
4368 else if (StrEquals(token
, "WindowShadeLazy"))
4370 S_SET_WINDOWSHADE_LAZINESS(SCF(*ps
), WINDOWSHADE_LAZY
);
4371 S_SET_WINDOWSHADE_LAZINESS(
4372 SCM(*ps
), WINDOWSHADE_LAZY_MASK
);
4373 S_SET_WINDOWSHADE_LAZINESS(
4374 SCC(*ps
), WINDOWSHADE_LAZY_MASK
);
4376 else if (StrEquals(token
, "WindowShadeAlwaysLazy"))
4378 S_SET_WINDOWSHADE_LAZINESS(
4379 SCF(*ps
), WINDOWSHADE_ALWAYS_LAZY
);
4380 S_SET_WINDOWSHADE_LAZINESS(
4381 SCM(*ps
), WINDOWSHADE_LAZY_MASK
);
4382 S_SET_WINDOWSHADE_LAZINESS(
4383 SCC(*ps
), WINDOWSHADE_LAZY_MASK
);
4385 else if (StrEquals(token
, "WindowShadeBusy"))
4387 S_SET_WINDOWSHADE_LAZINESS(SCF(*ps
), WINDOWSHADE_BUSY
);
4388 S_SET_WINDOWSHADE_LAZINESS(
4389 SCM(*ps
), WINDOWSHADE_LAZY_MASK
);
4390 S_SET_WINDOWSHADE_LAZINESS(
4391 SCC(*ps
), WINDOWSHADE_LAZY_MASK
);
4419 if (token_l
!= NULL
)
4428 void parse_and_set_window_style(char *action
, char *prefix
, window_style
*ps
)
4435 /* which current boxes to chain to */
4436 icon_boxes
*cur_ib
= NULL
;
4438 while (isspace((unsigned char)*action
))
4443 while (action
&& *action
&& *action
!= '\n')
4445 action
= GetNextFullOption(action
, &option
);
4450 token
= PeekToken(option
, &rest
);
4457 /* It might make more sense to capture the whole word, fix its
4458 * case, and use strcmp, but there aren't many caseless compares
4459 * because of this "switch" on the first letter. */
4460 found
= style_parse_one_style_option(
4461 token
, rest
, &rest
, prefix
, ps
, &cur_ib
);
4466 ERR
, "style_parse_and_set_window_style",
4467 "Bad style option: %s", option
);
4468 /* Can't return here since all malloced memory will be
4469 * lost. Ignore rest of line instead. */
4470 /* No, I think we /can/ return here. In fact, /not/
4471 * bombing out leaves a half-done style in the list!
4472 * N.Bird 07-Sep-1999 */
4473 /* domivogt (01-Oct-1999): Which is exactly what we
4474 * want! Why should all the styles be thrown away if a
4475 * single one is mis-spelled? Let's just continue
4476 * parsing styles. */
4478 else if (rest
!= NULL
)
4480 rest
= SkipSpaces(rest
,NULL
,0);
4484 "style_parse_and_set_window_style",
4485 "Unconsumed argument in %s: %s",
4490 } /* end while still stuff on command */
4495 /* Process a style command. First built up in a temp area.
4496 * If valid, added to the list in a malloced area.
4498 * *** Important note ***
4500 * Remember that *all* styles need a flag, flag_mask and change_mask.
4501 * It is not enough to add the code for new styles in this function.
4502 * There *must* be corresponding code in handle_new_window_style()
4503 * and merge_styles() too. And don't forget that allocated memory
4504 * must be freed in ProcessDestroyStyle().
4507 static void __style_command(F_CMD_ARGS
, char *prefix
, Bool is_window_style
)
4509 /* temp area to build name list */
4512 ps
= (window_style
*)safemalloc(sizeof(window_style
));
4513 /* init temp window_style area */
4514 memset(ps
, 0, sizeof(window_style
));
4515 /* init default focus policy */
4516 fpol_init_default_fp(&S_FOCUS_POLICY(SCF(*ps
)));
4517 /* mark style as changed */
4518 ps
->has_style_changed
= 1;
4519 /* set global flag */
4520 Scr
.flags
.do_need_window_update
= 1;
4521 /* default StartsOnPage behavior for initial capture */
4522 ps
->flags
.capture_honors_starts_on_page
= 1;
4524 if (!is_window_style
)
4526 /* parse style name */
4527 action
= GetNextToken(action
, &SGET_NAME(*ps
));
4528 /* in case there was no argument! */
4529 if (SGET_NAME(*ps
) == NULL
)
4534 SSET_ID_HAS_NAME(*ps
, True
);
4538 SSET_WINDOW_ID(*ps
, (XID
)FW_W(exc
->w
.fw
));
4539 SSET_ID_HAS_WINDOW_ID(*ps
, True
);
4540 CopyString(&SGET_NAME(*ps
), ""); /* safe */
4545 free(SGET_NAME(*ps
));
4550 parse_and_set_window_style(action
, prefix
, ps
);
4552 /* capture default icons */
4553 if (SGET_ID_HAS_NAME(*ps
) && StrEquals(SGET_NAME(*ps
), "*"))
4555 if (ps
->flags
.has_icon
== 1)
4557 if (Scr
.DefaultIcon
)
4559 free(Scr
.DefaultIcon
);
4561 Scr
.DefaultIcon
= SGET_ICON_NAME(*ps
);
4562 ps
->flags
.has_icon
= 0;
4563 ps
->flag_mask
.has_icon
= 0;
4564 ps
->change_mask
.has_icon
= 1;
4565 SSET_ICON_NAME(*ps
, NULL
);
4568 if (last_style_in_list
&& styles_have_same_id(ps
, last_style_in_list
))
4570 /* merge with previous style */
4571 merge_styles(last_style_in_list
, ps
, True
);
4577 /* add temp name list to list */
4578 add_style_to_list(ps
);
4579 cleanup_style_defaults(ps
);
4585 /* ---------------------------- interface functions ------------------------ */
4587 /* Compare two flag structures passed as byte arrays. Only compare bits set in
4591 * zero if the flags are the same
4592 * non-zero otherwise
4595 * flags1 - first byte array of flags to compare
4596 * flags2 - second byte array of flags to compare
4597 * mask - byte array of flags to be considered for the comparison
4598 * len - number of bytes to compare */
4599 Bool
blockcmpmask(char *blk1
, char *blk2
, char *mask
, int length
)
4603 for (i
= 0; i
< length
; i
++)
4605 if ((blk1
[i
] & mask
[i
]) != (blk2
[i
] & mask
[i
]))
4607 /* flags are not the same, return 1 */
4614 void free_icon_boxes(icon_boxes
*ib
)
4618 for ( ; ib
!= NULL
; ib
= temp
)
4621 if (ib
->use_count
== 0)
4627 /* we can't delete the icon box yet, it is still in use
4629 ib
->is_orphan
= True
;
4636 void simplify_style_list(void)
4638 /* one pass through the style list, then process other events first */
4639 Scr
.flags
.do_need_style_list_update
= __simplify_style_list();
4644 /* lookup_style - look through a list for a window name, or class
4647 * merged matching styles in callers window_style.
4650 * fw - FvwmWindow structure to match against
4651 * styles - callers return area
4653 void lookup_style(FvwmWindow
*fw
, window_style
*styles
)
4657 /* clear callers return area */
4658 memset(styles
, 0, sizeof(window_style
));
4660 /* look thru all styles in order defined. */
4661 for (nptr
= all_styles
; nptr
!= NULL
; nptr
= SGET_NEXT_STYLE(*nptr
))
4663 if (fw_match_style_id(fw
, SGET_ID(*nptr
)))
4665 merge_styles(styles
, nptr
, False
);
4668 if (!DO_IGNORE_GNOME_HINTS(fw
))
4670 window_style gnome_style
;
4672 /* use GNOME hints if not overridden by user with
4673 * GNOMEIgnoreHitns */
4674 memset(&gnome_style
, 0, sizeof(window_style
));
4675 GNOME_GetStyle(fw
, &gnome_style
);
4676 merge_styles(&gnome_style
, styles
, False
);
4677 memcpy(styles
, &gnome_style
, sizeof(window_style
));
4679 EWMH_GetStyle(fw
, styles
);
4684 /* This function sets the style update flags as necessary */
4685 void check_window_style_change(
4686 FvwmWindow
*t
, update_win
*flags
, window_style
*ret_style
)
4693 lookup_style(t
, ret_style
);
4694 if (!ret_style
->has_style_changed
&& !IS_STYLE_DELETED(t
))
4700 /* do_ignore_gnome_hints
4702 * must handle these first because they may alter the style */
4703 if (S_DO_IGNORE_GNOME_HINTS(SCC(*ret_style
)) &&
4704 !S_DO_IGNORE_GNOME_HINTS(SCF(*ret_style
)))
4706 GNOME_GetStyle(t
, ret_style
);
4707 /* may need further treatment for some styles */
4708 flags
->do_update_gnome_styles
= 1;
4711 /*** common style flags ***/
4713 wf
= (char *)(&FW_COMMON_STATIC_FLAGS(t
));
4714 sf
= (char *)(&SCFS(*ret_style
));
4715 if (IS_STYLE_DELETED(t
))
4717 /* update all styles */
4718 memset(flags
, 0xff, sizeof(*flags
));
4719 SET_STYLE_DELETED(t
, 0);
4720 /* copy the static common window flags */
4721 for (i
= 0; i
< sizeof(SCFS(*ret_style
)); i
++)
4728 /* All static common styles can simply be copied. For some there is
4729 * additional work to be done below. */
4730 sc
= (char *)(&SCCS(*ret_style
));
4731 for (i
= 0; i
< sizeof(SCFS(*ret_style
)); i
++)
4733 wf
[i
] = (wf
[i
] & ~sc
[i
]) | (sf
[i
] & sc
[i
]);
4739 if (S_IS_STICKY_ACROSS_PAGES(SCC(*ret_style
)) ||
4740 S_IS_STICKY_ACROSS_DESKS(SCC(*ret_style
)))
4742 flags
->do_update_stick
= 1;
4744 else if (S_IS_ICON_STICKY_ACROSS_PAGES(SCC(*ret_style
)) &&
4745 IS_ICONIFIED(t
) && !IS_STICKY_ACROSS_PAGES(t
))
4747 flags
->do_update_stick_icon
= 1;
4749 else if (S_IS_ICON_STICKY_ACROSS_DESKS(SCC(*ret_style
)) &&
4750 IS_ICONIFIED(t
) && !IS_STICKY_ACROSS_DESKS(t
))
4752 flags
->do_update_stick_icon
= 1;
4756 if (fpol_is_policy_changed(&S_FOCUS_POLICY(SCC(*ret_style
))))
4758 flags
->do_setup_focus_policy
= 1;
4761 /* is_left_title_rotated_cw
4762 * is_right_title_rotated_cw
4763 * is_top_title_rotated
4764 * is_bottom_title_rotated */
4765 if (S_IS_LEFT_TITLE_ROTATED_CW(SCC(*ret_style
)) ||
4766 S_IS_RIGHT_TITLE_ROTATED_CW(SCC(*ret_style
)) ||
4767 S_IS_TOP_TITLE_ROTATED(SCC(*ret_style
)) ||
4768 S_IS_BOTTOM_TITLE_ROTATED(SCC(*ret_style
)))
4770 flags
->do_update_title_text_dir
= 1;
4774 if (S_TITLE_DIR(SCC(*ret_style
)))
4776 flags
->do_update_title_dir
= 1;
4779 /* use_title_decor_rotation */
4780 if (S_USE_TITLE_DECOR_ROTATION(SCC(*ret_style
)))
4782 flags
->do_update_rotated_title
= 1;
4786 * has_mwm_buttons */
4787 if (S_HAS_MWM_BORDER(SCC(*ret_style
)) ||
4788 S_HAS_MWM_BUTTONS(SCC(*ret_style
)))
4790 flags
->do_redecorate
= 1;
4794 if (S_HAS_ICON_FONT(SCC(*ret_style
)))
4796 flags
->do_update_icon_font
= 1;
4799 /* has_window_font */
4800 if (S_HAS_WINDOW_FONT(SCC(*ret_style
)))
4802 flags
->do_update_window_font
= 1;
4805 /* has_stippled_title */
4806 if (S_HAS_STIPPLED_TITLE(SCC(*ret_style
)) ||
4807 S_HAS_NO_STICKY_STIPPLED_TITLE(SCC(*ret_style
)) ||
4808 S_HAS_STIPPLED_ICON_TITLE(SCC(*ret_style
)) ||
4809 S_HAS_NO_STICKY_STIPPLED_ICON_TITLE(SCC(*ret_style
)))
4811 flags
->do_redraw_decoration
= 1;
4814 /* has_no_icon_title
4815 * is_icon_suppressed
4819 /*** private style flags ***/
4821 /* nothing to do for these flags (only used when mapping new windows):
4828 * use_no_transient_pposition
4829 * use_no_transient_usposition
4831 * use_start_on_page_for_transient
4832 * use_start_on_screen
4833 * manual_placement_honors_starts_on_page
4834 * capture_honors_starts_on_page
4835 * recapture_honors_starts_on_page
4837 * ewmh_placement_mode
4840 /* not implemented yet:
4842 * handling the 'usestyle' style
4845 /* do_window_list_skip */
4846 if (S_DO_WINDOW_LIST_SKIP(SCC(*ret_style
)))
4848 flags
->do_update_modules_flags
= 1;
4849 flags
->do_update_ewmh_state_hints
= 1;
4854 if (ret_style
->change_mask
.has_icon
||
4855 S_ICON_OVERRIDE(SCC(*ret_style
)))
4857 flags
->do_update_icon_font
= 1;
4858 flags
->do_update_icon
= 1;
4861 /* has_icon_background_padding
4862 * has_icon_background_relief
4863 * has_icon_title_relief */
4864 if (ret_style
->change_mask
.has_icon_background_padding
||
4865 ret_style
->change_mask
.has_icon_background_relief
||
4866 ret_style
->change_mask
.has_icon_title_relief
)
4868 flags
->do_update_icon
= 1;
4871 /* has_no_icon_title
4872 * is_icon_suppressed */
4873 if (S_HAS_NO_ICON_TITLE(SCC(*ret_style
)) ||
4874 S_IS_ICON_SUPPRESSED(SCC(*ret_style
)))
4876 flags
->do_update_icon_font
= 1;
4877 flags
->do_update_icon_title
= 1;
4878 flags
->do_update_icon
= 1;
4879 flags
->do_update_modules_flags
= 1;
4882 /* has_icon_size_limits */
4883 if (ret_style
->change_mask
.has_icon_size_limits
)
4885 flags
->do_update_icon_size_limits
= 1;
4886 flags
->do_update_icon
= 1;
4889 /* has_icon_boxes */
4890 if (ret_style
->change_mask
.has_icon_boxes
)
4892 flags
->do_update_icon_boxes
= 1;
4893 flags
->do_update_icon
= 1;
4896 /* do_ewmh_donate_icon */
4897 if (S_DO_EWMH_DONATE_ICON(SCC(*ret_style
)))
4899 flags
->do_update_ewmh_icon
= 1;
4903 * do_ewmh_mini_icon_override */
4905 FMiniIconsSupported
&& (
4906 ret_style
->change_mask
.has_mini_icon
||
4907 S_DO_EWMH_MINI_ICON_OVERRIDE(SCC(*ret_style
))))
4909 flags
->do_update_mini_icon
= 1;
4910 flags
->do_update_ewmh_mini_icon
= 1;
4911 flags
->do_redecorate
= 1;
4914 /* do_ewmh_donate_mini_icon */
4915 if (FMiniIconsSupported
&& S_DO_EWMH_DONATE_MINI_ICON(SCC(*ret_style
)))
4917 flags
->do_update_ewmh_mini_icon
= 1;
4920 /* has_min_window_size */
4921 /* has_max_window_size */
4922 if (ret_style
->change_mask
.has_min_window_size
)
4924 flags
->do_resize_window
= 1;
4925 flags
->do_update_ewmh_allowed_actions
= 1;
4926 flags
->do_update_modules_flags
= 1;
4928 if (ret_style
->change_mask
.has_max_window_size
)
4930 flags
->do_resize_window
= 1;
4931 flags
->do_update_ewmh_allowed_actions
= 1;
4932 flags
->do_update_modules_flags
= 1;
4938 * use_border_colorset */
4939 if (ret_style
->change_mask
.has_color_fore
||
4940 ret_style
->change_mask
.has_color_back
||
4941 ret_style
->change_mask
.use_colorset
||
4942 ret_style
->change_mask
.use_border_colorset
)
4944 flags
->do_update_window_color
= 1;
4946 /* has_color_back_hi
4949 * use_border_colorset_hi */
4950 if (ret_style
->change_mask
.has_color_fore_hi
||
4951 ret_style
->change_mask
.has_color_back_hi
||
4952 ret_style
->change_mask
.use_colorset_hi
||
4953 ret_style
->change_mask
.use_border_colorset_hi
)
4955 flags
->do_update_window_color_hi
= 1;
4958 /* use_icon_title_colorset */
4959 if (ret_style
->change_mask
.use_icon_title_colorset
)
4961 flags
->do_update_icon_title_cs
= 1;
4964 /* use_icon_title_colorset_hi */
4965 if (ret_style
->change_mask
.use_icon_title_colorset_hi
)
4967 flags
->do_update_icon_title_cs_hi
= 1;
4970 /* use_icon_title_colorset */
4971 if (ret_style
->change_mask
.use_icon_title_colorset
)
4973 flags
->do_update_icon_title_cs
= 1;
4976 /* use_icon_background_colorset */
4977 if (ret_style
->change_mask
.use_icon_background_colorset
)
4979 flags
->do_update_icon_background_cs
= 1;
4983 if (ret_style
->change_mask
.has_decor
)
4985 flags
->do_redecorate
= 1;
4986 flags
->do_update_window_font_height
= 1;
4990 if (ret_style
->change_mask
.has_no_title
)
4992 flags
->do_redecorate
= 1;
4993 flags
->do_update_window_font
= 1;
4996 /* do_decorate_transient */
4997 if (ret_style
->change_mask
.do_decorate_transient
)
4999 flags
->do_redecorate_transient
= 1;
5003 if (ret_style
->change_mask
.has_ol_decor
)
5005 /* old decor overrides 'has_no_icon_title'! */
5006 flags
->do_update_icon_font
= 1;
5007 flags
->do_update_icon_title
= 1;
5008 flags
->do_update_icon
= 1;
5009 flags
->do_redecorate
= 1;
5018 * is_button_disabled */
5019 if (S_HAS_NO_BORDER(SCC(*ret_style
)) ||
5020 ret_style
->change_mask
.has_border_width
||
5021 ret_style
->change_mask
.has_handle_width
||
5022 ret_style
->change_mask
.has_mwm_decor
||
5023 ret_style
->change_mask
.has_mwm_functions
||
5024 ret_style
->change_mask
.has_no_handles
||
5025 ret_style
->change_mask
.is_button_disabled
)
5027 flags
->do_redecorate
= 1;
5028 flags
->do_update_ewmh_allowed_actions
= 1;
5029 flags
->do_update_modules_flags
= 1;
5032 if (ret_style
->change_mask
.do_save_under
||
5033 ret_style
->change_mask
.use_backing_store
||
5034 ret_style
->change_mask
.use_parent_relative
)
5036 flags
->do_update_frame_attributes
= 1;
5039 if (ret_style
->change_mask
.use_parent_relative
&&
5040 ret_style
->flags
.use_parent_relative
)
5042 /* needed only for Opacity -> ParentalRelativity */
5043 flags
->do_refresh
= 1;
5046 /* has_placement_penalty
5047 * has_placement_percentage_penalty */
5048 if (ret_style
->change_mask
.has_placement_penalty
||
5049 ret_style
->change_mask
.has_placement_percentage_penalty
)
5051 flags
->do_update_placement_penalty
= 1;
5054 /* do_ewmh_ignore_strut_hints */
5055 if (S_DO_EWMH_IGNORE_STRUT_HINTS(SCC(*ret_style
)))
5057 flags
->do_update_working_area
= 1;
5060 /* do_ewmh_ignore_state_hints */
5061 if (S_DO_EWMH_IGNORE_STATE_HINTS(SCC(*ret_style
)))
5063 flags
->do_update_ewmh_state_hints
= 1;
5064 flags
->do_update_modules_flags
= 1;
5067 /* do_ewmh_use_staking_hints */
5068 if (S_DO_EWMH_USE_STACKING_HINTS(SCC(*ret_style
)))
5070 flags
->do_update_ewmh_stacking_hints
= 1;
5073 /* use_indexed_window_name */
5074 if (S_USE_INDEXED_WINDOW_NAME(SCC(*ret_style
)))
5076 flags
->do_update_visible_window_name
= 1;
5077 flags
->do_redecorate
= 1;
5080 /* use_indexed_icon_name */
5081 if (S_USE_INDEXED_ICON_NAME(SCC(*ret_style
)))
5083 flags
->do_update_visible_icon_name
= 1;
5084 flags
->do_update_icon_title
= 1;
5088 if (S_IS_FIXED(SCC(*ret_style
)) ||
5089 S_IS_FIXED_PPOS(SCC(*ret_style
)) ||
5090 S_IS_SIZE_FIXED(SCC(*ret_style
)) ||
5091 S_IS_PSIZE_FIXED(SCC(*ret_style
)) ||
5092 S_HAS_OVERRIDE_SIZE(SCC(*ret_style
)))
5094 flags
->do_update_ewmh_allowed_actions
= 1;
5095 flags
->do_update_modules_flags
= 1;
5098 /* cr_motion_method */
5099 if (SCR_MOTION_METHOD(&ret_style
->change_mask
))
5101 flags
->do_update_cr_motion_method
= 1;
5107 /* Mark all styles as unchanged. */
5108 void reset_style_changes(void)
5112 for (temp
= all_styles
; temp
!= NULL
; temp
= SGET_NEXT_STYLE(*temp
))
5114 temp
->has_style_changed
= 0;
5115 memset(&SCCS(*temp
), 0, sizeof(SCCS(*temp
)));
5116 memset(&(temp
->change_mask
), 0, sizeof(temp
->change_mask
));
5122 /* Mark styles as updated if their colorset changed. */
5123 void update_style_colorset(int colorset
)
5127 for (temp
= all_styles
; temp
!= NULL
; temp
= SGET_NEXT_STYLE(*temp
))
5129 if (SUSE_COLORSET(&temp
->flags
) &&
5130 SGET_COLORSET(*temp
) == colorset
)
5132 temp
->has_style_changed
= 1;
5133 temp
->change_mask
.use_colorset
= 1;
5134 Scr
.flags
.do_need_window_update
= 1;
5136 if (SUSE_COLORSET_HI(&temp
->flags
) &&
5137 SGET_COLORSET_HI(*temp
) == colorset
)
5139 temp
->has_style_changed
= 1;
5140 temp
->change_mask
.use_colorset_hi
= 1;
5141 Scr
.flags
.do_need_window_update
= 1;
5143 if (SUSE_BORDER_COLORSET(&temp
->flags
) &&
5144 SGET_BORDER_COLORSET(*temp
) == colorset
)
5146 temp
->has_style_changed
= 1;
5147 temp
->change_mask
.use_border_colorset
= 1;
5148 Scr
.flags
.do_need_window_update
= 1;
5150 if (SUSE_BORDER_COLORSET_HI(&temp
->flags
) &&
5151 SGET_BORDER_COLORSET_HI(*temp
) == colorset
)
5153 temp
->has_style_changed
= 1;
5154 temp
->change_mask
.use_border_colorset_hi
= 1;
5155 Scr
.flags
.do_need_window_update
= 1;
5157 if (SUSE_ICON_TITLE_COLORSET(&temp
->flags
) &&
5158 SGET_ICON_TITLE_COLORSET(*temp
) == colorset
)
5160 temp
->has_style_changed
= 1;
5161 temp
->change_mask
.use_icon_title_colorset
= 1;
5162 Scr
.flags
.do_need_window_update
= 1;
5164 if (SUSE_ICON_TITLE_COLORSET_HI(&temp
->flags
) &&
5165 SGET_ICON_TITLE_COLORSET_HI(*temp
) == colorset
)
5167 temp
->has_style_changed
= 1;
5168 temp
->change_mask
.use_icon_title_colorset_hi
= 1;
5169 Scr
.flags
.do_need_window_update
= 1;
5171 if (SUSE_ICON_BACKGROUND_COLORSET(&temp
->flags
) &&
5172 SGET_ICON_BACKGROUND_COLORSET(*temp
) == colorset
)
5174 temp
->has_style_changed
= 1;
5175 temp
->change_mask
.use_icon_background_colorset
= 1;
5176 Scr
.flags
.do_need_window_update
= 1;
5183 /* Update fore and back colours for a specific window */
5184 void update_window_color_style(FvwmWindow
*fw
, window_style
*pstyle
)
5186 int cs
= Scr
.DefaultColorset
;
5188 if (SUSE_COLORSET(&pstyle
->flags
))
5190 cs
= SGET_COLORSET(*pstyle
);
5197 if (SGET_FORE_COLOR_NAME(*pstyle
) != NULL
&&
5198 !SUSE_COLORSET(&pstyle
->flags
))
5200 fw
->colors
.fore
= GetColor(SGET_FORE_COLOR_NAME(*pstyle
));
5204 fw
->colors
.fore
= Colorset
[cs
].fg
;
5206 if (SGET_BACK_COLOR_NAME(*pstyle
) != NULL
&&
5207 !SUSE_COLORSET(&pstyle
->flags
))
5209 fw
->colors
.back
= GetColor(SGET_BACK_COLOR_NAME(*pstyle
));
5210 fw
->colors
.shadow
= GetShadow(fw
->colors
.back
);
5211 fw
->colors
.hilight
= GetHilite(fw
->colors
.back
);
5215 fw
->colors
.hilight
= Colorset
[cs
].hilite
;
5216 fw
->colors
.shadow
= Colorset
[cs
].shadow
;
5217 fw
->colors
.back
= Colorset
[cs
].bg
;
5219 if (SUSE_BORDER_COLORSET(&pstyle
->flags
))
5221 cs
= SGET_BORDER_COLORSET(*pstyle
);
5223 fw
->border_colors
.hilight
= Colorset
[cs
].hilite
;
5224 fw
->border_colors
.shadow
= Colorset
[cs
].shadow
;
5225 fw
->border_colors
.back
= Colorset
[cs
].bg
;
5230 fw
->border_colors
.hilight
= fw
->colors
.hilight
;
5231 fw
->border_colors
.shadow
= fw
->colors
.shadow
;
5232 fw
->border_colors
.back
= fw
->colors
.back
;
5236 void update_window_color_hi_style(FvwmWindow
*fw
, window_style
*pstyle
)
5238 int cs
= Scr
.DefaultColorset
;
5240 if (SUSE_COLORSET_HI(&pstyle
->flags
))
5242 cs
= SGET_COLORSET_HI(*pstyle
);
5250 SGET_FORE_COLOR_NAME_HI(*pstyle
) != NULL
&&
5251 !SUSE_COLORSET_HI(&pstyle
->flags
))
5253 fw
->hicolors
.fore
= GetColor(SGET_FORE_COLOR_NAME_HI(*pstyle
));
5257 fw
->hicolors
.fore
= Colorset
[cs
].fg
;
5260 SGET_BACK_COLOR_NAME_HI(*pstyle
) != NULL
&&
5261 !SUSE_COLORSET_HI(&pstyle
->flags
))
5263 fw
->hicolors
.back
= GetColor(SGET_BACK_COLOR_NAME_HI(*pstyle
));
5264 fw
->hicolors
.shadow
= GetShadow(fw
->hicolors
.back
);
5265 fw
->hicolors
.hilight
= GetHilite(fw
->hicolors
.back
);
5269 fw
->hicolors
.hilight
= Colorset
[cs
].hilite
;
5270 fw
->hicolors
.shadow
= Colorset
[cs
].shadow
;
5271 fw
->hicolors
.back
= Colorset
[cs
].bg
;
5273 if (SUSE_BORDER_COLORSET_HI(&pstyle
->flags
))
5275 cs
= SGET_BORDER_COLORSET_HI(*pstyle
);
5276 fw
->border_cs_hi
= cs
;
5277 fw
->border_hicolors
.hilight
= Colorset
[cs
].hilite
;
5278 fw
->border_hicolors
.shadow
= Colorset
[cs
].shadow
;
5279 fw
->border_hicolors
.back
= Colorset
[cs
].bg
;
5283 fw
->border_cs_hi
= -1;
5284 fw
->border_hicolors
.hilight
= fw
->hicolors
.hilight
;
5285 fw
->border_hicolors
.shadow
= fw
->hicolors
.shadow
;
5286 fw
->border_hicolors
.back
= fw
->hicolors
.back
;
5290 void update_icon_title_cs_style(FvwmWindow
*fw
, window_style
*pstyle
)
5292 if (SUSE_ICON_TITLE_COLORSET(&pstyle
->flags
))
5294 fw
->icon_title_cs
= SGET_ICON_TITLE_COLORSET(*pstyle
);
5298 fw
->icon_title_cs
= -1;
5302 void update_icon_title_cs_hi_style(FvwmWindow
*fw
, window_style
*pstyle
)
5304 if (SUSE_ICON_TITLE_COLORSET_HI(&pstyle
->flags
))
5306 fw
->icon_title_cs_hi
= SGET_ICON_TITLE_COLORSET_HI(*pstyle
);
5310 fw
->icon_title_cs_hi
= -1;
5314 void update_icon_background_cs_style(FvwmWindow
*fw
, window_style
*pstyle
)
5316 if (SUSE_ICON_BACKGROUND_COLORSET(&pstyle
->flags
))
5318 fw
->icon_background_cs
=
5319 SGET_ICON_BACKGROUND_COLORSET(*pstyle
);
5323 fw
->icon_background_cs
= -1;
5327 void style_destroy_style(style_id_t s_id
)
5331 if (remove_all_of_style_from_list(s_id
))
5333 /* compact the current list of styles */
5334 Scr
.flags
.do_need_style_list_update
= 1;
5340 /* mark windows for update */
5341 for (t
= Scr
.FvwmRoot
.next
; t
!= NULL
; t
= t
->next
)
5343 if (fw_match_style_id(t
, s_id
))
5345 SET_STYLE_DELETED(t
, 1);
5346 Scr
.flags
.do_need_window_update
= 1;
5353 void print_styles(int verbose
)
5359 fprintf(stderr
,"Info on fvwm Styles:\n");
5362 fprintf(stderr
," List of Styles Names:\n");
5364 for (nptr
= all_styles
; nptr
!= NULL
; nptr
= SGET_NEXT_STYLE(*nptr
))
5367 if (SGET_ID_HAS_NAME(*nptr
))
5369 mem
+= strlen(SGET_NAME(*nptr
));
5372 fprintf(stderr
," * %s\n", SGET_NAME(*nptr
));
5380 fprintf(stderr
," * 0x%lx\n",
5381 (unsigned long)SGET_WINDOW_ID(*nptr
));
5384 if (SGET_BACK_COLOR_NAME(*nptr
))
5386 mem
+= strlen(SGET_BACK_COLOR_NAME(*nptr
));
5390 stderr
," Back Color: %s\n",
5391 SGET_BACK_COLOR_NAME(*nptr
));
5394 if (SGET_FORE_COLOR_NAME(*nptr
))
5396 mem
+= strlen(SGET_FORE_COLOR_NAME(*nptr
));
5400 stderr
," Fore Color: %s\n",
5401 SGET_FORE_COLOR_NAME(*nptr
));
5404 if (SGET_BACK_COLOR_NAME_HI(*nptr
))
5406 mem
+= strlen(SGET_BACK_COLOR_NAME_HI(*nptr
));
5410 stderr
," Back Color hi: %s\n",
5411 SGET_BACK_COLOR_NAME_HI(*nptr
));
5414 if (SGET_FORE_COLOR_NAME_HI(*nptr
))
5416 mem
+= strlen(SGET_FORE_COLOR_NAME_HI(*nptr
));
5420 stderr
," Fore Color hi: %s\n",
5421 SGET_FORE_COLOR_NAME_HI(*nptr
));
5424 if (SGET_DECOR_NAME(*nptr
))
5426 mem
+= strlen(SGET_DECOR_NAME(*nptr
));
5430 stderr
," Decor: %s\n",
5431 SGET_DECOR_NAME(*nptr
));
5434 if (SGET_WINDOW_FONT(*nptr
))
5436 mem
+= strlen(SGET_WINDOW_FONT(*nptr
));
5440 stderr
," Window Font: %s\n",
5441 SGET_WINDOW_FONT(*nptr
));
5444 if (SGET_ICON_FONT(*nptr
))
5446 mem
+= strlen(SGET_ICON_FONT(*nptr
));
5450 stderr
," Icon Font: %s\n",
5451 SGET_ICON_FONT(*nptr
));
5454 if (SGET_ICON_NAME(*nptr
))
5456 mem
+= strlen(SGET_ICON_NAME(*nptr
));
5460 stderr
," Icon Name: %s\n",
5461 SGET_ICON_NAME(*nptr
));
5464 if (SGET_MINI_ICON_NAME(*nptr
))
5466 mem
+= strlen(SGET_MINI_ICON_NAME(*nptr
));
5470 stderr
," MiniIcon Name: %s\n",
5471 SGET_MINI_ICON_NAME(*nptr
));
5474 if (SGET_ICON_BOXES(*nptr
))
5476 mem
+= sizeof(icon_boxes
);
5479 fprintf(stderr
," Number of styles: %d, Memory Used: %d bits\n",
5480 count
, (int)(count
*sizeof(window_style
) + mem
));
5485 /* ---------------------------- builtin commands --------------------------- */
5487 void CMD_Style(F_CMD_ARGS
)
5489 __style_command(F_PASS_ARGS
, NULL
, False
);
5494 void CMD_WindowStyle(F_CMD_ARGS
)
5496 __style_command(F_PASS_ARGS
, NULL
, True
);
5501 void CMD_FocusStyle(F_CMD_ARGS
)
5503 __style_command(F_PASS_ARGS
, "FP", False
);
5508 void CMD_DestroyStyle(F_CMD_ARGS
)
5513 /* parse style name */
5514 name
= PeekToken(action
, &action
);
5516 /* in case there was no argument! */
5520 memset(&s_id
, 0, sizeof(style_id_t
));
5521 SID_SET_NAME(s_id
, name
);
5522 SID_SET_HAS_NAME(s_id
, True
);
5525 style_destroy_style(s_id
);
5529 void CMD_DestroyWindowStyle(F_CMD_ARGS
)
5533 memset(&s_id
, 0, sizeof(style_id_t
));
5534 SID_SET_WINDOW_ID(s_id
, (XID
)FW_W(exc
->w
.fw
));
5535 SID_SET_HAS_WINDOW_ID(s_id
, True
);
5538 style_destroy_style(s_id
);