Small fixes

This commit is contained in:
crschnick 2024-07-04 20:11:38 +00:00
parent cc88a0594c
commit 3ef26d0b0b
3 changed files with 20 additions and 9 deletions

View file

@ -105,7 +105,13 @@ public class BeaconRequestHandler<T> implements HttpHandler {
ErrorEvent.fromThrowable(ex).omit().expected().handle();
} else {
ErrorEvent.fromThrowable(ex).omit().expected().handle();
writeError(exchange, new BeaconClientErrorResponse(ex.getMessage()), 400);
// Make deserialization error message more readable
var message = ex.getMessage()
.replace("$RequestBuilder", "")
.replace("Exchange$Request","Request")
.replace("at [Source: UNKNOWN; byte offset: #UNKNOWN]", "")
.trim();
writeError(exchange, new BeaconClientErrorResponse(message), 400);
}
return;
} catch (Throwable other) {

View file

@ -19,6 +19,10 @@ import org.apache.commons.lang3.SystemUtils;
public class ModifiedStage extends Stage {
public static boolean mergeFrame() {
return SystemUtils.IS_OS_WINDOWS_11;
}
@SneakyThrows
@SuppressWarnings("unchecked")
public static void init() {
@ -36,7 +40,7 @@ public class ModifiedStage extends Stage {
}
public static void prepareStage(Stage stage) {
if (SystemUtils.IS_OS_WINDOWS_11) {
if (mergeFrame()) {
stage.initStyle(StageStyle.UNIFIED);
}
}
@ -68,14 +72,14 @@ public class ModifiedStage extends Stage {
ctrl.setWindowAttribute(
NativeWinWindowControl.DmwaWindowAttribute.DWMWA_USE_IMMERSIVE_DARK_MODE.get(),
AppPrefs.get().theme.getValue().isDark());
boolean backdrop;
if (AppPrefs.get().performanceMode().get()) {
backdrop = false;
boolean seamlessFrame;
if (AppPrefs.get().performanceMode().get() || !mergeFrame()) {
seamlessFrame = false;
} else {
backdrop = ctrl.setWindowBackdrop(NativeWinWindowControl.DwmSystemBackDropType.MICA_ALT);
seamlessFrame = ctrl.setWindowBackdrop(NativeWinWindowControl.DwmSystemBackDropType.MICA_ALT);
}
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("seamless-frame"), backdrop);
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("separate-frame"), !backdrop);
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("seamless-frame"), seamlessFrame);
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("separate-frame"), !seamlessFrame);
}
private static void updateStage(Stage stage) {

View file

@ -1,6 +1,7 @@
package io.xpipe.app.util;
import io.xpipe.app.core.check.AppSystemFontCheck;
import io.xpipe.app.core.window.ModifiedStage;
import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.issue.TrackEvent;
import io.xpipe.app.prefs.AppPrefs;
@ -113,7 +114,7 @@ public enum PlatformState {
}
}
if (SystemUtils.IS_OS_WINDOWS_11) {
if (SystemUtils.IS_OS_WINDOWS && ModifiedStage.mergeFrame()) {
// This is primarily intended to fix Windows unified stage transparency issues (https://bugs.openjdk.org/browse/JDK-8329382)
System.setProperty("prism.forceUploadingPainter", "true");
}