上传备份

master
王兵 1 week ago
parent e911edb17c
commit 3576f50ac0

@ -120,6 +120,14 @@
<needShortcut>true</needShortcut>
<!-- 菜单设置 -->
<needMenu>true</needMenu>
<!-- JVM 参数 -->
<jvmArgs>
<!-- 这里加兼容低版本 Windows 的 JVM 参数 -->
<jvmArg>-Dprism.order=sw</jvmArg>
<jvmArg>-Dglass.win.uiScale=1</jvmArg>
<jvmArg>-Xms256m</jvmArg>
<jvmArg>-Xmx512m</jvmArg>
</jvmArgs>
</configuration>
<executions>
<execution>

@ -2,11 +2,13 @@ package xyz.wbsite.jmacro;
import com.melloware.jintellitype.JIntellitype;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import xyz.wbsite.jmacro.ui.FXMLUtil;
import xyz.wbsite.jmacro.util.DialogUtil;
import xyz.wbsite.jmacro.util.ResourceUtil;
import xyz.wbsite.jtask.TaskImpl;
@ -49,9 +51,14 @@ public class JMainApplication extends Application {
stage.show();
JMainApplication.primaryStage = stage;
// 创建独立线程处理JIntellitype初始化
Thread hotkeyRegistrationThread = new Thread(() -> {
try {
JIntellitype.getInstance().registerHotKey(F1_SHORTCUT, JIntellitype.MOD_CONTROL, KeyEvent.VK_F1);
JIntellitype.getInstance().registerHotKey(F2_SHORTCUT, JIntellitype.MOD_CONTROL, KeyEvent.VK_F2);
JIntellitype.getInstance().addHotKeyListener(identifier -> {
Platform.runLater(() -> {
switch (identifier) {
case F1_SHORTCUT:
mainController.onStart();
@ -61,6 +68,19 @@ public class JMainApplication extends Application {
break;
}
});
});
} catch (UnsatisfiedLinkError e) {
Platform.runLater(() -> DialogUtil.error("缺少必要的系统组件VC++运行时)"));
} catch (NoClassDefFoundError e) {
Platform.runLater(() -> DialogUtil.error("热键功能依赖库未找到"));
} catch (Exception ignored) {
}
}, "Hotkey-Registration-Thread");
// 启动线程设为守护线程避免阻止JVM退出
hotkeyRegistrationThread.setDaemon(true);
hotkeyRegistrationThread.start();
// 服务初始化
JMainService.init(new TaskImpl(), new File("legend"));

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Loading…
Cancel
Save

Powered by TurnKey Linux.