Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
62ac036b
Commit
62ac036b
authored
Oct 15, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Add a helper to retrieve the dimensions of an icon.
parent
538b2474
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
23 deletions
+33
-23
cursoricon.c
dlls/user32/cursoricon.c
+14
-0
static.c
dlls/user32/static.c
+16
-16
uitools.c
dlls/user32/uitools.c
+2
-7
user_private.h
dlls/user32/user_private.h
+1
-0
No files found.
dlls/user32/cursoricon.c
View file @
62ac036b
...
...
@@ -473,6 +473,20 @@ void CURSORICON_FreeModuleIcons( HMODULE16 hMod16 )
LeaveCriticalSection
(
&
IconCrst
);
}
/**********************************************************************
* get_icon_size
*/
BOOL
get_icon_size
(
HICON
handle
,
SIZE
*
size
)
{
CURSORICONINFO
*
info
;
if
(
!
(
info
=
GlobalLock16
(
HICON_16
(
handle
)
)))
return
FALSE
;
size
->
cx
=
info
->
nWidth
;
size
->
cy
=
info
->
nHeight
;
GlobalUnlock16
(
HICON_16
(
handle
)
);
return
TRUE
;
}
/*
* The following macro functions account for the irregularities of
* accessing cursor and icon resources in files and resource entries.
...
...
dlls/user32/static.c
View file @
62ac036b
...
...
@@ -148,12 +148,12 @@ static void restore_clipping(HDC hdc, HRGN hrgn)
static
HICON
STATIC_SetIcon
(
HWND
hwnd
,
HICON
hicon
,
DWORD
style
)
{
HICON
prevIcon
;
CURSORICONINFO
*
info
;
SIZE
size
;
if
((
style
&
SS_TYPEMASK
)
!=
SS_ICON
)
return
0
;
i
nfo
=
hicon
?
GlobalLock16
(
HICON_16
(
hicon
))
:
NULL
;
if
(
hicon
&&
!
info
)
{
WARN
(
"hicon != 0, but in
fo == 0
\n
"
);
i
f
(
hicon
&&
!
get_icon_size
(
hicon
,
&
size
))
{
WARN
(
"hicon != 0, but in
valid
\n
"
);
return
0
;
}
prevIcon
=
(
HICON
)
SetWindowLongPtrW
(
hwnd
,
HICON_GWL_OFFSET
,
(
LONG_PTR
)
hicon
);
...
...
@@ -170,11 +170,9 @@ static HICON STATIC_SetIcon( HWND hwnd, HICON hicon, DWORD style )
}
else */
{
SetWindowPos
(
hwnd
,
0
,
0
,
0
,
info
->
nWidth
,
info
->
nHeight
,
SWP_NOACTIVATE
|
SWP_NOMOVE
|
SWP_NOZORDER
);
SetWindowPos
(
hwnd
,
0
,
0
,
0
,
size
.
cx
,
size
.
cy
,
SWP_NOACTIVATE
|
SWP_NOMOVE
|
SWP_NOZORDER
);
}
}
if
(
info
)
GlobalUnlock16
(
HICON_16
(
hicon
));
return
prevIcon
;
}
...
...
@@ -573,8 +571,10 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
case
STM_GETIMAGE
:
return
(
LRESULT
)
STATIC_GetImage
(
hwnd
,
wParam
,
full_style
);
case
STM_GETICON16
:
return
HICON_16
(
STATIC_GetImage
(
hwnd
,
IMAGE_ICON
,
full_style
));
case
STM_GETICON
:
return
(
LRESULT
)
STATIC_GetImage
(
hwnd
,
IMAGE_ICON
,
full_style
);
...
...
@@ -598,6 +598,8 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
break
;
case
STM_SETICON16
:
wParam
=
(
WPARAM
)
HICON_32
(
(
HICON16
)
wParam
);
/* fall through */
case
STM_SETICON
:
lResult
=
(
LRESULT
)
STATIC_SetIcon
(
hwnd
,
(
HICON
)
wParam
,
full_style
);
STATIC_TryPaintFcn
(
hwnd
,
full_style
);
...
...
@@ -800,13 +802,12 @@ static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style )
RECT
rc
,
iconRect
;
HBRUSH
hbrush
;
HICON
hIcon
;
CURSORICONINFO
*
info
;
SIZE
size
;
GetClientRect
(
hwnd
,
&
rc
);
hbrush
=
STATIC_SendWmCtlColorStatic
(
hwnd
,
hdc
);
hIcon
=
(
HICON
)
GetWindowLongPtrW
(
hwnd
,
HICON_GWL_OFFSET
);
info
=
hIcon
?
GlobalLock16
(
HICON_16
(
hIcon
))
:
NULL
;
if
(
!
hIcon
||
!
info
)
if
(
!
hIcon
||
!
get_icon_size
(
hIcon
,
&
size
))
{
FillRect
(
hdc
,
&
rc
,
hbrush
);
}
...
...
@@ -814,10 +815,10 @@ static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style )
{
if
(
style
&
SS_CENTERIMAGE
)
{
iconRect
.
left
=
(
rc
.
right
-
rc
.
left
)
/
2
-
info
->
nWidth
/
2
;
iconRect
.
top
=
(
rc
.
bottom
-
rc
.
top
)
/
2
-
info
->
nHeight
/
2
;
iconRect
.
right
=
iconRect
.
left
+
info
->
nWidth
;
iconRect
.
bottom
=
iconRect
.
top
+
info
->
nHeight
;
iconRect
.
left
=
(
rc
.
right
-
rc
.
left
)
/
2
-
size
.
cx
/
2
;
iconRect
.
top
=
(
rc
.
bottom
-
rc
.
top
)
/
2
-
size
.
cy
/
2
;
iconRect
.
right
=
iconRect
.
left
+
size
.
cx
;
iconRect
.
bottom
=
iconRect
.
top
+
size
.
cy
;
}
else
iconRect
=
rc
;
...
...
@@ -825,7 +826,6 @@ static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style )
DrawIconEx
(
hdc
,
iconRect
.
left
,
iconRect
.
top
,
hIcon
,
iconRect
.
right
-
iconRect
.
left
,
iconRect
.
bottom
-
iconRect
.
top
,
0
,
NULL
,
DI_NORMAL
);
}
if
(
info
)
GlobalUnlock16
(
HICON_16
(
hIcon
));
}
static
void
STATIC_PaintBitmapfn
(
HWND
hwnd
,
HDC
hdc
,
DWORD
style
)
...
...
dlls/user32/uitools.c
View file @
62ac036b
...
...
@@ -22,8 +22,8 @@
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "wine/winuser16.h"
#include "winuser.h"
#include "user_private.h"
#include "wine/unicode.h"
...
...
@@ -1597,7 +1597,6 @@ static BOOL UITOOLS_DrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp
if
(
!
cx
||
!
cy
)
{
SIZE
s
;
CURSORICONINFO
*
ici
;
BITMAP
bm
;
switch
(
opcode
)
...
...
@@ -1612,11 +1611,7 @@ static BOOL UITOOLS_DrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp
break
;
case
DST_ICON
:
ici
=
GlobalLock16
((
HGLOBAL16
)
lp
);
if
(
!
ici
)
return
FALSE
;
s
.
cx
=
ici
->
nWidth
;
s
.
cy
=
ici
->
nHeight
;
GlobalUnlock16
((
HGLOBAL16
)
lp
);
if
(
!
get_icon_size
(
(
HICON
)
lp
,
&
s
))
return
FALSE
;
break
;
case
DST_BITMAP
:
...
...
dlls/user32/user_private.h
View file @
62ac036b
...
...
@@ -328,6 +328,7 @@ typedef struct
#include "poppack.h"
extern
void
CURSORICON_FreeModuleIcons
(
HMODULE16
hModule
)
DECLSPEC_HIDDEN
;
extern
BOOL
get_icon_size
(
HICON
handle
,
SIZE
*
size
)
DECLSPEC_HIDDEN
;
/* Mingw's assert() imports MessageBoxA and gets confused by user32 exporting it */
#ifdef __MINGW32__
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment