source: trunk/src/ddraw/OS2UTIL.CPP@ 9462

Last change on this file since 9462 was 9462, checked in by sandervl, 23 years ago

Post resize message in SetCooperativeLevel instead of calling SetWindowPos

File size: 2.8 KB
Line 
1/* $Id: OS2UTIL.CPP,v 1.14 2002-12-04 15:21:40 sandervl Exp $ */
2
3/*
4 * OS/2 Utility functions
5 *
6 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
7 *
8 * Project Odin Software License can be found in LICENSE.TXT
9 *
10 */
11#define INCL_DOS
12#define INCL_DOSMEMMGR
13#define INCL_DOSDEVICES
14#include <os2wrap.h>
15#include <misc.h>
16#include "os2util.h"
17#include "cio2.h"
18
19//******************************************************************************
20//******************************************************************************
21char *OS2AllocMem(ULONG size)
22{
23 PVOID lpMem;
24 APIRET rc;
25
26 rc = DosAllocMem(&lpMem, size, PAG_READ|PAG_WRITE|PAG_COMMIT);
27 if(rc) {
28 dprintf(("DDRAW: DosAllocMem returned %d", rc));
29 return(NULL);
30 }
31 return((char *)lpMem);
32}
33//******************************************************************************
34//******************************************************************************
35void OS2FreeMem(char *lpMem)
36{
37 APIRET rc;
38
39 rc = DosFreeMem(lpMem);
40 if(rc) {
41 dprintf(("DDRAW: DosFreeMem returned %d", rc));
42 }
43}//******************************************************************************
44//******************************************************************************
45void OS2MaximizeWindow(HWND hwndClient)
46{
47 WinSetWindowPos(hwndClient, HWND_TOP, 0, 0, 0, 0, SWP_MAXIMIZE);
48}
49//******************************************************************************
50//******************************************************************************
51BOOL OSLibPostMessage(HWND hwnd, ULONG msg, ULONG mp1, ULONG mp2)
52{
53 return WinPostMsg(hwnd, msg, (MPARAM)mp1, (MPARAM)mp2);
54}
55//******************************************************************************
56//******************************************************************************
57
58extern "C" {
59BOOL APIENTRY _GpiEnableYInversion (HPS hps, LONG lHeight);
60}
61
62void InverseDC(HDC hdc, LONG lHeight)
63{
64 USHORT sel = RestoreOS2FS();
65
66// _GpiEnableYInversion( WinGetPS( Win32ToOS2Handle( WindowFromDC(hdc) ) ), lHeight);
67 _GpiEnableYInversion( hdc, lHeight);
68 SetFS(sel);
69
70}
71//******************************************************************************
72//******************************************************************************
73int InitIO()
74{
75 WORD gdt;
76 HRESULT rc;
77 HFILE device;
78 ULONG ulAction;
79
80 rc = DosOpen( "\\dev\\fastio$",
81 &device,
82 &ulAction,
83 0,0,1,
84 OPEN_ACCESS_READWRITE|OPEN_SHARE_DENYNONE,
85 0);
86 if(rc)
87 return rc;
88
89 rc = DosDevIOCtl( device, 118, 100, 0,0,0,&gdt,2,&ulAction);
90
91 DosClose(device);
92
93 if(rc)
94 {
95 return rc;
96 }
97
98 USHORT sel = RestoreOS2FS();
99
100 io_init2(gdt);
101
102 SetFS(sel);
103 return 0;
104}
105//******************************************************************************
106//******************************************************************************
Note: See TracBrowser for help on using the repository browser.