### Eclipse Workspace Patch 1.0
#P josm
diff --git src/org/openstreetmap/josm/actions/FullscreenToggleAction.java src/org/openstreetmap/josm/actions/FullscreenToggleAction.java
index b31fe8c..7ed33f9 100644
|
|
|
|
| 4 | 4 | import static org.openstreetmap.josm.gui.help.HelpUtil.ht; |
| 5 | 5 | import static org.openstreetmap.josm.tools.I18n.tr; |
| 6 | 6 | |
| 7 | | import java.awt.Frame; |
| 8 | 7 | import java.awt.GraphicsDevice; |
| 9 | 8 | import java.awt.GraphicsEnvironment; |
| 10 | 9 | import java.awt.Rectangle; |
| … |
… |
|
| 79 | 78 | } |
| 80 | 79 | |
| 81 | 80 | protected void setMode() { |
| 82 | | JFrame frame = MainApplication.getMainFrame(); |
| | 81 | final JFrame frame = MainApplication.getMainFrame(); |
| | 82 | if (frame == null) { |
| | 83 | return; |
| | 84 | } |
| 83 | 85 | |
| 84 | | List<Window> visibleWindows = new ArrayList<>(); |
| 85 | | visibleWindows.add(frame); |
| 86 | | for (Window w : Frame.getWindows()) { |
| 87 | | if (w.isVisible() && w != frame) { |
| | 86 | final List<Window> visibleWindows = new ArrayList<>(); |
| | 87 | for (Window w : Window.getWindows()) { |
| | 88 | if (w != null && w.isVisible() && w != frame) { |
| 88 | 89 | visibleWindows.add(w); |
| 89 | 90 | } |
| 90 | 91 | } |
| 91 | 92 | |
| 92 | | boolean selected = isSelected(); |
| | 93 | final boolean selected = isSelected(); |
| 93 | 94 | |
| 94 | | if (frame != null) { |
| 95 | | frame.dispose(); |
| 96 | | frame.setUndecorated(selected); |
| | 95 | |
| | 96 | frame.dispose(); |
| | 97 | frame.setUndecorated(selected); |
| 97 | 98 | |
| 98 | | if (selected) { |
| 99 | | prevBounds = frame.getBounds(); |
| 100 | | frame.setBounds(new Rectangle(GuiHelper.getScreenSize())); |
| 101 | | } |
| 102 | | } |
| | 99 | if (selected) { |
| | 100 | prevBounds = frame.getBounds(); |
| | 101 | frame.setBounds(new Rectangle(GuiHelper.getScreenSize())); |
| | 102 | } else if (prevBounds != null) { |
| | 103 | frame.setBounds(prevBounds); |
| | 104 | } |
| 103 | 105 | |
| 104 | 106 | // we cannot use hw-exclusive fullscreen mode in MS-Win, as long |
| 105 | 107 | // as josm throws out modal dialogs. |
| … |
… |
|
| 107 | 109 | // the good thing is: fullscreen works without exclusive mode, |
| 108 | 110 | // since windows (or java?) draws the undecorated window full- |
| 109 | 111 | // screen by default (it's a simulated mode, but should be ok) |
| 110 | | String exclusive = Config.getPref().get("draw.fullscreen.exclusive-mode", "auto"); |
| | 112 | final String exclusive = Config.getPref().get("draw.fullscreen.exclusive-mode", "auto"); |
| 111 | 113 | if (("true".equals(exclusive) || ("auto".equals(exclusive) && !PlatformManager.isPlatformWindows())) && gd != null) { |
| 112 | 114 | gd.setFullScreenWindow(selected ? frame : null); |
| 113 | 115 | } |
| 114 | | |
| 115 | | if (!selected && prevBounds != null && frame != null) { |
| 116 | | frame.setBounds(prevBounds); |
| 117 | | } |
| | 116 | |
| | 117 | frame.setVisible(true); |
| 118 | 118 | |
| 119 | 119 | for (Window wind : visibleWindows) { |
| 120 | | if (wind != null) { |
| | 120 | if (wind != null && wind.isDisplayable()) { |
| 121 | 121 | wind.setVisible(true); |
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | // Free F10 key to allow it to be used by plugins, even after full screen (see #7502) |
| 126 | | if (frame != null) { |
| | 126 | if (frame.getJMenuBar() != null) { |
| 127 | 127 | frame.getJMenuBar().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F10, 0), "none"); |
| 128 | 128 | } |
| 129 | 129 | } |