Author: jgardou
Date: Thu Oct 23 11:46:01 2014
New Revision: 64920
URL:
http://svn.reactos.org/svn/reactos?rev=64920&view=rev
Log:
[WIN32K]
- Use shared icon handles when copying the small class icon from the larger one.
CORE-7575
Modified:
trunk/reactos/win32ss/user/ntuser/class.c
trunk/reactos/win32ss/user/ntuser/window.c
Modified: trunk/reactos/win32ss/user/ntuser/class.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/class.…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/class.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/class.c [iso-8859-1] Thu Oct 23 11:46:01 2014
@@ -248,10 +248,10 @@
#ifdef NEW_CURSORICON
if (Class->spicn)
UserDereferenceObject(Class->spicn);
+ if (Class->spcur)
+ UserDereferenceObject(Class->spcur);
if (Class->spicnSm)
UserDereferenceObject(Class->spicnSm);
- if (Class->spcur)
- UserDereferenceObject(Class->spcur);
#else
if (Class->hIconSmIntern)
IntClassDestroyIcon(Class->hIconSmIntern);
@@ -1976,18 +1976,31 @@
if (NewLong && !Class->spicnSm)
{
/* Create the new small icon from the new large(?) one */
- HICON SmallIconHandle = co_IntCopyImage(
- (HICON)NewLong,
- IMAGE_ICON,
- UserGetSystemMetrics( SM_CXSMICON ),
- UserGetSystemMetrics( SM_CYSMICON ),
- 0);
+ HICON SmallIconHandle = NULL;
+ if((NewIcon->CURSORF_flags & (CURSORF_LRSHARED |
CURSORF_FROMRESOURCE))
+ == (CURSORF_LRSHARED | CURSORF_FROMRESOURCE))
+ {
+ SmallIconHandle = co_IntCopyImage(
+ (HICON)NewLong,
+ IMAGE_ICON,
+ UserGetSystemMetrics( SM_CXSMICON ),
+ UserGetSystemMetrics( SM_CYSMICON ),
+ LR_COPYFROMRESOURCE | LR_SHARED);
+ }
+ if (!SmallIconHandle)
+ {
+ /* Retry without copying from resource */
+ SmallIconHandle = co_IntCopyImage(
+ (HICON)NewLong,
+ IMAGE_ICON,
+ UserGetSystemMetrics( SM_CXSMICON ),
+ UserGetSystemMetrics( SM_CYSMICON ),
+ LR_SHARED);
+ }
if (SmallIconHandle)
{
/* So use it */
NewSmallIcon = Class->spicnSm =
UserGetCurIconObject(SmallIconHandle);
- /* Let the handle go, we have the reference on the object */
- NtUserDestroyCursor(SmallIconHandle, FALSE);
Class->CSF_flags |= CSF_CACHEDSMICON;
}
}
Modified: trunk/reactos/win32ss/user/ntuser/window.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/window…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] Thu Oct 23 11:46:01 2014
@@ -1677,17 +1677,31 @@
#ifdef NEW_CURSORICON
if (Class->spicn && !Class->spicnSm)
{
- HICON IconSmHandle = co_IntCopyImage(
- UserHMGetHandle(Class->spicn),
- IMAGE_ICON,
- UserGetSystemMetrics( SM_CXSMICON ),
- UserGetSystemMetrics( SM_CYSMICON ),
- 0);
+ HICON IconSmHandle = NULL;
+ if((Class->spicn->CURSORF_flags & (CURSORF_LRSHARED |
CURSORF_FROMRESOURCE))
+ == (CURSORF_LRSHARED | CURSORF_FROMRESOURCE))
+ {
+ IconSmHandle = co_IntCopyImage(
+ UserHMGetHandle(Class->spicn),
+ IMAGE_ICON,
+ UserGetSystemMetrics( SM_CXSMICON ),
+ UserGetSystemMetrics( SM_CYSMICON ),
+ LR_COPYFROMRESOURCE | LR_SHARED);
+ }
+ if (!IconSmHandle)
+ {
+ /* Retry without copying from resource */
+ IconSmHandle = co_IntCopyImage(
+ UserHMGetHandle(Class->spicn),
+ IMAGE_ICON,
+ UserGetSystemMetrics( SM_CXSMICON ),
+ UserGetSystemMetrics( SM_CYSMICON ),
+ LR_SHARED);
+ }
+
if (IconSmHandle)
{
Class->spicnSm = UserGetCurIconObject(IconSmHandle);
- /* We can delete the handle, only the pointer is of interest */
- NtUserDestroyCursor(IconSmHandle, FALSE);
Class->CSF_flags |= CSF_CACHEDSMICON;
}
}