source: trunk/src/user32/new/oslibmsg.cpp@ 835

Last change on this file since 835 was 835, checked in by sandervl, 26 years ago

More dialog update

File size: 3.6 KB
Line 
1/* $Id: oslibmsg.cpp,v 1.4 1999-09-05 15:53:08 sandervl Exp $ */
2/*
3 * Window message translation functions for OS/2
4 *
5 *
6 * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl)
7 *
8 *
9 * Project Odin Software License can be found in LICENSE.TXT
10 *
11 * TODO: Simply copy for now. Need to make a real translation
12 *
13 */
14#define INCL_WIN
15#define INCL_PM
16#define INCL_DOSPROCESS
17#include <os2.h>
18#include <os2wrap.h>
19#include <string.h>
20#include <misc.h>
21#include "oslibmsg.h"
22#include <win32wnd.h>
23#include "oslibutil.h"
24
25QMSG *MsgThreadPtr = 0;
26
27//******************************************************************************
28//******************************************************************************
29BOOL OSLibInitMsgQueue()
30{
31 if(DosAllocThreadLocalMemory(sizeof(QMSG)/sizeof(ULONG), (PULONG *)&MsgThreadPtr) != 0)
32 {
33 dprintf(("OSLibInitMsgQueue: local thread memory alloc failed!!"));
34 DebugInt3();
35 return FALSE;
36 }
37 return TRUE;
38}
39//******************************************************************************
40//******************************************************************************
41void WinToOS2MsgTranslate(MSG *winMsg, QMSG *os2Msg, BOOL isUnicode)
42{
43 memcpy(os2Msg, winMsg, sizeof(MSG));
44 os2Msg->reserved = 0;
45}
46//******************************************************************************
47//******************************************************************************
48void OS2ToWinMsgTranslate(QMSG *os2Msg, MSG *winMsg, BOOL isUnicode)
49{
50 memcpy(winMsg, os2Msg, sizeof(MSG));
51 winMsg->hwnd = Win32Window::OS2ToWin32Handle(os2Msg->hwnd);
52}
53//******************************************************************************
54//TODO!!!
55//******************************************************************************
56ULONG TranslateWinMsg(ULONG msg)
57{
58 return 0;
59}
60//******************************************************************************
61//******************************************************************************
62void OSLibWinPostQuitMessage(ULONG nExitCode)
63{
64 WinPostQueueMsg(NULLHANDLE, WM_QUIT, (MPARAM)nExitCode, 0);
65}
66//******************************************************************************
67//******************************************************************************
68LONG OSLibWinDispatchMsg(MSG *msg, BOOL isUnicode)
69{
70//TODO: What to do if app changed msg? (translate)
71// WinToOS2MsgTranslate(msg, &qmsg, isUnicode);
72
73 return (LONG)WinDispatchMsg(GetThreadHAB(), MsgThreadPtr);
74}
75//******************************************************************************
76//******************************************************************************
77BOOL OSLibWinGetMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,
78 BOOL isUnicode)
79{
80 BOOL rc;
81
82 rc = WinGetMsg(GetThreadHAB(), MsgThreadPtr, TranslateWinMsg(uMsgFilterMin), TranslateWinMsg(uMsgFilterMax), 0);
83 OS2ToWinMsgTranslate(MsgThreadPtr, pMsg, isUnicode);
84 return rc;
85}
86//******************************************************************************
87//******************************************************************************
88BOOL OSLibWinPeekMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,
89 BOOL fRemove, BOOL isUnicode)
90{
91 BOOL rc;
92
93 rc = WinPeekMsg(GetThreadHAB(), MsgThreadPtr, hwnd, TranslateWinMsg(uMsgFilterMin),
94 TranslateWinMsg(uMsgFilterMax), (fRemove == MSG_REMOVE) ? PM_REMOVE : PM_NOREMOVE);
95 OS2ToWinMsgTranslate(MsgThreadPtr, pMsg, isUnicode);
96 return rc;
97}
98//******************************************************************************
99//******************************************************************************
Note: See TracBrowser for help on using the repository browser.