/*
* 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.
*/
#include <awt.h>
#include <sun_awt_Win32GraphicsEnvironment.h>
#include <sun_awt_Win32FontManager.h>
#include "awt_Canvas.h"
#include "awt_Win32GraphicsDevice.h"
#include "Devices.h"
#include "WindowsFlags.h"
#include "DllUtil.h"
return;
}
}
/**
* This function attempts to make a Win32 API call to
* BOOL SetProcessDPIAware(VOID);
* which is only present on Windows Vista, and which instructs the
* Vista Windows Display Manager that this application is High DPI Aware
* and does not need to be scaled by the WDM and lied about the
* actual system dpi.
*/
static void
{
// setHighDPIAware is set in WindowsFlags.cpp
if (!setHighDPIAware || bAlreadySet) {
return;
}
bAlreadySet = TRUE;
if (hLibUser32Dll != NULL) {
"SetProcessDPIAware");
if (lpSetProcessDPIAware != NULL) {
}
}
}
/**
* This function is called from toolkit event handling code when
* WM_DWMCOMPOSITIONCHANGED event is received
*/
void DWMResetCompositionEnabled() {
(void)DWMIsCompositionEnabled();
}
/**
* Returns true if dwm composition is enabled, false if it is not applicable
* (if the OS is not Vista) or dwm composition is disabled.
*/
// cheaper to check than whether it's vista or not
if (dwmIsCompositionEnabled != DWM_COMP_UNDEFINED) {
return (BOOL)dwmIsCompositionEnabled;
}
if (!IS_WINVISTA) {
return FALSE;
}
try {
} else {
"IsDWMCompositionEnabled: error %x when detecting"\
"if composition is enabled", res);
}
"IsDWMCompositionEnabled: no DwmIsCompositionEnabled() "\
"in dwmapi.dll or dwmapi.dll cannot be loaded");
}
return bRes;
}
/*
* Class: sun_awt_Win32GraphicsEnvironment
* Method: initDisplay
* Signature: ()V
*/
{
// This method needs to be called prior to any display-related activity
}
/*
* Class: sun_awt_Win32GraphicsEnvironment
* Method: getNumScreens
* Signature: ()I
*/
{
return devices->GetNumDevices();
}
/*
* Class: sun_awt_Win32GraphicsEnvironment
* Method: getDefaultScreen
* Signature: ()I
*/
{
return AwtWin32GraphicsDevice::GetDefaultDeviceIndex();
}
/*
* Class: sun_awt_Win32FontManager
* Method: registerFontWithPlatform
*/
{
if (file) {
}
}
/*
* Class: sun_awt_Win32FontManagerEnvironment
* Method: deRegisterFontWithPlatform
*
* This method intended for future use.
*/
{
if (file) {
}
}
int rc;
//lookup for encoding ID, EUDC only supported in
//codepage 932, 936, 949, 950 (and unicode)
// On Windows 7, at least for me, it shows up in Cp1252 if
// I create a custom font. Might as well support that as it makes
// verification easier.
if (langID == LANGID_JA_JP) {
langID == LANGID_ZH_MO) {
} else if (langID == LANGID_KO_KR) {
} else if (langID == LANGID_EN_US) {
} else {
return NULL;
}
if (rc != ERROR_SUCCESS) {
return NULL;
}
L"SystemDefaultEUDCFont",
0,
&type,
&fontPathLen);
return NULL;
}
//if the fontPath includes %SystemRoot%
if (systemRoot != NULL
}
else {
return NULL;
}
//else to see if it only inludes "EUDC.TTE"
}
else {
return NULL;
}
}
}
/*
* Class: sun_awt_Win32GraphicsEnvironment
* Method: getXResolution
* Signature: ()I
*/
{
TRY;
return result;
}
/*
* Class: sun_awt_Win32GraphicsEnvironment
* Method: getYResolution
* Signature: ()I
*/
{
TRY;
return result;
}
/*
* Class: sun_awt_Win32GraphicsEnvironment
* Method: isVistaOS
* Signature: ()Z
*/
{
return IS_WINVISTA;
}