Skip to content

Commit

Permalink
style: add window-property matching
Browse files Browse the repository at this point in the history
Historically, window style matching relied on fvwm matching a windows
name or resource or class, etc., in a hard-coded order, with very little
means of being able to specify those properties.

With this change, it's now possible to specify the following attributes
a window should match against, either individually or in combination:

 - Resource
 - Class
 - Name
 - Icon
 - WindowID

For example:

  Style (Name foo, Class XTerm) Sticky

Would only make the window sticky if its name matched "foo", and its
class is "XTerm".

Existing style lines such as:

  Style foo Sticky

Still work as expected.

In addition, this change also removes the "PrintInfo style" command as
it is no longer useful with this change to styles.
  • Loading branch information
ThomasAdam committed Jan 31, 2025
1 parent 04e71bc commit d134ba2
Show file tree
Hide file tree
Showing 7 changed files with 533 additions and 309 deletions.
2 changes: 0 additions & 2 deletions doc/fvwm3_manpage_source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3451,8 +3451,6 @@ fvwm used. _verbose_ can be 1 or 2.
+
_nls_ which prints information on the locale catalogs that fvwm used
+
_style_ which prints information on fvwm styles. _verbose_ can be 1.
+
_bindings_ which prints information on all the bindings fvwm has: key
and mouse bindings. _verbose_ has no effect with this option.
+
Expand Down
4 changes: 0 additions & 4 deletions fvwm/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -2651,10 +2651,6 @@ void CMD_PrintInfo(F_CMD_ARGS)
{
FGettextPrintLocalePath(verbose);
}
else if (StrEquals(subject, "style"))
{
print_styles(verbose);
}
else if (StrEquals(subject, "ImageCache"))
{
PicturePrintImageCache(verbose);
Expand Down
1 change: 1 addition & 0 deletions fvwm/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ void CMD_BugOpts(F_CMD_ARGS);
void CMD_BusyCursor(F_CMD_ARGS);
void CMD_ButtonState(F_CMD_ARGS);
void CMD_ButtonStyle(F_CMD_ARGS);
void CMD_Capabilities(F_CMD_ARGS);
void CMD_ChangeDecor(F_CMD_ARGS);
void CMD_ChangeMenuStyle(F_CMD_ARGS);
void CMD_CleanupColorsets(F_CMD_ARGS);
Expand Down
29 changes: 23 additions & 6 deletions fvwm/fvwm.h
Original file line number Diff line number Diff line change
Expand Up @@ -570,15 +570,24 @@ typedef struct style_flags
unsigned initial_placement_done : 1;
} style_flags;

typedef struct style_id_flags
{
unsigned has_name:1;
unsigned has_window_id:1;
unsigned has_class:1;
unsigned has_resource:1;
unsigned has_icon:1;
unsigned is_compatibility_mode:1;
} style_id_flags;

typedef struct style_id_t
{
char *name;
XID window_id;
struct
{
unsigned has_name:1;
unsigned has_window_id:1;
} flags;
style_id_flags flags;
char *name;
char *class;
char *resource;
char *icon;
} style_id_t;

typedef struct snap_attraction_t
Expand Down Expand Up @@ -679,6 +688,14 @@ typedef struct window_style
unsigned has_icon_title_format_string : 1;
} window_style;

typedef struct window_style_list
{
struct window_style_list *next;
style_id_t flags;
window_style *first_style;
window_style *last_style;
} window_style_list;

typedef struct window_g
{
rectangle frame;
Expand Down
4 changes: 4 additions & 0 deletions fvwm/screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@ typedef struct ScreenInfo
unsigned do_debug_randr : 1;
} bo; /* bug workaround control options */
struct
{
unsigned fvwm_style_v3 : 1;
} cap; /* Capabilities. */
struct
{
unsigned do_emulate_mwm : 1;
unsigned do_emulate_win : 1;
Expand Down
Loading

0 comments on commit d134ba2

Please sign in to comment.