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

Bugfix for Multiscreen #5738

Merged
merged 8 commits into from
Dec 12, 2019
Merged

Bugfix for Multiscreen #5738

merged 8 commits into from
Dec 12, 2019

Conversation

MisterM13
Copy link
Contributor

@MisterM13 MisterM13 commented Dec 11, 2019

Made following Changes to solve Multiscreen issue fixes #5037:

At JabRefGUI:

  • new local variable correctedWindowPos to support saving of Screendata
  • change in method openWindow to open window at the mainscreen if needed
  • made method printWindowState() to print out windowposition data (if Logger in debug mode)
  • made method testExternalCoordinates() to test if window is on external screen
  • made method numberOfMonitors() to test if external screen is connected
    ( |-> numberOfMonitors() finally replaced by Screen.getScreens().size())

At JabRefPreferences:

  • made copy of the window position and size variables (recognised with _CORE)
  • made initialisation for the variables described above

(made in accordance with an Project on Software Engineering at University Basel in cooperation with @unibas-marcelluethi)

  • Change in CHANGELOG.md described (if applicable)
  • Manually tested changed features in running JabRef (always required)

@Siedlerchr
Copy link
Member

Thanks for the contribution. Please remove the Travis integration as we recently switched to Github Actions.
Otherwise this looks good so far

Copy link
Member

@tobiasdiez tobiasdiez left a comment

Choose a reason for hiding this comment

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

Welcome to JabRef!

I've two suggestions to improve the code a little bit. Other than that, the code looks really good. It's also really helpful that you clearly outline your changes in the PR description. Thanks!

* returns the number of Monitors connected to the Computer
* @return numberOfmonitors
*/
private int numberOfMonitors() {
Copy link
Member

Choose a reason for hiding this comment

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

I think the pure JavaFX version would be Screen.getScreens().size()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

integrated with newest commit

*/
private boolean testExternalCoordinates() {
boolean outbounds = false;
if (Globals.prefs.getDouble(JabRefPreferences.POS_X) > Globals.prefs.getDouble(JabRefPreferences.SIZE_X)) {
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be slightly better to test against the actual dimensions of the screen, which you can get via Screen.getPrimary().getBounds()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

integrated with newest commit

@MisterM13 MisterM13 marked this pull request as ready for review December 11, 2019 21:39
Copy link
Member

@tobiasdiez tobiasdiez left a comment

Choose a reason for hiding this comment

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

Thanks! The code looks good and I've only a few minor remarks before we can merge.

private void printWindowState(Stage mainStage) {
StringBuilder bob = new StringBuilder();
bob.append("SCREEN DATA:");
bob.append("JabRefPreferences.WINDOW_MAXIMISED: " + mainStage.isMaximized() + "\n");
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't JabRefPreferences be replaced by MainStage ? (As this does not print the values stored in the preferences)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes it should, I think I had it wrong in because of earlier tries, were I also printed the preferences 😅 it'll be changed at the next commit

* Tests if the window coordinates are out of the mainscreen
* @return outbounds
*/
private boolean testExternalCoordinates() {
Copy link
Member

Choose a reason for hiding this comment

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

test is a bit vague, what about storedWindowPositionIsOutOfBounds (or maybe something a bit shorter).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

renamed it with isWindowPositionOutOfBounds()

@@ -172,6 +172,10 @@
public static final String SIZE_X = "mainWindowSizeX";
public static final String POS_Y = "mainWindowPosY";
public static final String POS_X = "mainWindowPosX";
public static final String SIZE_Y_CORE = "mainWindowSizeYCore";
Copy link
Member

Choose a reason for hiding this comment

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

As the user can never configure these values, there is no need to add them as preferences. Please convert them to static fields in JabRefGUI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will try to set the Numbers right in at the method openWindow(), not sure if that works, but if it do I can delete all variables I made up..

MisterM13 and others added 2 commits December 12, 2019 14:03
…med method testExternalCoordinates with isWindowPositionOutOfBounds(), Deleted unused Variables at JabrefPreferences due to a correction in openWindow (at JabRefGUI)
@tobiasdiez
Copy link
Member

Thanks for the quick follow-up!

@tobiasdiez tobiasdiez merged commit 0aa6138 into JabRef:master Dec 12, 2019
Siedlerchr added a commit that referenced this pull request Dec 14, 2019
* upstream/master: (21 commits)
  New Crowdin translations (#5729)
  Update license of Oracle JDBC
  Changes string representation when detecting custom entry types. (#5741)
  Try to fix GitVersion
  Also run workflow on tag creation
  Add README.md with an initial help to work on command line para… (#5720)
  Bugfix for Multiscreen (#5738)
  Fix #2868 - keep source groups selected after drag and drop
  retrigger build
  Squashed 'src/main/resources/csl-styles/' changes from f71cd32..49a1841
  try to fix pull of csl styles
  try to fix csl update
  Fixed untranslated Strings issue #5701
  Fix #5603 - account for file extension in file name length (#5726)
  New translations JabRef_en.properties (French)
  Bump unirest-java from 3.2.00 to 3.3.00
  Bump postgresql from 42.2.8 to 42.2.9
  Bump tika-core from 1.22 to 1.23
  Fix upload to GitHub artifacts (#5712)
  Try to fix csl update (#5718)
  ...
@koppor koppor mentioned this pull request Dec 20, 2019
koppor pushed a commit that referenced this pull request Dec 15, 2021
60bf7d5 Add encyclopedia type to wikipedia-templates.csl (#5778)
031afe1 Update and rename dependent/organization-studies.csl to organization-… (#5779)
7ed71e7 Update harvard-newcastle-university.csl (#5765)
46bab91 Update annals-of-oncology.csl (#5760)
6158ae6 Create research-in-plant-disease.csl (#5738)
04422a8 Create chemmedchem.csl (#5753)
7c11521 Create clinical-kidney-journal.csl (#5749)
e7ee983 Create kit-karlsruher-institut-fur-technologie-germanistik-ndl-neuere… (#5729)
96a1106 Update article format for STM journal (#5755)
a4ca057 Update historia-scribere.csl (#5748)

git-subtree-dir: buildres/csl/csl-styles
git-subtree-split: 60bf7d5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiscreen issue
3 participants