source: trunk/src/ddraw/os2DDWindow.cpp@ 6496

Last change on this file since 6496 was 5326, checked in by mike, 24 years ago

Merged DDRAW and DDRAW\NEW

File size: 1.6 KB
Line 
1/* $Id: os2DDWindow.cpp,v 1.5 2001-03-18 21:44:45 mike Exp $ */
2
3/*
4 * Functions to subclass the games windowproc to be used for
5 * fullscreen switching
6 *
7 * Copyright 1999 Markus Montkowski
8 *
9 * Project Odin Software License can be found in LICENSE.TXT
10 *
11 */
12
13#define INCL_WIN
14#include <os2wrap.h>
15#include <odinwrap.h>
16#include "os2DDWindow.h"
17
18PFNWP pfnOrgClientProc = NULL;
19
20MRESULT EXPENTRY DDOS2WindowProc(HWND hwnd, ULONG ulMsg, MPARAM mp1, MPARAM mp2);
21extern VOID SwitchDisplay(HWND hwnd);
22
23ODINFUNCTION1(BOOL , OS2DDSubClassWindow ,HWND, hwndClient)
24{
25 HWND hwndParent;
26
27 // only allow subclassing once!
28
29 if(NULL==pfnOrgClientProc)
30 {
31 hwndParent = WinQueryWindow(hwndClient,QW_PARENT);
32
33 if(hwndParent!=HWND_DESKTOP)
34 hwndFrame = hwndParent;
35 else
36 hwndFrame = hwndClient;
37
38 pfnOrgClientProc = WinSubclassWindow(hwndFrame,DDOS2WindowProc);
39
40 return TRUE;
41 }
42
43 return FALSE;
44}
45
46
47MRESULT EXPENTRY DDOS2WindowProc(HWND hwnd, ULONG ulMsg, MPARAM mp1, MPARAM mp2)
48{
49 USHORT usFlags;
50
51 switch(ulMsg)
52 {
53 // capture the mouse
54 case WM_ACTIVATE:
55 if(mp1)
56 WinSetCapture(HWND_DESKTOP,hwnd);
57 else
58 WinSetCapture(HWND_DESKTOP,NULLHANDLE);
59 break;
60 case WM_CHAR:
61 // Check for CTRL+SHIFT+F12 to toggle between stretched (FS) / windowd mode
62 usFlags = SHORT1FROMMP(mp1);
63 if(!(usFlags & KC_KEYUP))
64 {
65 if( (usFlags & KC_VIRTUALKEY) && (usFlags & KC_SHIFT) && (usFlags & KC_CTRL))
66 {
67 if(VK_F12 == SHORT2FROMMP(mp2))
68 SwitchDisplay(hwnd);
69 }
70 }
71 break;
72 default:
73 break;
74 }
75
76 return pfnOrgClientProc(hwnd, ulMsg, mp1,mp2);
77}
78
Note: See TracBrowser for help on using the repository browser.