Skip to content

Commit bdcf23b

Browse files
committed
fix: 작업표시줄에서 종료시 제대로 종료되지 않던 문제 수정
1 parent 623a996 commit bdcf23b

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "djmax-keyviewer",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "DM NOTE",
55
"main": "src/main/main.js",
66
"scripts": {

src/main/main.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,19 @@ class Application {
6464
// ANGLE 백엔드 설정 (d3d11, d3d9, gl, default)
6565
// app.commandLine.appendSwitch('use-angle', 'd3d9')
6666
app.whenReady().then(() => this.createWindows())
67+
// 모든 윈도우가 닫혔을 때 앱 종료
68+
app.on('window-all-closed', () => {
69+
keyboardService.stopListening()
70+
global.isAppQuitting = true;
71+
app.quit();
72+
});
6773
// 앱 종료 이벤트 핸들러 추가
6874
app.on('before-quit', () => {
75+
keyboardService.stopListening()
6976
global.isAppQuitting = true;
7077
});
7178
ipcMain.on('close-window', () => {
79+
keyboardService.stopListening()
7280
global.isAppQuitting = true;
7381
this.mainWindow.close();
7482
this.overlayWindow.close();

src/main/windows/mainWindow.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const { BrowserWindow } = require('electron/main')
22
const path = require('node:path')
33
const windowConfig = require('../config/windowConfig')
4+
const keyboardService = require('../services/keyboardListener')
45

56
class MainWindow {
67
constructor() {
@@ -17,6 +18,15 @@ class MainWindow {
1718
}
1819
})
1920

21+
// 윈도우 종료 이벤트 처리 추가
22+
this.window.on('close', () => {
23+
global.isAppQuitting = true;
24+
keyboardService.stopListening() // 키보드 서비스 정지
25+
if (this.backgroundInterval) {
26+
clearInterval(this.backgroundInterval)
27+
}
28+
});
29+
2030
this.disableContextMenu()
2131
this.loadContent()
2232
// this.setupBackgroundOptimization()

0 commit comments

Comments
 (0)