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(); ErrorEvent.fromThrowable(ex).omit().expected().handle();
} else { } else {
ErrorEvent.fromThrowable(ex).omit().expected().handle(); 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; return;
} catch (Throwable other) { } catch (Throwable other) {

View file

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

View file

@ -1,6 +1,7 @@
package io.xpipe.app.util; package io.xpipe.app.util;
import io.xpipe.app.core.check.AppSystemFontCheck; 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.ErrorEvent;
import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.issue.TrackEvent;
import io.xpipe.app.prefs.AppPrefs; 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) // This is primarily intended to fix Windows unified stage transparency issues (https://bugs.openjdk.org/browse/JDK-8329382)
System.setProperty("prism.forceUploadingPainter", "true"); System.setProperty("prism.forceUploadingPainter", "true");
} }