comctl32: rebar: bUnicode and NtfUnicode should be the same
Mikołaj Zalewski
mikolaj at zalewski.pl
Sat Oct 14 13:33:12 CDT 2006
It also removes some if's when SendMessageA and SendMessageW will do the
same.
-------------- next part --------------
diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c
index df6ef19..238ced6 100644
--- a/dlls/comctl32/rebar.c
+++ b/dlls/comctl32/rebar.c
@@ -188,8 +188,7 @@ typedef struct
DWORD orgStyle; /* original style (dwStyle may change) */
SIZE calcSize; /* calculated rebar size */
SIZE oldSize; /* previous calculated rebar size */
- BOOL bUnicode; /* TRUE if this window is W type */
- BOOL NtfUnicode; /* TRUE if parent wants notify in W format */
+ BOOL bUnicode; /* TRUE if parent wants notify in W format */
BOOL DoRedraw; /* TRUE to acutally draw bands */
UINT fStatus; /* Status flags (see below) */
HCURSOR hcurArrow; /* handle to the arrow cursor */
@@ -288,6 +287,8 @@ #define LEADJ(b,i) do { if(infoPtr->dwSt
#define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)GetWindowLongPtrW (hwnd, 0))
+static LRESULT REBAR_NotifyFormat(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam);
+
/* "constant values" retrieved when DLL was initialized */
/* FIXME we do this when the classes are registered. */
@@ -409,8 +410,8 @@ REBAR_DumpBand (REBAR_INFO *iP)
iP->dragNow.x, iP->dragNow.y,
iP->iGrabbedBand);
TRACE("hwnd=%p: style=%08lx, I'm Unicode=%s, notify in Unicode=%s, redraw=%s\n",
- iP->hwndSelf, iP->dwStyle, (iP->bUnicode)?"TRUE":"FALSE",
- (iP->NtfUnicode)?"TRUE":"FALSE", (iP->DoRedraw)?"TRUE":"FALSE");
+ iP->hwndSelf, iP->dwStyle, (iP->bUnicode)?"TRUE":"FALSE",
+ (iP->DoRedraw)?"TRUE":"FALSE");
for (i = 0; i < iP->uNumBands; i++) {
pB = &iP->bands[i];
TRACE("band # %u:", i);
@@ -502,15 +503,9 @@ REBAR_Notify (NMHDR *nmhdr, REBAR_INFO *
nmhdr->hwndFrom = infoPtr->hwndSelf;
nmhdr->code = code;
- TRACE("window %p, code=%08x, %s\n", parent, code,
- (infoPtr->NtfUnicode) ? "via Unicode" : "via ANSI");
+ TRACE("window %p, code=%08x, via %s\n", parent, code, (infoPtr->bUnicode)?"Unicode":"ANSI");
- if (infoPtr->NtfUnicode)
- return SendMessageW (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom,
- (LPARAM)nmhdr);
- else
- return SendMessageA (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom,
- (LPARAM)nmhdr);
+ return SendMessageW(parent, WM_NOTIFY, (WPARAM)nmhdr->idFrom, (LPARAM)nmhdr);
}
static INT
@@ -4176,18 +4171,11 @@ REBAR_NCCreate (HWND hwnd, WPARAM wParam
infoPtr->hcurHorz = LoadCursorW (0, (LPWSTR)IDC_SIZEWE);
infoPtr->hcurVert = LoadCursorW (0, (LPWSTR)IDC_SIZENS);
infoPtr->hcurDrag = LoadCursorW (0, (LPWSTR)IDC_SIZE);
- infoPtr->bUnicode = IsWindowUnicode (hwnd);
infoPtr->fStatus = CREATE_RUNNING;
infoPtr->hFont = GetStockObject (SYSTEM_FONT);
/* issue WM_NOTIFYFORMAT to get unicode status of parent */
- i = SendMessageW(REBAR_GetNotifyParent (infoPtr),
- WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
- if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {
- ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", i);
- i = NFR_ANSI;
- }
- infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;
+ REBASE_NotifyFormat(infoPtr, 0, NFR_REQUERY);
/* Stow away the original style */
infoPtr->orgStyle = cs->style;
@@ -4318,11 +4306,11 @@ REBAR_NotifyFormat (REBAR_INFO *infoPtr,
if (lParam == NF_REQUERY) {
i = SendMessageW(REBAR_GetNotifyParent (infoPtr),
WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
- if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {
+ if ((i != NFR_ANSI) && (i != NFR_UNICODE)) {
ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", i);
i = NFR_ANSI;
}
- infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;
+ infoPtr->bUnicode = (i == NFR_UNICODE) ? 1 : 0;
return (LRESULT)i;
}
return (LRESULT)((infoPtr->bUnicode) ? NFR_UNICODE : NFR_ANSI);
@@ -4721,12 +4709,7 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg,
case WM_COMMAND:
case WM_DRAWITEM:
case WM_NOTIFY:
- if (infoPtr->NtfUnicode)
- return SendMessageW (REBAR_GetNotifyParent (infoPtr),
- uMsg, wParam, lParam);
- else
- return SendMessageA (REBAR_GetNotifyParent (infoPtr),
- uMsg, wParam, lParam);
+ return SendMessageW(REBAR_GetNotifyParent (infoPtr), uMsg, wParam, lParam);
/* case WM_CHARTOITEM: supported according to ControlSpy */
--
1.4.2.3
More information about the wine-patches
mailing list