JDK-6500686 : Fullscreen windows behind the taskbar on Linux
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: linux
  • CPU: x86
  • Submitted: 2006-12-05
  • Updated: 2014-07-22
  • Resolved: 2007-05-11
Related Reports
Relates :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
1.6.0-rc.b104

ADDITIONAL OS VERSION INFORMATION :
Linux 2.6.18-1.2798.fc6

EXTRA RELEVANT SYSTEM CONFIGURATION :
Window manager Gnome

A DESCRIPTION OF THE PROBLEM :
When putting a JFrame in fullscreen exclusive mode following the java tutorial the frame is displayed in fullscreen but below the taskbar.

Nevertheless not set the resizable property of the JFrame to false made it appears above the taskbar.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Simply use GraphicsDevice.setFullScreenWindow with a JFrame on which resizable property was set to false.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The frame should be fullscreen and "on top" of any other windows.
ACTUAL -
The frame is displayed below the taskbar.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error message.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------

public class ScreenManager
{
    // -----------------------------------------------------------------------------
    //  STATIC ATTRIBUTES
    // -----------------------------------------------------------------------------
    private static ScreenManager   s_instance  = null;
    
    private static Logger           s_logger    = Logger.getLogger( "ScreensManager" );
    
    // -----------------------------------------------------------------------------
    //  ATTRIBUTES
    // -----------------------------------------------------------------------------
    private GraphicsEnvironment     m_gEnv;
    
    private GraphicsDevice          m_gDevice;
    
    // -----------------------------------------------------------------------------
    //  CONSTRUCTOR
    // -----------------------------------------------------------------------------
    /**
     * Default private constructor.
     */
    private ScreenManager()
    {
        m_gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
        m_gDevice = m_gEnv.getDefaultScreenDevice();
        
        s_logger.info( "Plein ��cran support�� = "
                + m_gDevice.isFullScreenSupported() );
    }
    
    /**
     * Retrieves single instance of ScreensManager
     * @return The unique instance of ScreensManager
     */
    public static ScreenManager getInstance()
    {
        if( s_instance == null )
        {
            s_instance = new ScreenManager();
        }
        
        return s_instance;
    }
    
    // -----------------------------------------------------------------------------
    //  METHODS
    // -----------------------------------------------------------------------------
    /**
     * Toggles the display of given JFrame in fullscreen mode.
     * TODO : perform a check in this method to see if fullscreen is enabled
     * @param frame frame to switch in full screen mode
     */
    public void setFullScreen( JFrame frame )
    {
        try
        {
            m_gDevice.setFullScreenWindow( frame );
        }
        finally
        {
        }
    }
    
    /**
     * Revert fullscreen mode off.
     */
    public void unFullScreen()
    {
        m_gDevice.setFullScreenWindow(null);
    }
}

//--------------------------------------------------------------------------------------------//
//--------------------------------------------------------------------------------------------//
//--------------------------------------------------------------------------------------------//

import java.awt.BorderLayout;
import java.awt.DisplayMode;
import java.awt.Graphics;
import java.awt.GraphicsEnvironment;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;


public class ScreenTest extends JFrame
{    
    public ScreenTest()
    {
        setLayout( new BorderLayout() );
        
        JButton quit = new JButton("Quit");
        quit.addActionListener( new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                ScreenManager.getInstance().unFullScreen();
                
                System.exit( 0 );
            }
        } );
        
        add( quit, BorderLayout.CENTER );
        
        setUndecorated( true );
        
        // Will appear below the taskbar if set to false
        setResizable( false );
        
        setVisible( true );
        
        pack();
        
        ScreenManager.getInstance().setFullScreen( this );
    }
    
    public static void main(String[] args)
    {
        SwingUtilities.invokeLater( new Runnable()
        {
            public void run()
            {
                new ScreenTest();
            }
        } );
    }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Don't call setResizable( false ), but it's against java tutorial recommandations.

Comments
EVALUATION GNOME developers confirm this is a bug in Metacity window manager. So I'm closing this change request as Will Not Fix.
11-05-2007

EVALUATION The following bug is filed against the GNOME window manager (metacity): http://bugzilla.gnome.org/show_bug.cgi?id=427902
13-04-2007

EVALUATION Here is the list of requirements to window manager (kwin, KDE 3.3) to enable _NET_ACTION_FULLSCREEN action: 1. WM_NORMAL_HINTS must not contain the minimum size hints 2. _MOTIF_WM_HINTS should contain at least MWM_FUNC_RESIZE and MWM_FUNC_MOVE If the window meets the requirements above and has the bounds equal to the window bounds, it is considered as fullscreen (not exclusive, though) and is displayed above all other windows. GNOME window manager (metacity, GNOME 2.6) seems to handle fullscreen windows correctly.
06-04-2007

EVALUATION The _NET_WM_STATE_FULLSCREEN mechanism used by X11GD_SetFullScreenMode() (in awt_GraphicsEnv.c) was added as part of the comprehensive fix for 6364134. We may be able to privately workaround this issue by always setting the window to be non-resizable before entering fullscreen mode, and then restore the original resizable setting when returning to windowed mode.
07-12-2006

EVALUATION The bug is not GNOME-specific, at least I can easily reproduce it with my KDE 3.3. I launched the test both with and without setResizable(false) and the only difference I have found is in _NET_WM_ALLOWED_ACTIONS property. When the window is resizable, window manager fills this atom with many actions including _NET_WM_ACTION_FULLSCREEN, but if the window is unresizable, _NET_WM_ACTION_FULLSCREEN is not set. I have also noticed that isFullScreenSupported() method of GraphicsDevice returns false in my system. So if I made a window fullscreen mode, this mode is not exclusive, only window bounds are changed. I beleive this is right what _NET_WM_ACTION_FULLSCREEN is intended for: if an application window is undecorated and its bounds are set equal to the screen bounds, then window manager considers this window as a fullscreen window. I have verified this by calling setBounds() instead of setFullScreenWindow() and the behaviour was right the same.
07-12-2006