Search in sources :

Example 1 with WWindowPeer

use of sun.awt.windows.WWindowPeer in project jdk8u_jdk by JetBrains.

the class D3DGraphicsDevice method addFSWindowListener.

@Override
protected void addFSWindowListener(Window w) {
    // real toplevel to enter the full-screen mode with (4933099).
    if (!(w instanceof Frame) && !(w instanceof Dialog) && (realFSWindow = getToplevelOwner(w)) != null) {
        ownerOrigBounds = realFSWindow.getBounds();
        WWindowPeer fp = (WWindowPeer) realFSWindow.getPeer();
        ownerWasVisible = realFSWindow.isVisible();
        Rectangle r = w.getBounds();
        // we use operations on peer instead of component because calling
        // them on component will take the tree lock
        fp.reshape(r.x, r.y, r.width, r.height);
        fp.setVisible(true);
    } else {
        realFSWindow = w;
    }
    fsWindowWasAlwaysOnTop = realFSWindow.isAlwaysOnTop();
    ((WWindowPeer) realFSWindow.getPeer()).setAlwaysOnTop(true);
    fsWindowListener = new D3DFSWindowAdapter();
    realFSWindow.addWindowListener(fsWindowListener);
}
Also used : Frame(java.awt.Frame) WWindowPeer(sun.awt.windows.WWindowPeer) Dialog(java.awt.Dialog) Rectangle(java.awt.Rectangle)

Example 2 with WWindowPeer

use of sun.awt.windows.WWindowPeer in project jdk8u_jdk by JetBrains.

the class D3DGraphicsDevice method configDisplayMode.

@Override
protected void configDisplayMode(final int screen, final WindowPeer w, final int width, final int height, final int bitDepth, final int refreshRate) {
    // we entered fs mode via gdi
    if (!fsStatus) {
        super.configDisplayMode(screen, w, width, height, bitDepth, refreshRate);
        return;
    }
    final WWindowPeer wpeer = (WWindowPeer) realFSWindow.getPeer();
    // update the bounds of the owner frame
    if (getFullScreenWindow() != realFSWindow) {
        Rectangle screenBounds = getDefaultConfiguration().getBounds();
        wpeer.reshape(screenBounds.x, screenBounds.y, width, height);
    }
    D3DRenderQueue rq = D3DRenderQueue.getInstance();
    rq.lock();
    try {
        rq.flushAndInvokeNow(new Runnable() {

            public void run() {
                long hwnd = wpeer.getHWnd();
                if (hwnd == 0l) {
                    // window is disposed
                    return;
                }
                // REMIND: do we really need a window here?
                // we should probably just use the current one
                configDisplayModeNative(screen, hwnd, width, height, bitDepth, refreshRate);
            }
        });
    } finally {
        rq.unlock();
    }
}
Also used : WWindowPeer(sun.awt.windows.WWindowPeer) Rectangle(java.awt.Rectangle)

Example 3 with WWindowPeer

use of sun.awt.windows.WWindowPeer in project jdk8u_jdk by JetBrains.

the class Win32GraphicsDevice method setFullScreenWindow.

@Override
public synchronized void setFullScreenWindow(Window w) {
    Window old = getFullScreenWindow();
    if (w == old) {
        return;
    }
    if (!isFullScreenSupported()) {
        super.setFullScreenWindow(w);
        return;
    }
    // Enter windowed mode.
    if (old != null) {
        // restore the original display mode
        if (defaultDisplayMode != null) {
            setDisplayMode(defaultDisplayMode);
            // we set the default display mode to null here
            // because the default mode could change during
            // the life of the application (user can change it through
            // the desktop properties dialog, for example), so
            // we need to record it every time prior to
            // entering the fullscreen mode.
            defaultDisplayMode = null;
        }
        WWindowPeer peer = (WWindowPeer) old.getPeer();
        if (peer != null) {
            peer.setFullScreenExclusiveModeState(false);
            // data replacement
            synchronized (peer) {
                exitFullScreenExclusive(screen, peer);
            }
        }
        removeFSWindowListener(old);
    }
    super.setFullScreenWindow(w);
    if (w != null) {
        // always record the default display mode prior to going
        // fullscreen
        defaultDisplayMode = getDisplayMode();
        addFSWindowListener(w);
        // Enter full screen exclusive mode.
        WWindowPeer peer = (WWindowPeer) w.getPeer();
        if (peer != null) {
            synchronized (peer) {
                enterFullScreenExclusive(screen, peer);
            // Note: removed replaceSurfaceData() call because
            // changing the window size or making it visible
            // will cause this anyway, and both of these events happen
            // as part of switching into fullscreen mode.
            }
            peer.setFullScreenExclusiveModeState(true);
        }
        // fix for 4868278
        peer.updateGC();
    }
}
Also used : Window(java.awt.Window) WWindowPeer(sun.awt.windows.WWindowPeer)

