Changeset 309 for trunk/src


Ignore:
Timestamp:
Jul 15, 1999, 8:03:03 PM (26 years ago)
Author:
sandervl
Message:

Send/PostMessage changes

Location:
trunk/src/user32/new
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/makefile

    r300 r309  
    1 # $Id: makefile,v 1.1 1999-07-14 08:35:35 sandervl Exp $
     1# $Id: makefile,v 1.2 1999-07-15 18:03:01 sandervl Exp $
    22
    33#
     
    2727        uitools.obj unknown.obj spy.obj wndmsg.obj \
    2828        pmwindow.obj win32class.obj win32wnd.obj win32dlg.obj \
    29         msgbox.obj window.obj windowmsg.obj windowclass.obj \
    30         windowword.obj gen_object.obj oslibwin.obj
     29        msgbox.obj window.obj windowmsg.obj windowclass.obj windlgmsg.obj \
     30        windowword.obj gen_object.obj oslibwin.obj 
    3131
    3232
     
    6969window.obj:    window.cpp win32class.h win32wnd.h
    7070windowmsg.obj: windowmsg.cpp win32class.h win32wnd.h
     71windlgmsg.obj: windlgmsg.cpp win32class.h win32wnd.h win32dlg.h
    7172windowclass.obj: windowclass.cpp win32class.h win32wnd.h
    7273windowword.obj:  windowword.cpp win32class.h win32wnd.h win32dlg.h
  • trunk/src/user32/new/oslibwin.cpp

    r304 r309  
    1 /* $Id: oslibwin.cpp,v 1.2 1999-07-14 21:05:58 cbratschi Exp $ */
     1/* $Id: oslibwin.cpp,v 1.3 1999-07-15 18:03:02 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    125125//******************************************************************************
    126126//******************************************************************************
     127BOOL OSLibPostMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam)
     128{
     129  return WinPostMsg(hwnd, msg, (MPARAM)wParam, (MPARAM)lParam);
     130}
     131//******************************************************************************
     132//******************************************************************************
     133
  • trunk/src/user32/new/oslibwin.h

    r300 r309  
    1 /* $Id: oslibwin.h,v 1.1 1999-07-14 08:35:35 sandervl Exp $ */
     1/* $Id: oslibwin.h,v 1.2 1999-07-15 18:03:02 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    2828ULONG OSLibWinGetWindowULong(HWND hwnd, ULONG offset);
    2929
     30BOOL  OSLibPostMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam);
     31
    3032#endif //__OSLIBWIN_H__
  • trunk/src/user32/new/pmwindow.cpp

    r304 r309  
    1 /* $Id: pmwindow.cpp,v 1.3 1999-07-14 21:05:58 cbratschi Exp $ */
     1/* $Id: pmwindow.cpp,v 1.4 1999-07-15 18:03:02 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    1414#include <os2.h>                        /* PM header file               */
    1515#include <os2wrap.h>
     16#include <stdlib.h>
    1617#include "win32type.h"
    1718#include <wprocess.h>
     
    6869MRESULT EXPENTRY Win32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
    6970{
     71 POSTMSG_PACKET *postmsg;
    7072 Win32Window  *win32wnd;
    7173 ULONG         magic;
     
    8486  switch( msg )
    8587  {
     88    //internal messages
     89    case WM_WIN32_POSTMESSAGEA:
     90        postmsg = (POSTMSG_PACKET *)mp1;
     91        if(postmsg == NULL) {
     92                dprintf(("WM_WIN32_POSTMESSAGEA, postmsg NULL!!"));
     93                break;
     94        }
     95        win32wnd->SendMessageA(postmsg->Msg, postmsg->wParam, postmsg->lParam);
     96        free(postmsg);
     97        break;
     98
     99    case WM_WIN32_POSTMESSAGEW:
     100        postmsg = (POSTMSG_PACKET *)mp1;
     101        if(postmsg == NULL) {
     102                dprintf(("WM_WIN32_POSTMESSAGEW, postmsg NULL!!"));
     103                break;
     104        }
     105        win32wnd->SendMessageW(postmsg->Msg, postmsg->wParam, postmsg->lParam);
     106        free(postmsg);
     107        break;
     108
     109    //OS/2 msgs
    86110    case WM_CREATE:
    87111        //Processing is done in after WinCreateWindow returns
  • trunk/src/user32/new/win32type.h

    r300 r309  
    4747#define PDWORD  DWORD *
    4848#define LRESULT DWORD
    49 #define LPARAM  DWORD
    50 #define WPARAM  DWORD
     49#define LPARAM  signed long
     50#define WPARAM  unsigned int
    5151#define CONST   const
    5252#define LPTSTR  char *
  • trunk/src/user32/new/win32wnd.cpp

    r304 r309  
    1 /* $Id: win32wnd.cpp,v 1.2 1999-07-14 21:05:58 cbratschi Exp $ */
     1/* $Id: win32wnd.cpp,v 1.3 1999-07-15 18:03:02 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    571571}
    572572//******************************************************************************
     573//todo, unicode msgs
     574//******************************************************************************
     575LRESULT Win32Window::SendMessageW(ULONG Msg, WPARAM wParam, LPARAM lParam)
     576{
     577  if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE)
     578        dprintf(("SendMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));
     579
     580  if(HkCBT::OS2HkCBTProc(getWindowHandle(), Msg, wParam, lParam) == TRUE) {//hook swallowed msg
     581        return(0);
     582  }
     583  switch(Msg)
     584  {
     585        case WM_CREATE:
     586        {
     587                if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
     588                        dprintf(("WM_NCCREATE returned FALSE\n"));
     589                        return(0); //don't create window
     590                }
     591                if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {
     592                        dprintf(("WM_CREATE returned FALSE\n"));
     593                        return(0); //don't create window
     594                }
     595                NotifyParent(Msg, wParam, lParam);
     596
     597                return(1);
     598        }
     599        case WM_LBUTTONDOWN:
     600        case WM_MBUTTONDOWN:
     601        case WM_RBUTTONDOWN:
     602                NotifyParent(Msg, wParam, lParam);
     603                return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
     604
     605        case WM_DESTROY:
     606                win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);
     607                NotifyParent(Msg, wParam, lParam);
     608                return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
     609        default:
     610                return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
     611  }
     612}
     613//******************************************************************************
     614//******************************************************************************
     615LRESULT Win32Window::PostMessageA(ULONG msg, WPARAM wParam, LPARAM lParam)
     616{
     617 POSTMSG_PACKET *postmsg;
     618
     619  postmsg = (POSTMSG_PACKET *)malloc(sizeof(POSTMSG_PACKET));
     620  if(postmsg == NULL) {
     621        dprintf(("Win32Window::PostMessageA: malloc returned NULL!!"));
     622  }
     623  postmsg->Msg    = msg;
     624  postmsg->wParam = wParam;
     625  postmsg->lParam = lParam;
     626  return OSLibPostMessage(OS2Hwnd, WM_WIN32_POSTMESSAGEA, (ULONG)postmsg, 0);
     627}
     628//******************************************************************************
     629//******************************************************************************
     630LRESULT Win32Window::PostMessageW(ULONG msg, WPARAM wParam, LPARAM lParam)
     631{
     632 POSTMSG_PACKET *postmsg;
     633
     634  postmsg = (POSTMSG_PACKET *)malloc(sizeof(POSTMSG_PACKET));
     635  if(postmsg == NULL) {
     636        dprintf(("Win32Window::PostMessageW: malloc returned NULL!!"));
     637  }
     638  postmsg->Msg    = msg;
     639  postmsg->wParam = wParam;
     640  postmsg->lParam = lParam;
     641  return OSLibPostMessage(OS2Hwnd, WM_WIN32_POSTMESSAGEW, (ULONG)postmsg, 0);
     642}
     643//******************************************************************************
    573644//******************************************************************************
    574645void Win32Window::NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam)
  • trunk/src/user32/new/win32wnd.h

    r300 r309  
    1 /* $Id: win32wnd.h,v 1.2 1999-07-14 08:35:37 sandervl Exp $ */
     1/* $Id: win32wnd.h,v 1.3 1999-07-15 18:03:03 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    3333        ULONG           win32CreateStruct;      //or dialog create dword
    3434} CUSTOMWNDDATA;
     35
     36typedef struct
     37{
     38        ULONG           Msg;
     39        ULONG           wParam;
     40        ULONG           lParam;
     41} POSTMSG_PACKET;
     42
     43#define WM_WIN32_POSTMESSAGEA   0x4000
     44#define WM_WIN32_POSTMESSAGEW   0x4001
    3545
    3646class Win32Window : public GenericObject
     
    7484         void   setWindowId(DWORD id)           { windowId = id; };
    7585
     86         DWORD  getFlags()                      { return flags; };
     87         void   setFlags(DWORD newflags)        { flags = newflags; };
     88
    7689       LRESULT  SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
    7790       LRESULT  SendMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
     91       LRESULT  PostMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
     92       LRESULT  PostMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
    7893       LRESULT  DefWindowProcA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
    7994       LRESULT  DefWindowProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  • trunk/src/user32/new/windowmsg.cpp

    r304 r309  
    1 /* $Id: windowmsg.cpp,v 1.2 1999-07-14 21:05:59 cbratschi Exp $ */
     1/* $Id: windowmsg.cpp,v 1.3 1999-07-15 18:03:03 sandervl Exp $ */
    22/*
    33 * Win32 window message APIs for OS/2
    44 *
    55 * Copyright 1999 Sander van Leeuwen
     6 *
     7 * Parts based on Wine Windows code (windows\message.c)
     8 *
     9 * Copyright 1993, 1994 Alexandre Julliard
    610 *
    711 *
     
    1115#include <os2win.h>
    1216#include <misc.h>
    13 
    14 
    15 //******************************************************************************
    16 //******************************************************************************
    17 LONG WIN32API SendDlgItemMessageA( HWND arg1, int arg2, UINT arg3, WPARAM arg4, LPARAM  arg5)
    18 {
    19 #ifdef DEBUG
    20     WriteLog("USER32:  SendDlgItemMessageA\n");
    21 #endif
    22     return O32_SendDlgItemMessage(arg1, arg2, arg3, arg4, arg5);
    23 }
    24 //******************************************************************************
    25 //******************************************************************************
    26 LONG WIN32API SendDlgItemMessageW( HWND arg1, int arg2, UINT arg3, WPARAM arg4, LPARAM  arg5)
    27 {
    28 #ifdef DEBUG
    29     WriteLog("USER32:  SendDlgItemMessageW\n");
    30 #endif
    31     return O32_SendDlgItemMessage(arg1, arg2, arg3, arg4, arg5);
    32 }
     17#include <win32wnd.h>
     18#include <handlemanager.h>
     19#include <win.h>
     20
    3321//******************************************************************************
    3422//******************************************************************************
     
    4129//******************************************************************************
    4230//******************************************************************************
    43 LONG WIN32API DispatchMessageA( const MSG * arg1)
    44 {
    45 ////    dprintf(("USER32:  DispatchMessage\n"));
    46     return O32_DispatchMessage(arg1);
    47 }
    48 //******************************************************************************
    49 //******************************************************************************
    50 LONG WIN32API DispatchMessageW( const MSG * arg1)
    51 {
    52 #ifdef DEBUG
    53     WriteLog("USER32:  DispatchMessageW\n");
    54 #endif
    55     // NOTE: This will not work as is (needs UNICODE support)
    56     return O32_DispatchMessage(arg1);
     31LONG WIN32API DispatchMessageA( const MSG * msg)
     32{
     33  LONG         retval;
     34  int          painting;
     35  Win32Window *window;
     36   
     37      /* Process timer messages */
     38    if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER))
     39    {
     40        if (msg->lParam)
     41        {
     42            return SendMessageA(msg->hwnd, msg->message, msg->wParam, GetTickCount());
     43        }
     44    }
     45
     46    if (!msg->hwnd) return 0;
     47
     48    if(HMHandleTranslateToOS2(msg->hwnd, (PULONG)&window) != NO_ERROR) {
     49        dprintf(("DispatchMessageA, window %x not found", msg->hwnd));
     50        return 0;
     51    }
     52
     53    painting = (msg->message == WM_PAINT);
     54    if (painting) window->setFlags(window->getFlags() | WIN_NEEDS_BEGINPAINT);
     55
     56    retval = window->SendMessageA(msg->message, msg->wParam, msg->lParam );
     57
     58#if 0
     59    if(HMHandleTranslateToOS2(msg->hwnd, (PULONG)&window) != NO_ERROR) {
     60        dprintf(("DispatchMessageA, window %x not found", msg->hwnd));
     61        return 0;
     62    }
     63
     64    if (painting && (wndPtr->getFlags() & WIN_NEEDS_BEGINPAINT) && wndPtr->hrgnUpdate)
     65    {
     66        ERR_(msg)("BeginPaint not called on WM_PAINT for hwnd %04x!\n",
     67            msg->hwnd);
     68        wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT;
     69        /* Validate the update region to avoid infinite WM_PAINT loop */
     70        ValidateRect( msg->hwnd, NULL );
     71    }
     72#endif
     73    return retval;
     74}
     75//******************************************************************************
     76//******************************************************************************
     77LONG WIN32API DispatchMessageW( const MSG * msg)
     78{
     79  LONG         retval;
     80  int          painting;
     81  Win32Window *window;
     82   
     83    /* Process timer messages */
     84    if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER))
     85    {
     86        if (msg->lParam)
     87        {
     88            return SendMessageW(msg->hwnd, msg->message, msg->wParam, GetTickCount());
     89        }
     90    }
     91
     92    if (!msg->hwnd) return 0;
     93
     94    if(HMHandleTranslateToOS2(msg->hwnd, (PULONG)&window) != NO_ERROR) {
     95        dprintf(("DispatchMessageW, window %x not found", msg->hwnd));
     96        return 0;
     97    }
     98
     99    painting = (msg->message == WM_PAINT);
     100    if (painting) window->setFlags(window->getFlags() | WIN_NEEDS_BEGINPAINT);
     101
     102    retval = window->SendMessageW(msg->message, msg->wParam, msg->lParam );
     103
     104#if 0
     105    if(HMHandleTranslateToOS2(msg->hwnd, (PULONG)&window) != NO_ERROR) {
     106        dprintf(("DispatchMessageW, window %x not found", msg->hwnd));
     107        return 0;
     108    }
     109
     110    if (painting && (wndPtr->getFlags() & WIN_NEEDS_BEGINPAINT) && wndPtr->hrgnUpdate)
     111    {
     112        ERR_(msg)("BeginPaint not called on WM_PAINT for hwnd %04x!\n",
     113            msg->hwnd);
     114        wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT;
     115        /* Validate the update region to avoid infinite WM_PAINT loop */
     116        ValidateRect( msg->hwnd, NULL );
     117    }
     118#endif
     119    return retval;
    57120}
    58121//******************************************************************************
     
    67130//******************************************************************************
    68131//******************************************************************************
    69 LRESULT WIN32API SendMessageA(HWND arg1, UINT arg2, WPARAM  arg3, LPARAM arg4)
    70 {
    71  LRESULT rc;
    72 
    73 #ifdef DEBUG1
    74     WriteLog("USER32:  SendMessage....\n");
    75 #endif
    76     rc = O32_SendMessage(arg1, arg2, arg3, arg4);
    77 #ifdef DEBUG1
    78     WriteLog("USER32:  *****SendMessage %X %X %X %X returned %d\n", arg1, arg2, arg3, arg4, rc);
    79 #endif
    80     return(rc);
    81 }
    82 //******************************************************************************
    83 //******************************************************************************
    84 LRESULT WIN32API SendMessageW( HWND arg1, UINT arg2, WPARAM  arg3, LPARAM  arg4)
    85 {
    86 LRESULT rc;
    87 
    88 #ifdef DEBUG
    89     WriteLog("USER32:  SendMessageW....\n");
    90 #endif
    91     rc = O32_SendMessage(arg1, arg2, arg3, arg4);
    92 #ifdef DEBUG
    93     WriteLog("USER32:  SendMessageW %X %X %X %X returned %d\n", arg1, arg2, arg3, arg4, rc);
    94 #endif
    95     return(rc);
    96 }
    97 //******************************************************************************
    98 //******************************************************************************
    99 BOOL WIN32API IsDialogMessageA( HWND arg1, LPMSG  arg2)
    100 {
    101 #ifdef DEBUG
    102 ////    WriteLog("USER32:  IsDialogMessage\n");
    103 #endif
    104     return O32_IsDialogMessage(arg1, arg2);
    105 }
    106 //******************************************************************************
    107 //******************************************************************************
    108 BOOL WIN32API PostMessageA( HWND arg1, UINT arg2, WPARAM  arg3, LPARAM  arg4)
    109 {
    110 #ifdef DEBUG
    111     WriteLog("USER32:  PostMessageA %X %X %X %X\n", arg1, arg2, arg3, arg4);
    112 #endif
    113     return O32_PostMessage(arg1, arg2, arg3, arg4);
     132LRESULT WIN32API SendMessageA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
     133{
     134  Win32Window *window;
     135
     136    if(HMHandleTranslateToOS2(hwnd, (PULONG)&window) != NO_ERROR) {
     137        dprintf(("SendMessageA, window %x not found", hwnd));
     138        return 0;
     139    }
     140    return window->SendMessageA(msg, wParam, lParam);
     141}
     142//******************************************************************************
     143//******************************************************************************
     144LRESULT WIN32API SendMessageW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
     145{
     146  Win32Window *window;
     147
     148    if(HMHandleTranslateToOS2(hwnd, (PULONG)&window) != NO_ERROR) {
     149        dprintf(("SendMessageW, window %x not found", hwnd));
     150        return 0;
     151    }
     152    return window->SendMessageW(msg, wParam, lParam);
     153}
     154//******************************************************************************
     155//******************************************************************************
     156BOOL WIN32API PostMessageA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
     157{
     158  Win32Window *window;
     159
     160    if(HMHandleTranslateToOS2(hwnd, (PULONG)&window) != NO_ERROR) {
     161        dprintf(("PostMessageA, window %x not found", hwnd));
     162        return 0;
     163    }
     164    return window->PostMessageA(msg, wParam, lParam);
     165}
     166//******************************************************************************
     167//******************************************************************************
     168BOOL WIN32API PostMessageW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
     169{
     170  Win32Window *window;
     171
     172    if(HMHandleTranslateToOS2(hwnd, (PULONG)&window) != NO_ERROR) {
     173        dprintf(("PostMessageW, window %x not found", hwnd));
     174        return 0;
     175    }
     176    return window->PostMessageW(msg, wParam, lParam);
    114177}
    115178//******************************************************************************
     
    143206//******************************************************************************
    144207//******************************************************************************
    145 // NOTE: Open32 function doesn't have the 'W'.
    146 BOOL WIN32API PostMessageW( HWND arg1, UINT arg2, WPARAM  arg3, LPARAM  arg4)
    147 {
    148 #ifdef DEBUG
    149     WriteLog("USER32:  PostMessageW\n");
    150 #endif
    151     // NOTE: This will not work as is (needs UNICODE support)
    152     return O32_PostMessage(arg1, arg2, arg3, arg4);
    153 }
    154 //******************************************************************************
    155 //******************************************************************************
    156208BOOL WIN32API InSendMessage(void)
    157209{
     
    162214}
    163215//******************************************************************************
    164 //******************************************************************************
    165 BOOL WIN32API IsDialogMessageW( HWND arg1, LPMSG  arg2)
    166 {
    167 #ifdef DEBUG
    168     WriteLog("USER32:  IsDialogMessageW\n");
    169 #endif
    170     // NOTE: This will not work as is (needs UNICODE support)
    171     return O32_IsDialogMessage(arg1, arg2);
    172 }
    173216//******************************************************************************
    174217//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.