On September 8, 2003 03:52 pm, Igor Grahek wrote:
ChangeLog: - TreeView control set Notify window correctly in case that window style is WS_POPUP.
Please send unidiff patches: http://www.winehq.org/site/sending_patches
I'm curious, can't we always use lpcs->hwndParent here? Or maybe do a GetParent(hwnd) when ->hwndParent is NULL? We should propage this to the other controls as well...
I'm pretty new at Wine patching and CreateWindowEx does some other parent checking so I didn't want to break anything else by fixing this one.
Igor
On Tue, 9 Sep 2003, Igor Grahek wrote:
Yes, but this solution just looks to ugly to be propagated to the other controls. Let's find a nice one that we can live with.
Do you think something like this will do?
------- patch begin ----------- Index: dlls/comctl32/treeview.c =================================================================== RCS file: /home/wine/wine/dlls/comctl32/treeview.c,v retrieving revision 1.125 diff -u -r1.125 treeview.c --- dlls/comctl32/treeview.c 5 Sep 2003 23:08:42 -0000 1.125 +++ dlls/comctl32/treeview.c 9 Sep 2003 19:26:47 -0000 @@ -4730,7 +4730,7 @@ /* Create/Destroy *******************************************************/
static LRESULT -TREEVIEW_Create(HWND hwnd) +TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) { RECT rcClient; TREEVIEW_INFO *infoPtr; @@ -4809,7 +4809,10 @@ infoPtr->root->iLevel = -1; infoPtr->root->visibleOrder = -1;
- infoPtr->hwndNotify = GetParent(hwnd); + infoPtr->hwndNotify = lpcs->hwndParent; + if(!IsWindow(infoPtr->hwndNotify)) + infoPtr->hwndNotify = GetParent(hwnd); + #if 0 infoPtr->bTransparent = ( GetWindowLongA( hwnd, GWL_STYLE) & TBSTYLE_FLAT); #endif @@ -5188,7 +5191,7 @@ else { if (uMsg == WM_CREATE) - TREEVIEW_Create(hwnd); + TREEVIEW_Create(hwnd, (LPCREATESTRUCTW)lParam); else goto def; } ------- patch end -------------
I also checked some other controls in comctl32 and every implementation is different. Usualy there is no hwndNotify and GetParent() is used in SendMessageW calls and all of these need to be replaced. Luckily most of control implementations are already forwarding lpcs to *_Create functions.
Igor
On Tue, 9 Sep 2003, Igor Grahek wrote:
Do you think something like this will do?
Yes, this looks much better.
Yes, I also wanted to do this very refactoring for a long time now, so it's good to see other are interested on working on it ;)
"Igor Grahek" igorg@cadlink.com writes:
Why do you need the IsWindow() check? AFAICS the parent should always be valid (or possibly 0 but then GetParent() will be 0 too).
CreateWindowEx set parent to GetDesktopWindow by default and if cs->hwndParent is null or if cs->hwndParent == HWND_MESSAGE it stays that way. Maybe check can be changed this way:
+ infoPtr->hwndNotify = lpcs->hwndParent; + if(!infoPtr->hwndNotify || infoPtr->hwndNotify == HWND_MESSAGE) + infoPtr->hwndNotify = GetParent(hwnd);
but not removed.
Igor