--- old/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp 2015-09-22 00:07:01.034620700 -0700 +++ new/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp 2015-09-22 00:07:00.815854900 -0700 @@ -963,6 +963,12 @@ ::MapWindowPoints(HWND_DESKTOP, ::GetParent(GetHWnd()), (LPPOINT)&rc, 2); DTRACE_PRINTLN4("AwtComponent::Reshape from %d, %d, %d, %d", rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top); #endif + + x = ScaleUpX(x); + y = ScaleUpY(y); + w = ScaleUpX(w); + h = ScaleUpY(h); + AwtWindow* container = GetContainer(); AwtComponent* parent = GetParent(); if (container != NULL && container == parent) { @@ -2212,8 +2218,11 @@ } for(i = 0; i < 2; i++) { if (un[i] != 0) { - DoCallback("handleExpose", "(IIII)V", un[i]->left, un[i]->top, - un[i]->right-un[i]->left, un[i]->bottom-un[i]->top); + DoCallback("handleExpose", "(IIII)V", + ScaleDownX(un[i]->left), + ScaleDownY(un[i]->top), + ScaleDownX(un[i]->right - un[i]->left), + ScaleDownY(un[i]->bottom - un[i]->top)); } } delete [] buffer; @@ -4603,6 +4612,34 @@ } } +int AwtComponent::ScaleUpX(int x) { + int screen = AwtWin32GraphicsDevice::DeviceIndexForWindow(GetHWnd()); + Devices::InstanceAccess devices; + AwtWin32GraphicsDevice* device = devices->GetDevice(screen); + return device == NULL ? x : device->ScaleUpX(x); +} + +int AwtComponent::ScaleUpY(int y) { + int screen = AwtWin32GraphicsDevice::DeviceIndexForWindow(GetHWnd()); + Devices::InstanceAccess devices; + AwtWin32GraphicsDevice* device = devices->GetDevice(screen); + return device == NULL ? y : device->ScaleUpY(y); +} + +int AwtComponent::ScaleDownX(int x) { + int screen = AwtWin32GraphicsDevice::DeviceIndexForWindow(GetHWnd()); + Devices::InstanceAccess devices; + AwtWin32GraphicsDevice* device = devices->GetDevice(screen); + return device == NULL ? x : device->ScaleDownX(x); +} + +int AwtComponent::ScaleDownY(int y) { + int screen = AwtWin32GraphicsDevice::DeviceIndexForWindow(GetHWnd()); + Devices::InstanceAccess devices; + AwtWin32GraphicsDevice* device = devices->GetDevice(screen); + return device == NULL ? y : device->ScaleDownY(y); +} + jintArray AwtComponent::CreatePrintedPixels(SIZE &loc, SIZE &size, int alpha) { JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); @@ -4896,8 +4933,9 @@ jobject mouseEvent = env->NewObject(mouseEventCls, mouseEventConst, target, id, when, modifiers, - x+insets.left, y+insets.top, - xAbs, yAbs, + ScaleDownX(x + insets.left), + ScaleDownY(y + insets.top), + ScaleDownX(xAbs), ScaleDownY(yAbs), clickCount, popupTrigger, button); if (safe_ExceptionOccurred(env)) { @@ -4964,8 +5002,10 @@ mouseWheelEventConst, target, id, when, modifiers, - x+insets.left, y+insets.top, - xAbs, yAbs, + ScaleDownX(x + insets.left), + ScaleDownY(y + insets.top), + ScaleDownX(xAbs), + ScaleDownY(yAbs), clickCount, popupTrigger, scrollType, scrollAmount, roundedWheelRotation, preciseWheelRotation); @@ -5471,7 +5511,8 @@ RECT rect; VERIFY(::GetWindowRect(p->GetHWnd(),&rect)); result = JNU_NewObjectByName(env, "java/awt/Point", "(II)V", - rect.left, rect.top); + p->ScaleDownX(rect.left), + p->ScaleDownY(rect.top)); } ret: env->DeleteGlobalRef(self); @@ -7059,6 +7100,11 @@ target = parent; } + x = ScaleUpX(x); + y = ScaleUpY(y); + width = ScaleUpX(width); + height = ScaleUpY(height); + // Test whether component's bounds match the native window's RECT rect; VERIFY(::GetWindowRect(GetHWnd(), &rect)); @@ -7251,5 +7297,4 @@ removedDCs = removedDCs->next; delete tmpDCList; } -} - +} \ No newline at end of file