Skip to main content

6uNEA screen flickers when switching between fullscreen/window mode

10 replies [Last post]
stevpan
Offline
Joined: 2007-12-22

I setup 6uNEA 1 week ago. It's excellent --- the browser freezes/hangs disappear.

Some small bugs still exist. My slideshow app flickers when switching between fullscreen and window mode.

I tested my app with JRE1.6.0, 1.6.0_01, 1.6.0_02, 1.6.0_03. It could switch smoothly in all these stable releases (no screen flickers).

As I could not find bug report, I have to post it here. Hope that 6uNEA will be stable soon.

The version info:

java version "1.6.0_10-ea"
Java(TM) SE Runtime Environment (build 1.6.0_10-ea-b08)
Java HotSpot(TM) Client VM (build 1.6.0_10-ea-b08, mixed mode, sharing)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
stevpan
Offline
Joined: 2007-12-22

After I set J2D_TRACE_LEVEL=4

the debug output is:
[W] GetFlagValues: DDraw screen locking is disabled (W2K, XP+)
[I] InitDirectX
[V] CheckRegistry: Found Display Device 0: Intel(R) 82865G Graphics Controller
[I] CreateDevice: lpGUID=0x0 hMon=0x0
[I] DDSetupDevice
[E] CheckDDCreationCaps: previous surface creation failure detected
[E] DDSetupDevice: Failed to setup ddraw device

ndcosta
Offline
Joined: 2004-05-21

Hi Steve,

Thanks for posting a bug report related to this problem - we have included the report in our bug database with Bug ID - 6709453 . The report should be visible at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6709453 in a day or two.

Thanks,
Nelson

trembovetski
Offline
Joined: 2003-12-31

Note that according to the latest tracing post he's _not_ using 6u10.

Dmitri

Message was edited by: trembovetski

trembovetski
Offline
Joined: 2003-12-31

pls ignore, wrong thread.

removed - posted to the wrong thread

Message was edited by: trembovetski

trembovetski
Offline
Joined: 2003-12-31

Thank you for the feedback.

Is there a way to get access to your application?
It would be the best if you could produce a small test case
which reproduces the issue.

When you say "switching" - do you mean alt+tabbing or
when your application does it itself?

Or does it only flicker in either full-screen or windowed mode?

Could you also please run any java application with
J2D_TRACE_LEVEL=4 environment variable set and
post the result:
set J2D_TRACE_LEVEL=4
java -jar SwingSet2.jar

If you don't have the latest drivers for your video board
please install them and see if it helps. If it does,
please do the command above and post the output
as well so that we know which driver version works.

(and note that a new build is out)

stevpan
Offline
Joined: 2007-12-22

Very glad to hear your reply.

The app does "switching" between fullscreen and window mode itself (a menu item).

At first, it runs in window mode; 1. I choose the fullscreen menu;
2. The app will disappear and leave a black block (for 1-2 seconds); 3. during this period, the windows background desktop will appear transiently and return to black block (flickers).
4. The fullscreen becomes black; 5. The app continues to run normally.

When switching from fullscreen to window mode, this phenomenon does not appear.

The app is about 1Mb.

screenshot is attached as "jrebug.jpg"

the test app is http://download.stevpan.googlepages.com/jrebug.jar (double-click to run) .

Background has been set to Color.black in JFrame 's getContentPane()

The switching code:

if(menuLabel.equals("Fullscreen (Esc to cancel)")) {

setVisible(false);
setMenuBar(null);
dispose();
setUndecorated(true);

// switching to fullscreen mode
GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(this);

// getting display resolution: width and height
int w = this.getWidth();
int h = this.getHeight();
System.out.println("Display resolution: " + String.valueOf(w) + "x" + String.valueOf(h));

setPreferredSize(new Dimension(w, h));

layout= new SpringLayout();
this.setLayout(layout);
layout.putConstraint(SpringLayout.WEST, myApplet, (w-d1.width)/2, SpringLayout.WEST, this);
layout.putConstraint(SpringLayout.NORTH, myApplet, (h-d1.height)/2, SpringLayout.NORTH, this);
pack();

// window should be visible
this.setVisible(true);
requestFocus();
requestFocusInWindow();
requestFocus();
repaint();

fullscreenOn=true;

}

I guess that it is caused by some system repaint() events during switching, although I have setVisible(false).

stevpan
Offline
Joined: 2007-12-22

The test environment is Windows 2003.

trembovetski
Offline
Joined: 2003-12-31

Thanks for the update.

Could you please post the output with J2D_TRACE_LEVEL=4 ?

Dmitri

stevpan
Offline
Joined: 2007-12-22

The first 2 lines output ( after J2D_TRACE_LEVEL=4)
G:\www\Jtvmini>java jtvplayer.AppMain

[I] OS Version = OS_WINSERV_2003
[E] D3DPPLM::CheckOSVersion: Windows 2000 or earlier (or a server) OS detected,
failed

stevpan
Offline
Joined: 2007-12-22

