To set disabled HardwareAcceleration #25

This commit is contained in:
Cutls 2019-03-09 21:17:54 +09:00
parent 1361958e8d
commit ba018b8568
12 changed files with 71 additions and 8 deletions

View File

@ -24,6 +24,7 @@ function settings() {
themes(cd);
localStorage.setItem("theme", cd);
}
var nd = $("[name=nsfw]:checked").val();
var nt = $("[for=n_"+nd+"]").text();
if (nd != localStorage.getItem("nsfw")) {
@ -250,6 +251,12 @@ function load() {
}
$("#" + theme).prop("checked", true);
var ha = localStorage.getItem("ha");
if (!ha) {
var ha = "false";
}
$("#ha_" + ha).prop("checked", true);
var nsfw = localStorage.getItem("nsfw");
if (!nsfw) {
var nsfw = "yes";
@ -913,6 +920,12 @@ function customImp(){
alert("Error")
}
}
function hardwareAcceleration(){
var had = $("[name=ha]:checked").val();
localStorage.setItem("ha", had);
console.log("ha");
ipc.send('ha', had);
}
ipc.on('theme-json-create-complete', function (event, args) {
$("#custom_import").val("");

View File

@ -16,8 +16,6 @@ const join = require('path').join;
var JSON5 = require('json5');
// アプリケーションをコントロールするモジュール
const app = electron.app;
//app.disableHardwareAcceleration()
// ウィンドウを作成するモジュール
const BrowserWindow = electron.BrowserWindow;
const {
@ -29,8 +27,15 @@ var info_path = join(app.getPath("userData"), "window-size.json");
var max_info_path = join(app.getPath("userData"), "max-window-size.json");
var lang_path=join(app.getPath("userData"), "language");
var customcss=join(app.getPath("userData"), "custom.css");
var tmp_img = join(app.getPath("userData"), "tmp.png");
var ha_path=join(app.getPath("userData"), "hardwareAcceleration");
try{
fs.readFileSync(ha_path, 'utf8');
app.disableHardwareAcceleration()
console.log("disabled: HA");
}catch{
console.log("enabled: HA");
}
var window_size;
try {
window_size = JSON.parse(fs.readFileSync(info_path, 'utf8'));
@ -261,7 +266,16 @@ ipc.on('theme-json-list', function(e, arg) {
mainWindow.webContents.send('theme-json-list-response', themes);
});
})
//ハードウェアアクセラレーションの無効化
ipc.on('ha', function(e, arg) {
if(arg=="true"){
fs.writeFileSync(ha_path,arg);
}else{
fs.unlink(ha_path, function (err) {});
}
app.relaunch()
app.exit()
})
ipc.on('update', function(e, x, y) {
var platform=process.platform;

View File

@ -1,6 +1,6 @@
{
"name": "thedesk",
"version": "17.2.0",
"version": "17.2.1",
"description": "TheDesk is a Mastodon client for PC.",
"main": "main.js",
"scripts": {

View File

@ -32,7 +32,7 @@
<script type="text/javascript" src="../../js/common/modal.js"></script>
<script type="text/javascript" src="../../js/ui/jquery-ui.min.js"></script>
<script>
var ver="Miria (17.2.0)";
var ver="Miria (17.2.1)";
//betaを入れるとバージョンチェックしない
//GitHubに上げるときはindex.htmlをちゃんとする。(index.start.html)
//var ver="beta";

View File

@ -79,6 +79,14 @@
TheDesk uses this value when it try to save pictures or take screenshots.<br>
<button class="btn waves-effect" style="width:100px;" onclick="savefolder()">Change</button>
<br>
<h5>Disable hardware acceleration</h5>
Auto restarted
<br>
<input class="with-gap" onchange="hardwareAcceleration()" name="ha" type="radio" id="ha_true" value="true" />
<label for="ha_true">Yes</label>
<input class="with-gap" onchange="hardwareAcceleration()" name="ha" type="radio" id="ha_false" value="false" />
<label for="ha_false">No</label>
<br>
</div>
</li>
<li>

View File

@ -32,7 +32,7 @@
<script type="text/javascript" src="../../js/common/modal.js"></script>
<script type="text/javascript" src="../../js/ui/jquery-ui.min.js"></script>
<script>
var ver="Miria (17.2.0)";
var ver="Miria (17.2.1)";
//betaを入れるとバージョンチェックしない
//GitHubに上げるときはindex.htmlをちゃんとする。(index.start.html)
//var ver="beta";

View File

@ -79,6 +79,14 @@
画像ダウンロードやスクリーンショットに影響します。<br>
<button class="btn waves-effect" style="width:100px;" onclick="savefolder()">変更</button>
<br>
<h5>ハードウェアアクセラレーションの無効化</h5>
表示(特に設定画面)が乱れる場合に「はい」を選択してください。自動で再起動します。
<br>
<input class="with-gap" onchange="hardwareAcceleration()" name="ha" type="radio" id="ha_true" value="true" />
<label for="ha_true">はい</label>
<input class="with-gap" onchange="hardwareAcceleration()" name="ha" type="radio" id="ha_false" value="false" />
<label for="ha_false">いいえ</label>
<br>
</div>
</li>
<li>

View File

@ -10,6 +10,8 @@
"backup":"Import and export of preferences",
"import":"Import",
"export":"Export",
"hardwareAcceleration":"Disable hardware acceleration",
"hardwareAccelerationWarn":"Auto restarted",
"theme":"Themes",
"popup":"Popup notification(on Windows)",
"popupwarn":"Hide to set \"0\"",

View File

@ -10,6 +10,8 @@
"backup":"設定のインポートとエクスポート",
"import":"インポート",
"export":"エクスポート",
"hardwareAcceleration":"ハードウェアアクセラレーションの無効化",
"hardwareAccelerationWarn":"表示(特に設定画面)が乱れる場合に「はい」を選択してください。自動で再起動します。",
"theme":"テーマの設定",
"popup":"新規通知のポップアップお知らせの表示秒数",
"popupwarn":"0に設定すると表示されません",

View File

@ -79,6 +79,14 @@
{{savefolderwarn}}<br>
<button class="btn waves-effect" style="width:100px;" onclick="savefolder()">{{change}}</button>
<br>
<h5>{{hardwareAcceleration}}</h5>
{{hardwareAccelerationWarn}}
<br>
<input class="with-gap" onchange="hardwareAcceleration()" name="ha" type="radio" id="ha_true" value="true" />
<label for="ha_true">{{yes}}</label>
<input class="with-gap" onchange="hardwareAcceleration()" name="ha" type="radio" id="ha_false" value="false" />
<label for="ha_false">{{no}}</label>
<br>
</div>
</li>
<li>

View File

@ -32,7 +32,7 @@
<script type="text/javascript" src="../../js/common/modal.js"></script>
<script type="text/javascript" src="../../js/ui/jquery-ui.min.js"></script>
<script>
var ver="Miria (17.2.0)";
var ver="Miria (17.2.1)";
//betaを入れるとバージョンチェックしない
//GitHubに上げるときはindex.htmlをちゃんとする。(index.start.html)
//var ver="beta";

View File

@ -79,6 +79,14 @@
crwdns548:0crwdne548:0<br>
<button class="btn waves-effect" style="width:100px;" onclick="savefolder()">crwdns528:0crwdne528:0</button>
<br>
<h5>{{hardwareAcceleration}}</h5>
{{hardwareAccelerationWarn}}
<br>
<input class="with-gap" onchange="hardwareAcceleration()" name="ha" type="radio" id="ha_true" value="true" />
<label for="ha_true">crwdns526:0crwdne526:0</label>
<input class="with-gap" onchange="hardwareAcceleration()" name="ha" type="radio" id="ha_false" value="false" />
<label for="ha_false">crwdns527:0crwdne527:0</label>
<br>
</div>
</li>
<li>