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
f961dab4
Commit
f961dab4
authored
Aug 01, 2000
by
Marcus Meissner
Committed by
Alexandre Julliard
Aug 01, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed some flicker by detecting if we set the same value again.
parent
cef12530
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
41 deletions
+64
-41
status.c
dlls/comctl32/status.c
+64
-41
No files found.
dlls/comctl32/status.c
View file @
f961dab4
...
@@ -4,6 +4,13 @@
...
@@ -4,6 +4,13 @@
* Copyright 1996 Bruce Milner
* Copyright 1996 Bruce Milner
* Copyright 1998, 1999 Eric Kohl
* Copyright 1998, 1999 Eric Kohl
*/
*/
/*
* FIXME/TODO
* 1) Don't hard code bar to bottom of window, allow CCS_TOP also.
* 2) Tooltip support (almost done).
* 3) I think RedrawWindow() is rather wrong, we should use InvalidateRect
* probably.
*/
#include "winbase.h"
#include "winbase.h"
#include "commctrl.h"
#include "commctrl.h"
...
@@ -12,17 +19,13 @@
...
@@ -12,17 +19,13 @@
DEFAULT_DEBUG_CHANNEL
(
statusbar
)
DEFAULT_DEBUG_CHANNEL
(
statusbar
)
/*
/*
* Run tests using Waite Group Windows95 API Bible Vol. 1&2
* Run tests using Waite Group Windows95 API Bible Vol. 1&2
* The second cdrom contains executables drawstat.exe,gettext.exe,
* The second cdrom contains executables drawstat.exe,gettext.exe,
* simple.exe, getparts.exe, setparts.exe, statwnd.exe
* simple.exe, getparts.exe, setparts.exe, statwnd.exe
*/
*/
/*
* Fixme/Todo
* 1) Don't hard code bar to bottom of window, allow CCS_TOP also.
* 2) Tooltip support (almost done).
*/
#define _MAX(a,b) (((a)>(b))?(a):(b))
#define _MAX(a,b) (((a)>(b))?(a):(b))
#define _MIN(a,b) (((a)>(b))?(b):(a))
#define _MIN(a,b) (((a)>(b))?(b):(a))
...
@@ -149,8 +152,7 @@ STATUSBAR_RefreshPart (HWND hwnd, STATUSWINDOWPART *part, HDC hdc, int itemID)
...
@@ -149,8 +152,7 @@ STATUSBAR_RefreshPart (HWND hwnd, STATUSWINDOWPART *part, HDC hdc, int itemID)
dis
.
itemData
=
(
INT
)
part
->
text
;
dis
.
itemData
=
(
INT
)
part
->
text
;
SendMessageA
(
GetParent
(
hwnd
),
WM_DRAWITEM
,
SendMessageA
(
GetParent
(
hwnd
),
WM_DRAWITEM
,
(
WPARAM
)
dis
.
CtlID
,
(
LPARAM
)
&
dis
);
(
WPARAM
)
dis
.
CtlID
,
(
LPARAM
)
&
dis
);
}
}
else
else
STATUSBAR_DrawPart
(
hdc
,
part
);
STATUSBAR_DrawPart
(
hdc
,
part
);
SelectObject
(
hdc
,
hOldFont
);
SelectObject
(
hdc
,
hOldFont
);
...
@@ -193,8 +195,7 @@ STATUSBAR_Refresh (HWND hwnd, HDC hdc)
...
@@ -193,8 +195,7 @@ STATUSBAR_Refresh (HWND hwnd, HDC hdc)
if
(
infoPtr
->
simple
)
{
if
(
infoPtr
->
simple
)
{
STATUSBAR_RefreshPart
(
hwnd
,
&
infoPtr
->
part0
,
hdc
,
0
);
STATUSBAR_RefreshPart
(
hwnd
,
&
infoPtr
->
part0
,
hdc
,
0
);
}
}
else
{
else
{
for
(
i
=
0
;
i
<
infoPtr
->
numParts
;
i
++
)
{
for
(
i
=
0
;
i
<
infoPtr
->
numParts
;
i
++
)
{
if
(
infoPtr
->
parts
[
i
].
style
&
SBT_OWNERDRAW
)
{
if
(
infoPtr
->
parts
[
i
].
style
&
SBT_OWNERDRAW
)
{
DRAWITEMSTRUCT
dis
;
DRAWITEMSTRUCT
dis
;
...
@@ -207,8 +208,7 @@ STATUSBAR_Refresh (HWND hwnd, HDC hdc)
...
@@ -207,8 +208,7 @@ STATUSBAR_Refresh (HWND hwnd, HDC hdc)
dis
.
itemData
=
(
INT
)
infoPtr
->
parts
[
i
].
text
;
dis
.
itemData
=
(
INT
)
infoPtr
->
parts
[
i
].
text
;
SendMessageA
(
GetParent
(
hwnd
),
WM_DRAWITEM
,
SendMessageA
(
GetParent
(
hwnd
),
WM_DRAWITEM
,
(
WPARAM
)
dis
.
CtlID
,
(
LPARAM
)
&
dis
);
(
WPARAM
)
dis
.
CtlID
,
(
LPARAM
)
&
dis
);
}
}
else
else
STATUSBAR_RefreshPart
(
hwnd
,
&
infoPtr
->
parts
[
i
],
hdc
,
i
);
STATUSBAR_RefreshPart
(
hwnd
,
&
infoPtr
->
parts
[
i
],
hdc
,
i
);
}
}
}
}
...
@@ -506,26 +506,28 @@ STATUSBAR_SetIcon (HWND hwnd, WPARAM wParam, LPARAM lParam)
...
@@ -506,26 +506,28 @@ STATUSBAR_SetIcon (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
{
STATUSWINDOWINFO
*
self
=
STATUSBAR_GetInfoPtr
(
hwnd
);
STATUSWINDOWINFO
*
self
=
STATUSBAR_GetInfoPtr
(
hwnd
);
INT
nPart
=
(
INT
)
wParam
&
0x00ff
;
INT
nPart
=
(
INT
)
wParam
&
0x00ff
;
HDC
hdc
;
if
((
nPart
<
-
1
)
||
(
nPart
>=
self
->
numParts
))
if
((
nPart
<
-
1
)
||
(
nPart
>=
self
->
numParts
))
return
FALSE
;
return
FALSE
;
hdc
=
GetDC
(
hwnd
);
TRACE
(
"setting part %d, icon %lx
\n
"
,
nPart
,
lParam
);
if
(
nPart
==
-
1
)
{
if
(
nPart
==
-
1
)
{
if
(
self
->
part0
.
hIcon
==
(
HICON
)
lParam
)
/* same as - no redraw */
return
TRUE
;
self
->
part0
.
hIcon
=
(
HICON
)
lParam
;
self
->
part0
.
hIcon
=
(
HICON
)
lParam
;
if
(
self
->
simple
)
if
(
self
->
simple
)
RedrawWindow
(
hwnd
,
&
self
->
part0
.
bound
,(
HRGN
)
NULL
,
RedrawWindow
(
hwnd
,
&
self
->
part0
.
bound
,(
HRGN
)
NULL
,
RDW_INVALIDATE
|
RDW_UPDATENOW
);
RDW_INVALIDATE
|
RDW_UPDATENOW
);
}
}
else
{
else
{
if
(
self
->
parts
[
nPart
].
hIcon
==
(
HICON
)
lParam
)
/* same as - no redraw */
return
TRUE
;
self
->
parts
[
nPart
].
hIcon
=
(
HICON
)
lParam
;
self
->
parts
[
nPart
].
hIcon
=
(
HICON
)
lParam
;
if
(
!
(
self
->
simple
))
if
(
!
(
self
->
simple
))
RedrawWindow
(
hwnd
,
&
self
->
parts
[
nPart
].
bound
,(
HRGN
)
NULL
,
RedrawWindow
(
hwnd
,
&
self
->
parts
[
nPart
].
bound
,(
HRGN
)
NULL
,
RDW_INVALIDATE
|
RDW_UPDATENOW
);
RDW_INVALIDATE
|
RDW_UPDATENOW
);
}
}
ReleaseDC
(
hwnd
,
hdc
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -564,6 +566,8 @@ STATUSBAR_SetParts (HWND hwnd, WPARAM wParam, LPARAM lParam)
...
@@ -564,6 +566,8 @@ STATUSBAR_SetParts (HWND hwnd, WPARAM wParam, LPARAM lParam)
int
i
;
int
i
;
int
oldNumParts
;
int
oldNumParts
;
TRACE
(
"(%d,%p)
\n
"
,
wParam
,(
LPVOID
)
lParam
);
if
(
self
->
simple
)
if
(
self
->
simple
)
self
->
simple
=
FALSE
;
self
->
simple
=
FALSE
;
...
@@ -576,7 +580,7 @@ STATUSBAR_SetParts (HWND hwnd, WPARAM wParam, LPARAM lParam)
...
@@ -576,7 +580,7 @@ STATUSBAR_SetParts (HWND hwnd, WPARAM wParam, LPARAM lParam)
COMCTL32_Free
(
self
->
parts
[
i
].
text
);
COMCTL32_Free
(
self
->
parts
[
i
].
text
);
}
}
}
}
else
if
(
oldNumParts
<
self
->
numParts
)
{
if
(
oldNumParts
<
self
->
numParts
)
{
tmp
=
COMCTL32_Alloc
(
sizeof
(
STATUSWINDOWPART
)
*
self
->
numParts
);
tmp
=
COMCTL32_Alloc
(
sizeof
(
STATUSWINDOWPART
)
*
self
->
numParts
);
for
(
i
=
0
;
i
<
oldNumParts
;
i
++
)
{
for
(
i
=
0
;
i
<
oldNumParts
;
i
++
)
{
tmp
[
i
]
=
self
->
parts
[
i
];
tmp
[
i
]
=
self
->
parts
[
i
];
...
@@ -585,10 +589,16 @@ STATUSBAR_SetParts (HWND hwnd, WPARAM wParam, LPARAM lParam)
...
@@ -585,10 +589,16 @@ STATUSBAR_SetParts (HWND hwnd, WPARAM wParam, LPARAM lParam)
COMCTL32_Free
(
self
->
parts
);
COMCTL32_Free
(
self
->
parts
);
self
->
parts
=
tmp
;
self
->
parts
=
tmp
;
}
}
if
(
oldNumParts
==
self
->
numParts
)
{
for
(
i
=
0
;
i
<
oldNumParts
;
i
++
)
if
(
self
->
parts
[
i
].
x
!=
parts
[
i
])
break
;
if
(
i
==
oldNumParts
)
/* Unchanged? no need to redraw! */
return
TRUE
;
}
for
(
i
=
0
;
i
<
self
->
numParts
;
i
++
)
{
for
(
i
=
0
;
i
<
self
->
numParts
;
i
++
)
self
->
parts
[
i
].
x
=
parts
[
i
];
self
->
parts
[
i
].
x
=
parts
[
i
];
}
if
(
self
->
hwndToolTip
)
{
if
(
self
->
hwndToolTip
)
{
INT
nTipCount
=
INT
nTipCount
=
...
@@ -614,17 +624,12 @@ STATUSBAR_SetParts (HWND hwnd, WPARAM wParam, LPARAM lParam)
...
@@ -614,17 +624,12 @@ STATUSBAR_SetParts (HWND hwnd, WPARAM wParam, LPARAM lParam)
INT
i
;
INT
i
;
for
(
i
=
nTipCount
-
1
;
i
>=
self
->
numParts
;
i
--
)
{
for
(
i
=
nTipCount
-
1
;
i
>=
self
->
numParts
;
i
--
)
{
FIXME
(
"delete tool %d
\n
"
,
i
);
FIXME
(
"delete tool %d
\n
"
,
i
);
}
}
}
}
}
}
STATUSBAR_SetPartBounds
(
hwnd
);
STATUSBAR_SetPartBounds
(
hwnd
);
RedrawWindow
(
hwnd
,(
RECT
*
)
NULL
,(
HRGN
)
NULL
,
RDW_INVALIDATE
|
RDW_UPDATENOW
);
RedrawWindow
(
hwnd
,(
RECT
*
)
NULL
,(
HRGN
)
NULL
,
RDW_INVALIDATE
|
RDW_UPDATENOW
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -637,34 +642,51 @@ STATUSBAR_SetTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
...
@@ -637,34 +642,51 @@ STATUSBAR_SetTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
int
part_num
;
int
part_num
;
int
style
;
int
style
;
LPSTR
text
;
LPSTR
text
;
int
len
;
BOOL
changed
=
FALSE
;
text
=
(
LPSTR
)
lParam
;
text
=
(
LPSTR
)
lParam
;
part_num
=
((
INT
)
wParam
)
&
0x00ff
;
part_num
=
((
INT
)
wParam
)
&
0x00ff
;
style
=
((
INT
)
wParam
)
&
0xff00
;
style
=
((
INT
)
wParam
)
&
0xff00
;
TRACE
(
"setting part %d, text %s
\n
"
,
part_num
,
debugstr_a
(
text
));
if
(
part_num
==
255
)
if
(
part_num
==
255
)
part
=
&
self
->
part0
;
part
=
&
self
->
part0
;
else
if
(
!
self
->
simple
&&
self
->
parts
!=
NULL
)
else
if
(
!
self
->
simple
&&
self
->
parts
!=
NULL
)
part
=
&
self
->
parts
[
part_num
];
part
=
&
self
->
parts
[
part_num
];
if
(
!
part
)
return
FALSE
;
if
(
!
part
)
return
FALSE
;
if
(
!
(
part
->
style
&
SBT_OWNERDRAW
)
&&
part
->
text
)
if
(
part
->
style
!=
style
)
COMCTL32_Free
(
part
->
text
);
changed
=
TRUE
;
part
->
text
=
0
;
part
->
style
=
style
;
if
(
style
&
SBT_OWNERDRAW
)
{
if
(
style
&
SBT_OWNERDRAW
)
{
if
(
part
->
text
==
(
LPWSTR
)
text
)
return
TRUE
;
part
->
text
=
(
LPWSTR
)
text
;
part
->
text
=
(
LPWSTR
)
text
;
}
}
else
{
else
{
LPWSTR
ntext
;
/* duplicate string */
if
(
text
&&
(
len
=
lstrlenA
(
text
)))
{
/* check if text is unchanged -> no need to redraw */
part
->
text
=
COMCTL32_Alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
text
)
{
lstrcpyAtoW
(
part
->
text
,
text
);
LPWSTR
tmptext
=
COMCTL32_Alloc
((
lstrlenA
(
text
)
+
1
)
*
sizeof
(
WCHAR
));
lstrcpyAtoW
(
tmptext
,
text
);
if
(
!
changed
&&
part
->
text
&&
!
lstrcmpW
(
tmptext
,
part
->
text
))
{
COMCTL32_Free
(
tmptext
);
return
TRUE
;
}
ntext
=
tmptext
;
}
else
{
if
(
!
changed
&&
!
part
->
text
)
return
TRUE
;
ntext
=
0
;
}
}
}
part
->
style
=
style
;
if
(
part
->
text
)
COMCTL32_Free
(
part
->
text
);
part
->
text
=
ntext
;
}
RedrawWindow
(
hwnd
,
&
part
->
bound
,(
HRGN
)
NULL
,
RDW_INVALIDATE
|
RDW_UPDATENOW
);
RedrawWindow
(
hwnd
,
&
part
->
bound
,(
HRGN
)
NULL
,
RDW_INVALIDATE
|
RDW_UPDATENOW
);
return
TRUE
;
return
TRUE
;
...
@@ -693,10 +715,10 @@ STATUSBAR_SetTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
...
@@ -693,10 +715,10 @@ STATUSBAR_SetTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
COMCTL32_Free
(
part
->
text
);
COMCTL32_Free
(
part
->
text
);
part
->
text
=
0
;
part
->
text
=
0
;
/* FIXME: add "no need to redraw logic" */
if
(
style
&
SBT_OWNERDRAW
)
{
if
(
style
&
SBT_OWNERDRAW
)
{
part
->
text
=
text
;
part
->
text
=
text
;
}
}
else
{
else
{
/* duplicate string */
/* duplicate string */
if
(
text
&&
(
len
=
lstrlenW
(
text
)))
{
if
(
text
&&
(
len
=
lstrlenW
(
text
)))
{
part
->
text
=
COMCTL32_Alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
part
->
text
=
COMCTL32_Alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
...
@@ -772,6 +794,9 @@ STATUSBAR_Simple (HWND hwnd, WPARAM wParam, LPARAM lParam)
...
@@ -772,6 +794,9 @@ STATUSBAR_Simple (HWND hwnd, WPARAM wParam, LPARAM lParam)
STATUSWINDOWINFO
*
infoPtr
=
STATUSBAR_GetInfoPtr
(
hwnd
);
STATUSWINDOWINFO
*
infoPtr
=
STATUSBAR_GetInfoPtr
(
hwnd
);
NMHDR
nmhdr
;
NMHDR
nmhdr
;
if
(
infoPtr
->
simple
==
wParam
)
/* no need to change */
return
TRUE
;
infoPtr
->
simple
=
(
BOOL
)
wParam
;
infoPtr
->
simple
=
(
BOOL
)
wParam
;
/* send notification */
/* send notification */
...
@@ -779,9 +804,7 @@ STATUSBAR_Simple (HWND hwnd, WPARAM wParam, LPARAM lParam)
...
@@ -779,9 +804,7 @@ STATUSBAR_Simple (HWND hwnd, WPARAM wParam, LPARAM lParam)
nmhdr
.
idFrom
=
GetWindowLongA
(
hwnd
,
GWL_ID
);
nmhdr
.
idFrom
=
GetWindowLongA
(
hwnd
,
GWL_ID
);
nmhdr
.
code
=
SBN_SIMPLEMODECHANGE
;
nmhdr
.
code
=
SBN_SIMPLEMODECHANGE
;
SendMessageA
(
GetParent
(
hwnd
),
WM_NOTIFY
,
0
,
(
LPARAM
)
&
nmhdr
);
SendMessageA
(
GetParent
(
hwnd
),
WM_NOTIFY
,
0
,
(
LPARAM
)
&
nmhdr
);
RedrawWindow
(
hwnd
,(
RECT
*
)
NULL
,(
HRGN
)
NULL
,
RDW_INVALIDATE
|
RDW_UPDATENOW
);
RedrawWindow
(
hwnd
,(
RECT
*
)
NULL
,(
HRGN
)
NULL
,
RDW_INVALIDATE
|
RDW_UPDATENOW
);
return
TRUE
;
return
TRUE
;
}
}
...
...
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