Add the option to disable hardware acceleration (#8655)
This commit is contained in:
parent
1535ff0d6c
commit
4f9598361f
3 changed files with 43 additions and 0 deletions
|
@ -291,6 +291,18 @@ export default abstract class BasePlatform {
|
||||||
throw new Error("Unimplemented");
|
throw new Error("Unimplemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public supportsTogglingHardwareAcceleration(): boolean {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async getHardwareAccelerationEnabled(): Promise<boolean> {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async setHardwareAccelerationEnabled(enabled: boolean): Promise<void> {
|
||||||
|
throw new Error("Unimplemented");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get our platform specific EventIndexManager.
|
* Get our platform specific EventIndexManager.
|
||||||
*
|
*
|
||||||
|
|
|
@ -29,6 +29,7 @@ import dis from "../../../../../dispatcher/dispatcher";
|
||||||
import { UserTab } from "../../../dialogs/UserTab";
|
import { UserTab } from "../../../dialogs/UserTab";
|
||||||
import { OpenToTabPayload } from "../../../../../dispatcher/payloads/OpenToTabPayload";
|
import { OpenToTabPayload } from "../../../../../dispatcher/payloads/OpenToTabPayload";
|
||||||
import { Action } from "../../../../../dispatcher/actions";
|
import { Action } from "../../../../../dispatcher/actions";
|
||||||
|
import SdkConfig from "../../../../../SdkConfig";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
closeSettingsFn(success: boolean): void;
|
closeSettingsFn(success: boolean): void;
|
||||||
|
@ -43,6 +44,8 @@ interface IState {
|
||||||
alwaysShowMenuBar: boolean;
|
alwaysShowMenuBar: boolean;
|
||||||
minimizeToTraySupported: boolean;
|
minimizeToTraySupported: boolean;
|
||||||
minimizeToTray: boolean;
|
minimizeToTray: boolean;
|
||||||
|
togglingHardwareAccelerationSupported: boolean;
|
||||||
|
enableHardwareAcceleration: boolean;
|
||||||
autocompleteDelay: string;
|
autocompleteDelay: string;
|
||||||
readMarkerInViewThresholdMs: string;
|
readMarkerInViewThresholdMs: string;
|
||||||
readMarkerOutOfViewThresholdMs: string;
|
readMarkerOutOfViewThresholdMs: string;
|
||||||
|
@ -117,6 +120,8 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
|
||||||
alwaysShowMenuBarSupported: false,
|
alwaysShowMenuBarSupported: false,
|
||||||
minimizeToTray: true,
|
minimizeToTray: true,
|
||||||
minimizeToTraySupported: false,
|
minimizeToTraySupported: false,
|
||||||
|
enableHardwareAcceleration: true,
|
||||||
|
togglingHardwareAccelerationSupported: false,
|
||||||
autocompleteDelay:
|
autocompleteDelay:
|
||||||
SettingsStore.getValueAt(SettingLevel.DEVICE, 'autocompleteDelay').toString(10),
|
SettingsStore.getValueAt(SettingLevel.DEVICE, 'autocompleteDelay').toString(10),
|
||||||
readMarkerInViewThresholdMs:
|
readMarkerInViewThresholdMs:
|
||||||
|
@ -153,6 +158,12 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
|
||||||
minimizeToTray = await platform.getMinimizeToTrayEnabled();
|
minimizeToTray = await platform.getMinimizeToTrayEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const togglingHardwareAccelerationSupported = platform.supportsTogglingHardwareAcceleration();
|
||||||
|
let enableHardwareAcceleration = true;
|
||||||
|
if (togglingHardwareAccelerationSupported) {
|
||||||
|
enableHardwareAcceleration = await platform.getHardwareAccelerationEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
autoLaunch,
|
autoLaunch,
|
||||||
autoLaunchSupported,
|
autoLaunchSupported,
|
||||||
|
@ -162,6 +173,8 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
|
||||||
alwaysShowMenuBar,
|
alwaysShowMenuBar,
|
||||||
minimizeToTraySupported,
|
minimizeToTraySupported,
|
||||||
minimizeToTray,
|
minimizeToTray,
|
||||||
|
togglingHardwareAccelerationSupported,
|
||||||
|
enableHardwareAcceleration,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,6 +194,11 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
|
||||||
PlatformPeg.get().setMinimizeToTrayEnabled(checked).then(() => this.setState({ minimizeToTray: checked }));
|
PlatformPeg.get().setMinimizeToTrayEnabled(checked).then(() => this.setState({ minimizeToTray: checked }));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private onHardwareAccelerationChange = (checked: boolean) => {
|
||||||
|
PlatformPeg.get().setHardwareAccelerationEnabled(checked).then(
|
||||||
|
() => this.setState({ enableHardwareAcceleration: checked }));
|
||||||
|
};
|
||||||
|
|
||||||
private onAutocompleteDelayChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
private onAutocompleteDelayChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
this.setState({ autocompleteDelay: e.target.value });
|
this.setState({ autocompleteDelay: e.target.value });
|
||||||
SettingsStore.setValue("autocompleteDelay", null, SettingLevel.DEVICE, e.target.value);
|
SettingsStore.setValue("autocompleteDelay", null, SettingLevel.DEVICE, e.target.value);
|
||||||
|
@ -246,6 +264,17 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
|
||||||
label={_t('Show tray icon and minimise window to it on close')} />;
|
label={_t('Show tray icon and minimise window to it on close')} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let hardwareAccelerationOption = null;
|
||||||
|
if (this.state.togglingHardwareAccelerationSupported) {
|
||||||
|
const appName = SdkConfig.get().brand;
|
||||||
|
hardwareAccelerationOption = <LabelledToggleSwitch
|
||||||
|
value={this.state.enableHardwareAcceleration}
|
||||||
|
onChange={this.onHardwareAccelerationChange}
|
||||||
|
label={_t('Enable hardware acceleration (restart %(appName)s to take effect)', {
|
||||||
|
appName,
|
||||||
|
})} />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx_SettingsTab mx_PreferencesUserSettingsTab">
|
<div className="mx_SettingsTab mx_PreferencesUserSettingsTab">
|
||||||
<div className="mx_SettingsTab_heading">{ _t("Preferences") }</div>
|
<div className="mx_SettingsTab_heading">{ _t("Preferences") }</div>
|
||||||
|
@ -303,6 +332,7 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
|
||||||
<span className="mx_SettingsTab_subheading">{ _t("General") }</span>
|
<span className="mx_SettingsTab_subheading">{ _t("General") }</span>
|
||||||
{ this.renderGroup(PreferencesUserSettingsTab.GENERAL_SETTINGS) }
|
{ this.renderGroup(PreferencesUserSettingsTab.GENERAL_SETTINGS) }
|
||||||
{ minimizeToTrayOption }
|
{ minimizeToTrayOption }
|
||||||
|
{ hardwareAccelerationOption }
|
||||||
{ autoHideMenuOption }
|
{ autoHideMenuOption }
|
||||||
{ autoLaunchOption }
|
{ autoLaunchOption }
|
||||||
{ warnBeforeExitOption }
|
{ warnBeforeExitOption }
|
||||||
|
|
|
@ -1500,6 +1500,7 @@
|
||||||
"Warn before quitting": "Warn before quitting",
|
"Warn before quitting": "Warn before quitting",
|
||||||
"Always show the window menu bar": "Always show the window menu bar",
|
"Always show the window menu bar": "Always show the window menu bar",
|
||||||
"Show tray icon and minimise window to it on close": "Show tray icon and minimise window to it on close",
|
"Show tray icon and minimise window to it on close": "Show tray icon and minimise window to it on close",
|
||||||
|
"Enable hardware acceleration (restart %(appName)s to take effect)": "Enable hardware acceleration (restart %(appName)s to take effect)",
|
||||||
"Preferences": "Preferences",
|
"Preferences": "Preferences",
|
||||||
"Room list": "Room list",
|
"Room list": "Room list",
|
||||||
"Keyboard shortcuts": "Keyboard shortcuts",
|
"Keyboard shortcuts": "Keyboard shortcuts",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue