Changeset 134 for trunk/src


Ignore:
Timestamp:
Jun 20, 1999, 6:47:39 PM (26 years ago)
Author:
sandervl
Message:

Parent notification changes

Location:
trunk/src/user32
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/defwndproc.cpp

    r37 r134  
    1 /* $Id: defwndproc.cpp,v 1.2 1999-06-06 12:25:49 cbratschi Exp $ */
     1/* $Id: defwndproc.cpp,v 1.3 1999-06-20 16:47:39 sandervl Exp $ */
    22
    33/*
     
    4444                return GetSysColorBrush(COLOR_BTNFACE);
    4545
     46        case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     47                dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
     48                return 0;
    4649        default:
    4750                return O32_DefWindowProc(hwnd, Msg, wParam, lParam);
     
    7982                return GetSysColorBrush(COLOR_BTNFACE);
    8083
     84        case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     85                dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
     86                return 0;
     87
    8188        default:
    8289                return O32_DefWindowProc(hwnd, Msg, wParam, lParam);
     
    113120                return GetSysColorBrush(COLOR_BTNFACE);
    114121
     122        case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     123                dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
     124                return 0;
     125
    115126        default:
    116127                return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
     
    147158                SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
    148159                return GetSysColorBrush(COLOR_BTNFACE);
     160
     161        case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     162                dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
     163                return 0;
    149164
    150165        default:
     
    190205                return GetSysColorBrush(COLOR_BTNFACE);
    191206
     207        case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     208                dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwndFrame));
     209                return 0;
     210
    192211        default:
    193212                return O32_DefFrameProc(hwndFrame, hwndClient, Msg, wParam, lParam);
     
    233252                return GetSysColorBrush(COLOR_BTNFACE);
    234253
     254        case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     255                dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwndFrame));
     256                return 0;
     257
    235258        default:
    236259                return O32_DefFrameProc(hwndFrame, hwndClient, Msg, wParam, lParam);
     
    267290                return GetSysColorBrush(COLOR_BTNFACE);
    268291
     292        case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     293                dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
     294                return 0;
     295
    269296        default:
    270297                return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
     
    302329                return GetSysColorBrush(COLOR_BTNFACE);
    303330
     331        case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     332                dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
     333                return 0;
     334
    304335        default:
    305336                return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
  • trunk/src/user32/initterm.cpp

    r120 r134  
    1 /* $Id: initterm.cpp,v 1.3 1999-06-19 10:54:47 sandervl Exp $ */
     1/* $Id: initterm.cpp,v 1.4 1999-06-20 16:47:39 sandervl Exp $ */
    22
    33/*
     
    124124{
    125125   dprintf(("user32 exit\n"));
     126   UnregisterSystemClasses();
    126127   _ctordtorTerm();
    127128   CRT_term();
  • trunk/src/user32/user32.cpp

    r131 r134  
    1 /* $Id: user32.cpp,v 1.8 1999-06-20 14:02:13 sandervl Exp $ */
     1/* $Id: user32.cpp,v 1.9 1999-06-20 16:47:39 sandervl Exp $ */
    22
    33/*
     
    625625    }
    626626    if(window) {
    627         window->SetWindowHandle(hwnd);
    628     }
    629     //SvL: Taken from Wine
    630     if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
    631     {
    632         /* Notify the parent window only */
    633         SendMessageA(parent, WM_PARENTNOTIFY, MAKEWPARAM(WM_CREATE, 0), (LPARAM)hwnd );
     627        window->SetWindowHandle(hwnd);
    634628    }
    635629
     
    955949 LONG rc;
    956950
    957 #ifdef DEBUG
    958     WriteLog("USER32:  GetWindowLong %X %d\n", hwnd, nIndex);
    959 #endif
    960951    if(nIndex == GWL_WNDPROC || nIndex == DWL_DLGPROC) {
    961      Win32WindowProc *window = Win32WindowProc::FindProc(hwnd);
    962      if(window && !(nIndex == DWL_DLGPROC && window->IsWindow() == TRUE)) {
    963         return (LONG)window->GetWin32Callback();
    964      }
     952#ifdef DEBUG
     953        WriteLog("USER32:  GetWindowLong %X %d\n", hwnd, nIndex);
     954#endif
     955        Win32WindowProc *window = Win32WindowProc::FindProc(hwnd);
     956        if(window && !(nIndex == DWL_DLGPROC && window->IsWindow() == TRUE)) {
     957                return (LONG)window->GetWin32Callback();
     958        }
    965959    }
    966960    rc = O32_GetWindowLong(hwnd, nIndex);
    967 #ifdef DEBUG
    968     WriteLog("USER32:  GetWindowLong returned %X\n", rc);
    969 #endif
    970961    return(rc);
    971962}
     
    26392630BOOL WIN32API PtInRect( const RECT * arg1, POINT  arg2)
    26402631{
    2641 #ifdef DEBUG
     2632#ifdef DEBUG1
    26422633    WriteLog("USER32:  PtInRect\n");
    26432634#endif
  • trunk/src/user32/wndclass.cpp

    r131 r134  
    1 /* $Id: wndclass.cpp,v 1.4 1999-06-20 14:02:13 sandervl Exp $ */
     1/* $Id: wndclass.cpp,v 1.5 1999-06-20 16:47:38 sandervl Exp $ */
    22
    33/*
     
    4343WNDPROC_O32 ScrollbarHandler = 0;
    4444WNDPROC_O32 StaticHandler = 0;
     45
     46HWND hwndButton = 0;
     47HWND hwndListbox = 0;
     48HWND hwndEdit = 0;
     49HWND hwndCombobox = 0;
     50HWND hwndScrollbar = 0;
     51HWND hwndMdiClient = 0;
     52HWND hwndStatic = 0;
     53
     54Win32WindowClass *ButtonClass = 0;
     55Win32WindowClass *ListboxClass = 0;
     56Win32WindowClass *EditClass = 0;
     57Win32WindowClass *ComboboxClass = 0;
     58Win32WindowClass *MdiClientClass = 0;
     59Win32WindowClass *ScrollbarClass = 0;
     60Win32WindowClass *StaticClass = 0;
    4561//******************************************************************************
    4662//******************************************************************************
    4763LRESULT WIN32API ButtonCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    4864{
     65  switch(Msg)
     66  {
     67        case WM_CREATE:
     68        case WM_DESTROY:
     69        case WM_LBUTTONDOWN:
     70        case WM_MBUTTONDOWN:
     71        case WM_RBUTTONDOWN:
     72                NotifyParent(hwnd, Msg, wParam, lParam);
     73                break;
     74  }
    4975  return ButtonHandler(hwnd, Msg, wParam, lParam);
    5076}
     
    91117{
    92118 WNDCLASSA wndclass;
     119 HWND hwnd;
    93120
    94121   if(O32_GetClassInfo(NULL, "BUTTON", &wndclass)) {
    95         new Win32WindowClass(ButtonCallback, "BUTTON", hModule);
     122        dprintf(("Create BUTTON System class"));
     123        ButtonClass = new Win32WindowClass(ButtonCallback, "BUTTON", hModule);
    96124        ButtonHandler = (WNDPROC_O32)wndclass.lpfnWndProc;
     125        hwndButton = O32_CreateWindow("BUTTON", "BUTTON", 0, 0, 0, 0, 0, 0, 0, 0, 0);
     126        if(hwndButton == 0) {
     127                dprintf(("RegisterSystemClasses failed!!"));
     128        }
     129        O32_SetClassLong(hwndButton, GCL_WNDPROC, (LONG)ButtonCallback);
    97130   }
    98131   if(O32_GetClassInfo(NULL, "LISTBOX", &wndclass)) {
    99         new Win32WindowClass(ListboxCallback, "LISTBOX", hModule);
     132        dprintf(("Create LISTBOX System class"));
     133        ListboxClass = new Win32WindowClass(ListboxCallback, "LISTBOX", hModule);
    100134        ListboxHandler = (WNDPROC_O32)wndclass.lpfnWndProc;
     135        hwndListbox = O32_CreateWindow("LISTBOX", "LISTBOX", 0, 0, 0, 0, 0, 0, 0, 0, 0);
     136        if(hwndListbox == 0) {
     137                dprintf(("RegisterSystemClasses failed!!"));
     138        }
     139        O32_SetClassLong(hwndListbox, GCL_WNDPROC, (LONG)ListboxCallback);
    101140   }
    102141   if(O32_GetClassInfo(NULL, "COMBOBOX", &wndclass)) {
    103         new Win32WindowClass(ComboboxCallback, "COMBOBOX", hModule);
     142        dprintf(("Create COMBOBOX System class"));
     143        ComboboxClass = new Win32WindowClass(ComboboxCallback, "COMBOBOX", hModule);
    104144        ComboboxHandler = (WNDPROC_O32)wndclass.lpfnWndProc;
     145        hwndCombobox = O32_CreateWindow("COMBOBOX", "COMBOBOX", 0, 0, 0, 0, 0, 0, 0, 0, 0);
     146        if(hwndCombobox == 0) {
     147                dprintf(("RegisterSystemClasses failed!!"));
     148        }
     149        O32_SetClassLong(hwndCombobox, GCL_WNDPROC, (LONG)ComboboxCallback);
    105150   }
    106151   if(O32_GetClassInfo(NULL, "EDIT", &wndclass)) {
    107         new Win32WindowClass(EditCallback, "EDIT", hModule);
     152        dprintf(("Create EDIT System class"));
     153        EditClass = new Win32WindowClass(EditCallback, "EDIT", hModule);
    108154        EditHandler = (WNDPROC_O32)wndclass.lpfnWndProc;
     155        hwndEdit = O32_CreateWindow("EDIT", "EDIT", 0, 0, 0, 0, 0, 0, 0, 0, 0);
     156        if(hwndEdit == 0) {
     157                dprintf(("RegisterSystemClasses failed!!"));
     158        }
     159        O32_SetClassLong(hwndEdit, GCL_WNDPROC, (LONG)EditCallback);
    109160   }
     161   //TODO: This doens't work yet!! (need to create a normal window as parent)
    110162   if(O32_GetClassInfo(NULL, "MDICLIENT", &wndclass)) {
    111         new Win32WindowClass(MdiClientCallback, "MDICLIENT", hModule);
     163        dprintf(("Create MDICLIENT System class"));
     164        MdiClientClass = new Win32WindowClass(MdiClientCallback, "MDICLIENT", hModule);
    112165        MdiClientHandler = (WNDPROC_O32)wndclass.lpfnWndProc;
     166        hwndMdiClient = O32_CreateWindow("MDICLIENT", "MDICLIENT", WS_CHILD, 0, 0, 0, 0, hwndListbox, 0, 0, 0);
     167        if(hwndMdiClient == 0) {
     168                dprintf(("RegisterSystemClasses failed!!"));
     169        }
     170        O32_SetClassLong(hwndMdiClient, GCL_WNDPROC, (LONG)MdiClientCallback);
    113171   }
    114172   if(O32_GetClassInfo(NULL, "SCROLLBAR", &wndclass)) {
    115         new Win32WindowClass(ScrollbarCallback, "SCROLLBAR", hModule);
     173        dprintf(("Create SCROLLBAR System class"));
     174        ScrollbarClass = new Win32WindowClass(ScrollbarCallback, "SCROLLBAR", hModule);
    116175        ScrollbarHandler = (WNDPROC_O32)wndclass.lpfnWndProc;
     176        hwndScrollbar = O32_CreateWindow("SCROLLBAR", "SCROLLBAR", 0, 0, 0, 0, 0, 0, 0, 0, 0);
     177        if(hwndScrollbar == 0) {
     178                dprintf(("RegisterSystemClasses failed!!"));
     179        }
     180        O32_SetClassLong(hwndScrollbar, GCL_WNDPROC, (LONG)ScrollbarCallback);
    117181   }
    118182   if(O32_GetClassInfo(NULL, "STATIC", &wndclass)) {
    119         new Win32WindowClass(StaticCallback, "STATIC", hModule);
     183        dprintf(("Create STATIC System class"));
     184        StaticClass = new Win32WindowClass(StaticCallback, "STATIC", hModule);
    120185        StaticHandler = (WNDPROC_O32)wndclass.lpfnWndProc;
     186        hwndStatic = O32_CreateWindow("STATIC", "STATIC", 0, 0, 0, 0, 0, 0, 0, 0, 0);
     187        if(hwndStatic == 0) {
     188                dprintf(("RegisterSystemClasses failed!!"));
     189        }
     190        O32_SetClassLong(hwndStatic, GCL_WNDPROC, (LONG)StaticCallback);
    121191   }
    122192//TODO: More standard classes in win95/NT4?
     193}
     194//******************************************************************************
     195//******************************************************************************
     196void UnregisterSystemClasses()
     197{
     198   dprintf(("KERNEL32: UnregisterSystemClasses"));
     199   if(hwndButton)    O32_DestroyWindow(hwndButton);
     200   if(hwndListbox)   O32_DestroyWindow(hwndListbox);
     201   if(hwndCombobox)  O32_DestroyWindow(hwndCombobox);
     202   if(hwndMdiClient) O32_DestroyWindow(hwndMdiClient);
     203   if(hwndEdit)      O32_DestroyWindow(hwndEdit);
     204   if(hwndScrollbar) O32_DestroyWindow(hwndScrollbar);
     205   if(hwndStatic)    O32_DestroyWindow(hwndStatic);
     206   if(ButtonClass)    delete ButtonClass;
     207   if(ListboxClass)   delete ListboxClass;
     208   if(EditClass)      delete EditClass;
     209   if(ComboboxClass)  delete ComboboxClass;
     210   if(MdiClientClass) delete MdiClientClass;
     211   if(ScrollbarClass) delete ScrollbarClass;
     212   if(StaticClass)    delete StaticClass;
     213   ButtonClass    = NULL;
     214   EditClass      = NULL;
     215   ListboxClass   = NULL;
     216   ComboboxClass  = NULL;
     217   MdiClientClass = NULL;
     218   ScrollbarClass = NULL;
     219   StaticClass    = NULL;
    123220}
    124221//******************************************************************************
     
    218315    //These are not supported by Open32
    219316    wc.style &= ~(CS_PARENTDC | CS_CLASSDC);
    220  
    221 //SvL: 18-7-'98 Breaks apps (solitaire, rasmol..) 
    222 #if 0
    223     /* @@@PH 98/06/21 experimental fix for WInhlp32 */
    224 #ifndef CS_SYNCPAINT
    225   #define CS_SYNCPAINT 0x02000000L
    226 #endif
    227  
    228     wc.style |= CS_SYNCPAINT;
    229 #endif 
    230  
     317   
    231318    wc.lpfnWndProc = (WNDPROC)Win32WindowClass::GetOS2ClassCallback();
    232319
     
    708795 char                  szClass[128];
    709796 Win32WindowClass     *wclass;
     797 LRESULT               rc;
     798 DWORD                 dwStyle, dwExStyle;
     799 HWND                  parentHwnd;
     800 Win32WindowProc      *window;
    710801
    711802#ifdef DEBUG
     
    720811        wclass = Win32WindowClass::FindClass(szClass);
    721812        if(wclass) {
    722                 //SvL: Correct Open32 key mapping bug
    723                 if(Msg == WM_KEYDOWN || Msg == WM_KEYUP || Msg == WM_CHAR) {
    724 //                        dprintf(("WM_KEYDOWN %X %08X\n", wParam, lParam));
    725                         lParam = MapOEMToRealKey(wParam, lParam);
    726                 }
    727 
    728                 if(Msg == WM_CREATE) {//Open32 isn't sending WM_NCCREATE messages!!
     813                switch(Msg)
     814                {
     815                case WM_CREATE://Open32 isn't sending WM_NCCREATE messages!!
     816                        window = Win32WindowProc::FindProc(hwnd, GetCurrentThreadId());
     817                        if(window) {
     818                                dprintf(("OS2ToWinCallback (class): New window object!"));
     819                                window->SetWindowHandle(hwnd);
     820                        }
     821               
    729822                        if(wclass->GetWinCallback()(hwnd, WM_NCCREATE, 0, lParam) == 0) {
    730823                                dprintf(("WM_NCCREATE returned FALSE\n"));
    731824                                return(-1); //don't create window
    732825                        }
    733                 }
    734                 if(Msg == WM_ACTIVATE && LOWORD(wParam) != WA_INACTIVE)
    735                 {//SvL: Bugfix, Open32 is NOT sending this to the window (messes up Solitaire)
    736                   HDC hdc = GetDC(hwnd);
    737 
    738                         wclass->GetWinCallback()(hwnd, WM_ERASEBKGND, hdc, 0);
    739                         ReleaseDC(hwnd, hdc);
    740                 }
     826                        //Send WM_CREATE message before notifying parent
     827                        rc = wclass->GetWinCallback()(hwnd, Msg, wParam, lParam);
     828
     829                        NotifyParent(hwnd, WM_CREATE, wParam, lParam);
     830                        return(rc);
     831
     832                case WM_DESTROY: //nofity parent
     833                case WM_LBUTTONDOWN:
     834                case WM_MBUTTONDOWN:
     835                case WM_RBUTTONDOWN:
     836                        NotifyParent(hwnd, Msg, wParam, lParam);
     837                        break;
     838
     839                case WM_KEYDOWN:
     840                case WM_KEYUP:
     841                case WM_CHAR:   //SvL: Correct Open32 key mapping bug
     842                        lParam = MapOEMToRealKey(wParam, lParam);
     843                        break;
     844                case WM_ACTIVATE:
     845                        if(LOWORD(wParam) != WA_INACTIVE)
     846                        {//SvL: Bugfix, Open32 is NOT sending this to the window (messes up Solitaire)
     847                         HDC hdc = GetDC(hwnd);
     848
     849                                wclass->GetWinCallback()(hwnd, WM_ERASEBKGND, hdc, 0);
     850                                ReleaseDC(hwnd, hdc);
     851                        }
     852                        break;
     853                }
    741854                return wclass->GetWinCallback()(hwnd, Msg, wParam, lParam);
    742855        }
  • trunk/src/user32/wndproc.cpp

    r131 r134  
    1 /* $Id: wndproc.cpp,v 1.5 1999-06-20 14:02:13 sandervl Exp $ */
     1/* $Id: wndproc.cpp,v 1.6 1999-06-20 16:47:39 sandervl Exp $ */
    22
    33/*
     
    2828#endif
    2929
     30
     31void NotifyParent(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
     32{
     33 DWORD   dwStyle, dwExStyle;
     34 HWND    hwndParent = GetParent(hwnd);;
     35
     36   while(hwndParent) {
     37        dwStyle   = GetWindowLongA(hwnd, GWL_STYLE);
     38        dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
     39        //SvL: Taken from Wine
     40        if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
     41        {
     42                hwndParent = GetParent(hwnd);
     43                dprintf(("%s Send WM_PARENTNOTIFY from child %x to parent %x", GetMsgText(Msg), hwnd, hwndParent));
     44                /* Notify the parent window only */
     45                Win32WindowProc *parentwnd = Win32WindowProc::FindProc(hwndParent);
     46                if(parentwnd) {
     47                        if(Msg == WM_CREATE || Msg == WM_DESTROY) {
     48                                //Todo: Set IdChild!!
     49                                parentwnd->GetWin32Callback()(hwndParent, WM_PARENTNOTIFY, MAKEWPARAM(Msg, 0), (LPARAM)hwnd );
     50                        }
     51                        else    parentwnd->GetWin32Callback()(hwndParent, WM_PARENTNOTIFY, MAKEWPARAM(Msg, 0), lParam );
     52                }
     53        }
     54        if(hwnd == hwndParent) {
     55                break;
     56        }
     57        hwnd = hwndParent;
     58   }
     59}
    3060//******************************************************************************
    3161//******************************************************************************
     
    6797{
    6898 WNDCLASSA wc;
    69 
    70   assert(GetClassInfoA(hinst, lpszClassName, &wc) == TRUE);
     99 BOOL rc;
     100
     101  rc = GetClassInfoA(hinst, lpszClassName, &wc);
     102  assert(rc == TRUE);
     103
    71104//  pCallback = Win32WindowClass::GetClassCallback(hinst, (LPSTR)wc.lpszClassName);
    72105  pCallback = Win32WindowClass::GetClassCallback((LPSTR)wc.lpszClassName);
     
    152185  }
    153186  dprintf(("Win32WindowProc::FindProc, can't find window %X!\n", hwnd));
     187  return(NULL);
     188}
     189//******************************************************************************
     190//Find newly created window
     191//******************************************************************************
     192Win32WindowProc *Win32WindowProc::FindProc(HWND hwnd, DWORD threadid)
     193{
     194  Win32WindowProc *window = Win32WindowProc::windows;
     195
     196  while(window != NULL) {
     197        if(window->hwnd == 0 && window->threadid == threadid) {
     198                return(window);
     199        }
     200        window = window->next;
     201  }
     202  dprintf(("Win32WindowProc::FindProc, can't find window %X %d!\n", hwnd, threadid));
    154203  return(NULL);
    155204}
     
    225274LRESULT EXPENTRY_O32 WndCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    226275{
    227  Win32WindowProc *curwnd = Win32WindowProc::windows;
     276 Win32WindowProc *curwnd;
    228277 LRESULT rc;
    229278
     
    231280        return(0);
    232281  }
    233   while(curwnd != NULL) {
    234         if(curwnd->hwnd == hwnd) {
    235                 //SvL: Correct Open32 key mapping bug
    236                 if(Msg == WM_KEYDOWN || Msg == WM_KEYUP || Msg == WM_CHAR) {
    237 //                        dprintf(("WM_KEYDOWN %X %08X\n", wParam, lParam));
    238                         lParam = MapOEMToRealKey(wParam, lParam);
     282 
     283  curwnd = Win32WindowProc::FindProc(hwnd);
     284  if(!curwnd) {
     285        curwnd = Win32WindowProc::FindProc(0, GetCurrentThreadId());
     286        if(curwnd)      curwnd->SetWindowHandle(hwnd);
     287  }
     288  if(curwnd != NULL) {
     289#ifdef DEBUG
     290        WriteLog("***************Message %s for window/dialog %X\n", GetMsgText(Msg), hwnd);
     291#endif
     292        switch(Msg)
     293        {
     294        case WM_KEYDOWN:
     295        case WM_KEYUP:
     296        case WM_CHAR:
     297                //SvL: Correct Open32 key mapping bug
     298                lParam = MapOEMToRealKey(wParam, lParam);
     299                break;
     300        case WM_CREATE:  //Open32 isn't sending WM_NCCREATE messages!!
     301                if(curwnd->pCallback(hwnd, WM_NCCREATE, 0, lParam) == 0) {
     302                       dprintf(("WM_NCCREATE returned FALSE\n"));
     303                       return(-1); //don't create window
    239304                }
    240 #ifdef DEBUG
    241                 WriteLog("***************Message %s for window/dialog %X\n", GetMsgText(Msg), hwnd);
    242 #endif
    243 //              if(Msg == WM_CREATE || Msg == WM_INITDIALOG) {//Open32 isn't sending WM_NCCREATE messages!!
    244                 if(Msg == WM_CREATE) {//Open32 isn't sending WM_NCCREATE messages!!
    245 #ifdef DEBUG1
    246                         WriteLog("WM_NCCREATE\n");
    247 #endif
    248                         if(curwnd->pCallback(hwnd, WM_NCCREATE, 0, lParam) == 0) {
    249                                 dprintf(("WM_NCCREATE returned FALSE\n"));
    250                                 return(-1); //don't create window
    251                         }
     305       
     306                NotifyParent(hwnd, WM_CREATE, wParam, lParam);
    252307//TODO
    253308#if 0
    254                         if(curwnd->pCallback(hwnd, WM_NCCALCSIZE, 0, lParam) == 0) {
    255 #ifdef DEBUG1
    256                                 WriteLog("WM_NCCREATE returned FALSE\n");
    257 #endif
    258                                 return(-1); //don't create window
    259                         }
    260 #endif
    261 #ifdef DEBUG1
    262                         WriteLog("WM_NCCREATE, continue window creation\n");
    263 #endif
    264                 }
    265 #if 1
    266                 if(Msg == WM_ACTIVATE && LOWORD(wParam) != WA_INACTIVE)
    267                 {//SvL: Bugfix, Open32 is NOT sending this to the window (messes up Solitaire)
    268                   HDC hdc = GetDC(hwnd);
    269 
    270                         curwnd->pCallback(hwnd, WM_ERASEBKGND, hdc, 0);
    271                         ReleaseDC(hwnd, hdc);
     309                if(curwnd->pCallback(hwnd, WM_NCCALCSIZE, 0, lParam) == 0) {
     310                        return(-1); //don't create window
    272311                }
    273312#endif
    274                 rc = curwnd->pCallback(hwnd, Msg, wParam, lParam);
    275 #ifdef DEBUG1
    276                 WriteLog("***************Message processed rc = %d\n", rc);
    277 #endif
    278                 if(Msg == WM_NCDESTROY) {
    279                         dprintf(("WM_NCDESTROY received for window/dialog %X\n", curwnd->hwnd));
    280                         Win32WindowSubProc::DeleteSubWindow(hwnd); //if present
    281                         delete curwnd;
    282                 }
    283                 return rc;
     313                break;
     314
     315        case WM_LBUTTONDOWN:
     316        case WM_MBUTTONDOWN:
     317        case WM_RBUTTONDOWN:
     318        case WM_DESTROY: //nofity parent
     319                NotifyParent(hwnd, Msg, wParam, lParam);       
     320                break;
     321
     322        case WM_ACTIVATE:
     323                if(LOWORD(wParam) != WA_INACTIVE)
     324                {//SvL: Bugfix, Open32 is NOT sending this to the window (messes up Solitaire)
     325                  HDC hdc = GetDC(hwnd);
     326
     327                        curwnd->pCallback(hwnd, WM_ERASEBKGND, hdc, 0);
     328                        ReleaseDC(hwnd, hdc);
     329                }
     330                break;
     331        }
     332        rc = curwnd->pCallback(hwnd, Msg, wParam, lParam);
     333        if(Msg == WM_NCDESTROY) {
     334                dprintf(("WM_NCDESTROY received for window/dialog %X\n", curwnd->hwnd));
     335                Win32WindowSubProc::DeleteSubWindow(hwnd); //if present
     336                delete curwnd;
    284337        }
    285         curwnd = curwnd->next;
    286   }
    287   //Message for window/dialog that's just been created
    288   //TODO: This should be thread safe, right?
    289   DWORD threadid = (DWORD)GetCurrentThreadId();
    290   curwnd = (Win32WindowProc *)Win32WindowProc::windows;
    291   while(curwnd != NULL) {
    292         if(curwnd->hwnd == 0 && curwnd->threadid == threadid) {
    293 #ifdef DEBUG1
    294                 WriteLog("***************First message %s for window/dialog %X\n", GetMsgText(Msg), hwnd);
    295 #endif
    296                 curwnd->SetWindowHandle(hwnd);
    297 //              if(Msg == WM_CREATE || Msg == WM_INITDIALOG) {//Open32 isn't sending WM_NCCREATE messages!!
    298                 if(Msg == WM_CREATE) {//Open32 isn't sending WM_NCCREATE messages!!
    299 #ifdef DEBUG1
    300                         WriteLog("WM_NCCREATE\n");
    301 #endif
    302                         if(curwnd->pCallback(hwnd, WM_NCCREATE, 0, lParam) == 0) {
    303                                 dprintf(("WM_NCCREATE returned FALSE\n"));
    304                                 return(-1); //don't create window
    305                         }
    306 #ifdef DEBUG1
    307                         WriteLog("WM_NCCREATE, continue window creation\n");
    308 #endif
    309                 }
    310                 rc = curwnd->pCallback(hwnd, Msg, wParam, lParam);
    311                 if(Msg == WM_NCDESTROY) {
    312                         dprintf(("WM_NCDESTROY received for window/dialog %X\n", curwnd->hwnd));
    313                         Win32WindowSubProc::DeleteSubWindow(hwnd); //if present
    314                         delete curwnd;
    315                 }
    316                 return rc;
    317         }
    318         curwnd = curwnd->next;
    319   }
    320 #ifdef DEBUG1
    321   WriteLog("Dialog control??\n");
    322 #endif
     338        return rc;
     339  }
     340
    323341  //Could be a dialog control using a registered class, so check this:
    324342  char                  szClass[128];
Note: See TracChangeset for help on using the changeset viewer.