mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-09-20 15:04:23 +00:00
Merge branch 'develop' into feature/add-vault-button-to-dropdown
This commit is contained in:
@@ -8,7 +8,7 @@ updates:
|
|||||||
time: "06:00"
|
time: "06:00"
|
||||||
timezone: "UTC"
|
timezone: "UTC"
|
||||||
groups:
|
groups:
|
||||||
all: # one PR for all dependencies
|
maven-dependencies:
|
||||||
patterns:
|
patterns:
|
||||||
- "*"
|
- "*"
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ updates:
|
|||||||
schedule:
|
schedule:
|
||||||
interval: "monthly"
|
interval: "monthly"
|
||||||
groups:
|
groups:
|
||||||
all: # one PR for all actions
|
github-actions:
|
||||||
patterns:
|
patterns:
|
||||||
- "*"
|
- "*"
|
||||||
labels:
|
labels:
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
@@ -54,16 +54,16 @@
|
|||||||
<logback.version>1.4.11</logback.version>
|
<logback.version>1.4.11</logback.version>
|
||||||
<slf4j.version>2.0.7</slf4j.version>
|
<slf4j.version>2.0.7</slf4j.version>
|
||||||
<tinyoauth2.version>0.6.0</tinyoauth2.version>
|
<tinyoauth2.version>0.6.0</tinyoauth2.version>
|
||||||
<zxcvbn.version>1.8.0</zxcvbn.version>
|
<zxcvbn.version>1.8.2</zxcvbn.version>
|
||||||
|
|
||||||
<!-- test dependencies -->
|
<!-- test dependencies -->
|
||||||
<junit.jupiter.version>5.10.0</junit.jupiter.version>
|
<junit.jupiter.version>5.10.0</junit.jupiter.version>
|
||||||
<mockito.version>5.4.0</mockito.version>
|
<mockito.version>5.5.0</mockito.version>
|
||||||
<hamcrest.version>2.2</hamcrest.version>
|
<hamcrest.version>2.2</hamcrest.version>
|
||||||
|
|
||||||
<!-- build-time dependencies -->
|
<!-- build-time dependencies -->
|
||||||
<jetbrains.annotations.version>24.0.1</jetbrains.annotations.version>
|
<jetbrains.annotations.version>24.0.1</jetbrains.annotations.version>
|
||||||
<dependency-check.version>8.3.1</dependency-check.version>
|
<dependency-check.version>8.4.0</dependency-check.version>
|
||||||
<jacoco.version>0.8.10</jacoco.version>
|
<jacoco.version>0.8.10</jacoco.version>
|
||||||
<license-generator.version>2.2.0</license-generator.version>
|
<license-generator.version>2.2.0</license-generator.version>
|
||||||
<junit-tree-reporter.version>1.2.1</junit-tree-reporter.version>
|
<junit-tree-reporter.version>1.2.1</junit-tree-reporter.version>
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ public class Settings {
|
|||||||
public final IntegerProperty windowYPosition;
|
public final IntegerProperty windowYPosition;
|
||||||
public final IntegerProperty windowWidth;
|
public final IntegerProperty windowWidth;
|
||||||
public final IntegerProperty windowHeight;
|
public final IntegerProperty windowHeight;
|
||||||
public final StringProperty displayConfiguration;
|
|
||||||
public final StringProperty language;
|
public final StringProperty language;
|
||||||
public final StringProperty mountService;
|
public final StringProperty mountService;
|
||||||
public final StringProperty lastUpdateCheck;
|
public final StringProperty lastUpdateCheck;
|
||||||
@@ -103,7 +102,6 @@ public class Settings {
|
|||||||
this.windowYPosition = new SimpleIntegerProperty(this, "windowYPosition", json.windowYPosition);
|
this.windowYPosition = new SimpleIntegerProperty(this, "windowYPosition", json.windowYPosition);
|
||||||
this.windowWidth = new SimpleIntegerProperty(this, "windowWidth", json.windowWidth);
|
this.windowWidth = new SimpleIntegerProperty(this, "windowWidth", json.windowWidth);
|
||||||
this.windowHeight = new SimpleIntegerProperty(this, "windowHeight", json.windowHeight);
|
this.windowHeight = new SimpleIntegerProperty(this, "windowHeight", json.windowHeight);
|
||||||
this.displayConfiguration = new SimpleStringProperty(this, "displayConfiguration", json.displayConfiguration);
|
|
||||||
this.language = new SimpleStringProperty(this, "language", json.language);
|
this.language = new SimpleStringProperty(this, "language", json.language);
|
||||||
this.mountService = new SimpleStringProperty(this, "mountService", json.mountService);
|
this.mountService = new SimpleStringProperty(this, "mountService", json.mountService);
|
||||||
this.lastUpdateCheck = new SimpleStringProperty(this, "lastUpdateCheck", json.lastUpdateCheck);
|
this.lastUpdateCheck = new SimpleStringProperty(this, "lastUpdateCheck", json.lastUpdateCheck);
|
||||||
@@ -131,7 +129,6 @@ public class Settings {
|
|||||||
windowYPosition.addListener(this::somethingChanged);
|
windowYPosition.addListener(this::somethingChanged);
|
||||||
windowWidth.addListener(this::somethingChanged);
|
windowWidth.addListener(this::somethingChanged);
|
||||||
windowHeight.addListener(this::somethingChanged);
|
windowHeight.addListener(this::somethingChanged);
|
||||||
displayConfiguration.addListener(this::somethingChanged);
|
|
||||||
language.addListener(this::somethingChanged);
|
language.addListener(this::somethingChanged);
|
||||||
mountService.addListener(this::somethingChanged);
|
mountService.addListener(this::somethingChanged);
|
||||||
lastUpdateCheck.addListener(this::somethingChanged);
|
lastUpdateCheck.addListener(this::somethingChanged);
|
||||||
@@ -186,7 +183,6 @@ public class Settings {
|
|||||||
json.windowYPosition = windowYPosition.get();
|
json.windowYPosition = windowYPosition.get();
|
||||||
json.windowWidth = windowWidth.get();
|
json.windowWidth = windowWidth.get();
|
||||||
json.windowHeight = windowHeight.get();
|
json.windowHeight = windowHeight.get();
|
||||||
json.displayConfiguration = displayConfiguration.get();
|
|
||||||
json.language = language.get();
|
json.language = language.get();
|
||||||
json.mountService = mountService.get();
|
json.mountService = mountService.get();
|
||||||
json.lastUpdateCheck = lastUpdateCheck.get();
|
json.lastUpdateCheck = lastUpdateCheck.get();
|
||||||
|
|||||||
@@ -31,9 +31,6 @@ class SettingsJson {
|
|||||||
@JsonProperty("theme")
|
@JsonProperty("theme")
|
||||||
UiTheme theme = Settings.DEFAULT_THEME;
|
UiTheme theme = Settings.DEFAULT_THEME;
|
||||||
|
|
||||||
@JsonProperty("displayConfiguration")
|
|
||||||
String displayConfiguration;
|
|
||||||
|
|
||||||
@JsonProperty("keychainProvider")
|
@JsonProperty("keychainProvider")
|
||||||
String keychainProvider = Settings.DEFAULT_KEYCHAIN_PROVIDER;
|
String keychainProvider = Settings.DEFAULT_KEYCHAIN_PROVIDER;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javafx.beans.binding.Bindings;
|
|
||||||
import javafx.beans.binding.BooleanBinding;
|
import javafx.beans.binding.BooleanBinding;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
@@ -15,6 +14,7 @@ import javafx.scene.input.MouseEvent;
|
|||||||
import javafx.scene.layout.Region;
|
import javafx.scene.layout.Region;
|
||||||
import javafx.stage.Screen;
|
import javafx.stage.Screen;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
import javafx.stage.WindowEvent;
|
||||||
|
|
||||||
@MainWindow
|
@MainWindow
|
||||||
public class ResizeController implements FxController {
|
public class ResizeController implements FxController {
|
||||||
@@ -53,48 +53,70 @@ public class ResizeController implements FxController {
|
|||||||
public void initialize() {
|
public void initialize() {
|
||||||
LOG.trace("init ResizeController");
|
LOG.trace("init ResizeController");
|
||||||
|
|
||||||
if (neverTouched()) {
|
if (!neverTouched()) {
|
||||||
settings.displayConfiguration.set(getMonitorSizes());
|
window.setHeight(settings.windowHeight.get() > window.getMinHeight() ? settings.windowHeight.get() : window.getMinHeight());
|
||||||
return;
|
window.setWidth(settings.windowWidth.get() > window.getMinWidth() ? settings.windowWidth.get() : window.getMinWidth());
|
||||||
} else {
|
window.setX(settings.windowXPosition.get());
|
||||||
if (didDisplayConfigurationChange()) {
|
window.setY(settings.windowYPosition.get());
|
||||||
//If the position is illegal, then the window appears on the main screen in the middle of the window.
|
|
||||||
Rectangle2D primaryScreenBounds = Screen.getPrimary().getBounds();
|
|
||||||
window.setX((primaryScreenBounds.getWidth() - window.getMinWidth()) / 2);
|
|
||||||
window.setY((primaryScreenBounds.getHeight() - window.getMinHeight()) / 2);
|
|
||||||
window.setWidth(window.getMinWidth());
|
|
||||||
window.setHeight(window.getMinHeight());
|
|
||||||
} else {
|
|
||||||
window.setHeight(settings.windowHeight.get() > window.getMinHeight() ? settings.windowHeight.get() : window.getMinHeight());
|
|
||||||
window.setWidth(settings.windowWidth.get() > window.getMinWidth() ? settings.windowWidth.get() : window.getMinWidth());
|
|
||||||
window.setX(settings.windowXPosition.get());
|
|
||||||
window.setY(settings.windowYPosition.get());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
savePositionalSettings();
|
|
||||||
|
window.setOnShowing(this::checkDisplayBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean neverTouched() {
|
private boolean neverTouched() {
|
||||||
return (settings.windowHeight.get() == 0) && (settings.windowWidth.get() == 0) && (settings.windowXPosition.get() == 0) && (settings.windowYPosition.get() == 0);
|
return (settings.windowHeight.get() == 0) && (settings.windowWidth.get() == 0) && (settings.windowXPosition.get() == 0) && (settings.windowYPosition.get() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean didDisplayConfigurationChange() {
|
private boolean isWithinDisplayBounds() {
|
||||||
String currentDisplayConfiguration = getMonitorSizes();
|
// (x1, y1) is the top left corner of the window, (x2, y2) is the bottom right corner
|
||||||
String settingsDisplayConfiguration = settings.displayConfiguration.get();
|
final double slack = 10;
|
||||||
boolean configurationHasChanged = !settingsDisplayConfiguration.equals(currentDisplayConfiguration);
|
final double width = window.getWidth() - 2 * slack;
|
||||||
if (configurationHasChanged) settings.displayConfiguration.set(currentDisplayConfiguration);
|
final double height = window.getHeight() - 2 * slack;
|
||||||
return configurationHasChanged;
|
final double x1 = window.getX() + slack;
|
||||||
|
final double y1 = window.getY() + slack;
|
||||||
|
final double x2 = x1 + width;
|
||||||
|
final double y2 = y1 + height;
|
||||||
|
|
||||||
|
final ObservableList<Screen> screens = Screen.getScreensForRectangle(x1, y1, width, height);
|
||||||
|
|
||||||
|
// Find the total visible area of the window
|
||||||
|
double visibleArea = 0;
|
||||||
|
for (Screen screen : screens) {
|
||||||
|
Rectangle2D bounds = screen.getVisualBounds();
|
||||||
|
|
||||||
|
double xOverlap = Math.min(x2, bounds.getMaxX()) - Math.max(x1, bounds.getMinX());
|
||||||
|
double yOverlap = Math.min(y2, bounds.getMaxY()) - Math.max(y1, bounds.getMinY());
|
||||||
|
|
||||||
|
visibleArea += xOverlap * yOverlap;
|
||||||
|
}
|
||||||
|
|
||||||
|
final double windowArea = width * height;
|
||||||
|
|
||||||
|
// Within bounds if the visible area matches the window area
|
||||||
|
return visibleArea == windowArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getMonitorSizes() {
|
private void checkDisplayBounds(WindowEvent evt) {
|
||||||
ObservableList<Screen> screens = Screen.getScreens();
|
|
||||||
StringBuilder sb = new StringBuilder();
|
// Minimizing a window in Windows and closing it could result in an out of bounds position at (x, y) = (-32000, -32000)
|
||||||
for (int i = 0; i < screens.size(); i++) {
|
// See https://devblogs.microsoft.com/oldnewthing/20041028-00/?p=37453
|
||||||
Rectangle2D screenBounds = screens.get(i).getBounds();
|
// If the position is (-32000, -32000), restore to the last saved position
|
||||||
if (!sb.isEmpty()) sb.append(" ");
|
if (window.getX() == -32000 && window.getY() == -32000) {
|
||||||
sb.append("displayId: " + i + ", " + screenBounds.getWidth() + "x" + screenBounds.getHeight() + ";");
|
window.setX(settings.windowXPosition.get());
|
||||||
|
window.setY(settings.windowYPosition.get());
|
||||||
|
window.setWidth(settings.windowWidth.get());
|
||||||
|
window.setHeight(settings.windowHeight.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isWithinDisplayBounds()) {
|
||||||
|
// If the position is illegal, then the window appears on the main screen in the middle of the window.
|
||||||
|
Rectangle2D primaryScreenBounds = Screen.getPrimary().getBounds();
|
||||||
|
window.setX((primaryScreenBounds.getWidth() - window.getMinWidth()) / 2);
|
||||||
|
window.setY((primaryScreenBounds.getHeight() - window.getMinHeight()) / 2);
|
||||||
|
window.setWidth(window.getMinWidth());
|
||||||
|
window.setHeight(window.getMinHeight());
|
||||||
|
savePositionalSettings();
|
||||||
}
|
}
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startResize(MouseEvent evt) {
|
private void startResize(MouseEvent evt) {
|
||||||
@@ -183,5 +205,4 @@ public class ResizeController implements FxController {
|
|||||||
public boolean isShowResizingArrows() {
|
public boolean isShowResizingArrows() {
|
||||||
return showResizingArrows.get();
|
return showResizingArrows.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user