Skip to content

Commit

Permalink
new command: Capabilities
Browse files Browse the repository at this point in the history
For some changes in fvwm3, it is often preferable to have something
which can run side-by-side with the original, so that compatibility
isn't broken whilst the feature is in development.

To handle this, create a new command 'Capabilities' which works very
similar to the 'BugOpts' command, but isn't for bugs.
  • Loading branch information
ThomasAdam committed May 19, 2024
1 parent 5d6c045 commit 18ffc47
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 0 deletions.
10 changes: 10 additions & 0 deletions doc/fvwm3_manpage_source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2925,6 +2925,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
46 changes: 46 additions & 0 deletions fvwm/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -3360,6 +3360,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 @@ -215,6 +216,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
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

0 comments on commit 18ffc47

Please sign in to comment.