diff --git a/CHANGELOG b/CHANGELOG index 3b87b114fa3..d9e60e69f76 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -34,6 +34,7 @@ - Tweak of preference defaults: Autolink requires that the filename starts with the given BibTeX key and the default filename patterns is key followed by title - Remove support to the move-to-SysTray action - Feature: case changers now leave protected areas (enclosed with curly brakets) alone + - Fix #223: Window is displayed in visible area even when having multiple screens [dev_2.11] - Backports from 2.80: Fix bug #194: JabRef starts again on Win XP and Win Vista - Backports from 2.80: Fixes #103: JDialog for auto set links is openend and closed correctly diff --git a/src/main/java/net/sf/jabref/gui/JabRefFrame.java b/src/main/java/net/sf/jabref/gui/JabRefFrame.java index fb03dc586d9..78f88a1d82d 100644 --- a/src/main/java/net/sf/jabref/gui/JabRefFrame.java +++ b/src/main/java/net/sf/jabref/gui/JabRefFrame.java @@ -542,6 +542,55 @@ public void windowClosing(WindowEvent e) { tlb.setVisible(Globals.prefs.getBoolean(JabRefPreferences.TOOLBAR_VISIBLE)); setBounds(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds()); + positionWindowOnScreen(); + + tabbedPane.setBorder(null); + tabbedPane.setForeground(GUIGlobals.inActiveTabbed); + + /* + * The following state listener makes sure focus is registered with the + * correct database when the user switches tabs. Without this, + * cut/paste/copy operations would some times occur in the wrong tab. + */ + tabbedPane.addChangeListener(new ChangeListener() { + + @Override + public void stateChanged(ChangeEvent e) { + markActiveBasePanel(); + + BasePanel bp = basePanel(); + if (bp != null) { + groupToggle.setSelected(sidePaneManager.isComponentVisible("groups")); + searchToggle.setSelected(sidePaneManager.isComponentVisible("search")); + previewToggle.setSelected(Globals.prefs.getBoolean(JabRefPreferences.PREVIEW_ENABLED)); + highlightAny + .setSelected(Globals.prefs.getBoolean(JabRefPreferences.HIGHLIGHT_GROUPS_MATCHING_ANY)); + highlightAll + .setSelected(Globals.prefs.getBoolean(JabRefPreferences.HIGHLIGHT_GROUPS_MATCHING_ALL)); + Globals.focusListener.setFocused(bp.mainTable); + setWindowTitle(); + // Update search autocompleter with information for the correct database: + bp.updateSearchManager(); + // Set correct enabled state for Back and Forward actions: + bp.setBackAndForwardEnabledState(); + new FocusRequester(bp.mainTable); + } + } + }); + + //Note: The registration of Apple event is at the end of initialization, because + //if the events happen too early (ie when the window is not initialized yet), the + //opened (double-clicked) documents are not displayed. + if (OS.OS_X) { + try { + new MacAdapter().registerMacEvents(this); + } catch (Exception e) { + LOGGER.fatal("could not interface with Mac OS X methods", e); + } + } + } + + private void positionWindowOnScreen() { if (!prefs.getBoolean(JabRefPreferences.WINDOW_MAXIMISED)) { int sizeX = prefs.getInt(JabRefPreferences.SIZE_X); @@ -549,19 +598,6 @@ public void windowClosing(WindowEvent e) { int posX = prefs.getInt(JabRefPreferences.POS_X); int posY = prefs.getInt(JabRefPreferences.POS_Y); - /* - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - GraphicsDevice[] gs = ge.getScreenDevices(); - - - // Get size of each screen - for (int i=0; i= 1) { Rectangle bounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()[0] .getDefaultConfiguration().getBounds(); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); @@ -587,8 +622,6 @@ public void windowClosing(WindowEvent e) { int height = (int) dim.getHeight(); int width = (int) dim.getWidth(); - //if (posX < ) - if (posX + sizeX > width) { if (sizeX <= width) { posX = width - sizeX; @@ -609,51 +642,6 @@ public void windowClosing(WindowEvent e) { } setBounds(posX, posY, sizeX, sizeY); } - - tabbedPane.setBorder(null); - tabbedPane.setForeground(GUIGlobals.inActiveTabbed); - - /* - * The following state listener makes sure focus is registered with the - * correct database when the user switches tabs. Without this, - * cut/paste/copy operations would some times occur in the wrong tab. - */ - tabbedPane.addChangeListener(new ChangeListener() { - - @Override - public void stateChanged(ChangeEvent e) { - markActiveBasePanel(); - - BasePanel bp = basePanel(); - if (bp != null) { - groupToggle.setSelected(sidePaneManager.isComponentVisible("groups")); - searchToggle.setSelected(sidePaneManager.isComponentVisible("search")); - previewToggle.setSelected(Globals.prefs.getBoolean(JabRefPreferences.PREVIEW_ENABLED)); - highlightAny - .setSelected(Globals.prefs.getBoolean(JabRefPreferences.HIGHLIGHT_GROUPS_MATCHING_ANY)); - highlightAll - .setSelected(Globals.prefs.getBoolean(JabRefPreferences.HIGHLIGHT_GROUPS_MATCHING_ALL)); - Globals.focusListener.setFocused(bp.mainTable); - setWindowTitle(); - // Update search autocompleter with information for the correct database: - bp.updateSearchManager(); - // Set correct enabled state for Back and Forward actions: - bp.setBackAndForwardEnabledState(); - new FocusRequester(bp.mainTable); - } - } - }); - - //Note: The registration of Apple event is at the end of initialization, because - //if the events happen too early (ie when the window is not initialized yet), the - //opened (double-clicked) documents are not displayed. - if (OS.OS_X) { - try { - new MacAdapter().registerMacEvents(this); - } catch (Exception e) { - LOGGER.fatal("could not interface with Mac OS X methods", e); - } - } } public void setWindowTitle() {