< prev index next >
src/java.desktop/windows/native/libawt/windows/awt_Component.cpp
Print this page
*** 961,970 ****
--- 961,976 ----
RECT rc;
::GetWindowRect(GetHWnd(), &rc);
::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) {
container->SubtractInsetPoint(x, y);
}
*** 2210,2221 ****
}
}
}
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);
}
}
delete [] buffer;
}
::DeleteObject((HGDIOBJ)rgn);
--- 2216,2230 ----
}
}
}
for(i = 0; i < 2; i++) {
if (un[i] != 0) {
! 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;
}
::DeleteObject((HGDIOBJ)rgn);
*** 4601,4610 ****
--- 4610,4647 ----
((BYTE*)(dest++))[3] = alpha;
}
}
}
+ 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);
if (!::IsWindowVisible(GetHWnd())) {
return NULL;
*** 4894,4905 ****
int xAbs = GET_X_LPARAM(curMousePos);
int yAbs = GET_Y_LPARAM(curMousePos);
jobject mouseEvent = env->NewObject(mouseEventCls, mouseEventConst,
target,
id, when, modifiers,
! x+insets.left, y+insets.top,
! xAbs, yAbs,
clickCount, popupTrigger, button);
if (safe_ExceptionOccurred(env)) {
env->ExceptionDescribe();
env->ExceptionClear();
--- 4931,4943 ----
int xAbs = GET_X_LPARAM(curMousePos);
int yAbs = GET_Y_LPARAM(curMousePos);
jobject mouseEvent = env->NewObject(mouseEventCls, mouseEventConst,
target,
id, when, modifiers,
! ScaleDownX(x + insets.left),
! ScaleDownY(y + insets.top),
! ScaleDownX(xAbs), ScaleDownY(yAbs),
clickCount, popupTrigger, button);
if (safe_ExceptionOccurred(env)) {
env->ExceptionDescribe();
env->ExceptionClear();
*** 4962,4973 ****
jobject mouseWheelEvent = env->NewObject(mouseWheelEventCls,
mouseWheelEventConst,
target,
id, when, modifiers,
! x+insets.left, y+insets.top,
! xAbs, yAbs,
clickCount, popupTrigger,
scrollType, scrollAmount,
roundedWheelRotation, preciseWheelRotation);
DASSERT(mouseWheelEvent != NULL);
--- 5000,5013 ----
jobject mouseWheelEvent = env->NewObject(mouseWheelEventCls,
mouseWheelEventConst,
target,
id, when, modifiers,
! ScaleDownX(x + insets.left),
! ScaleDownY(y + insets.top),
! ScaleDownX(xAbs),
! ScaleDownY(yAbs),
clickCount, popupTrigger,
scrollType, scrollAmount,
roundedWheelRotation, preciseWheelRotation);
DASSERT(mouseWheelEvent != NULL);
*** 5469,5479 ****
if (::IsWindow(p->GetHWnd()))
{
RECT rect;
VERIFY(::GetWindowRect(p->GetHWnd(),&rect));
result = JNU_NewObjectByName(env, "java/awt/Point", "(II)V",
! rect.left, rect.top);
}
ret:
env->DeleteGlobalRef(self);
if (result != NULL)
--- 5509,5520 ----
if (::IsWindow(p->GetHWnd()))
{
RECT rect;
VERIFY(::GetWindowRect(p->GetHWnd(),&rect));
result = JNU_NewObjectByName(env, "java/awt/Point", "(II)V",
! p->ScaleDownX(rect.left),
! p->ScaleDownY(rect.top));
}
ret:
env->DeleteGlobalRef(self);
if (result != NULL)
*** 7057,7066 ****
--- 7098,7112 ----
}
env->DeleteLocalRef(target);
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));
#if 0
DASSERT( (x == rect.left) &&
*** 7250,7255 ****
}
removedDCs = removedDCs->next;
delete tmpDCList;
}
}
-
--- 7296,7300 ----
< prev index next >