上传备份

master
王兵 1 week ago
parent e911edb17c
commit 3576f50ac0

@ -120,6 +120,14 @@
<needShortcut>true</needShortcut> <needShortcut>true</needShortcut>
<!-- 菜单设置 --> <!-- 菜单设置 -->
<needMenu>true</needMenu> <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> </configuration>
<executions> <executions>
<execution> <execution>

@ -2,11 +2,13 @@ package xyz.wbsite.jmacro;
import com.melloware.jintellitype.JIntellitype; import com.melloware.jintellitype.JIntellitype;
import javafx.application.Application; import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.stage.Stage; import javafx.stage.Stage;
import xyz.wbsite.jmacro.ui.FXMLUtil; import xyz.wbsite.jmacro.ui.FXMLUtil;
import xyz.wbsite.jmacro.util.DialogUtil;
import xyz.wbsite.jmacro.util.ResourceUtil; import xyz.wbsite.jmacro.util.ResourceUtil;
import xyz.wbsite.jtask.TaskImpl; import xyz.wbsite.jtask.TaskImpl;
@ -49,18 +51,36 @@ public class JMainApplication extends Application {
stage.show(); stage.show();
JMainApplication.primaryStage = stage; JMainApplication.primaryStage = stage;
JIntellitype.getInstance().registerHotKey(F1_SHORTCUT, JIntellitype.MOD_CONTROL, KeyEvent.VK_F1); // 创建独立线程处理JIntellitype初始化
JIntellitype.getInstance().registerHotKey(F2_SHORTCUT, JIntellitype.MOD_CONTROL, KeyEvent.VK_F2); Thread hotkeyRegistrationThread = new Thread(() -> {
JIntellitype.getInstance().addHotKeyListener(identifier -> { try {
switch (identifier) { JIntellitype.getInstance().registerHotKey(F1_SHORTCUT, JIntellitype.MOD_CONTROL, KeyEvent.VK_F1);
case F1_SHORTCUT: JIntellitype.getInstance().registerHotKey(F2_SHORTCUT, JIntellitype.MOD_CONTROL, KeyEvent.VK_F2);
mainController.onStart();
break; JIntellitype.getInstance().addHotKeyListener(identifier -> {
case F2_SHORTCUT: Platform.runLater(() -> {
mainController.onStop(); switch (identifier) {
break; case F1_SHORTCUT:
mainController.onStart();
break;
case F2_SHORTCUT:
mainController.onStop();
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")); 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.