This commit is contained in:
Pete Brunet 2015-06-16 10:38:23 -05:00
commit 687f9dd406
3 changed files with 34 additions and 12 deletions

View File

@ -175,7 +175,7 @@ LookupProcessor::LookupProcessor(const LETableReference &baseAddress,
LEReferenceTo<LangSysTable> langSysTable;
le_uint16 featureCount = 0;
le_uint16 lookupListCount = 0;
le_uint16 requiredFeatureIndex;
le_uint16 requiredFeatureIndex = 0xFFFF;
if (LE_FAILURE(success)) {
return;

View File

@ -851,14 +851,14 @@ final class Win32ShellFolder2 extends ShellFolder {
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 @@ final class Win32ShellFolder2 extends ShellFolder {
// 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 @@ final class Win32ShellFolder2 extends ShellFolder {
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 @@ final class Win32ShellFolder2 extends ShellFolder {
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);
}

View File

@ -868,10 +868,11 @@ JNIEXPORT jint JNICALL Java_sun_awt_shell_Win32ShellFolder2_getIconIndex
/*
* 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 @@ JNIEXPORT jlong JNICALL Java_sun_awt_shell_Win32ShellFolder2_extractIcon
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 @@ JNIEXPORT jlong JNICALL Java_sun_awt_shell_Win32ShellFolder2_extractIcon
fn_DestroyIcon((HICON)hIconLarge);
}
}
} else if (hres == E_PENDING) {
pIcon->Release();
return E_PENDING;
}
pIcon->Release();
}
@ -1284,7 +1289,6 @@ JNIEXPORT jint JNICALL
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));