I tried adding a full screen action to josm, see the attached patch.

This works if only the main window is displayed, however when JOSM
opens another dialog (e.g. the download dialog), the OS's gui elements
pop over the main window.

Is there anything special one has to do in awt to make child windows
respect the full screen configuration?
Index: src/org/openstreetmap/josm/gui/MainMenu.java
===================================================================
--- src/org/openstreetmap/josm/gui/MainMenu.java	(revision 1461)
+++ src/org/openstreetmap/josm/gui/MainMenu.java	(working copy)
@@ -14,6 +14,12 @@
 import javax.swing.JMenuItem;
 import javax.swing.KeyStroke;
 
+/* For the fullscreen action */
+import java.awt.Frame;
+import java.awt.GraphicsEnvironment;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.AboutAction;
 import org.openstreetmap.josm.actions.AddNodeAction;
@@ -228,6 +234,27 @@
             JosmAction autoScaleAction = new AutoScaleAction(mode);
             add(viewMenu, autoScaleAction);
         }
+        viewMenu.addSeparator();
+        // TODO move code to an "action" like the others?
+        final JCheckBoxMenuItem fullscreen = new JCheckBoxMenuItem(tr("Full Screen"));
+        fullscreen.setSelected(Main.pref.getBoolean("draw.fullscreen", false));
+        fullscreen.setAccelerator(Shortcut.registerShortcut("menu:view:fullscreen", tr("Toggle Full Screen view"),
+                KeyEvent.VK_F11, Shortcut.GROUP_DIRECT).getKeyStroke());
+        fullscreen.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent ev) {
+                Main.pref.put("draw.fullscreen", fullscreen.isSelected());
+
+                GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+                GraphicsDevice gs = ge.getDefaultScreenDevice();
+
+                if (Main.pref.getBoolean("draw.fullscreen")) {
+                    gs.setFullScreenWindow((Frame)Main.parent);
+                } else {
+                    gs.setFullScreenWindow(null);
+                }
+            }
+        });
+        viewMenu.add(fullscreen);
         add(viewMenu, KeyEvent.VK_V, "view");
 
         add(toolsMenu, splitWay);
_______________________________________________
josm-dev mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/josm-dev

Reply via email to