Ignore:
Timestamp:
Jun 26, 1999, 3:21:53 PM (26 years ago)
Author:
sandervl
Message:

Spy and window message changes

File:
1 edited

Legend:

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

    r208 r215  
    1 /* $Id: wndclass.cpp,v 1.8 1999-06-26 08:25:22 sandervl Exp $ */
     1/* $Id: wndclass.cpp,v 1.9 1999-06-26 13:21:11 sandervl Exp $ */
    22
    33/*
     
    1616#include <os2win.h>
    1717#include <stdarg.h>
     18#include <stdio.h>
     19#include <string.h>
     20#include <stdlib.h>
    1821#include <assert.h>
    19 #include "misc.h"
    20 #include "user32.h"
    21 #include "wndproc.h"
    22 #include "wndclass.h"
     22#include <misc.h>
     23#include <wndproc.h>
     24#include <wndclass.h>
     25#include <nameid.h>
     26#include <spy.h>
    2327#include "hooks.h"
    24 #include <spy.h>
    2528
    2629//default window handlers that are registered by RegisterClass are called
     
    6467LRESULT WIN32API ButtonCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    6568{
     69 DWORD dwStyle, dwExStyle;
     70
     71  PostSpyMessage(hwnd, Msg, wParam, lParam);
    6672  switch(Msg)
    6773  {
     74        case WM_MOUSEACTIVATE:
     75                //Open32 sends an OS/2 window message for a button click
     76                if(HIWORD(lParam) == 0x71)  //WM_BUTTONCLICKFIRST
     77                {
     78                        lParam = (WM_LBUTTONDOWN << 16) | LOWORD(lParam);
     79                }
     80                dwStyle   = GetWindowLongA(hwnd, GWL_STYLE);
     81                dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
     82
     83                if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
     84                {
     85                        HWND hwndParent = GetParent(hwnd);
     86
     87                        Win32WindowProc *parentwnd = Win32WindowProc::FindProc(hwndParent);
     88                        if(parentwnd) {
     89                                LRESULT rc = parentwnd->SendMessageA(hwndParent, Msg, wParam, lParam);
     90                                if(rc) return TRUE;
     91                        }
     92                }
     93                break;
    6894        case WM_CREATE:
    6995        case WM_DESTROY:
     
    80106LRESULT WIN32API ListboxCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    81107{
     108  PostSpyMessage(hwnd, Msg, wParam, lParam);
    82109  return ListboxHandler(hwnd, Msg, wParam, lParam);
    83110}
     
    86113LRESULT WIN32API ComboboxCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    87114{
     115  PostSpyMessage(hwnd, Msg, wParam, lParam);
    88116  return ComboboxHandler(hwnd, Msg, wParam, lParam);
    89117}
     
    92120LRESULT WIN32API MdiClientCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    93121{
     122  PostSpyMessage(hwnd, Msg, wParam, lParam);
    94123  return MdiClientHandler(hwnd, Msg, wParam, lParam);
    95124}
     
    98127LRESULT WIN32API EditCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    99128{
     129  PostSpyMessage(hwnd, Msg, wParam, lParam);
    100130  return EditHandler(hwnd, Msg, wParam, lParam);
    101131}
     
    104134LRESULT WIN32API ScrollbarCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    105135{
     136  PostSpyMessage(hwnd, Msg, wParam, lParam);
    106137  return ScrollbarHandler(hwnd, Msg, wParam, lParam);
    107138}
     
    110141LRESULT WIN32API StaticCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    111142{
     143  PostSpyMessage(hwnd, Msg, wParam, lParam);
    112144  return StaticHandler(hwnd, Msg, wParam, lParam);
    113145}
     
    198230{
    199231   dprintf(("KERNEL32: UnregisterSystemClasses"));
    200    if(hwndButton)    O32_DestroyWindow(hwndButton);
    201    if(hwndListbox)   O32_DestroyWindow(hwndListbox);
    202    if(hwndCombobox)  O32_DestroyWindow(hwndCombobox);
    203    if(hwndMdiClient) O32_DestroyWindow(hwndMdiClient);
    204    if(hwndEdit)      O32_DestroyWindow(hwndEdit);
    205    if(hwndScrollbar) O32_DestroyWindow(hwndScrollbar);
    206    if(hwndStatic)    O32_DestroyWindow(hwndStatic);
     232   if(hwndButton)     O32_DestroyWindow(hwndButton);
     233   if(hwndListbox)    O32_DestroyWindow(hwndListbox);
     234   if(hwndCombobox)   O32_DestroyWindow(hwndCombobox);
     235   if(hwndMdiClient)  O32_DestroyWindow(hwndMdiClient);
     236   if(hwndEdit)       O32_DestroyWindow(hwndEdit);
     237   if(hwndScrollbar)  O32_DestroyWindow(hwndScrollbar);
     238   if(hwndStatic)     O32_DestroyWindow(hwndStatic);
    207239   if(ButtonClass)    delete ButtonClass;
    208240   if(ListboxClass)   delete ListboxClass;
     
    257289    //These are not supported by Open32
    258290    wc.style &= ~(CS_PARENTDC | CS_CLASSDC);
    259 
    260 //SvL: 18-7-'98 Breaks apps (solitaire, rasmol..) 
    261 #if 0
    262     /* @@@PH 98/06/21 experimental fix for WInhlp32 */
    263 #ifndef CS_SYNCPAINT
    264   #define CS_SYNCPAINT 0x02000000L
    265 #endif
    266  
    267     wc.style |= CS_SYNCPAINT;
    268 #endif
    269291
    270292    wc.lpfnWndProc = (WNDPROC)Win32WindowClass::GetOS2ClassCallback();
     
    840862                case WM_KEYUP:
    841863                case WM_CHAR:   //SvL: Correct Open32 key mapping bug
     864                        //TODO: Not good enough, look at Wine
    842865                        lParam = MapOEMToRealKey(wParam, lParam);
    843866                        break;
     867
     868                case WM_MOUSEACTIVATE:
     869                        //Open32 sends an OS/2 window message for a button click
     870                        if(HIWORD(lParam) == 0x71)  //WM_BUTTONCLICKFIRST
     871                        {
     872                                lParam = (WM_LBUTTONDOWN << 16) | LOWORD(lParam);
     873                        }
     874                        break;
     875
    844876                case WM_ACTIVATE:
    845                         if(LOWORD(wParam) != WA_INACTIVE)
    846                   {
    847                    //EB: I think the problem is not a missing wm_erasebkgnd.
    848                    //Maybe some wrong flags in open32 during async repainting.
    849                    //SvL: Bugfix, Open32 is NOT sending this to the window (messes up Solitaire)
    850                    RECT rect;
    851                    HRGN hrgn;
    852                    HDC hdc = GetDC(hwnd);
    853 
    854                    // erase the dirty rect
    855                    GetUpdateRect(hwnd, &rect, TRUE);
    856                    hrgn = CreateRectRgnIndirect(&rect);
    857                    SelectClipRgn (hdc, hrgn);
    858                    DeleteObject (hrgn);
    859                    wclass->GetWinCallback()(hwnd, WM_ERASEBKGND, hdc, (LPARAM)&rect);
    860                    SelectClipRgn (hdc, NULL);
    861                    ReleaseDC(hwnd, hdc);
    862                   }
     877                        if(LOWORD(wParam) != WA_INACTIVE)
     878                        {
     879                          //EB: I think the problem is not a missing wm_erasebkgnd.
     880                          //Maybe some wrong flags in open32 during async repainting.
     881                          RECT rect;
     882                          HRGN hrgn;
     883                          HDC hdc = GetDC(hwnd);
     884
     885                                // erase the dirty rect
     886                                GetUpdateRect(hwnd, &rect, TRUE);
     887                                hrgn = CreateRectRgnIndirect(&rect);
     888                                SelectClipRgn (hdc, hrgn);
     889                                DeleteObject (hrgn);
     890                                wclass->GetWinCallback()(hwnd, WM_ERASEBKGND, hdc, (LPARAM)&rect);
     891                                SelectClipRgn (hdc, NULL);
     892                                ReleaseDC(hwnd, hdc);
     893                        }
    863894                        break;
    864895                }
Note: See TracChangeset for help on using the changeset viewer.