< prev index next >
src/java.desktop/windows/native/libawt/windows/awt_FileDialog.cpp
Print this page
rev 60071 : 8211999: Window positioning bugs due to overlapping GraphicsDevice bounds (Windows/HiDPI)
Reviewed-by: XXX
*** 1,7 ****
/*
! * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 629,650 ****
// global ref is deleted in _ToBack
CATCH_BAD_ALLOC;
}
! int ScaleDownX(int x, HWND hwnd) {
int screen = AwtWin32GraphicsDevice::DeviceIndexForWindow(hwnd);
Devices::InstanceAccess devices;
AwtWin32GraphicsDevice* device = devices->GetDevice(screen);
! return device == NULL ? x : device->ScaleDownX(x);
}
! int ScaleDownY(int y, HWND hwnd) {
int screen = AwtWin32GraphicsDevice::DeviceIndexForWindow(hwnd);
Devices::InstanceAccess devices;
AwtWin32GraphicsDevice* device = devices->GetDevice(screen);
! return device == NULL ? y : device->ScaleDownY(y);
}
jobject AwtFileDialog::_GetLocationOnScreen(void *param)
{
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
--- 629,650 ----
// global ref is deleted in _ToBack
CATCH_BAD_ALLOC;
}
! int ScaleDownAbsX(int x, HWND hwnd) {
int screen = AwtWin32GraphicsDevice::DeviceIndexForWindow(hwnd);
Devices::InstanceAccess devices;
AwtWin32GraphicsDevice* device = devices->GetDevice(screen);
! return device == NULL ? x : device->ScaleDownAbsX(x);
}
! int ScaleDownAbsY(int y, HWND hwnd) {
int screen = AwtWin32GraphicsDevice::DeviceIndexForWindow(hwnd);
Devices::InstanceAccess devices;
AwtWin32GraphicsDevice* device = devices->GetDevice(screen);
! return device == NULL ? y : device->ScaleDownAbsY(y);
}
jobject AwtFileDialog::_GetLocationOnScreen(void *param)
{
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
*** 655,665 ****
if (::IsWindow(hwnd))
{
RECT rect;
VERIFY(::GetWindowRect(hwnd, &rect));
result = JNU_NewObjectByName(env, "java/awt/Point", "(II)V",
! ScaleDownX(rect.left, hwnd), ScaleDownY(rect.top, hwnd));
}
if (result != NULL)
{
jobject resultRef = env->NewGlobalRef(result);
--- 655,666 ----
if (::IsWindow(hwnd))
{
RECT rect;
VERIFY(::GetWindowRect(hwnd, &rect));
result = JNU_NewObjectByName(env, "java/awt/Point", "(II)V",
! ScaleDownAbsX(rect.left, hwnd),
! ScaleDownAbsY(rect.top, hwnd));
}
if (result != NULL)
{
jobject resultRef = env->NewGlobalRef(result);
< prev index next >