Example 4 with WWindowPeer

use of sun.awt.windows.WWindowPeer in project jdk8u_jdk by JetBrains.

the class Win32GraphicsDevice method setDisplayMode.

@Override
public synchronized void setDisplayMode(DisplayMode dm) {
    if (!isDisplayChangeSupported()) {
        super.setDisplayMode(dm);
        return;
    }
    if (dm == null || (dm = getMatchingDisplayMode(dm)) == null) {
        throw new IllegalArgumentException("Invalid display mode");
    }
    if (getDisplayMode().equals(dm)) {
        return;
    }
    Window w = getFullScreenWindow();
    if (w != null) {
        WWindowPeer peer = (WWindowPeer) w.getPeer();
        configDisplayMode(screen, peer, dm.getWidth(), dm.getHeight(), dm.getBitDepth(), dm.getRefreshRate());
        // resize the fullscreen window to the dimensions of the new
        // display mode
        Rectangle screenBounds = getDefaultConfiguration().getBounds();
        w.setBounds(screenBounds.x, screenBounds.y, dm.getWidth(), dm.getHeight());
    // Note: no call to replaceSurfaceData is required here since
    // replacement will be caused by an upcoming display change event
    } else {
        throw new IllegalStateException("Must be in fullscreen mode " + "in order to set display mode");
    }
}
Also used : Window(java.awt.Window) WWindowPeer(sun.awt.windows.WWindowPeer) Rectangle(java.awt.Rectangle)

Example 5 with WWindowPeer

use of sun.awt.windows.WWindowPeer in project jdk8u_jdk by JetBrains.

the class D3DGraphicsDevice method removeFSWindowListener.

@Override
protected void removeFSWindowListener(Window w) {
    realFSWindow.removeWindowListener(fsWindowListener);
    fsWindowListener = null;
    /**
         * Bug 4933099: There is some funny-business to deal with when this
         * method is called with a Window instead of a Frame.  See 4836744
         * for more information on this.  One side-effect of our workaround
         * for the problem is that the owning Frame of a Window may end
         * up getting resized during the fullscreen process.  When we
         * return from fullscreen mode, we should resize the Frame to
         * its original size (just like the Window is being resized
         * to its original size in GraphicsDevice).
         */
    WWindowPeer wpeer = (WWindowPeer) realFSWindow.getPeer();
    if (wpeer != null) {
        if (ownerOrigBounds != null) {
            // could have (0,0) dimensions
            if (ownerOrigBounds.width == 0)
                ownerOrigBounds.width = 1;
            if (ownerOrigBounds.height == 0)
                ownerOrigBounds.height = 1;
            wpeer.reshape(ownerOrigBounds.x, ownerOrigBounds.y, ownerOrigBounds.width, ownerOrigBounds.height);
            if (!ownerWasVisible) {
                wpeer.setVisible(false);
            }
            ownerOrigBounds = null;
        }
        if (!fsWindowWasAlwaysOnTop) {
            wpeer.setAlwaysOnTop(false);
        }
    }
    realFSWindow = null;
}
Also used : WWindowPeer(sun.awt.windows.WWindowPeer)

Aggregations

WWindowPeer (sun.awt.windows.WWindowPeer)6 Rectangle (java.awt.Rectangle)3 Window (java.awt.Window)2 Dialog (java.awt.Dialog)1 Frame (java.awt.Frame)1