[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix window decorations #11440

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/main/java/org/jabref/gui/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ private void openWindow() {

mainStage.setMinHeight(330);
mainStage.setMinWidth(580);
mainStage.setFullScreen(guiPreferences.isWindowFullscreen());
mainStage.setMaximized(guiPreferences.isWindowMaximised());
if ((Screen.getScreens().size() == 1) && isWindowPositionOutOfBounds()) {
// corrects the Window, if it is outside the mainscreen
Expand Down Expand Up @@ -253,12 +252,13 @@ public void onHiding(WindowEvent event) {

private void saveWindowState() {
GuiPreferences preferences = preferencesService.getGuiPreferences();
preferences.setPositionX(mainStage.getX());
preferences.setPositionY(mainStage.getY());
preferences.setSizeX(mainStage.getWidth());
preferences.setSizeY(mainStage.getHeight());
if (!mainStage.isMaximized()) {
preferences.setPositionX(mainStage.getX());
preferences.setPositionY(mainStage.getY());
preferences.setSizeX(mainStage.getWidth());
preferences.setSizeY(mainStage.getHeight());
}
preferences.setWindowMaximised(mainStage.isMaximized());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would drop this line, too.

This should keep the fix at #4939

preferences.setWindowFullScreen(mainStage.isFullScreen());
debugLogWindowState(mainStage);
}

Expand Down
15 changes: 0 additions & 15 deletions src/main/java/org/jabref/preferences/GuiPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class GuiPreferences {
private final DoubleProperty sizeY;

private final BooleanProperty windowMaximised;
private final BooleanProperty windowFullScreen;

// the last libraries that were open when jabref closes and should be reopened on startup
private final ObservableList<Path> lastFilesOpened;
Expand All @@ -39,7 +38,6 @@ public GuiPreferences(double positionX,
double sizeX,
double sizeY,
boolean windowMaximised,
boolean windowFullScreen,
List<Path> lastFilesOpened,
Path lastFocusedFile,
FileHistory fileHistory,
Expand All @@ -50,7 +48,6 @@ public GuiPreferences(double positionX,
this.sizeX = new SimpleDoubleProperty(sizeX);
this.sizeY = new SimpleDoubleProperty(sizeY);
this.windowMaximised = new SimpleBooleanProperty(windowMaximised);
this.windowFullScreen = new SimpleBooleanProperty(windowFullScreen);
this.lastFilesOpened = FXCollections.observableArrayList(lastFilesOpened);
this.lastFocusedFile = new SimpleObjectProperty<>(lastFocusedFile);
this.lastSelectedIdBasedFetcher = new SimpleStringProperty(lastSelectedIdBasedFetcher);
Expand Down Expand Up @@ -118,18 +115,6 @@ public void setWindowMaximised(boolean windowMaximised) {
this.windowMaximised.set(windowMaximised);
}

public BooleanProperty windowFullScreenProperty() {
return windowFullScreen;
}

public void setWindowFullScreen(boolean windowFullScreen) {
this.windowFullScreen.set(windowFullScreen);
}

public boolean isWindowFullscreen() {
return windowFullScreen.get();
}

public ObservableList<Path> getLastFilesOpened() {
return lastFilesOpened;
}
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/org/jabref/preferences/JabRefPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ public class JabRefPreferences implements PreferencesService {
public static final String ENTRY_EDITOR_PREVIEW_DIVIDER_POS = "entryEditorPreviewDividerPos";
public static final String AUTO_RESIZE_MODE = "autoResizeMode";
public static final String WINDOW_MAXIMISED = "windowMaximised";
public static final String WINDOW_FULLSCREEN = "windowFullscreen";

public static final String REFORMAT_FILE_ON_SAVE_AND_EXPORT = "reformatFileOnSaveAndExport";
public static final String EXPORT_IN_ORIGINAL_ORDER = "exportInOriginalOrder";
Expand Down Expand Up @@ -603,7 +602,6 @@ private JabRefPreferences() {
defaults.put(SIZE_X, 1024);
defaults.put(SIZE_Y, 768);
defaults.put(WINDOW_MAXIMISED, Boolean.TRUE);
defaults.put(WINDOW_FULLSCREEN, Boolean.FALSE);
defaults.put(AUTO_RESIZE_MODE, Boolean.FALSE); // By default disable "Fit table horizontally on the screen"
defaults.put(ENTRY_EDITOR_HEIGHT, 0.65);
defaults.put(ENTRY_EDITOR_PREVIEW_DIVIDER_POS, 0.5);
Expand Down Expand Up @@ -2572,7 +2570,6 @@ public GuiPreferences getGuiPreferences() {
getDouble(SIZE_X),
getDouble(SIZE_Y),
getBoolean(WINDOW_MAXIMISED),
getBoolean(WINDOW_FULLSCREEN),
getStringList(LAST_EDITED).stream()
.map(Path::of)
.collect(Collectors.toList()),
Expand All @@ -2586,7 +2583,6 @@ public GuiPreferences getGuiPreferences() {
EasyBind.listen(guiPreferences.sizeXProperty(), (obs, oldValue, newValue) -> putDouble(SIZE_X, newValue.doubleValue()));
EasyBind.listen(guiPreferences.sizeYProperty(), (obs, oldValue, newValue) -> putDouble(SIZE_Y, newValue.doubleValue()));
EasyBind.listen(guiPreferences.windowMaximisedProperty(), (obs, oldValue, newValue) -> putBoolean(WINDOW_MAXIMISED, newValue));
EasyBind.listen(guiPreferences.windowFullScreenProperty(), (obs, oldValue, newValue) -> putBoolean(WINDOW_FULLSCREEN, newValue));
guiPreferences.getLastFilesOpened().addListener((ListChangeListener<Path>) change -> {
if (change.getList().isEmpty()) {
prefs.remove(LAST_EDITED);
Expand Down