2001-01-04 23:44:55 +01:00
|
|
|
/* User-based primary surface driver
|
|
|
|
*
|
|
|
|
* Copyright 2000 TransGaming Technologies Inc.
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2001-01-04 23:44:55 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdlib.h>
|
2001-01-26 21:43:40 +01:00
|
|
|
#include <string.h>
|
2001-01-04 23:44:55 +01:00
|
|
|
|
2001-07-18 23:04:23 +02:00
|
|
|
#include "winerror.h"
|
|
|
|
|
2001-01-04 23:44:55 +01:00
|
|
|
#include "ddraw_private.h"
|
2001-07-19 21:09:33 +02:00
|
|
|
#include "dsurface/wndproc.h"
|
2001-07-18 23:04:23 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2001-01-04 23:44:55 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
|
2001-01-04 23:44:55 +01:00
|
|
|
|
|
|
|
static LRESULT WINAPI DirectDrawSurface_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
|
|
|
|
|
|
|
void DirectDrawSurface_RegisterClass(void)
|
|
|
|
{
|
|
|
|
WNDCLASSA wc;
|
|
|
|
memset(&wc, 0, sizeof(wc));
|
|
|
|
wc.lpfnWndProc = DirectDrawSurface_WndProc;
|
|
|
|
wc.cbWndExtra = sizeof(IDirectDrawSurfaceImpl*);
|
2003-09-10 05:56:47 +02:00
|
|
|
wc.hCursor = (HCURSOR)IDC_ARROW;
|
2001-01-04 23:44:55 +01:00
|
|
|
wc.lpszClassName = "WINE_DDRAW";
|
|
|
|
RegisterClassA(&wc);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DirectDrawSurface_UnregisterClass(void)
|
|
|
|
{
|
|
|
|
UnregisterClassA("WINE_DDRAW", 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static LRESULT WINAPI DirectDrawSurface_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
IDirectDrawSurfaceImpl *This;
|
|
|
|
LRESULT ret;
|
|
|
|
|
|
|
|
This = (IDirectDrawSurfaceImpl *)GetWindowLongA(hwnd, 0);
|
|
|
|
if (This) {
|
|
|
|
HWND window = This->ddraw_owner->window;
|
|
|
|
|
|
|
|
switch (msg) {
|
|
|
|
case WM_DESTROY:
|
|
|
|
case WM_NCDESTROY:
|
|
|
|
case WM_SHOWWINDOW:
|
|
|
|
case WM_WINDOWPOSCHANGING:
|
|
|
|
case WM_WINDOWPOSCHANGED:
|
|
|
|
case WM_SIZE:
|
|
|
|
case WM_MOVE:
|
|
|
|
case WM_ERASEBKGND:
|
2002-07-10 05:04:58 +02:00
|
|
|
case WM_SYNCPAINT:
|
2001-01-04 23:44:55 +01:00
|
|
|
/* since we're pretending fullscreen,
|
|
|
|
* let's not pass these on to the app */
|
|
|
|
ret = DefWindowProcA(hwnd, msg, wParam, lParam);
|
|
|
|
break;
|
|
|
|
case WM_NCHITTEST:
|
|
|
|
ret = HTCLIENT;
|
|
|
|
break;
|
|
|
|
case WM_MOUSEACTIVATE:
|
|
|
|
ret = MA_NOACTIVATE;
|
|
|
|
break;
|
|
|
|
case WM_PAINT:
|
|
|
|
{
|
|
|
|
PAINTSTRUCT ps;
|
2001-01-13 00:18:22 +01:00
|
|
|
HDC dc;
|
|
|
|
dc = BeginPaint(hwnd, &ps);
|
2001-01-04 23:44:55 +01:00
|
|
|
/* call User_copy_to_screen? */
|
|
|
|
EndPaint(hwnd, &ps);
|
|
|
|
ret = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ret = window ? SendMessageA(window, msg, wParam, lParam)
|
|
|
|
: DefWindowProcA(hwnd, msg, wParam, lParam);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (msg == WM_CREATE) {
|
|
|
|
CREATESTRUCTA *cs = (CREATESTRUCTA *)lParam;
|
|
|
|
This = (IDirectDrawSurfaceImpl *)cs->lpCreateParams;
|
|
|
|
SetWindowLongA(hwnd, 0, (LONG)This);
|
|
|
|
}
|
|
|
|
ret = DefWindowProcA(hwnd, msg, wParam, lParam);
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|