Skip to content

Commit

Permalink
WIP: Style v3
Browse files Browse the repository at this point in the history
Need to sort out whether Capabilities is worth it.
Need to fix print_styles() to work similar to print_bindings()
Need to check DestroyStyle() syntax.
  • Loading branch information
ThomasAdam committed Jan 26, 2025
1 parent 04e71bc commit 727b408
Show file tree
Hide file tree
Showing 9 changed files with 778 additions and 251 deletions.
10 changes: 10 additions & 0 deletions doc/fvwm3_manpage_source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2928,6 +2928,16 @@ the newcomer.

=== Miscellaneous Commands

*Capabilities* [_option_ [_bool_]], ...::
This command enables features which are still experimental.
+
_FvwmStyleV3_ activates enhanced style matching whereby different aspects of
styles can be matched, for example:
+
....
Style (Class=XTerm, Name=mc) Sticky
....

*BugOpts* [_option_ [_bool_]], ...::
This command controls several workarounds for bugs in third party
programs. The individual options are separated by commas. The optional
Expand Down
1 change: 1 addition & 0 deletions fvwm/bindings.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ static int mods_unused = DEFAULT_MODS_UNUSED;
static void update_nr_buttons(
int contexts, int *nr_left_buttons, int *nr_right_buttons, Bool do_set)
{
return;
int i;
int l = *nr_left_buttons;
int r = *nr_right_buttons;
Expand Down
46 changes: 46 additions & 0 deletions fvwm/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -3179,6 +3179,52 @@ void CMD_UnsetEnv(F_CMD_ARGS)
return;
}

void CMD_Capabilities(F_CMD_ARGS)
{
char *opt;
int toggle;
char *optstring;

while (action && *action && *action != '\n')
{
action = GetNextFullOption(action, &optstring);
if (!optstring)
{
/* no more options */
return;
}
toggle = ParseToggleArgument(
SkipNTokens(optstring,1), NULL, 2, False);
opt = PeekToken(optstring, NULL);
free(optstring);

if (!opt)
{
return;
}

if (StrEquals(opt, "FvwmStyleV3"))
{
switch (toggle)
{
case -1:
Scr.cap.fvwm_style_v3 ^= 1;
break;
case 0:
case 1:
Scr.cap.fvwm_style_v3 = toggle;
break;
default:
Scr.cap.fvwm_style_v3 = 0;
break;
}
} else {
fvwm_debug(__func__,
"Unknown capability '%s'", opt);
}
}
}

void CMD_BugOpts(F_CMD_ARGS)
{
char *opt;
Expand Down
2 changes: 2 additions & 0 deletions fvwm/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ enum
F_BUSY_CURSOR,
F_BUTTON_STATE,
F_BUTTON_STYLE,
F_CAPABILITIES,
F_CHANGE_MENUSTYLE,
F_CIRCULATE_DOWN,
F_CIRCULATE_UP,
Expand Down Expand Up @@ -206,6 +207,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
3 changes: 3 additions & 0 deletions fvwm/functable.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ const func_t func_table[] =
FUNC_DECOR, 0),
/* - Define a window button look (will be reworked) */

CMD_ENT("capabilities", CMD_Capabilities, F_CAPABILITIES, 0, 0),
/* - Define capabilities which can be changed at runtime */

CMD_ENT("changedecor", CMD_ChangeDecor, F_CHANGE_DECOR,
FUNC_NEEDS_WINDOW, CRS_SELECT),
/* - Attach decor to a window (will be obsolete) */
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 727b408

Please sign in to comment.