Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reporting of the slider in the Parameters dialog with Windows Narrator. #762

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions src/paramsUi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,15 +621,34 @@ class ParamsDialog {
SetWindowText(this->dialog, this->source->getTitle().c_str());
this->paramCombo = GetDlgItem(this->dialog, ID_PARAM);
WDL_UTF8_HookComboBox(this->paramCombo);
this->slider = GetDlgItem(this->dialog, ID_PARAM_VAL_SLIDER);
// We need to do exotic stuff with this slider that we can't support on Mac:
// 1. Custom step values (TBM_SETLINESIZE, TBM_SETPAGESIZE).
// 2. Down arrow moving left instead of right (TBS_DOWNISLEFT).
// We also snap to changes in value text, which is even tricky on Windows.
// Therefore, we just use the slider as a placeholder and handle key
// presses ourselves.
// We also use this key handler to pass some keys through to the main
// window.
// Finally, we need to expose value text, not just a numeric value, but UIA
// ignores annotation of PROPID_ACC_VALUE and
// UIA_IsValuePatternAvailablePropertyId on real sliders.
// Therefore, we just use a placeholder and handle key presses ourselves.
#ifdef _WIN32
// On Windows, we use a Static text control and annotate the role and value
// to get around the annotation issues with real sliders.
HWND realSlider = GetDlgItem(this->dialog, ID_PARAM_VAL_SLIDER);
ShowWindow(realSlider, SW_HIDE);
this->slider = GetDlgItem(this->dialog, ID_PARAM_VAL_FAKE_SLIDER);
VARIANT role;
role.vt = VT_I4;
role.lVal = ROLE_SYSTEM_SLIDER;
accPropServices->SetHwndProp(this->slider, OBJID_CLIENT, CHILDID_SELF,
PROPID_ACC_ROLE, role);
#else
// On Mac, we use a real slider because we can't annotate roles and we want
// it to be reported as a slider.
HWND fakeSlider = GetDlgItem(this->dialog, ID_PARAM_VAL_FAKE_SLIDER);
ShowWindow(fakeSlider, SW_HIDE);
this->slider = GetDlgItem(this->dialog, ID_PARAM_VAL_SLIDER);
#endif
// As well as the slider keyboard handling, we also use this key handler to
// pass some keys through to the main window.
this->accelReg.translateAccel = &this->translateAccel;
this->accelReg.isLocal = true;
this->accelReg.user = (void*)this;
Expand Down
1 change: 1 addition & 0 deletions src/reaper_osara.rc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ BEGIN
LTEXT "Value:", IDC_STATIC, 10, 30, 23, 10
// SWELL doesn't have the TRACKBAR_CLASS constant.
CONTROL "", ID_PARAM_VAL_SLIDER, "msctls_trackbar32", WS_TABSTOP, 40, 30, 60, 10
CONTROL "", ID_PARAM_VAL_FAKE_SLIDER, "Static", WS_TABSTOP, 40, 30, 60, 10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder what this will do with JAWS.

Suggested change
CONTROL "", ID_PARAM_VAL_FAKE_SLIDER, "Static", WS_TABSTOP, 40, 30, 60, 10
CONTROL "", ID_PARAM_VAL_FAKE_SLIDER, "Button", WS_TABSTOP, 40, 30, 60, 10

EDITTEXT ID_PARAM_VAL_EDIT, 112, 30, 40, 10
LTEXT "", ID_PARAM_VAL_LABEL, 40, 45, 60, 10
LTEXT "&Filter:", IDC_STATIC, 10, 63, 23, 10
Expand Down
1 change: 1 addition & 0 deletions src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#define ID_PARAM_VAL_SLIDER 103
#define ID_PARAM_FILTER 104
#define ID_PARAM_VAL_LABEL 105
#define ID_PARAM_VAL_FAKE_SLIDER 106

#define ID_PEAK_WATCHER_DLG 200
#define ID_PEAK_TYPE 201
Expand Down