It seems that the problem still exists in 6U10 build

I submit the bug report and wrote a simple demo program.

import java.awt.*;
import java.util.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.*;

public class AppMain {

public static void main (String[] args) {

// define frame, its size and make it visible
int arg0=-1;

AppletFrame myFrame = new AppletFrame();

myFrame.setVisible(true);

} // end main method
} // end class

class AppletFrame extends JFrame implements ActionListener, WindowListener, MouseListener, MouseMotionListener, KeyListener {
private MenuBar mb=null;
private SpringLayout layout=null;
private Dimension d0=null, d1=null;
private boolean fullscreenOn=false;
private int itemcounter=0;
private boolean noSnapShot= true;
private String[] xmlname;
private String[] trackname;
private int[] initTrack;
private int trackCounter=1;
private boolean fromlocaldir=false;
private String[] localfilelist=null;
private String autoplay="enable";
private String strokemode="disable";
private boolean debug=false;
private ImageIcon jtvicon=null;
private JFileChooser _fileChooser1;

public AppletFrame(boolean debug)
{
super("SlidePlayer"); // use SlidePlay as window title
this.debug=debug;
initFrame();
}
public AppletFrame()
{
super("SlidePlayer"); // use SlidePlay as window title
initFrame();
}

public void initFrame() {

this.getContentPane().setBackground(Color.black);

// define Menubar
mb = new MenuBar();
// mb.setFont(new Font("Helvetica", Font.PLAIN, 13));

setMenuBar(mb);
// Define File menu and with Exit menu item
Menu fileMenu = new Menu("File");

MenuItem exitMenuItem = new MenuItem("Exit");
MenuItem fullscreenMenuItem = new MenuItem("Fullscreen (Esc to cancel)");

//exitMenuItem.setAccelerator( KeyStroke.getKeyStroke("alt F4") );
fileMenu.add(exitMenuItem);
fileMenu.add(fullscreenMenuItem);

// respond to file exit/fullscreen menu
exitMenuItem.addActionListener(this);
fullscreenMenuItem.addActionListener(this);

// respond to window events
addWindowListener(this);
addKeyListener(this); // Respond to keystroke

mb.add(fileMenu);

JLabel t1= new JLabel("Hello");
this.add(t1);

this.setLayout(new BorderLayout());

this.setPreferredSize(new Dimension(640, 480));

pack();

getContentPane().setBackground(Color.blue);
d0= this.getSize();
System.out.println("d0:"+ d0);

setVisible(true); // usual step to make frame visible

requestFocus();
requestFocusInWindow();
requestFocus();
setResizable(false);

} // end main

public void destroy()
{
System.exit(1);
}

public void actionPerformed(ActionEvent evt) {

if (evt.getSource() instanceof MenuItem) {
String menuLabel = ((MenuItem)evt.getSource()).getLabel();

if(menuLabel.equals("Exit")) {
// close application, when exit is selected
dispose();
System.exit(0);
} // end if

if(menuLabel.equals("Fullscreen (Esc to cancel)")) {

setVisible(false);

setMenuBar(null);
dispose();
setUndecorated(true);

// switching to fullscreen mode
GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(this);

// getting display resolution: width and height
int w = this.getWidth();
int h = this.getHeight();

setPreferredSize(new Dimension(w, h));
getContentPane().setBackground(Color.blue);

this.setVisible(true);
// requestFocus();
// requestFocusInWindow();
// requestFocus();
repaint();

fullscreenOn=true;

} // end if
}

} // end ActionPerformed

public void keyPressed(KeyEvent evt) {

int key = evt.getKeyCode();
// escape key to exit from fullscreen mode
if (key == KeyEvent.VK_ESCAPE) { // switching to window when press Escape key
if(fullscreenOn==true)
{

// switching to window mode
setVisible(false);
GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(null);

setMenuBar(mb);
dispose();
setUndecorated(false);

this.setLayout(new BorderLayout());
this.setPreferredSize(d0);
pack();

// window should be visible
this.setVisible(true);
fullscreenOn=false;
repaint();
}

}

}

public void keyReleased(KeyEvent evt) {}
public void keyTyped(KeyEvent evt) {}

public void windowClosing(WindowEvent e) {
System.exit(1);
}

public void windowClosed(WindowEvent e) {
//This will only be seen on standard output.
}

public void windowOpened(WindowEvent e) {
}

public void windowIconified(WindowEvent e) {
}

public void windowDeiconified(WindowEvent e) {
}

public void windowActivated(WindowEvent e) {
}

public void windowDeactivated(WindowEvent e) {
}

public void mouseDragged(MouseEvent e) {}

public void mouseMoved(MouseEvent e) {}

// detect double click and single click
public void mouseClicked( MouseEvent e ) {}

public void mouseEntered( MouseEvent e ) { }
public void mouseExited( MouseEvent e ) { }
public void mousePressed( MouseEvent e ) { }
public void mouseReleased( MouseEvent e ) { }

} // end class