Removed NativeHook From being used in Linux Versions
This commit is contained in:
parent
fc768ab36f
commit
026832e3f7
|
@ -1,18 +1,3 @@
|
||||||
/HelveticaNeue-UltraLight.otf
|
|
||||||
/LiberationSerif-Regular.ttf
|
|
||||||
/back.png
|
|
||||||
/basics/
|
/basics/
|
||||||
/edit.png
|
|
||||||
/guis/
|
|
||||||
/icon.ico
|
|
||||||
/icon.png
|
|
||||||
/lock.png
|
|
||||||
/main/
|
/main/
|
||||||
/manager/
|
/guis/
|
||||||
/mod_quicklaunch/
|
|
||||||
/plus.png
|
|
||||||
/save.png
|
|
||||||
/scenes/
|
|
||||||
/trash.png
|
|
||||||
/unsaved.png
|
|
||||||
/update/
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -17,6 +17,7 @@ import javafx.stage.WindowEvent;
|
||||||
import main.KeyChecker;
|
import main.KeyChecker;
|
||||||
import main.ModLoader;
|
import main.ModLoader;
|
||||||
import main.Start;
|
import main.Start;
|
||||||
|
import manager.OperatingSystem;
|
||||||
import manager.SettingManager;
|
import manager.SettingManager;
|
||||||
import scenes.MainScene;
|
import scenes.MainScene;
|
||||||
import update.Updater;
|
import update.Updater;
|
||||||
|
@ -36,6 +37,12 @@ public class BasicGuiApp extends Application{
|
||||||
ml.addMods();
|
ml.addMods();
|
||||||
ml.initMods();
|
ml.initMods();
|
||||||
|
|
||||||
|
if(SettingManager.getOperatingSystem() == OperatingSystem.WINDOWS) {
|
||||||
|
registerNativeHoook();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerNativeHoook() {
|
||||||
try {
|
try {
|
||||||
GlobalScreen.registerNativeHook();
|
GlobalScreen.registerNativeHook();
|
||||||
} catch (NativeHookException e) {
|
} catch (NativeHookException e) {
|
||||||
|
@ -49,7 +56,6 @@ public class BasicGuiApp extends Application{
|
||||||
GlobalScreen.addNativeKeyListener(listener);
|
GlobalScreen.addNativeKeyListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void start(Stage primaryStage) throws Exception {
|
public void start(Stage primaryStage) throws Exception {
|
||||||
|
|
||||||
mainStage = primaryStage;
|
mainStage = primaryStage;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package guis;
|
package guis;
|
||||||
|
|
||||||
|
|
||||||
import org.jnativehook.GlobalScreen;
|
import org.jnativehook.GlobalScreen;
|
||||||
|
|
||||||
import basics.BasicGuiApp;
|
import basics.BasicGuiApp;
|
||||||
|
@ -11,12 +10,12 @@ import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.text.Text;
|
import javafx.scene.text.Text;
|
||||||
import main.ShortcutKeyChecker;
|
import main.ShortcutKeyChecker;
|
||||||
|
import manager.OperatingSystem;
|
||||||
import manager.ResourceManager;
|
import manager.ResourceManager;
|
||||||
import manager.SettingManager;
|
import manager.SettingManager;
|
||||||
|
|
||||||
public class SettingGui extends AnchorPane {
|
public class SettingGui extends AnchorPane {
|
||||||
|
|
||||||
|
|
||||||
AnchorPane settingPane;
|
AnchorPane settingPane;
|
||||||
|
|
||||||
public SettingGui() {
|
public SettingGui() {
|
||||||
|
@ -56,6 +55,7 @@ public class SettingGui extends AnchorPane{
|
||||||
setting3Box.setSelected(SettingManager.isCheckUptdateOnBoot());
|
setting3Box.setSelected(SettingManager.isCheckUptdateOnBoot());
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
if (SettingManager.getOperatingSystem() == OperatingSystem.WINDOWS) {
|
||||||
Text setting4 = new Text("QuickLaunch shortcut:");
|
Text setting4 = new Text("QuickLaunch shortcut:");
|
||||||
setting4.setFont(ResourceManager.getFontSmall());
|
setting4.setFont(ResourceManager.getFontSmall());
|
||||||
setting4.setLayoutX(10);
|
setting4.setLayoutX(10);
|
||||||
|
@ -74,7 +74,6 @@ public class SettingGui extends AnchorPane{
|
||||||
setting4button1.prefHeight(24);
|
setting4button1.prefHeight(24);
|
||||||
setting4button1.setOnAction(new EventHandler<ActionEvent>() {
|
setting4button1.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
|
|
||||||
|
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
ShortcutKeyChecker skc = new ShortcutKeyChecker();
|
ShortcutKeyChecker skc = new ShortcutKeyChecker();
|
||||||
GlobalScreen.removeNativeKeyListener(BasicGuiApp.listener);
|
GlobalScreen.removeNativeKeyListener(BasicGuiApp.listener);
|
||||||
|
@ -106,7 +105,6 @@ public class SettingGui extends AnchorPane{
|
||||||
setting4button2.prefHeight(24);
|
setting4button2.prefHeight(24);
|
||||||
setting4button2.setOnAction(new EventHandler<ActionEvent>() {
|
setting4button2.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
|
|
||||||
|
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
ShortcutKeyChecker skc = new ShortcutKeyChecker();
|
ShortcutKeyChecker skc = new ShortcutKeyChecker();
|
||||||
GlobalScreen.removeNativeKeyListener(BasicGuiApp.listener);
|
GlobalScreen.removeNativeKeyListener(BasicGuiApp.listener);
|
||||||
|
@ -124,6 +122,10 @@ public class SettingGui extends AnchorPane{
|
||||||
GlobalScreen.addNativeKeyListener(BasicGuiApp.listener);
|
GlobalScreen.addNativeKeyListener(BasicGuiApp.listener);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.getChildren().add(setting4);
|
||||||
|
this.getChildren().add(setting4button1);
|
||||||
|
this.getChildren().add(setting4button2);
|
||||||
|
}
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -135,7 +137,6 @@ public class SettingGui extends AnchorPane{
|
||||||
exit.prefHeight(24);
|
exit.prefHeight(24);
|
||||||
exit.setOnAction(new EventHandler<ActionEvent>() {
|
exit.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
|
|
||||||
|
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
SettingManager.setLoadFileOnBoot(setting1Box.isSelected());
|
SettingManager.setLoadFileOnBoot(setting1Box.isSelected());
|
||||||
SettingManager.setCheckUptdateOnBoot(setting3Box.isSelected());
|
SettingManager.setCheckUptdateOnBoot(setting3Box.isSelected());
|
||||||
|
@ -145,14 +146,11 @@ public class SettingGui extends AnchorPane{
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
this.getChildren().add(setting1);
|
this.getChildren().add(setting1);
|
||||||
this.getChildren().add(setting1Box);
|
this.getChildren().add(setting1Box);
|
||||||
this.getChildren().add(setting3);
|
this.getChildren().add(setting3);
|
||||||
this.getChildren().add(setting3Box);
|
this.getChildren().add(setting3Box);
|
||||||
this.getChildren().add(setting4);
|
|
||||||
this.getChildren().add(setting4button1);
|
|
||||||
this.getChildren().add(setting4button2);
|
|
||||||
this.getChildren().add(exit);
|
this.getChildren().add(exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import org.jnativehook.keyboard.NativeKeyListener;
|
||||||
import basics.BasicGuiApp;
|
import basics.BasicGuiApp;
|
||||||
import guis.MainGui;
|
import guis.MainGui;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import manager.OperatingSystem;
|
|
||||||
import manager.SettingManager;
|
import manager.SettingManager;
|
||||||
|
|
||||||
public class KeyChecker implements NativeKeyListener{
|
public class KeyChecker implements NativeKeyListener{
|
||||||
|
@ -31,15 +30,6 @@ public class KeyChecker implements NativeKeyListener{
|
||||||
Platform.runLater(new Runnable() {
|
Platform.runLater(new Runnable() {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
if(SettingManager.getOperatingSystem() == OperatingSystem.LINUX) {
|
|
||||||
BasicGuiApp.mainStage.setIconified(true);
|
|
||||||
BasicGuiApp.mainStage.setIconified(false);
|
|
||||||
BasicGuiApp.mainStage.toFront();
|
|
||||||
BasicGuiApp.mainStage.requestFocus();
|
|
||||||
MainGui.inputField.requestFocus();
|
|
||||||
}
|
|
||||||
else if(SettingManager.getOperatingSystem() == OperatingSystem.WINDOWS) {
|
|
||||||
BasicGuiApp.mainStage.setAlwaysOnTop(true);
|
BasicGuiApp.mainStage.setAlwaysOnTop(true);
|
||||||
BasicGuiApp.mainStage.setAlwaysOnTop(false);
|
BasicGuiApp.mainStage.setAlwaysOnTop(false);
|
||||||
BasicGuiApp.mainStage.requestFocus();
|
BasicGuiApp.mainStage.requestFocus();
|
||||||
|
@ -47,16 +37,6 @@ public class KeyChecker implements NativeKeyListener{
|
||||||
BasicGuiApp.mainStage.setIconified(true);
|
BasicGuiApp.mainStage.setIconified(true);
|
||||||
BasicGuiApp.mainStage.setIconified(false);
|
BasicGuiApp.mainStage.setIconified(false);
|
||||||
}
|
}
|
||||||
else if(SettingManager.getOperatingSystem() == OperatingSystem.OSX) {
|
|
||||||
BasicGuiApp.mainStage.setIconified(true);
|
|
||||||
BasicGuiApp.mainStage.setIconified(false);
|
|
||||||
BasicGuiApp.mainStage.toFront();
|
|
||||||
BasicGuiApp.mainStage.requestFocus();
|
|
||||||
MainGui.inputField.requestFocus();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue