Skip to content

Commit

Permalink
Dialogs resizable properties and size weren't set correctly on Linux.…
Browse files Browse the repository at this point in the history
  • Loading branch information
torakiki committed Oct 23, 2023
1 parent 7e32ec0 commit a6444c0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.pdfsam.gui.components.dialog;

import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
Expand All @@ -42,7 +43,6 @@ public class ConfirmationDialog extends Stage {
public ConfirmationDialog(DialogStyle style, Stage owner, String positiveButtonText, String negativeButtonText) {
initModality(Modality.WINDOW_MODAL);
initStyle(StageStyle.UTILITY);
setResizable(false);
initOwner(owner);
this.dialogContent = new ConfirmationDialogContent(style.icon);
VBox containerPane = new VBox();
Expand All @@ -55,6 +55,10 @@ public ConfirmationDialog(DialogStyle style, Stage owner, String positiveButtonT
Scene scene = new Scene(containerPane);
setScene(scene);
app().registerScene(scene);
Platform.runLater(() -> {
scene.getWindow().sizeToScene();
setResizable(false);
});
this.setOnShown(e -> requestFocus());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import jakarta.inject.Inject;
import jakarta.inject.Named;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.geometry.Pos;
import javafx.scene.Scene;
Expand Down Expand Up @@ -71,7 +72,6 @@ public OpenWithDialog(@Named("primaryStage") Stage stage) {
OpenWithDialog(Collection<Tool> tools, @Named("primaryStage") Stage stage) {
initModality(Modality.WINDOW_MODAL);
initStyle(StageStyle.UTILITY);
setResizable(false);
setTitle(i18n().tr("Open with"));
initOwner(stage);

Expand All @@ -97,6 +97,10 @@ public OpenWithDialog(@Named("primaryStage") Stage stage) {
setScene(scene);
app().registerScene(scene);
eventStudio().addAnnotatedListeners(this);
Platform.runLater(() -> {
scene.getWindow().sizeToScene();
setResizable(false);
});
this.setOnShown(e -> requestFocus());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import jakarta.inject.Inject;
import jakarta.inject.Named;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
Expand Down Expand Up @@ -51,7 +52,6 @@ public class OverwriteConfirmationDialog extends Stage {
public OverwriteConfirmationDialog(@Named("primaryStage") Stage stage) {
initModality(Modality.WINDOW_MODAL);
initStyle(StageStyle.UTILITY);
setResizable(false);
initOwner(stage);
this.dialogContent = new ConfirmationDialogContent(DialogStyle.WARNING.icon);
VBox containerPane = new VBox();
Expand All @@ -62,6 +62,10 @@ public OverwriteConfirmationDialog(@Named("primaryStage") Stage stage) {
Scene scene = new Scene(containerPane);
setScene(scene);
app().registerScene(scene);
Platform.runLater(() -> {
scene.getWindow().sizeToScene();
setResizable(false);
});
this.setOnShown(e -> requestFocus());
}

Expand Down

0 comments on commit a6444c0

Please sign in to comment.