mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-14 13:08:09 +00:00
8387675: IS_WINVISTA macro is obsolete
Reviewed-by: aivanov, stuefe, prr
This commit is contained in:
parent
30abe0b3a6
commit
6ec04bb204
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, 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
|
||||
@ -255,11 +255,4 @@ public final class Win32GraphicsEnvironment extends SunGraphicsEnvironment {
|
||||
private static void dwmCompositionChanged(boolean enabled) {
|
||||
isDWMCompositionEnabled = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to find out if the OS is Windows Vista or later.
|
||||
*
|
||||
* @return {@code true} if the OS is Vista or later, {@code false} otherwise
|
||||
*/
|
||||
public static native boolean isVistaOS();
|
||||
}
|
||||
|
||||
@ -1082,16 +1082,10 @@ public abstract class WComponentPeer extends WObjectPeer
|
||||
*/
|
||||
public boolean isAccelCapable() {
|
||||
if (!isAccelCapable ||
|
||||
!isContainingTopLevelAccelCapable((Component)target))
|
||||
{
|
||||
!isContainingTopLevelAccelCapable((Component)target)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean isTranslucent =
|
||||
SunToolkit.isContainingTopLevelTranslucent((Component)target);
|
||||
// D3D/OGL and translucent windows interacted poorly in Windows XP;
|
||||
// these problems are no longer present in Vista
|
||||
return !isTranslucent || Win32GraphicsEnvironment.isVistaOS();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -683,16 +683,6 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
|
||||
throw new IllegalArgumentException(
|
||||
"The value of opacity should be in the range [0.0f .. 1.0f].");
|
||||
}
|
||||
|
||||
if (((this.opacity == 1.0f && opacity < 1.0f) ||
|
||||
(this.opacity < 1.0f && opacity == 1.0f)) &&
|
||||
!Win32GraphicsEnvironment.isVistaOS())
|
||||
{
|
||||
// non-Vista OS: only replace the surface data if opacity status
|
||||
// changed (see WComponentPeer.isAccelCapable() for more)
|
||||
replaceSurfaceDataRecursively((Component)getTarget());
|
||||
}
|
||||
|
||||
this.opacity = opacity;
|
||||
|
||||
final int maxOpacity = 0xff;
|
||||
@ -734,14 +724,6 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
|
||||
}
|
||||
}
|
||||
|
||||
boolean isVistaOS = Win32GraphicsEnvironment.isVistaOS();
|
||||
|
||||
if (this.isOpaque != isOpaque && !isVistaOS) {
|
||||
// non-Vista OS: only replace the surface data if the opacity
|
||||
// status changed (see WComponentPeer.isAccelCapable() for more)
|
||||
replaceSurfaceDataRecursively(target);
|
||||
}
|
||||
|
||||
synchronized (getStateLock()) {
|
||||
this.isOpaque = isOpaque;
|
||||
setOpaqueImpl(isOpaque);
|
||||
@ -756,16 +738,14 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
|
||||
}
|
||||
}
|
||||
|
||||
if (isVistaOS) {
|
||||
// On Vista: setting the window non-opaque makes the window look
|
||||
// rectangular, though still catching the mouse clicks within
|
||||
// its shape only. To restore the correct visual appearance
|
||||
// of the window (i.e. w/ the correct shape) we have to reset
|
||||
// the shape.
|
||||
Shape shape = target.getShape();
|
||||
if (shape != null) {
|
||||
target.setShape(shape);
|
||||
}
|
||||
// Since Vista: setting the window non-opaque makes the window look
|
||||
// rectangular, though still catching the mouse clicks within
|
||||
// its shape only. To restore the correct visual appearance
|
||||
// of the window (i.e. w/ the correct shape) we have to reset
|
||||
// the shape.
|
||||
Shape shape = target.getShape();
|
||||
if (shape != null) {
|
||||
target.setShape(shape);
|
||||
}
|
||||
|
||||
if (target.isVisible()) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2026, 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
|
||||
@ -88,8 +88,7 @@ void GetFlagValues(JNIEnv *env, jclass wFlagsClass)
|
||||
}
|
||||
useD3D = d3dEnabled;
|
||||
forceD3DUsage = d3dSet;
|
||||
setHighDPIAware =
|
||||
(IS_WINVISTA && GetStaticBoolean(env, wFlagsClass, "setHighDPIAware"));
|
||||
setHighDPIAware = GetStaticBoolean(env, wFlagsClass, "setHighDPIAware");
|
||||
JNU_CHECK_EXCEPTION(env);
|
||||
|
||||
J2dTraceLn(J2D_TRACE_INFO, "WindowsFlags (native):");
|
||||
|
||||
@ -154,12 +154,8 @@ typedef AwtObject* PDATA;
|
||||
JNI_TRUE)
|
||||
/* /NEW JNI */
|
||||
|
||||
/*
|
||||
* IS_WINVISTA returns TRUE on Vista
|
||||
*/
|
||||
#define IS_WINVISTA (LOBYTE(LOWORD(::GetVersion())) >= 6)
|
||||
#define IS_WIN8 ( \
|
||||
(IS_WINVISTA && (HIBYTE(LOWORD(::GetVersion())) >= 2)) || \
|
||||
(LOBYTE(LOWORD(::GetVersion())) == 6 && (HIBYTE(LOWORD(::GetVersion())) >= 2)) || \
|
||||
(LOBYTE(LOWORD(::GetVersion())) > 6))
|
||||
|
||||
#define IS_WINVER_ATLEAST(maj, min) \
|
||||
|
||||
@ -272,20 +272,8 @@ void AwtDesktopProperties::GetNonClientParameters() {
|
||||
// general window properties
|
||||
//
|
||||
NONCLIENTMETRICS ncmetrics;
|
||||
ncmetrics.cbSize = sizeof(ncmetrics);
|
||||
|
||||
// Fix for 6944516: specify correct size for ncmetrics on WIN2K/XP
|
||||
// Microsoft recommend to subtract the size of 'iPaddedBorderWidth' field
|
||||
// when running on XP. However this can't be referenced at compile time
|
||||
// with the older SDK, so there use 'lfMessageFont' plus its size.
|
||||
if (!IS_WINVISTA) {
|
||||
#if defined(_MSC_VER)
|
||||
ncmetrics.cbSize = offsetof(NONCLIENTMETRICS, iPaddedBorderWidth);
|
||||
#else
|
||||
ncmetrics.cbSize = offsetof(NONCLIENTMETRICS,lfMessageFont) + sizeof(LOGFONT);
|
||||
#endif
|
||||
} else {
|
||||
ncmetrics.cbSize = sizeof(ncmetrics);
|
||||
}
|
||||
VERIFY( SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncmetrics.cbSize, &ncmetrics, FALSE) );
|
||||
|
||||
float invScaleX;
|
||||
|
||||
@ -395,9 +395,7 @@ AwtMenuItem::DrawSelf(DRAWITEMSTRUCT& drawInfo)
|
||||
//draw check mark
|
||||
int checkWidth = ::GetSystemMetrics(SM_CXMENUCHECK);
|
||||
// Workaround for CR#6401956
|
||||
if (IS_WINVISTA) {
|
||||
AdjustCheckWidth(checkWidth);
|
||||
}
|
||||
AdjustCheckWidth(checkWidth);
|
||||
|
||||
if (IsCheckbox()) {
|
||||
// means that target is a java.awt.CheckboxMenuItem
|
||||
@ -558,9 +556,7 @@ void AwtMenuItem::MeasureSelf(HDC hDC, MEASUREITEMSTRUCT& measureInfo)
|
||||
if (!IsTopMenu()) {
|
||||
int checkWidth = ::GetSystemMetrics(SM_CXMENUCHECK);
|
||||
// Workaround for CR#6401956
|
||||
if (IS_WINVISTA) {
|
||||
AdjustCheckWidth(checkWidth);
|
||||
}
|
||||
AdjustCheckWidth(checkWidth);
|
||||
measureInfo.itemWidth += checkWidth;
|
||||
|
||||
// Add in shortcut width, if one exists.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2026, 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
|
||||
@ -78,7 +78,7 @@ void AwtTextArea::EditSetSel(CHARRANGE &cr) {
|
||||
SendMessage(EM_EXSETSEL, 0, reinterpret_cast<LPARAM>(&cr));
|
||||
SendMessage(EM_HIDESELECTION, TRUE, TRUE);
|
||||
// 6417581: force expected drawing
|
||||
if (IS_WINVISTA && cr.cpMin == cr.cpMax) {
|
||||
if (cr.cpMin == cr.cpMax) {
|
||||
::InvalidateRect(GetHWnd(), NULL, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2026, 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
|
||||
@ -55,7 +55,7 @@ void AwtTextField::EditSetSel(CHARRANGE &cr) {
|
||||
SendMessage(EM_EXSETSEL, 0, reinterpret_cast<LPARAM>(&cr));
|
||||
|
||||
// 6417581: force expected drawing
|
||||
if (IS_WINVISTA && cr.cpMin == cr.cpMax) {
|
||||
if (cr.cpMin == cr.cpMax) {
|
||||
::InvalidateRect(GetHWnd(), NULL, TRUE);
|
||||
}
|
||||
|
||||
|
||||
@ -90,20 +90,13 @@ void DWMResetCompositionEnabled() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if dwm composition is enabled, false if it is not applicable
|
||||
* (if the OS is not Vista) or dwm composition is disabled.
|
||||
* Returns true if DWM composition is enabled, false if DWM composition is disabled.
|
||||
*/
|
||||
BOOL DWMIsCompositionEnabled() {
|
||||
// cheaper to check than whether it's vista or not
|
||||
if (dwmIsCompositionEnabled != DWM_COMP_UNDEFINED) {
|
||||
return (BOOL)dwmIsCompositionEnabled;
|
||||
}
|
||||
|
||||
if (!IS_WINVISTA) {
|
||||
dwmIsCompositionEnabled = FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL bRes = FALSE;
|
||||
|
||||
try {
|
||||
@ -337,13 +330,3 @@ Java_sun_awt_Win32GraphicsEnvironment_getYResolution(JNIEnv *env, jobject wge)
|
||||
CATCH_BAD_ALLOC_RET(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_Win32GraphicsEnvironment
|
||||
* Method: isVistaOS
|
||||
* Signature: ()Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_sun_awt_Win32GraphicsEnvironment_isVistaOS
|
||||
(JNIEnv *env, jclass wgeclass)
|
||||
{
|
||||
return IS_WINVISTA;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user