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

Send/PostMessage changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.