Skip to content

Commit

Permalink
Improve the mouse capture nane reported incorrectly configured
Browse files Browse the repository at this point in the history
If the first capture_mouse variable is incorrect, the output is now:

- "first-bad-val" is not a valid value for variable: capture_mouse (first value).
- It might now be reset to the default value: seamless

If the second capture_mouse variable is incorrect, the output is now:

- "second-bad-val" is not a valid value for variable: capture_mouse (second value).
- It might now be reset to the default value: middlerelease
  • Loading branch information
kcgen committed Aug 20, 2020
1 parent aa45d6a commit 40f186f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/gui/sdlmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2241,7 +2241,7 @@ static void GUI_StartUp(Section * sec) {

// Apply the user's mouse settings
Section_prop* s = section->Get_multival("capture_mouse")->GetSection();
const std::string control_choice = s->Get_string("mouse_control");
const std::string control_choice = s->Get_string("capture_mouse (first value)");
std::string mouse_control_msg;
if (control_choice == "onclick") {
sdl.mouse.control_choice = CaptureOnClick;
Expand All @@ -2259,7 +2259,7 @@ static void GUI_StartUp(Section * sec) {
assert(sdl.mouse.control_choice == CaptureOnClick);
}
std:: string middle_control_msg;
if (std::string(s->Get_string("middle_control")) == "middlerelease") {
if (std::string(s->Get_string("capture_mouse (second value)")) == "middlerelease") {
sdl.mouse.middle_will_release = true;
if (sdl.mouse.control_choice & (CaptureOnClick | CaptureOnStart))
middle_control_msg = " and middle-click will uncapture the mouse";
Expand Down Expand Up @@ -2833,8 +2833,8 @@ void Config_Add_SDL() {

// Add the mouse and middle control as sub-sections
Psection = Pmulti->GetSection();
Psection->Add_string("mouse_control", always, mouse_controls[0])->Set_values(mouse_controls);
Psection->Add_string("middle_control", always, middle_controls[0])->Set_values(middle_controls);
Psection->Add_string("capture_mouse (first value)", always, mouse_controls[0])->Set_values(mouse_controls);
Psection->Add_string("capture_mouse (second value)", always, middle_controls[0])->Set_values(middle_controls);

// Construct and set the help block using defaults set above
std::string mouse_control_help(
Expand Down

0 comments on commit 40f186f

Please sign in to comment.