Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 2622c92

Browse files
committed
invert how we refer to enablement
1 parent 1b76a22 commit 2622c92

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

src/BasePlatform.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,15 +291,15 @@ export default abstract class BasePlatform {
291291
throw new Error("Unimplemented");
292292
}
293293

294-
public supportsDisableHardwareAcceleration(): boolean {
294+
public supportsHardwareAcceleration(): boolean {
295295
return false;
296296
}
297297

298-
public async getDisableHardwareAcceleration(): Promise<boolean> {
299-
return false;
298+
public async getHardwareAccelerationEnabled(): Promise<boolean> {
299+
return true;
300300
}
301301

302-
public async setDisableHardwareAcceleration(enabled: boolean): Promise<void> {
302+
public async setHardwareAccelerationEnabled(enabled: boolean): Promise<void> {
303303
throw new Error("Unimplemented");
304304
}
305305

src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ interface IState {
4343
alwaysShowMenuBar: boolean;
4444
minimizeToTraySupported: boolean;
4545
minimizeToTray: boolean;
46-
disableHardwareAccelerationSupported: boolean;
47-
disableHardwareAcceleration: boolean;
46+
hardwareAccelerationSupported: boolean;
47+
hardwareAcceleration: boolean;
4848
autocompleteDelay: string;
4949
readMarkerInViewThresholdMs: string;
5050
readMarkerOutOfViewThresholdMs: string;
@@ -119,8 +119,8 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
119119
alwaysShowMenuBarSupported: false,
120120
minimizeToTray: true,
121121
minimizeToTraySupported: false,
122-
disableHardwareAcceleration: false,
123-
disableHardwareAccelerationSupported: false,
122+
hardwareAcceleration: true,
123+
hardwareAccelerationSupported: false,
124124
autocompleteDelay:
125125
SettingsStore.getValueAt(SettingLevel.DEVICE, 'autocompleteDelay').toString(10),
126126
readMarkerInViewThresholdMs:
@@ -157,10 +157,10 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
157157
minimizeToTray = await platform.getMinimizeToTrayEnabled();
158158
}
159159

160-
const disableHardwareAccelerationSupported = platform.supportsDisableHardwareAcceleration();
161-
let disableHardwareAcceleration = false;
162-
if (disableHardwareAccelerationSupported) {
163-
disableHardwareAcceleration = await platform.getDisableHardwareAcceleration();
160+
const hardwareAccelerationSupported = platform.supportsHardwareAcceleration();
161+
let enableHardwareAcceleration = false;
162+
if (hardwareAccelerationSupported) {
163+
enableHardwareAcceleration = await platform.getHardwareAccelerationEnabled();
164164
}
165165

166166
this.setState({
@@ -172,8 +172,8 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
172172
alwaysShowMenuBar,
173173
minimizeToTraySupported,
174174
minimizeToTray,
175-
disableHardwareAccelerationSupported,
176-
disableHardwareAcceleration,
175+
hardwareAccelerationSupported,
176+
enableHardwareAcceleration,
177177
});
178178
}
179179

@@ -193,9 +193,9 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
193193
PlatformPeg.get().setMinimizeToTrayEnabled(checked).then(() => this.setState({ minimizeToTray: checked }));
194194
};
195195

196-
private onDisableHardwareAccelerationChange = (checked: boolean) => {
197-
PlatformPeg.get().setDisableHardwareAcceleration(checked).then(
198-
() => this.setState({ disableHardwareAcceleration: checked }));
196+
private onHardwareAccelerationChange = (checked: boolean) => {
197+
PlatformPeg.get().setHardwareAccelerationEnabled(checked).then(
198+
() => this.setState({ enableHardwareAcceleration: checked }));
199199
};
200200

201201
private onAutocompleteDelayChange = (e: React.ChangeEvent<HTMLInputElement>) => {
@@ -263,12 +263,12 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
263263
label={_t('Show tray icon and minimise window to it on close')} />;
264264
}
265265

266-
let disableHardwareAccelerationOption = null;
267-
if (this.state.disableHardwareAccelerationSupported) {
268-
disableHardwareAccelerationOption = <LabelledToggleSwitch
269-
value={this.state.disableHardwareAcceleration}
270-
onChange={this.onDisableHardwareAccelerationChange}
271-
label={_t('Disable hardware acceleration (requires restart to take effect)')} />;
266+
let hardwareAccelerationOption = null;
267+
if (this.state.hardwareAccelerationSupported) {
268+
hardwareAccelerationOption = <LabelledToggleSwitch
269+
value={this.state.enableHardwareAcceleration}
270+
onChange={this.onHardwareAccelerationChange}
271+
label={_t('Enable hardware acceleration (requires restart to take effect)')} />;
272272
}
273273

274274
return (
@@ -328,7 +328,7 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
328328
<span className="mx_SettingsTab_subheading">{ _t("General") }</span>
329329
{ this.renderGroup(PreferencesUserSettingsTab.GENERAL_SETTINGS) }
330330
{ minimizeToTrayOption }
331-
{ disableHardwareAccelerationOption }
331+
{ hardwareAccelerationOption }
332332
{ autoHideMenuOption }
333333
{ autoLaunchOption }
334334
{ warnBeforeExitOption }

0 commit comments

Comments
 (0)