Skip to content

Commit 4187b52

Browse files
committed
fix: after webview fullscreen force repaint
Signed-off-by: Innei <i@innei.in>
1 parent bc7914f commit 4187b52

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/main/window.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,22 @@ export function createWindow(
5959
...configs,
6060
})
6161

62-
window.on("enter-html-full-screen", () => {
63-
window.setBackgroundColor("")
64-
window.webContents.invalidate()
65-
})
66-
window.on("leave-html-full-screen", () => {
67-
window.setBackgroundColor("")
68-
69-
window.webContents.invalidate()
62+
function refreshBound(timeout = 0) {
7063
setTimeout(() => {
71-
window.setBackgroundColor("#00000000")
72-
}, 10_000)
64+
const mainWindow = getMainWindow()
65+
if (!mainWindow) return
66+
// FIXME: workaround for theme bug in full screen mode
67+
const size = mainWindow.getSize()
68+
mainWindow.setSize(size[0] + 1, size[1] + 1)
69+
mainWindow.setSize(size[0], size[1])
70+
}, timeout)
71+
}
72+
73+
window.on("leave-html-full-screen", () => {
74+
// To solve the vibrancy losing issue when leaving full screen mode
75+
// @see https://github.com/toeverything/AFFiNE/blob/280e24934a27557529479a70ab38c4f5fc65cb00/packages/frontend/electron/src/main/windows-manager/main-window.ts:L157
76+
refreshBound()
77+
refreshBound(1000)
7378
})
7479

7580
window.on("ready-to-show", () => {

0 commit comments

Comments
 (0)