Changeset 3537 in josm for trunk/src/org


Ignore:
Timestamp:
2010-09-18T09:48:41+02:00 (14 years ago)
Author:
bastiK
Message:

fix fullscreen by adding simulated mode for windows platorm (patch by Christian Müller) - see #5463 - get rid of window decorations in fullscreen mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/FullscreenToggleAction.java

    r3535 r3537  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
     6import java.awt.Dimension;
    67import java.awt.Frame;
    78import java.awt.GraphicsDevice;
    89import java.awt.GraphicsEnvironment;
     10import java.awt.Toolkit;
    911import java.awt.event.ActionEvent;
    1012import java.awt.event.KeyEvent;
     
    1618import org.openstreetmap.josm.Main;
    1719import org.openstreetmap.josm.tools.PlatformHookUnixoid;
     20import org.openstreetmap.josm.tools.PlatformHookWindows;
    1821import org.openstreetmap.josm.tools.Shortcut;
    1922
     
    7174
    7275        Frame frame = (Frame)Main.parent;
    73         frame.dispose();
    74         frame.setUndecorated(selected);
    75         gd.setFullScreenWindow(selected ? frame : null);
    76         frame.setVisible(true);
     76       
     77        // we cannot use hw-exclusive fullscreen mode in MS-Win, as long
     78        // as josm throws out modal dialogs as well :-), see here:
     79        // http://forums.sun.com/thread.jspa?threadID=5351882
     80        //
     81        // the good thing is: fullscreen works without exclusive mode,
     82        // since windows (or java?) draws the undecorated window full-
     83        // screen by default (it's a simulated mode, but should be ok)
     84        String exclusive = Main.pref.get("draw.fullscreen.exclusive-mode", "auto");
     85        if ("yes".equals(exclusive) || ("auto".equals(exclusive) && !(Main.platform instanceof PlatformHookWindows))) {
     86            frame.dispose();
     87            frame.setUndecorated(selected);
     88            gd.setFullScreenWindow(selected ? frame : null);
     89            frame.setVisible(true);
     90        } else {
     91            frame.dispose();
     92            if (Main.pref.getBoolean("draw.fullscreen.set-screen-bounds", true)) {
     93                Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
     94                frame.setBounds(0, 0, dim.width, dim.height);
     95            }
     96            frame.setUndecorated(selected);
     97            frame.setVisible(true);
     98        }
    7799    }
    78100
Note: See TracChangeset for help on using the changeset viewer.