Skip to content

Commit

Permalink
Implement maximized window pseudoclass & improve corner radius styling
Browse files Browse the repository at this point in the history
  • Loading branch information
sghpjuikit committed Jan 11, 2025
1 parent 95f7463 commit 0bdaa4d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/skins/Main/Main.css
Original file line number Diff line number Diff line change
Expand Up @@ -2187,6 +2187,7 @@ TextFlow > * {
* resized: the window is being resized
* moved: the window is being moved
* fullscreen: the window is in fullscreen mode
* maximized: the window is in maximized state
* transparent-on: the window has StageStyle.TRANSPARENT and is not `transparent` or `transparent-ct`
* transparent-blur: same as transparent-on, but window has blurred bgr effect enabled
* transparent: the window has forcefully disabled certain decorations to show transparency effects
Expand Down
14 changes: 13 additions & 1 deletion app/skins/rounded-edges.extension.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,19 @@
.window,
.window > #front > #frontContent,
.pop-window,
.pop-window-content,
.pop-window-content {
-fx-background-radius: 0.5em; // 0.5 is compatible with windows radius
-fx-border-radius: 0.6em; // -fx-background-radius + 0.1em to improve look in the corner
}

.window:maximized,
.window:maximized > #front > #frontContent,
.window:fullscreen,
.window:fullscreen > #front > #frontContent {
-fx-background-radius: 0;
-fx-border-radius: 0;
}

* {
-fx-background-radius: 1em;
-fx-border-radius: 1em;
Expand Down
3 changes: 3 additions & 0 deletions src/player/main/sp/it/pl/ui/objects/window/stage/Window.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ public class Window extends WindowBase {
public static final PseudoClass pcMoved = pseudoclass("moved");
/** Pseudoclass active when this window is fullscreen. Applied on {@link #scWindow}. */
public static final PseudoClass pcFullscreen = pseudoclass("fullscreen");
/** Pseudoclass active when this window is maximized. Applied on {@link #scWindow}. */
public static final PseudoClass pcMaximized = pseudoclass("maximized");
/** Pseudoclass active when this window {@link javafx.stage.StageStyle} is {@link javafx.stage.StageStyle#TRANSPARENT} and {@link #effect} is {@link sp.it.pl.ui.objects.window.stage.Window.BgrEffect#OFF}. */
public static final String pcTransparentOn = "transparent-on";
/** Pseudoclass active when this window {@link javafx.stage.StageStyle} is {@link javafx.stage.StageStyle#TRANSPARENT} and {@link #effect} is not {@link sp.it.pl.ui.objects.window.stage.Window.BgrEffect#OFF}. */
Expand Down Expand Up @@ -259,6 +261,7 @@ void initialize() {
resizing.addListener((o, ov, nv) -> root.pseudoClassStateChanged(pcResized, nv!=NONE));
moving.addListener((o, ov, nv) -> root.pseudoClassStateChanged(pcMoved, nv));
fullscreen.addListener((o, ov, nv) -> root.pseudoClassStateChanged(pcFullscreen, nv));
maximized.addListener((o, ov, nv) -> root.pseudoClassStateChanged(pcMaximized, nv==Maximized.ALL));

// disable borders when not resizable
// makes gui consistent & prevents potential bugs
Expand Down

0 comments on commit 0bdaa4d

Please sign in to comment.