/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This class implements D3D-specific functionality, such as fullscreen
* exclusive mode and display changes. It is kept separate from
* Win32GraphicsDevice to help avoid overburdening the parent class.
*/
private static boolean d3dAvailable;
private static native boolean initD3D();
static {
// loading the library doesn't help because we need the
// toolkit thread running, so we have to call getDefaultToolkit()
d3dAvailable = initD3D();
if (d3dAvailable) {
// we don't use pixel formats for the d3d pipeline
pfDisabled = true;
} else {
}
}
/**
* Used to construct a Direct3D-enabled GraphicsDevice.
*
* @return a D3DGraphicsDevice if it could be created
* successfully, null otherwise.
*/
if (!d3dAvailable) {
return null;
}
// could not initialize the device successfully
if (WindowsFlags.isD3DVerbose()) {
"screen " + screen);
}
return null;
}
if (WindowsFlags.isD3DVerbose()) {
}
return gd;
}
try {
class Result {
int caps;
};
public void run() {
}
});
} finally {
}
}
}
super(screennum);
}
public boolean isD3DEnabledOnDevice() {
}
/**
* Returns true if d3d pipeline has been successfully initialized.
* @return true if d3d pipeline is initialized, false otherwise
*/
public static boolean isD3DAvailable() {
return d3dAvailable;
}
/**
* Return the owning Frame for a given Window. Used in setFSWindow below
* to set the properties of the owning Frame when a Window goes
* into fullscreen mode.
*/
}
}
// could get here if passed Window is an owner-less Dialog
return null;
}
private boolean fsStatus;
private boolean ownerWasVisible;
private boolean fsWindowWasAlwaysOnTop;
long hwnd);
{
try {
public void run() {
if (hwnd == 0l) {
// window is disposed
fsStatus = false;
return;
}
}
});
} finally {
}
if (!fsStatus) {
}
}
if (fsStatus) {
try {
public void run() {
}
});
} finally {
}
} else {
super.exitFullScreenExclusive(screen, w);
}
}
/**
* WindowAdapter class for the full-screen frame, responsible for
* restoring the devices. This is important to do because unless the device
* is restored it will not go back into the FS mode once alt+tabbed out.
* This is a problem for windows for which we do not do any d3d-related
* operations (like when we disabled on-screen rendering).
*
* REMIND: we create an instance per each full-screen device while a single
* instance would suffice (but requires more management).
*/
}
}
}
// if the window is not a toplevel (has an owner) we have to use the
// real toplevel to enter the full-screen mode with (4933099).
{
// we use operations on peer instead of component because calling
// them on component will take the tree lock
fp.setVisible(true);
} else {
realFSWindow = w;
}
fsWindowListener = new D3DFSWindowAdapter();
}
/**
* 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).
*/
if (ownerOrigBounds != null) {
// if the window went into fs mode before it was realized it
// could have (0,0) dimensions
if (!ownerWasVisible) {
wpeer.setVisible(false);
}
}
if (!fsWindowWasAlwaysOnTop) {
wpeer.setAlwaysOnTop(false);
}
}
realFSWindow = null;
}
try {
class Result {
};
public void run() {
}
});
return super.getCurrentDisplayMode(screen);
}
} finally {
}
}
int bitDepth,
int refreshRate);
final int bitDepth, final int refreshRate)
{
// we entered fs mode via gdi
if (!fsStatus) {
return;
}
// REMIND: we do this before we switch the display mode, so
// the dimensions may be exceeding the dimensions of the screen,
// is this a problem?
// update the bounds of the owner frame
if (getFullScreenWindow() != realFSWindow) {
}
try {
public void run() {
if (hwnd == 0l) {
// window is disposed
return;
}
// REMIND: do we really need a window here?
// we should probably just use the current one
}
});
} finally {
}
}
try {
public void run() {
}
});
}
} finally {
}
}
public int getAvailableAcceleratedMemory() {
try {
class Result {
long mem = 0L;
};
public void run() {
}
});
} finally {
}
}
if (isD3DEnabledOnDevice()) {
if (defaultConfig != null) {
}
}
}
return super.getConfigurations();
}
if (defaultConfig == null) {
if (isD3DEnabledOnDevice()) {
defaultConfig = new D3DGraphicsConfig(this);
} else {
defaultConfig = super.getDefaultConfiguration();
}
}
return defaultConfig;
}
// REMIND: this method is not used now, we use caps instead
if (!d3dAvailable) {
return false;
}
// REMIND: should we cache the result per device somehow,
// and then reset and retry it on display change?
try {
class Result {
boolean avail = false;
};
public void run() {
}
});
} finally {
}
}
return context;
}
return d3dCaps;
}
public void displayChanged() {
super.displayChanged();
// REMIND: make sure this works when the device is lost and we don't
// disable d3d too eagerly
if (d3dAvailable) {
}
}
super.invalidate(defaultScreen);
// REMIND: this is a bit excessive, isD3DEnabledOnDevice will return
// false anyway because the device is invalid
}
}