8307160: Fix AWT/2D/A11Y to support the permissive- flag on the Microsoft Visual C compiler
Co-authored-by: Magnus Ihse Bursie <ihse@openjdk.org> Reviewed-by: jwaters, prr
This commit is contained in:
parent
8efe569b8d
commit
8bc1867da7
@ -577,8 +577,8 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
|
||||
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
# The -utf-8 option sets source and execution character sets to UTF-8 to enable correct
|
||||
# compilation of all source files regardless of the active code page on Windows.
|
||||
TOOLCHAIN_CFLAGS_JVM="-nologo -MD -Zc:preprocessor -Zc:strictStrings -Zc:inline -permissive- -utf-8 -MP"
|
||||
TOOLCHAIN_CFLAGS_JDK="-nologo -MD -Zc:preprocessor -Zc:strictStrings -Zc:inline -utf-8 -Zc:wchar_t-"
|
||||
TOOLCHAIN_CFLAGS_JVM="-nologo -MD -Zc:preprocessor -Zc:inline -permissive- -utf-8 -MP"
|
||||
TOOLCHAIN_CFLAGS_JDK="-nologo -MD -Zc:preprocessor -Zc:inline -permissive- -utf-8 -Zc:wchar_t-"
|
||||
fi
|
||||
|
||||
# CFLAGS C language level for JDK sources (hotspot only uses C++)
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "D3DTextRenderer.h"
|
||||
#include "D3DRenderQueue.h"
|
||||
|
||||
void D3DGlyphCache_FlushGlyphVertexCache();
|
||||
static void D3DGlyphCache_FlushGlyphVertexCache();
|
||||
|
||||
// static
|
||||
HRESULT
|
||||
|
@ -206,19 +206,31 @@ void AwtCanvas::_SetEraseBackground(void *param)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
SetEraseBackgroundStruct *sebs = (SetEraseBackgroundStruct *)param;
|
||||
SetEraseBackgroundStruct *sebs = static_cast<SetEraseBackgroundStruct *>(param);
|
||||
jobject canvas = sebs->canvas;
|
||||
jboolean doErase = sebs->doErase;
|
||||
jboolean doEraseOnResize = sebs->doEraseOnResize;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_GOTO(canvas, ret);
|
||||
AwtCanvas *c = NULL;
|
||||
|
||||
if (canvas == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "canvas");
|
||||
delete sebs;
|
||||
return;
|
||||
} else {
|
||||
c = (AwtCanvas*)JNI_GET_PDATA(canvas);
|
||||
if (c == NULL) {
|
||||
THROW_NULL_PDATA_IF_NOT_DESTROYED(canvas);
|
||||
env->DeleteGlobalRef(canvas);
|
||||
delete sebs;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AwtCanvas *c = (AwtCanvas*)pData;
|
||||
c->m_eraseBackground = doErase;
|
||||
c->m_eraseBackgroundOnResize = doEraseOnResize;
|
||||
|
||||
ret:
|
||||
env->DeleteGlobalRef(canvas);
|
||||
delete sebs;
|
||||
}
|
||||
|
@ -6360,18 +6360,46 @@ void AwtComponent::_SetParent(void * param)
|
||||
{
|
||||
if (AwtToolkit::IsMainThread()) {
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
SetParentStruct *data = (SetParentStruct*) param;
|
||||
SetParentStruct *data = static_cast<SetParentStruct*>(param);
|
||||
jobject self = data->component;
|
||||
jobject parent = data->parentComp;
|
||||
|
||||
AwtComponent *awtComponent = NULL;
|
||||
AwtComponent *awtParent = NULL;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_GOTO(self, ret);
|
||||
awtComponent = (AwtComponent *)pData;
|
||||
JNI_CHECK_PEER_GOTO(parent, ret);
|
||||
awtParent = (AwtComponent *)pData;
|
||||
if (self == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "self");
|
||||
env->DeleteGlobalRef(parent);
|
||||
delete data;
|
||||
return;
|
||||
} else {
|
||||
awtComponent = (AwtComponent *)JNI_GET_PDATA(self);;
|
||||
if (awtComponent == NULL) {
|
||||
THROW_NULL_PDATA_IF_NOT_DESTROYED(self);
|
||||
env->DeleteGlobalRef(self);
|
||||
env->DeleteGlobalRef(parent);
|
||||
delete data;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (parent == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "parent");
|
||||
env->DeleteGlobalRef(self);
|
||||
delete data;
|
||||
return;
|
||||
} else {
|
||||
awtParent = (AwtComponent *)JNI_GET_PDATA(parent);
|
||||
if (awtParent == NULL) {
|
||||
THROW_NULL_PDATA_IF_NOT_DESTROYED(parent);
|
||||
env->DeleteGlobalRef(self);
|
||||
env->DeleteGlobalRef(parent);
|
||||
delete data;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
HWND selfWnd = awtComponent->GetHWnd();
|
||||
HWND parentWnd = awtParent->GetHWnd();
|
||||
@ -6380,7 +6408,7 @@ void AwtComponent::_SetParent(void * param)
|
||||
// (only the proxy may be the native focus owner).
|
||||
::SetParent(selfWnd, parentWnd);
|
||||
}
|
||||
ret:
|
||||
|
||||
env->DeleteGlobalRef(self);
|
||||
env->DeleteGlobalRef(parent);
|
||||
delete data;
|
||||
@ -6539,19 +6567,31 @@ static void _GetInsets(void* param)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
GetInsetsStruct *gis = (GetInsetsStruct *)param;
|
||||
GetInsetsStruct *gis = static_cast<GetInsetsStruct *>(param);
|
||||
jobject self = gis->window;
|
||||
|
||||
gis->insets->left = gis->insets->top =
|
||||
gis->insets->right = gis->insets->bottom = 0;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_GOTO(self, ret);
|
||||
AwtComponent *component = (AwtComponent *)pData;
|
||||
AwtComponent *component = NULL;
|
||||
|
||||
if (self == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "self");
|
||||
delete gis;
|
||||
return;
|
||||
} else {
|
||||
component = (AwtComponent *)JNI_GET_PDATA(self);
|
||||
if (component == NULL) {
|
||||
THROW_NULL_PDATA_IF_NOT_DESTROYED(self);
|
||||
env->DeleteGlobalRef(self);
|
||||
delete gis;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
component->GetInsets(gis->insets);
|
||||
|
||||
ret:
|
||||
env->DeleteGlobalRef(self);
|
||||
delete gis;
|
||||
}
|
||||
|
@ -39,10 +39,15 @@ void * operator new(size_t size) {return operator new(size, "stl", 1);}
|
||||
#pragma pop_macro("bad_alloc")
|
||||
//"bad_alloc" is undefined from here
|
||||
|
||||
#include <awt.h>
|
||||
#include <shlobj.h>
|
||||
|
||||
// These files must be included before awt.h, since the latter redefines malloc
|
||||
// to Do_Not_Use_Malloc, etc, and that will break these files.
|
||||
#include "awt_ole.h"
|
||||
#include "awt_DCHolder.h"
|
||||
|
||||
#include "jlong.h"
|
||||
#include "awt.h"
|
||||
#include "awt_DataTransferer.h"
|
||||
#include "awt_DnDDS.h"
|
||||
#include "awt_DnDDT.h"
|
||||
@ -54,9 +59,6 @@ void * operator new(size_t size) {return operator new(size, "stl", 1);}
|
||||
#include "java_awt_dnd_DnDConstants.h"
|
||||
#include "sun_awt_windows_WDragSourceContextPeer.h"
|
||||
|
||||
#include "awt_ole.h"
|
||||
#include "awt_DCHolder.h"
|
||||
|
||||
bool operator < (const FORMATETC &fr, const FORMATETC &fl) {
|
||||
return memcmp(&fr, &fl, sizeof(FORMATETC)) < 0;
|
||||
}
|
||||
|
@ -27,11 +27,13 @@
|
||||
#include <shellapi.h>
|
||||
#include <memory.h>
|
||||
|
||||
// awt_ole.h must be included before awt.h, since the latter redefines malloc
|
||||
// to Do_Not_Use_Malloc, etc, and that will break awt_ole.h.
|
||||
#include "awt_ole.h"
|
||||
#include "awt_DataTransferer.h"
|
||||
#include "java_awt_dnd_DnDConstants.h"
|
||||
#include "sun_awt_windows_WDropTargetContextPeer.h"
|
||||
#include "awt_Container.h"
|
||||
#include "awt_ole.h"
|
||||
#include "awt_Toolkit.h"
|
||||
#include "awt_DnDDT.h"
|
||||
#include "awt_DnDDS.h"
|
||||
|
@ -1340,15 +1340,27 @@ void AwtFrame::_SetState(void *param)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
SetStateStruct *sss = (SetStateStruct *)param;
|
||||
SetStateStruct *sss = static_cast<SetStateStruct *>(param);
|
||||
jobject self = sss->frame;
|
||||
jint state = sss->state;
|
||||
|
||||
AwtFrame *f = NULL;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_GOTO(self, ret);
|
||||
f = (AwtFrame *)pData;
|
||||
if (self == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "self");
|
||||
delete sss;
|
||||
return;
|
||||
} else {
|
||||
f = (AwtFrame *)JNI_GET_PDATA(self);
|
||||
if (f == NULL) {
|
||||
THROW_NULL_PDATA_IF_NOT_DESTROYED(self);
|
||||
env->DeleteGlobalRef(self);
|
||||
delete sss;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
HWND hwnd = f->GetHWnd();
|
||||
if (::IsWindow(hwnd))
|
||||
{
|
||||
@ -1405,7 +1417,7 @@ void AwtFrame::_SetState(void *param)
|
||||
f->setZoomed(zoom);
|
||||
}
|
||||
}
|
||||
ret:
|
||||
|
||||
env->DeleteGlobalRef(self);
|
||||
|
||||
delete sss;
|
||||
@ -1569,21 +1581,59 @@ void AwtFrame::_NotifyModalBlocked(void *param)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
NotifyModalBlockedStruct *nmbs = (NotifyModalBlockedStruct *)param;
|
||||
NotifyModalBlockedStruct *nmbs = static_cast<NotifyModalBlockedStruct *>(param);
|
||||
jobject self = nmbs->frame;
|
||||
jobject peer = nmbs->peer;
|
||||
jobject blockerPeer = nmbs->blockerPeer;
|
||||
jboolean blocked = nmbs->blocked;
|
||||
|
||||
PDATA pData;
|
||||
AwtFrame *f = NULL;
|
||||
|
||||
JNI_CHECK_PEER_GOTO(peer, ret);
|
||||
AwtFrame *f = (AwtFrame *)pData;
|
||||
if (peer == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "peer");
|
||||
env->DeleteGlobalRef(self);
|
||||
env->DeleteGlobalRef(blockerPeer);
|
||||
|
||||
delete nmbs;
|
||||
return;
|
||||
} else {
|
||||
f = (AwtFrame *)JNI_GET_PDATA(peer);
|
||||
if (f == NULL) {
|
||||
THROW_NULL_PDATA_IF_NOT_DESTROYED(peer);
|
||||
env->DeleteGlobalRef(self);
|
||||
env->DeleteGlobalRef(peer);
|
||||
env->DeleteGlobalRef(blockerPeer);
|
||||
|
||||
delete nmbs;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// dialog here may be NULL, for example, if the blocker is a native dialog
|
||||
// however, we need to install/unistall modal hooks anyway
|
||||
JNI_CHECK_PEER_GOTO(blockerPeer, ret);
|
||||
AwtDialog *d = (AwtDialog *)pData;
|
||||
AwtDialog *d = NULL;
|
||||
|
||||
if (blockerPeer == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "blockerPeer");
|
||||
env->DeleteGlobalRef(self);
|
||||
env->DeleteGlobalRef(peer);
|
||||
|
||||
delete nmbs;
|
||||
return;
|
||||
} else {
|
||||
d = (AwtDialog *)JNI_GET_PDATA(blockerPeer);
|
||||
if (d == NULL) {
|
||||
THROW_NULL_PDATA_IF_NOT_DESTROYED(blockerPeer);
|
||||
env->DeleteGlobalRef(self);
|
||||
env->DeleteGlobalRef(peer);
|
||||
env->DeleteGlobalRef(blockerPeer);
|
||||
|
||||
delete nmbs;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((f != NULL) && ::IsWindow(f->GetHWnd()))
|
||||
{
|
||||
@ -1634,7 +1684,7 @@ void AwtFrame::_NotifyModalBlocked(void *param)
|
||||
}
|
||||
}
|
||||
}
|
||||
ret:
|
||||
|
||||
env->DeleteGlobalRef(self);
|
||||
env->DeleteGlobalRef(peer);
|
||||
env->DeleteGlobalRef(blockerPeer);
|
||||
|
@ -35,10 +35,10 @@
|
||||
|
||||
class AwtPrintDialog {
|
||||
public:
|
||||
static jfieldID AwtPrintDialog::controlID;
|
||||
static jfieldID AwtPrintDialog::parentID;
|
||||
static jfieldID AwtPrintDialog::pageID;
|
||||
static jmethodID AwtPrintDialog::setHWndMID;
|
||||
static jfieldID controlID;
|
||||
static jfieldID parentID;
|
||||
static jfieldID pageID;
|
||||
static jmethodID setHWndMID;
|
||||
|
||||
static BOOL PrintDlg(LPPRINTDLG);
|
||||
|
||||
|
@ -57,6 +57,8 @@
|
||||
*/
|
||||
#define ROUND_TO_INT(num) ((int) floor((num) + 0.5))
|
||||
|
||||
jfieldID AwtPrintDialog::pageID;
|
||||
|
||||
/************************************************************************
|
||||
* WPrintJob native methods
|
||||
*/
|
||||
@ -209,7 +211,6 @@ static const double POINTS_TO_HIMETRIC = (2540.0 / 72.0);
|
||||
*/
|
||||
static const double POINTS_TO_LOMETRIC = (254.0 / 72.0);
|
||||
|
||||
jfieldID AwtPrintDialog::pageID;
|
||||
|
||||
|
||||
/*** Private Macros ***/
|
||||
@ -493,6 +494,18 @@ Java_sun_awt_windows_WPageDialog_initIDs(JNIEnv *env, jclass cls)
|
||||
* WPageDialogPeer native methods
|
||||
*/
|
||||
|
||||
#define CLEANUP_SHOW { \
|
||||
env->DeleteGlobalRef(peerGlobalRef); \
|
||||
if (target != NULL) { \
|
||||
env->DeleteLocalRef(target); \
|
||||
} \
|
||||
if (parent != NULL) { \
|
||||
env->DeleteLocalRef(parent); \
|
||||
} \
|
||||
env->DeleteLocalRef(page); \
|
||||
env->DeleteLocalRef(self); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_windows_WPageDialogPeer
|
||||
* Method: show
|
||||
@ -521,8 +534,6 @@ Java_sun_awt_windows_WPageDialogPeer__1show(JNIEnv *env, jobject peer)
|
||||
AwtComponent *awtParent = (parent != NULL) ? (AwtComponent *)JNI_GET_PDATA(parent) : NULL;
|
||||
HWND hwndOwner = awtParent ? awtParent->GetHWnd() : NULL;
|
||||
|
||||
|
||||
jboolean doIt = JNI_FALSE; // Assume the user will cancel the dialog.
|
||||
PAGESETUPDLG setup;
|
||||
memset(&setup, 0, sizeof(setup));
|
||||
|
||||
@ -572,13 +583,13 @@ Java_sun_awt_windows_WPageDialogPeer__1show(JNIEnv *env, jobject peer)
|
||||
*/
|
||||
if (AwtPrintControl::getPrintHDMode(env, self) == NULL ||
|
||||
AwtPrintControl::getPrintHDName(env,self) == NULL) {
|
||||
(void)::PageSetupDlg(&setup);
|
||||
static_cast<void>(::PageSetupDlg(&setup));
|
||||
/* check if hDevMode and hDevNames are set.
|
||||
* If both are null, then there is no default printer.
|
||||
*/
|
||||
if ((setup.hDevMode == NULL) && (setup.hDevNames == NULL)) {
|
||||
doIt = JNI_FALSE;
|
||||
goto done;
|
||||
CLEANUP_SHOW;
|
||||
return JNI_FALSE;
|
||||
}
|
||||
} else {
|
||||
int measure = PSD_INTHOUSANDTHSOFINCHES;
|
||||
@ -605,8 +616,8 @@ Java_sun_awt_windows_WPageDialogPeer__1show(JNIEnv *env, jobject peer)
|
||||
*/
|
||||
pageFormatToSetup(env, self, page, &setup, AwtPrintControl::getPrintDC(env, self));
|
||||
if (env->ExceptionCheck()) {
|
||||
doIt = JNI_FALSE;
|
||||
goto done;
|
||||
CLEANUP_SHOW;
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
setup.lpfnPageSetupHook = reinterpret_cast<LPPAGESETUPHOOK>(pageDlgHook);
|
||||
@ -619,8 +630,8 @@ Java_sun_awt_windows_WPageDialogPeer__1show(JNIEnv *env, jobject peer)
|
||||
|
||||
jobject paper = getPaper(env, page);
|
||||
if (paper == NULL) {
|
||||
doIt = JNI_FALSE;
|
||||
goto done;
|
||||
CLEANUP_SHOW;
|
||||
return JNI_FALSE;
|
||||
}
|
||||
int units = setup.Flags & PSD_INTHOUSANDTHSOFINCHES ?
|
||||
MM_HIENGLISH :
|
||||
@ -660,9 +671,9 @@ Java_sun_awt_windows_WPageDialogPeer__1show(JNIEnv *env, jobject peer)
|
||||
* and place them into a Paper instance.
|
||||
*/
|
||||
setPaperValues(env, paper, &paperSize, &margins, units);
|
||||
if (env->ExceptionCheck()) {
|
||||
doIt = JNI_FALSE;
|
||||
goto done;
|
||||
if (env->ExceptionCheck()) {
|
||||
CLEANUP_SHOW;
|
||||
return JNI_FALSE;
|
||||
}
|
||||
/*
|
||||
* Put the updated Paper instance and the orientation into
|
||||
@ -670,13 +681,13 @@ Java_sun_awt_windows_WPageDialogPeer__1show(JNIEnv *env, jobject peer)
|
||||
*/
|
||||
setPaper(env, page, paper);
|
||||
if (env->ExceptionCheck()) {
|
||||
doIt = JNI_FALSE;
|
||||
goto done;
|
||||
CLEANUP_SHOW;
|
||||
return JNI_FALSE;
|
||||
}
|
||||
setPageFormatOrientation(env, page, orientation);
|
||||
if (env->ExceptionCheck()) {
|
||||
doIt = JNI_FALSE;
|
||||
goto done;
|
||||
CLEANUP_SHOW;
|
||||
return JNI_FALSE;
|
||||
}
|
||||
if (setup.hDevMode != NULL) {
|
||||
DEVMODE *devmode = (DEVMODE *)::GlobalLock(setup.hDevMode);
|
||||
@ -684,14 +695,13 @@ Java_sun_awt_windows_WPageDialogPeer__1show(JNIEnv *env, jobject peer)
|
||||
if (devmode->dmFields & DM_PAPERSIZE) {
|
||||
jboolean err = setPrintPaperSize(env, self, devmode->dmPaperSize);
|
||||
if (err) {
|
||||
doIt = JNI_FALSE;
|
||||
goto done;
|
||||
CLEANUP_SHOW;
|
||||
return JNI_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
::GlobalUnlock(setup.hDevMode);
|
||||
}
|
||||
doIt = JNI_TRUE;
|
||||
}
|
||||
|
||||
AwtDialog::CheckUninstallModalHook();
|
||||
@ -708,18 +718,9 @@ Java_sun_awt_windows_WPageDialogPeer__1show(JNIEnv *env, jobject peer)
|
||||
AwtPrintControl::setPrintHDName(env, self, setup.hDevNames);
|
||||
}
|
||||
|
||||
done:
|
||||
env->DeleteGlobalRef(peerGlobalRef);
|
||||
if (target != NULL) {
|
||||
env->DeleteLocalRef(target);
|
||||
}
|
||||
if (parent != NULL) {
|
||||
env->DeleteLocalRef(parent);
|
||||
}
|
||||
env->DeleteLocalRef(page);
|
||||
env->DeleteLocalRef(self);
|
||||
CLEANUP_SHOW;
|
||||
|
||||
return doIt;
|
||||
return JNI_TRUE;
|
||||
|
||||
CATCH_BAD_ALLOC_RET(0);
|
||||
}
|
||||
@ -881,6 +882,21 @@ done:
|
||||
|
||||
}
|
||||
|
||||
#define CLEANUP_VALIDATE_PAPER { \
|
||||
if (privateDC == TRUE) { \
|
||||
if (printDC != NULL) { \
|
||||
/* In this case we know that this DC has no GDI objects to free */ \
|
||||
::DeleteDC(printDC); \
|
||||
} \
|
||||
if (hDevMode != NULL) { \
|
||||
::GlobalFree(hDevMode); \
|
||||
} \
|
||||
if (hDevNames != NULL) { \
|
||||
::GlobalFree(hDevNames); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_windows_WPrinterJob
|
||||
* Method: validatePaper
|
||||
@ -919,7 +935,12 @@ Java_sun_awt_windows_WPrinterJob_validatePaper(JNIEnv *env, jobject self,
|
||||
}
|
||||
}
|
||||
|
||||
JNI_CHECK_NULL_GOTO(printDC, "Invalid printDC", done);
|
||||
if (printDC == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "Invalid printDC");
|
||||
CLEANUP_VALIDATE_PAPER;
|
||||
return;
|
||||
}
|
||||
|
||||
/* We try to mitigate the effects of floating point rounding errors
|
||||
* by only setting a value if it would differ from the value in the
|
||||
@ -932,7 +953,10 @@ Java_sun_awt_windows_WPrinterJob_validatePaper(JNIEnv *env, jobject self,
|
||||
jdouble paperWidth, paperHeight;
|
||||
jboolean err;
|
||||
WORD dmPaperSize = getPrintPaperSize(env, &err, self);
|
||||
if (err) goto done;
|
||||
if (err) {
|
||||
CLEANUP_VALIDATE_PAPER;
|
||||
return;
|
||||
}
|
||||
|
||||
double ix, iy, iw, ih, pw, ph;
|
||||
|
||||
@ -940,24 +964,59 @@ Java_sun_awt_windows_WPrinterJob_validatePaper(JNIEnv *env, jobject self,
|
||||
jmethodID getID;
|
||||
|
||||
jclass paperClass = env->GetObjectClass(origPaper);
|
||||
JNI_CHECK_NULL_GOTO(paperClass, "paper class not found", done);
|
||||
if (paperClass == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "paper class not found");
|
||||
CLEANUP_VALIDATE_PAPER;
|
||||
return;
|
||||
}
|
||||
getID = env->GetMethodID(paperClass, GETWIDTH_STR, GETWIDTH_SIG);
|
||||
JNI_CHECK_NULL_GOTO(getID, "no getWidth method", done);
|
||||
if (getID == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "no getWidth method");
|
||||
CLEANUP_VALIDATE_PAPER;
|
||||
return;
|
||||
}
|
||||
pw = env->CallDoubleMethod(origPaper, getID);
|
||||
getID = env->GetMethodID(paperClass, GETHEIGHT_STR, GETHEIGHT_SIG);
|
||||
JNI_CHECK_NULL_GOTO(getID, "no getHeight method", done);
|
||||
if (getID == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "no getHeight method");
|
||||
CLEANUP_VALIDATE_PAPER;
|
||||
return;
|
||||
}
|
||||
ph = env->CallDoubleMethod(origPaper, getID);
|
||||
getID = env->GetMethodID(paperClass, GETIMG_X_STR, GETIMG_X_SIG);
|
||||
JNI_CHECK_NULL_GOTO(getID, "no getX method", done);
|
||||
if (getID == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "no getX method");
|
||||
CLEANUP_VALIDATE_PAPER;
|
||||
return;
|
||||
}
|
||||
ix = env->CallDoubleMethod(origPaper, getID);
|
||||
getID = env->GetMethodID(paperClass, GETIMG_Y_STR, GETIMG_Y_SIG);
|
||||
JNI_CHECK_NULL_GOTO(getID, "no getY method", done);
|
||||
if (getID == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "no getY method");
|
||||
CLEANUP_VALIDATE_PAPER;
|
||||
return;
|
||||
}
|
||||
iy = env->CallDoubleMethod(origPaper, getID);
|
||||
getID = env->GetMethodID(paperClass, GETIMG_W_STR, GETIMG_W_SIG);
|
||||
JNI_CHECK_NULL_GOTO(getID, "no getW method", done);
|
||||
if (getID == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "no getW method");
|
||||
CLEANUP_VALIDATE_PAPER;
|
||||
return;
|
||||
}
|
||||
iw = env->CallDoubleMethod(origPaper, getID);
|
||||
getID = env->GetMethodID(paperClass, GETIMG_H_STR, GETIMG_H_SIG);
|
||||
JNI_CHECK_NULL_GOTO(getID, "no getH method", done);
|
||||
if (getID == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "no getH method");
|
||||
CLEANUP_VALIDATE_PAPER;
|
||||
return;
|
||||
}
|
||||
ih = env->CallDoubleMethod(origPaper, getID);
|
||||
|
||||
matchPaperSize(printDC, hDevMode, hDevNames, pw, ph,
|
||||
@ -1050,29 +1109,27 @@ Java_sun_awt_windows_WPrinterJob_validatePaper(JNIEnv *env, jobject self,
|
||||
|
||||
jmethodID setSizeID = env->GetMethodID(paperClass,
|
||||
SETSIZE_STR, SETSIZE_SIG);
|
||||
JNI_CHECK_NULL_GOTO(setSizeID, "no setSize method", done);
|
||||
if (setSizeID == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "no setSize method");
|
||||
CLEANUP_VALIDATE_PAPER;
|
||||
return;
|
||||
}
|
||||
|
||||
jmethodID setImageableID = env->GetMethodID(paperClass,
|
||||
SETIMAGEABLE_STR, SETIMAGEABLE_SIG);
|
||||
JNI_CHECK_NULL_GOTO(setImageableID, "no setImageable method", done);
|
||||
if (setImageableID == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "no setImageable method");
|
||||
CLEANUP_VALIDATE_PAPER;
|
||||
return;
|
||||
}
|
||||
|
||||
env->CallVoidMethod(newPaper, setSizeID, paperWidth, paperHeight);
|
||||
env->CallVoidMethod(newPaper, setImageableID, ix, iy, iw, ih);
|
||||
|
||||
done:
|
||||
/* Free any resources allocated */
|
||||
if (privateDC == TRUE) {
|
||||
if (printDC != NULL) {
|
||||
/* In this case we know that this DC has no GDI objects to free */
|
||||
::DeleteDC(printDC);
|
||||
}
|
||||
if (hDevMode != NULL) {
|
||||
::GlobalFree(hDevMode);
|
||||
}
|
||||
if (hDevNames != NULL) {
|
||||
::GlobalFree(hDevNames);
|
||||
}
|
||||
}
|
||||
CLEANUP_VALIDATE_PAPER;
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
@ -53,12 +53,14 @@ struct EnableEditingStruct {
|
||||
* AwtTextComponent fields
|
||||
*/
|
||||
|
||||
jmethodID AwtTextComponent::canAccessClipboardMID;
|
||||
AwtTextComponent::OleCallback AwtTextComponent::sm_oleCallback;
|
||||
WNDPROC AwtTextComponent::sm_pDefWindowProc = NULL;
|
||||
|
||||
/************************************************************************
|
||||
* AwtTextComponent methods
|
||||
*/
|
||||
|
||||
jmethodID AwtTextComponent::canAccessClipboardMID;
|
||||
|
||||
AwtTextComponent::AwtTextComponent() {
|
||||
m_synthetic = FALSE;
|
||||
m_lStartPos = -1;
|
||||
@ -911,8 +913,6 @@ Java_sun_awt_windows_WTextComponentPeer_initIDs(JNIEnv *env, jclass cls)
|
||||
}
|
||||
|
||||
|
||||
AwtTextComponent::OleCallback AwtTextComponent::sm_oleCallback;
|
||||
|
||||
/************************************************************************
|
||||
* Inner class OleCallback definition.
|
||||
*/
|
||||
@ -1040,8 +1040,6 @@ AwtTextComponent::OleCallback::GetContextMenu(WORD seltype,
|
||||
* (See AwtTextArea::WmContextMenu for more details).
|
||||
*/
|
||||
|
||||
WNDPROC AwtTextComponent::sm_pDefWindowProc = NULL;
|
||||
|
||||
LRESULT
|
||||
AwtTextComponent::EditProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
|
||||
|
@ -1019,16 +1019,28 @@ void AwtWindow::_RepositionSecurityWarning(void* param)
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
RepositionSecurityWarningStruct *rsws =
|
||||
(RepositionSecurityWarningStruct *)param;
|
||||
static_cast<RepositionSecurityWarningStruct *>(param);
|
||||
jobject self = rsws->window;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_GOTO(self, ret);
|
||||
AwtWindow *window = (AwtWindow *)pData;
|
||||
AwtWindow *window = NULL;
|
||||
|
||||
if (self == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "self");
|
||||
delete rsws;
|
||||
return;
|
||||
} else {
|
||||
window = (AwtWindow *)JNI_GET_PDATA(self);
|
||||
if (window == NULL) {
|
||||
THROW_NULL_PDATA_IF_NOT_DESTROYED(self);
|
||||
env->DeleteGlobalRef(self);
|
||||
delete rsws;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
window->RepositionSecurityWarning(env);
|
||||
|
||||
ret:
|
||||
env->DeleteGlobalRef(self);
|
||||
delete rsws;
|
||||
}
|
||||
@ -3116,28 +3128,32 @@ void AwtWindow::_ModalDisable(void *param)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
ModalDisableStruct *mds = (ModalDisableStruct *)param;
|
||||
ModalDisableStruct *mds = static_cast<ModalDisableStruct *>(param);
|
||||
jobject self = mds->window;
|
||||
HWND blockerHWnd = (HWND)mds->blockerHWnd;
|
||||
|
||||
AwtWindow *window = NULL;
|
||||
HWND windowHWnd = 0;
|
||||
|
||||
JNI_CHECK_NULL_GOTO(self, "peer", ret);
|
||||
PDATA pData = JNI_GET_PDATA(self);
|
||||
if (pData == NULL) {
|
||||
env->DeleteGlobalRef(self);
|
||||
if (self == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "self");
|
||||
delete mds;
|
||||
return;
|
||||
} else {
|
||||
window = (AwtWindow *)JNI_GET_PDATA(self);
|
||||
if (window == NULL) {
|
||||
env->DeleteGlobalRef(self);
|
||||
delete mds;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
window = (AwtWindow *)pData;
|
||||
windowHWnd = window->GetHWnd();
|
||||
if (::IsWindow(windowHWnd)) {
|
||||
AwtWindow::SetAndActivateModalBlocker(windowHWnd, blockerHWnd);
|
||||
}
|
||||
|
||||
ret:
|
||||
env->DeleteGlobalRef(self);
|
||||
|
||||
delete mds;
|
||||
@ -3147,25 +3163,28 @@ void AwtWindow::_ModalEnable(void *param)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
jobject self = (jobject)param;
|
||||
jobject self = static_cast<jobject>(param);
|
||||
|
||||
AwtWindow *window = NULL;
|
||||
HWND windowHWnd = 0;
|
||||
|
||||
JNI_CHECK_NULL_GOTO(self, "peer", ret);
|
||||
PDATA pData = JNI_GET_PDATA(self);
|
||||
if (pData == NULL) {
|
||||
env->DeleteGlobalRef(self);
|
||||
if (self == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "self");
|
||||
return;
|
||||
} else {
|
||||
window = (AwtWindow *)JNI_GET_PDATA(self);
|
||||
if (window == NULL) {
|
||||
env->DeleteGlobalRef(self);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
window = (AwtWindow *)pData;
|
||||
windowHWnd = window->GetHWnd();
|
||||
if (::IsWindow(windowHWnd)) {
|
||||
AwtWindow::SetModalBlocker(windowHWnd, NULL);
|
||||
}
|
||||
|
||||
ret:
|
||||
env->DeleteGlobalRef(self);
|
||||
}
|
||||
|
||||
@ -3173,17 +3192,29 @@ void AwtWindow::_SetOpacity(void* param)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
OpacityStruct *os = (OpacityStruct *)param;
|
||||
OpacityStruct *os = static_cast<OpacityStruct *>(param);
|
||||
jobject self = os->window;
|
||||
BYTE iOpacity = (BYTE)os->iOpacity;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_GOTO(self, ret);
|
||||
AwtWindow *window = (AwtWindow *)pData;
|
||||
AwtWindow *window = NULL;
|
||||
|
||||
if (self == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "self");
|
||||
delete os;
|
||||
return;
|
||||
} else {
|
||||
window = (AwtWindow *)JNI_GET_PDATA(self);
|
||||
if (window == NULL) {
|
||||
THROW_NULL_PDATA_IF_NOT_DESTROYED(self);
|
||||
env->DeleteGlobalRef(self);
|
||||
delete os;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
window->SetTranslucency(iOpacity, window->isOpaque());
|
||||
|
||||
ret:
|
||||
env->DeleteGlobalRef(self);
|
||||
delete os;
|
||||
}
|
||||
@ -3192,17 +3223,29 @@ void AwtWindow::_SetOpaque(void* param)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
OpaqueStruct *os = (OpaqueStruct *)param;
|
||||
OpaqueStruct *os = static_cast<OpaqueStruct *>(param);
|
||||
jobject self = os->window;
|
||||
BOOL isOpaque = (BOOL)os->isOpaque;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_GOTO(self, ret);
|
||||
AwtWindow *window = (AwtWindow *)pData;
|
||||
AwtWindow *window = NULL;
|
||||
|
||||
if (self == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "self");
|
||||
delete os;
|
||||
return;
|
||||
} else {
|
||||
window = (AwtWindow *)JNI_GET_PDATA(self);
|
||||
if (window == NULL) {
|
||||
THROW_NULL_PDATA_IF_NOT_DESTROYED(self);
|
||||
env->DeleteGlobalRef(self);
|
||||
delete os;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
window->SetTranslucency(window->getOpacity(), isOpaque);
|
||||
|
||||
ret:
|
||||
env->DeleteGlobalRef(self);
|
||||
delete os;
|
||||
}
|
||||
@ -3211,18 +3254,36 @@ void AwtWindow::_UpdateWindow(void* param)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
UpdateWindowStruct *uws = (UpdateWindowStruct *)param;
|
||||
UpdateWindowStruct *uws = static_cast<UpdateWindowStruct *>(param);
|
||||
jobject self = uws->window;
|
||||
jintArray data = uws->data;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_GOTO(self, ret);
|
||||
AwtWindow *window = (AwtWindow *)pData;
|
||||
AwtWindow *window = NULL;
|
||||
|
||||
if (self == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "self");
|
||||
if (data != NULL) {
|
||||
env->DeleteGlobalRef(data);
|
||||
}
|
||||
delete uws;
|
||||
return;
|
||||
} else {
|
||||
window = (AwtWindow *)JNI_GET_PDATA(self);
|
||||
if (window == NULL) {
|
||||
THROW_NULL_PDATA_IF_NOT_DESTROYED(self);
|
||||
env->DeleteGlobalRef(self);
|
||||
if (data != NULL) {
|
||||
env->DeleteGlobalRef(data);
|
||||
}
|
||||
delete uws;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
window->UpdateWindow(env, data, (int)uws->width, (int)uws->height,
|
||||
uws->hBitmap);
|
||||
|
||||
ret:
|
||||
env->DeleteGlobalRef(self);
|
||||
if (data != NULL) {
|
||||
env->DeleteGlobalRef(data);
|
||||
@ -3239,13 +3300,25 @@ void AwtWindow::_SetFullScreenExclusiveModeState(void *param)
|
||||
jobject self = data->window;
|
||||
jboolean state = data->isFSEMState;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_GOTO(self, ret);
|
||||
AwtWindow *window = (AwtWindow *)pData;
|
||||
AwtWindow *window = NULL;
|
||||
|
||||
if (self == NULL) {
|
||||
env->ExceptionClear();
|
||||
JNU_ThrowNullPointerException(env, "self");
|
||||
delete data;
|
||||
return;
|
||||
} else {
|
||||
window = (AwtWindow *)JNI_GET_PDATA(self);
|
||||
if (window == NULL) {
|
||||
THROW_NULL_PDATA_IF_NOT_DESTROYED(self);
|
||||
env->DeleteGlobalRef(self);
|
||||
delete data;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
window->setFullScreenExclusiveModeState(state != 0);
|
||||
|
||||
ret:
|
||||
env->DeleteGlobalRef(self);
|
||||
delete data;
|
||||
}
|
||||
|
@ -1041,7 +1041,7 @@ AccessBridgeJavaEntryPoints::getParentWithRole(const jobject accessibleContext,
|
||||
rAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,
|
||||
getParentWithRoleMethod,
|
||||
accessibleContext, roleName);
|
||||
EXCEPTION_CHECK("Getting ParentWithRole - call to CallObjectMethod()", (AccessibleContext)0);
|
||||
EXCEPTION_CHECK("Getting ParentWithRole - call to CallObjectMethod()", reinterpret_cast<jobject>((AccessibleContext)0));
|
||||
PrintDebugString("[INFO]: rAccessibleContext = %p", rAccessibleContext);
|
||||
jobject globalRef = jniEnv->NewGlobalRef(rAccessibleContext);
|
||||
EXCEPTION_CHECK("Getting ParentWithRole - call to NewGlobalRef()", FALSE);
|
||||
@ -1111,7 +1111,7 @@ AccessBridgeJavaEntryPoints::getParentWithRoleElseRoot(const jobject accessibleC
|
||||
rAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,
|
||||
getParentWithRoleElseRootMethod,
|
||||
accessibleContext, roleName);
|
||||
EXCEPTION_CHECK("Getting ParentWithRoleElseRoot - call to CallObjectMethod()", (AccessibleContext)0);
|
||||
EXCEPTION_CHECK("Getting ParentWithRoleElseRoot - call to CallObjectMethod()", reinterpret_cast<jobject>((AccessibleContext)0));
|
||||
PrintDebugString("[INFO]: rAccessibleContext = %p", rAccessibleContext);
|
||||
jobject globalRef = jniEnv->NewGlobalRef(rAccessibleContext);
|
||||
EXCEPTION_CHECK("Getting ParentWithRoleElseRoot - call to NewGlobalRef()", FALSE);
|
||||
@ -1168,7 +1168,7 @@ AccessBridgeJavaEntryPoints::getActiveDescendent(const jobject accessibleContext
|
||||
rAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,
|
||||
getActiveDescendentMethod,
|
||||
accessibleContext);
|
||||
EXCEPTION_CHECK("Getting ActiveDescendent - call to CallObjectMethod()", (AccessibleContext)0);
|
||||
EXCEPTION_CHECK("Getting ActiveDescendent - call to CallObjectMethod()", reinterpret_cast<jobject>((AccessibleContext)0));
|
||||
PrintDebugString("[INFO]: rAccessibleContext = %p", rAccessibleContext);
|
||||
jobject globalRef = jniEnv->NewGlobalRef(rAccessibleContext);
|
||||
EXCEPTION_CHECK("Getting ActiveDescendant - call to NewGlobalRef()", FALSE);
|
||||
@ -1177,7 +1177,7 @@ AccessBridgeJavaEntryPoints::getActiveDescendent(const jobject accessibleContext
|
||||
return globalRef;
|
||||
} else {
|
||||
PrintDebugString("[ERROR]: either jniEnv == 0 or getActiveDescendentMethod == 0");
|
||||
return (AccessibleContext)0;
|
||||
return reinterpret_cast<jobject>((AccessibleContext)0);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user