mirror of
https://github.com/fanchenio/DawnLauncher.git
synced 2025-07-14 05:12:11 +08:00
修复'透明窗口'下出现窗口闪烁的问题。
This commit is contained in:
parent
a2ccd8670b
commit
5c791874c6
@ -24,7 +24,11 @@ function createWindow() {
|
||||
fullscreenable: false,
|
||||
focusable: true,
|
||||
show: false,
|
||||
backgroundColor: getMainBackgorunColor(),
|
||||
transparent: global.setting.appearance.transparency < 1,
|
||||
backgroundColor:
|
||||
global.setting.appearance.transparency === 1
|
||||
? getMainBackgorunColor()
|
||||
: null,
|
||||
webPreferences: {
|
||||
spellcheck: false,
|
||||
preload: join(__dirname, "../preload/index.js"),
|
||||
|
@ -49,7 +49,11 @@ function createAddEditWindow(id: number | null, parentId: number | null) {
|
||||
fullscreenable: false,
|
||||
focusable: true,
|
||||
show: false,
|
||||
backgroundColor: getMainBackgorunColor(),
|
||||
transparent: global.setting.appearance.transparency < 1,
|
||||
backgroundColor:
|
||||
global.setting.appearance.transparency === 1
|
||||
? getMainBackgorunColor()
|
||||
: null,
|
||||
webPreferences: {
|
||||
spellcheck: false,
|
||||
preload: join(__dirname, "../preload/index.js"),
|
||||
@ -113,7 +117,11 @@ function createSetIconWindow(id: number) {
|
||||
fullscreenable: false,
|
||||
focusable: true,
|
||||
show: false,
|
||||
backgroundColor: getMainBackgorunColor(),
|
||||
transparent: global.setting.appearance.transparency < 1,
|
||||
backgroundColor:
|
||||
global.setting.appearance.transparency === 1
|
||||
? getMainBackgorunColor()
|
||||
: null,
|
||||
webPreferences: {
|
||||
spellcheck: false,
|
||||
preload: join(__dirname, "../preload/index.js"),
|
||||
@ -172,7 +180,11 @@ function createAssociateFolderWindow(id: number) {
|
||||
fullscreenable: false,
|
||||
focusable: true,
|
||||
show: false,
|
||||
backgroundColor: getMainBackgorunColor(),
|
||||
transparent: global.setting.appearance.transparency < 1,
|
||||
backgroundColor:
|
||||
global.setting.appearance.transparency === 1
|
||||
? getMainBackgorunColor()
|
||||
: null,
|
||||
webPreferences: {
|
||||
spellcheck: false,
|
||||
preload: join(__dirname, "../preload/index.js"),
|
||||
@ -236,7 +248,11 @@ function createAggregateWindow(id: number) {
|
||||
fullscreenable: false,
|
||||
focusable: true,
|
||||
show: false,
|
||||
backgroundColor: getMainBackgorunColor(),
|
||||
transparent: global.setting.appearance.transparency < 1,
|
||||
backgroundColor:
|
||||
global.setting.appearance.transparency === 1
|
||||
? getMainBackgorunColor()
|
||||
: null,
|
||||
webPreferences: {
|
||||
spellcheck: false,
|
||||
preload: join(__dirname, "../preload/index.js"),
|
||||
|
@ -25,7 +25,11 @@ function createBackupRestoreDataWindow() {
|
||||
fullscreenable: false,
|
||||
focusable: true,
|
||||
show: false,
|
||||
backgroundColor: getMainBackgorunColor(),
|
||||
transparent: global.setting.appearance.transparency < 1,
|
||||
backgroundColor:
|
||||
global.setting.appearance.transparency === 1
|
||||
? getMainBackgorunColor()
|
||||
: null,
|
||||
webPreferences: {
|
||||
spellcheck: false,
|
||||
preload: join(__dirname, "../preload/index.js"),
|
||||
|
@ -8,7 +8,10 @@ import { initSystemItem } from "./item/commons/data";
|
||||
import commonIpcEvent from "./commons/ipcEvent";
|
||||
import itemIpcEvent from "./item/ipcEvent";
|
||||
import settingIpcEvent from "./setting/ipcEvent";
|
||||
import { init as settingDataInit } from "./setting/data";
|
||||
import {
|
||||
init as settingDataInit,
|
||||
update as updateSetting,
|
||||
} from "./setting/data";
|
||||
import { setShortcutKey } from "./setting";
|
||||
import searchIpcEvent from "./search/ipcEvent";
|
||||
import { createMainWindow } from "./main";
|
||||
@ -37,8 +40,13 @@ process.env.VITE_PUBLIC = process.env.VITE_DEV_SERVER_URL
|
||||
// 解决透明窗口闪烁
|
||||
app.commandLine.appendSwitch("wm-window-animations-disabled");
|
||||
|
||||
// 解决创建窗口屏幕闪烁问题
|
||||
app.disableHardwareAcceleration();
|
||||
// 初始化设置数据
|
||||
settingDataInit();
|
||||
// 如果主窗口是非透明窗口的话,禁止GPU加速,解决白屏问题。
|
||||
// 如果主窗口是透明窗口的话,将除主窗口外的窗口都改为透明度0.99,解决解决白屏问题。
|
||||
if (global.setting.appearance.transparency === 1) {
|
||||
app.disableHardwareAcceleration();
|
||||
}
|
||||
|
||||
// Set application name for Windows 10+ notifications
|
||||
if (process.platform === "win32") app.setAppUserModelId(app.getName());
|
||||
@ -62,8 +70,18 @@ app.whenReady().then(() => {
|
||||
}
|
||||
// addon
|
||||
global.addon = require("../../native/addon.node");
|
||||
// 初始化数据
|
||||
settingDataInit();
|
||||
if (global.first) {
|
||||
// 首次添加,判断系统语言
|
||||
if (app.getLocale().toLowerCase().indexOf("zh-") === 0) {
|
||||
// 简体中文
|
||||
global.setting.general.language = "SimplifiedChinese";
|
||||
} else {
|
||||
// 英文
|
||||
global.setting.general.language = "English";
|
||||
}
|
||||
// 修改
|
||||
updateSetting(global.setting);
|
||||
}
|
||||
// 获取语言
|
||||
global.language = getLanguage(global.setting.general.language);
|
||||
// 禁用debugtron
|
||||
|
@ -59,7 +59,11 @@ async function createAddEditWindow(
|
||||
fullscreenable: false,
|
||||
focusable: true,
|
||||
show: false,
|
||||
backgroundColor: getMainBackgorunColor(),
|
||||
transparent: global.setting.appearance.transparency < 1,
|
||||
backgroundColor:
|
||||
global.setting.appearance.transparency === 1
|
||||
? getMainBackgorunColor()
|
||||
: null,
|
||||
webPreferences: {
|
||||
spellcheck: false,
|
||||
preload: join(__dirname, "../preload/index.js"),
|
||||
@ -119,7 +123,11 @@ async function createNetworkIconWindow() {
|
||||
fullscreenable: false,
|
||||
focusable: true,
|
||||
show: false,
|
||||
backgroundColor: getMainBackgorunColor(),
|
||||
transparent: global.setting.appearance.transparency < 1,
|
||||
backgroundColor:
|
||||
global.setting.appearance.transparency === 1
|
||||
? getMainBackgorunColor()
|
||||
: null,
|
||||
webPreferences: {
|
||||
spellcheck: false,
|
||||
preload: join(__dirname, "../preload/index.js"),
|
||||
@ -170,7 +178,11 @@ async function createSVGIconWindow() {
|
||||
fullscreenable: false,
|
||||
focusable: true,
|
||||
show: false,
|
||||
backgroundColor: getMainBackgorunColor(),
|
||||
transparent: global.setting.appearance.transparency < 1,
|
||||
backgroundColor:
|
||||
global.setting.appearance.transparency === 1
|
||||
? getMainBackgorunColor()
|
||||
: null,
|
||||
webPreferences: {
|
||||
spellcheck: false,
|
||||
preload: join(__dirname, "../preload/index.js"),
|
||||
|
@ -1,6 +1,10 @@
|
||||
import { BrowserWindow, shell, screen } from "electron";
|
||||
import { join } from "node:path";
|
||||
import { getWindowInScreen, sendToWebContent } from "../commons";
|
||||
import {
|
||||
getMainBackgorunColor,
|
||||
getWindowInScreen,
|
||||
sendToWebContent,
|
||||
} from "../commons";
|
||||
import cacheData from "../commons/cacheData";
|
||||
|
||||
// 窗口
|
||||
@ -24,7 +28,11 @@ function createQuickSearchWindow() {
|
||||
fullscreenable: false,
|
||||
resizable: false,
|
||||
alwaysOnTop: true,
|
||||
backgroundColor: global.setting.appearance.theme.mainBackgroundColor,
|
||||
transparent: global.setting.appearance.transparency < 1,
|
||||
backgroundColor:
|
||||
global.setting.appearance.transparency === 1
|
||||
? getMainBackgorunColor()
|
||||
: null,
|
||||
webPreferences: {
|
||||
spellcheck: false,
|
||||
backgroundThrottling: false,
|
||||
|
@ -51,14 +51,6 @@ function select() {
|
||||
* 添加
|
||||
*/
|
||||
function add(setting: Setting) {
|
||||
// 首次添加,判断系统语言
|
||||
if (app.getLocale().toLowerCase().indexOf("zh-") === 0) {
|
||||
// 简体中文
|
||||
setting.general.language = "SimplifiedChinese";
|
||||
} else {
|
||||
// 英文
|
||||
setting.general.language = "English";
|
||||
}
|
||||
// SQL
|
||||
let sql = `INSERT INTO ${settingTableName}
|
||||
(id, setting)
|
||||
@ -67,6 +59,8 @@ function add(setting: Setting) {
|
||||
let id = db.prepare(sql).run(1, JSON.stringify(setting)).lastInsertRowid;
|
||||
if (id) {
|
||||
global.setting = setting;
|
||||
// 添加设置被视为首次打开软件
|
||||
global.first = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -34,7 +34,11 @@ function createSettingWindow() {
|
||||
fullscreenable: false,
|
||||
skipTaskbar: true,
|
||||
show: false,
|
||||
backgroundColor: getMainBackgorunColor(),
|
||||
transparent: global.setting.appearance.transparency < 1,
|
||||
backgroundColor:
|
||||
global.setting.appearance.transparency === 1
|
||||
? getMainBackgorunColor()
|
||||
: null,
|
||||
webPreferences: {
|
||||
spellcheck: false,
|
||||
preload: join(__dirname, "../preload/index.js"),
|
||||
|
2
electron/types/global.d.ts
vendored
2
electron/types/global.d.ts
vendored
@ -5,6 +5,8 @@ import { Setting } from "../../types/setting";
|
||||
declare global {
|
||||
// addon
|
||||
var addon: any;
|
||||
// 是否是首次打开软件
|
||||
var first: boolean;
|
||||
// 语言
|
||||
var language: any;
|
||||
// 主窗口
|
||||
|
@ -4,6 +4,11 @@
|
||||
:style="{
|
||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||
color: store.setting.appearance.theme.mainFontColor,
|
||||
borderRadius:
|
||||
store.setting.appearance.transparency < 1 &&
|
||||
store.setting.appearance.windowRounded
|
||||
? '8px'
|
||||
: undefined,
|
||||
}"
|
||||
>
|
||||
<div class="flex items-center px-2 app-region-drag">
|
||||
|
@ -4,6 +4,11 @@
|
||||
:style="{
|
||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||
color: store.setting.appearance.theme.mainFontColor,
|
||||
borderRadius:
|
||||
store.setting.appearance.transparency < 1 &&
|
||||
store.setting.appearance.windowRounded
|
||||
? '8px'
|
||||
: undefined,
|
||||
}"
|
||||
>
|
||||
<div class="flex items-center app-region-drag">
|
||||
|
@ -4,6 +4,11 @@
|
||||
:style="{
|
||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||
color: store.setting.appearance.theme.mainFontColor,
|
||||
borderRadius:
|
||||
store.setting.appearance.transparency < 1 &&
|
||||
store.setting.appearance.windowRounded
|
||||
? '8px'
|
||||
: undefined,
|
||||
}"
|
||||
>
|
||||
<div class="flex items-center app-region-drag">
|
||||
|
@ -4,6 +4,11 @@
|
||||
:style="{
|
||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||
color: store.setting.appearance.theme.mainFontColor,
|
||||
borderRadius:
|
||||
store.setting.appearance.transparency < 1 &&
|
||||
store.setting.appearance.windowRounded
|
||||
? '8px'
|
||||
: undefined,
|
||||
}"
|
||||
>
|
||||
<div class="flex items-center app-region-drag">
|
||||
|
@ -4,6 +4,11 @@
|
||||
:style="{
|
||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||
color: store.setting.appearance.theme.mainFontColor,
|
||||
borderRadius:
|
||||
store.setting.appearance.transparency < 1 &&
|
||||
store.setting.appearance.windowRounded
|
||||
? '8px'
|
||||
: undefined,
|
||||
}"
|
||||
>
|
||||
<div class="flex items-center px-2 app-region-drag">
|
||||
|
@ -4,6 +4,11 @@
|
||||
:style="{
|
||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||
color: store.setting.appearance.theme.mainFontColor,
|
||||
borderRadius:
|
||||
store.setting.appearance.transparency < 1 &&
|
||||
store.setting.appearance.windowRounded
|
||||
? '8px'
|
||||
: undefined,
|
||||
}"
|
||||
>
|
||||
<div class="flex items-center px-2 app-region-drag">
|
||||
|
@ -5,6 +5,11 @@
|
||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||
color: store.setting.appearance.theme.mainFontColor,
|
||||
height: height + 'px',
|
||||
borderRadius:
|
||||
store.setting.appearance.transparency < 1 &&
|
||||
store.setting.appearance.windowRounded
|
||||
? '8px'
|
||||
: undefined,
|
||||
}"
|
||||
>
|
||||
<div class="flex items-center px-2 app-region-drag">
|
||||
|
@ -4,6 +4,11 @@
|
||||
:style="{
|
||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||
color: store.setting.appearance.theme.mainFontColor,
|
||||
borderRadius:
|
||||
store.setting.appearance.transparency < 1 &&
|
||||
store.setting.appearance.windowRounded
|
||||
? '8px'
|
||||
: undefined,
|
||||
}"
|
||||
>
|
||||
<div class="flex items-center px-2 app-region-drag">
|
||||
|
@ -4,6 +4,11 @@
|
||||
:style="{
|
||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||
color: store.setting.appearance.theme.mainFontColor,
|
||||
borderRadius:
|
||||
store.setting.appearance.transparency < 1 &&
|
||||
store.setting.appearance.windowRounded
|
||||
? '8px'
|
||||
: undefined,
|
||||
}"
|
||||
>
|
||||
<div class="flex items-center px-2 app-region-drag">
|
||||
|
@ -4,6 +4,11 @@
|
||||
:style="{
|
||||
color: store.setting.appearance.theme.mainFontColor,
|
||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||
borderRadius:
|
||||
store.setting.appearance.transparency < 1 &&
|
||||
store.setting.appearance.windowRounded
|
||||
? '8px'
|
||||
: undefined,
|
||||
}"
|
||||
>
|
||||
<div
|
||||
|
@ -5,6 +5,11 @@
|
||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||
color: store.setting.appearance.theme.mainFontColor,
|
||||
height: height + 'px',
|
||||
borderRadius:
|
||||
store.setting.appearance.transparency < 1 &&
|
||||
store.setting.appearance.windowRounded
|
||||
? '8px'
|
||||
: undefined,
|
||||
}"
|
||||
>
|
||||
<div class="flex items-center px-2 app-region-drag">
|
||||
|
Loading…
Reference in New Issue
Block a user