classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] FYI: primitive fullscreen mode support


From: Robert Schuster
Subject: Re: [cp-patches] FYI: primitive fullscreen mode support
Date: Tue, 05 Apr 2005 18:51:55 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.7.6) Gecko/20050403

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

Roman Kennke wrote:
> Hi,
> 
> I'm committing the attached patch that implements a primitive fullscreen
> support on a peer independent level. Actually it does only resize and
> relocate the fullscreen window. Peers that implement a real
> (accelerated) fullscreen mode would override the setFullScreenWindow(),
> getFullScreenWindow() and isFullScreenSupported() methods.
> 
Great! You have made GNU Classpath and all its dependent VMs superior by
that because Sun's runtime does not FSEM on GNU/Linux. (Btw: Is there
are *real* fullscreen mode for application in X11 anyway?)

> I wonder about the default of isFullScreenSupported in
> java.awt.GraphicsDevice returning true. Does that make sense? Should it
> be the other way, defaulting to false and requiring Devices that support
> fullscreen to override it to return true?
I favor changing this to false, too.

> 
> 2005-04-05  Roman Kennke  <address@hidden>
> 
>       * gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
>       (getDisplayMode): Added. Returns the current display mode.
>       (isFullScreenSupported): Added.
>       * java/awt/GraphicsDevice.java
>       (setFullScreenWindow): Implemented a primitive fullscreen mode.
>       This resizes and relocates the fullscreen window so that it uses
>       the whole screen. This is not a fully accelerated fullscreen
>       exclusive mode.
> 
> Best regards,
> /Roman
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ? java/util/LocaleData.java
> ? lib/classes.locale
> ? scripts/classpath.spec
> Index: gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
> ===================================================================
> RCS file: 
> /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java,v
> retrieving revision 1.3
> diff -u -r1.3 GdkScreenGraphicsDevice.java
> --- gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java        16 Feb 2005 
> 13:59:03 -0000      1.3
> +++ gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java        5 Apr 2005 
> 14:08:09 -0000
> @@ -38,6 +38,8 @@
>  
>  package gnu.java.awt.peer.gtk;
>  
> +import java.awt.Dimension;
> +import java.awt.DisplayMode;
>  import java.awt.GraphicsConfiguration;
>  import java.awt.GraphicsDevice;
>  
> @@ -79,4 +81,35 @@
>      // FIXME: query X for default configuration
>      return new GdkGraphicsConfiguration(this);
>    }
> +
> +
> +  /**
> +   * Returns the current display mode of this device, or null if unknown.
> +   *
> +   * @return the current display mode
> +   * @see #setDisplayMode(DisplayMode)
> +   * @see #getDisplayModes()
> +   * @since 1.4
> +   */
> +  public DisplayMode getDisplayMode()
> +  {
> +    // determine display mode
> +    Dimension dim = getToolkit().getScreenSize();
> +    DisplayMode mode = new DisplayMode(dim.width, dim.height, 0,
> +                                    DisplayMode.REFRESH_RATE_UNKNOWN);
> +    return mode;
> +  }

OK this is peer independent, but why is it in a peer class then? This
may IMHO trigger a circular dependency if someone makes Toolkit's
implementation of getScreenSize() dependent on the default
graphicsdevice. Which is the way to go for later because getScreenSize()
is an older API (1.0?) that can be layered on top of the newer (1.4)
GraphicsDevice/GraphicsEnvironment/GraphicsConfiguration API.

> +
> +  /**
> +   * This device does not yet support fullscreen exclusive mode, so this
> +   * returns <code>false</code>.
> +   *
> +   * @return <code>false</code>
> +   * @since 1.4
> +   */
> +  public boolean isFullScreenSupported()
> +  {
> +    return false;
> +  }
> +
>  }
> Index: java/awt/GraphicsDevice.java
> ===================================================================
> RCS file: /cvsroot/classpath/classpath/java/awt/GraphicsDevice.java,v
> retrieving revision 1.2
> diff -u -r1.2 GraphicsDevice.java
> --- java/awt/GraphicsDevice.java      16 Feb 2005 10:39:26 -0000      1.2
> +++ java/awt/GraphicsDevice.java      5 Apr 2005 14:08:12 -0000
> @@ -64,6 +64,12 @@
>    /** The current full-screen window, or null if there is none. */
>    private Window full_screen;
>  
> +  /**
> +   * The bounds of the fullscreen window before it has been switched to full
> +   * screen.
> +   */
> +  private Rectangle fullScreenOldBounds;
> +
>    /** The current display mode, or null if unknown. */
>    private DisplayMode mode;
>  
> @@ -151,9 +157,9 @@
>     * </ul><br>
>     * If <code>isFullScreenSupported()</code> returns false, full-screen
>     * exclusive mode is simulated by resizing the window to the size of the
> -   * screen and positioning it at (0,0).
> -   *
> -   * XXX Not yet implemented in Classpath.
> +   * screen and positioning it at (0,0). This is also what this method does.
> +   * If a device supports real fullscreen mode then it should override this
> +   * method as well as #isFullScreenSupported and #getFullScreenWindow.
>     *
>     * @param w the window to toggle
>     * @see #isFullScreenSupported()
> @@ -164,11 +170,24 @@
>     */
>    public synchronized void setFullScreenWindow(Window w)
>    {
> +    // Restore the previous window to normal mode and release the reference.
>      if (full_screen != null)
> -      ; // XXX Restore the previous window to normal mode.
> -    full_screen = w;
> -    // XXX If w != null, make it full-screen.
> -    throw new Error("not implemented");
> +      {
> +     full_screen.setBounds(fullScreenOldBounds);
> +      }
> +
> +    full_screen = null;
> +
> +    // If w != null, make it full-screen.
> +    if (w != null)
> +      {
> +     fullScreenOldBounds = w.getBounds();
> +     full_screen = w;
> +     DisplayMode dMode = getDisplayMode();
> +     full_screen.setBounds(0, 0, dMode.getWidth(), dMode.getHeight());
> +     full_screen.requestFocus();
> +     full_screen.setLocationRelativeTo(null);
> +      }
>    }

What about switching window decorations (borders and such) of before
going into FS and when coming back restore the initial mode (whatever it
was.)

cu
Robert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFCUsIrG9cfwmwwEtoRAhHIAKCOfz1yfl4BAP0Y6T6ADk//BQ7yiACeOjPW
zFs+DY0J6j5wjy2vVIYghWI=
=/9IU
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]