--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/LookupProcessor.cpp Mon Jun 15 12:36:35 2015 -0500
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/LookupProcessor.cpp Tue Jun 16 10:38:23 2015 -0500
@@ -175,7 +175,7 @@
LEReferenceTo<LangSysTable> langSysTable;
le_uint16 featureCount = 0;
le_uint16 lookupListCount = 0;
- le_uint16 requiredFeatureIndex;
+ le_uint16 requiredFeatureIndex = 0xFFFF;
if (LE_FAILURE(success)) {
return;
--- a/jdk/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java Mon Jun 15 12:36:35 2015 -0500
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java Tue Jun 16 10:38:23 2015 -0500
@@ -851,14 +851,14 @@
return getLinkLocation(true);
}
- private ShellFolder getLinkLocation(final boolean resolve) {
- return invoke(new Callable<ShellFolder>() {
- public ShellFolder call() {
+ private Win32ShellFolder2 getLinkLocation(final boolean resolve) {
+ return invoke(new Callable<Win32ShellFolder2>() {
+ public Win32ShellFolder2 call() {
if (!isLink()) {
return null;
}
- ShellFolder location = null;
+ Win32ShellFolder2 location = null;
long linkLocationPIDL = getLinkLocation(getParentIShellFolder(),
getRelativePIDL(), resolve);
if (linkLocationPIDL != 0) {
@@ -968,7 +968,7 @@
// NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private static native long extractIcon(long parentIShellFolder, long relativePIDL,
- boolean getLargeIcon);
+ boolean getLargeIcon, boolean getDefaultIcon);
// Returns an icon from the Windows system icon list in the form of an HICON
private static native long getSystemIcon(int iconID);
@@ -1019,7 +1019,13 @@
invoke(new Callable<Image>() {
public Image call() {
Image newIcon = null;
- if (isFileSystem()) {
+ if (isLink()) {
+ Win32ShellFolder2 folder = getLinkLocation(false);
+ if (folder != null && folder.isLibrary()) {
+ return folder.getIcon(getLargeIcon);
+ }
+ }
+ if (isFileSystem() || isLibrary()) {
long parentIShellIcon = (parent != null)
? ((Win32ShellFolder2) parent).getIShellIcon()
: 0L;
@@ -1049,7 +1055,19 @@
if (newIcon == null) {
// These are only cached per object
long hIcon = extractIcon(getParentIShellFolder(),
- getRelativePIDL(), getLargeIcon);
+ getRelativePIDL(), getLargeIcon, false);
+ // E_PENDING: loading can take time so get the default
+ if(hIcon <= 0) {
+ hIcon = extractIcon(getParentIShellFolder(),
+ getRelativePIDL(), getLargeIcon, true);
+ if(hIcon <= 0) {
+ if (isDirectory()) {
+ return getShell32Icon(4, getLargeIcon);
+ } else {
+ return getShell32Icon(1, getLargeIcon);
+ }
+ }
+ }
newIcon = makeIcon(hIcon, getLargeIcon);
disposeIcon(hIcon);
}
--- a/jdk/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp Mon Jun 15 12:36:35 2015 -0500
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp Tue Jun 16 10:38:23 2015 -0500
@@ -868,10 +868,11 @@
/*
* Class: sun_awt_shell_Win32ShellFolder2
* Method: extractIcon
- * Signature: (JJZ)J
+ * Signature: (JJZZ)J
*/
JNIEXPORT jlong JNICALL Java_sun_awt_shell_Win32ShellFolder2_extractIcon
- (JNIEnv* env, jclass cls, jlong pIShellFolderL, jlong relativePIDL, jboolean getLargeIcon)
+ (JNIEnv* env, jclass cls, jlong pIShellFolderL, jlong relativePIDL,
+ jboolean getLargeIcon, jboolean getDefaultIcon)
{
IShellFolder* pIShellFolder = (IShellFolder*)pIShellFolderL;
LPITEMIDLIST pidl = (LPITEMIDLIST)relativePIDL;
@@ -889,7 +890,8 @@
WCHAR szBuf[MAX_PATH];
INT index;
UINT flags;
- hres = pIcon->GetIconLocation(GIL_FORSHELL, szBuf, MAX_PATH, &index, &flags);
+ UINT uFlags = getDefaultIcon ? GIL_DEFAULTICON : GIL_FORSHELL | GIL_ASYNC;
+ hres = pIcon->GetIconLocation(uFlags, szBuf, MAX_PATH, &index, &flags);
if (SUCCEEDED(hres)) {
HICON hIconLarge;
hres = pIcon->Extract(szBuf, index, &hIconLarge, &hIcon, (16 << 16) + 32);
@@ -901,6 +903,9 @@
fn_DestroyIcon((HICON)hIconLarge);
}
}
+ } else if (hres == E_PENDING) {
+ pIcon->Release();
+ return E_PENDING;
}
pIcon->Release();
}
@@ -1284,7 +1289,6 @@
JNIEXPORT jobjectArray JNICALL Java_sun_awt_shell_Win32ShellFolder2_loadKnownFolders
(JNIEnv* env, jclass cls )
{
- CoInitialize(NULL);
IKnownFolderManager* pkfm = NULL;
HRESULT hr = CoCreateInstance(CLSID_KnownFolderManager, NULL,
CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pkfm));