Skip to content

Commit

Permalink
screen win: grab even if just screen:clear_prefs
Browse files Browse the repository at this point in the history
Previously it cleared the preferences and exitted if no options followed
but starts grabbing otherwise, which is inconsistent. If user wants just
clearing preferences, Ctrl-c may be pressed immediately to exit.
  • Loading branch information
MartinPulec committed Oct 27, 2023
1 parent 8b41214 commit c9bdbc1
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/video_capture/screen_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,12 @@ static void show_help()
color_printf("%s", wrap_paragraph(desc));
color_printf("Usage\n");
color_printf(
TBOLD(TRED("\t-t screen") "[:size=<w>x<h>][:fps=<f>][other-opts]") "\n");
TBOLD(TRED("\t-t screen") "[:clear_prefs][:size=<w>x<h>][:fps=<f>][other-opts]") "\n");
color_printf(TBOLD("\t-t screen:help") " | " TBOLD(
"-t screen:unregister") " | " TBOLD("-t screen:clear_prefs") "\n");
"-t screen:unregister") "\n");
color_printf("where:\n");
color_printf(TBOLD("\tunregister") " - unregister DShow filter\n");
color_printf(TBOLD("\tclear_prefs") " - clear screen capture preferences from registry\n");
color_printf("\t\tIf an option follow, UG will run using new parameters.\n");
color_printf(TBOLD("\tclear_prefs") " - clear screen capture preferences from registry (must be first opt)\n");
color_printf(TBOLD("\tother-opts") " - one of screen-capture-recorder opts (with value):");
for (unsigned i = 0;
i < sizeof screen_cap_rec_opts / sizeof screen_cap_rec_opts[0];
Expand Down Expand Up @@ -474,11 +473,8 @@ static int vidcap_screen_win_init(struct vidcap_params *params, void **state)
return res ? VIDCAP_INIT_NOERR : VIDCAP_INIT_FAIL;
}
if (strstr(cfg, "clear_prefs") == cfg) {
const bool ret = delete_winreg_tree();
cfg += strlen("clear_prefs");
if (strlen(cfg) == 0) {
return ret ? VIDCAP_INIT_NOERR : VIDCAP_INIT_FAIL;
}
delete_winreg_tree();
}
if (strstr(cfg, "child") == cfg) {
child = true;
Expand Down

0 comments on commit c9bdbc1

Please sign in to comment.