This commit is contained in:
Martin Beyer
2020-05-27 12:04:34 +02:00
parent 675a0b1a73
commit f36f9d412c
2 changed files with 7 additions and 5 deletions

View File

@@ -74,7 +74,7 @@ public class UnlockController implements FxController {
this.unlockButtonContentDisplay = Bindings.createObjectBinding(this::getUnlockButtonContentDisplay, passwordEntryLock.awaitingInteraction());
this.userInteractionDisabled = passwordEntryLock.awaitingInteraction().not();
this.unlockButtonDisabled = new SimpleBooleanProperty();
this.window.setOnCloseRequest(windowEvent -> close());
this.window.setOnCloseRequest(windowEvent -> cancel());
}
@FXML
@@ -128,10 +128,6 @@ public class UnlockController implements FxController {
@FXML
public void cancel() {
LOG.debug("Unlock canceled by user.");
close();
}
private void close() {
window.close();
passwordEntryLock.interacted(UnlockModule.PasswordEntry.CANCELED);
}

View File

@@ -5,6 +5,7 @@ import javafx.application.Platform;
import javafx.concurrent.Task;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.Window;
import org.cryptomator.common.vaults.Vault;
import org.cryptomator.common.vaults.VaultState;
import org.cryptomator.common.vaults.Volume;
@@ -112,6 +113,11 @@ public class UnlockWorkflow extends Task<Boolean> {
Platform.runLater(() -> {
window.setScene(unlockScene.get());
window.show();
Window owner = window.getOwner();
if (owner != null) {
window.setX(owner.getX() + (owner.getWidth() - window.getWidth()) / 2);
window.setY(owner.getY() + (owner.getHeight() - window.getHeight()) / 2);
} else window.centerOnScreen();
if (animateShake) {
Animations.createShakeWindowAnimation(window).play();
}