Moved some more code to the X11 driver.

This commit is contained in:
Patrik Stridvall 1999-02-04 14:05:38 +00:00 committed by Alexandre Julliard
parent c6e6a9aff9
commit 8d8703cb48
35 changed files with 693 additions and 690 deletions

View File

@ -4,14 +4,50 @@
* Copyright 1994 Alexandre Julliard
*/
#include "x11drv.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "win.h"
#include "desktop.h"
#include "heap.h"
#include "monitor.h"
#include "win.h"
#include "wine/winuser16.h"
/***********************************************************************
* DESKTOP_GetScreenWidth
*
* Return the width of the screen associated to the current desktop.
*/
int DESKTOP_GetScreenWidth()
{
DESKTOP *pDesktop = (DESKTOP *) WIN_GetDesktop()->wExtra;
return MONITOR_GetWidth(pDesktop->pPrimaryMonitor);
}
/***********************************************************************
* DESKTOP_GetScreenHeight
*
* Return the height of the screen associated to the current desktop.
*/
int DESKTOP_GetScreenHeight()
{
DESKTOP *pDesktop = (DESKTOP *) WIN_GetDesktop()->wExtra;
return MONITOR_GetHeight(pDesktop->pPrimaryMonitor);
}
/***********************************************************************
* DESKTOP_GetScreenDepth
*
* Return the depth of the screen associated to the current desktop.
*/
int DESKTOP_GetScreenDepth()
{
DESKTOP *pDesktop = (DESKTOP *) WIN_GetDesktop()->wExtra;
return MONITOR_GetDepth(pDesktop->pPrimaryMonitor);
}
/***********************************************************************
* DESKTOP_LoadBitmap
@ -74,7 +110,7 @@ static HBITMAP32 DESKTOP_LoadBitmap( HDC32 hdc, const char *filename )
* Handle the WM_ERASEBKGND message.
*/
static LRESULT DESKTOP_DoEraseBkgnd( HWND32 hwnd, HDC32 hdc,
DESKTOPINFO *infoPtr )
DESKTOP *desktopPtr )
{
RECT32 rect;
WND* Wnd = WIN_FindWndPtr( hwnd );
@ -86,40 +122,40 @@ static LRESULT DESKTOP_DoEraseBkgnd( HWND32 hwnd, HDC32 hdc,
/* Paint desktop pattern (only if wall paper does not cover everything) */
if (!infoPtr->hbitmapWallPaper ||
(!infoPtr->fTileWallPaper && ((infoPtr->bitmapSize.cx < rect.right) ||
(infoPtr->bitmapSize.cy < rect.bottom))))
if (!desktopPtr->hbitmapWallPaper ||
(!desktopPtr->fTileWallPaper && ((desktopPtr->bitmapSize.cx < rect.right) ||
(desktopPtr->bitmapSize.cy < rect.bottom))))
{
/* Set colors in case pattern is a monochrome bitmap */
SetBkColor32( hdc, RGB(0,0,0) );
SetTextColor32( hdc, GetSysColor32(COLOR_BACKGROUND) );
FillRect32( hdc, &rect, infoPtr->hbrushPattern );
FillRect32( hdc, &rect, desktopPtr->hbrushPattern );
}
/* Paint wall paper */
if (infoPtr->hbitmapWallPaper)
if (desktopPtr->hbitmapWallPaper)
{
INT32 x, y;
HDC32 hMemDC = CreateCompatibleDC32( hdc );
SelectObject32( hMemDC, infoPtr->hbitmapWallPaper );
SelectObject32( hMemDC, desktopPtr->hbitmapWallPaper );
if (infoPtr->fTileWallPaper)
if (desktopPtr->fTileWallPaper)
{
for (y = 0; y < rect.bottom; y += infoPtr->bitmapSize.cy)
for (x = 0; x < rect.right; x += infoPtr->bitmapSize.cx)
BitBlt32( hdc, x, y, infoPtr->bitmapSize.cx,
infoPtr->bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
for (y = 0; y < rect.bottom; y += desktopPtr->bitmapSize.cy)
for (x = 0; x < rect.right; x += desktopPtr->bitmapSize.cx)
BitBlt32( hdc, x, y, desktopPtr->bitmapSize.cx,
desktopPtr->bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
}
else
{
x = (rect.left + rect.right - infoPtr->bitmapSize.cx) / 2;
y = (rect.top + rect.bottom - infoPtr->bitmapSize.cy) / 2;
x = (rect.left + rect.right - desktopPtr->bitmapSize.cx) / 2;
y = (rect.top + rect.bottom - desktopPtr->bitmapSize.cy) / 2;
if (x < 0) x = 0;
if (y < 0) y = 0;
BitBlt32( hdc, x, y, infoPtr->bitmapSize.cx,
infoPtr->bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
BitBlt32( hdc, x, y, desktopPtr->bitmapSize.cx,
desktopPtr->bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
}
DeleteDC32( hMemDC );
}
@ -137,7 +173,7 @@ LRESULT WINAPI DesktopWndProc( HWND32 hwnd, UINT32 message,
WPARAM32 wParam, LPARAM lParam )
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
DESKTOPINFO *infoPtr = (DESKTOPINFO *)wndPtr->wExtra;
DESKTOP *desktopPtr = (DESKTOP *)wndPtr->wExtra;
/* Most messages are ignored (we DON'T call DefWindowProc) */
@ -146,15 +182,17 @@ LRESULT WINAPI DesktopWndProc( HWND32 hwnd, UINT32 message,
/* Warning: this message is sent directly by */
/* WIN_CreateDesktopWindow() and does not contain a valid lParam */
case WM_NCCREATE:
infoPtr->hbrushPattern = 0;
infoPtr->hbitmapWallPaper = 0;
desktopPtr->hbrushPattern = 0;
desktopPtr->hbitmapWallPaper = 0;
SetDeskPattern();
SetDeskWallPaper32( (LPSTR)-1 );
return 1;
case WM_ERASEBKGND:
if (rootWindow == DefaultRootWindow(display)) return 1;
return DESKTOP_DoEraseBkgnd( hwnd, (HDC32)wParam, infoPtr );
if (X11DRV_WND_GetXRootWindow(wndPtr) ==
DefaultRootWindow(display))
return 1;
return DESKTOP_DoEraseBkgnd( hwnd, (HDC32)wParam, desktopPtr );
case WM_SYSCOMMAND:
if ((wParam & 0xfff0) != SC_CLOSE) return 0;
@ -175,9 +213,9 @@ BOOL32 WINAPI PaintDesktop(HDC32 hdc)
{
HWND32 hwnd = GetDesktopWindow32();
WND *wndPtr = WIN_FindWndPtr( hwnd );
DESKTOPINFO *infoPtr = (DESKTOPINFO *)wndPtr->wExtra;
DESKTOP *desktopPtr = (DESKTOP *)wndPtr->wExtra;
return DESKTOP_DoEraseBkgnd( hwnd, hdc, infoPtr );
return DESKTOP_DoEraseBkgnd( hwnd, hdc, desktopPtr );
}
/***********************************************************************
@ -211,7 +249,7 @@ BOOL32 WINAPI SetDeskWallPaper32( LPCSTR filename )
HDC32 hdc;
char buffer[256];
WND *wndPtr = WIN_GetDesktop();
DESKTOPINFO *infoPtr = (DESKTOPINFO *)wndPtr->wExtra;
DESKTOP *desktopPtr = (DESKTOP *)wndPtr->wExtra;
if (filename == (LPSTR)-1)
{
@ -221,15 +259,15 @@ BOOL32 WINAPI SetDeskWallPaper32( LPCSTR filename )
hdc = GetDC32( 0 );
hbitmap = DESKTOP_LoadBitmap( hdc, filename );
ReleaseDC32( 0, hdc );
if (infoPtr->hbitmapWallPaper) DeleteObject32( infoPtr->hbitmapWallPaper );
infoPtr->hbitmapWallPaper = hbitmap;
infoPtr->fTileWallPaper = GetProfileInt32A( "desktop", "TileWallPaper", 0 );
if (desktopPtr->hbitmapWallPaper) DeleteObject32( desktopPtr->hbitmapWallPaper );
desktopPtr->hbitmapWallPaper = hbitmap;
desktopPtr->fTileWallPaper = GetProfileInt32A( "desktop", "TileWallPaper", 0 );
if (hbitmap)
{
BITMAP32 bmp;
GetObject32A( hbitmap, sizeof(bmp), &bmp );
infoPtr->bitmapSize.cx = (bmp.bmWidth != 0) ? bmp.bmWidth : 1;
infoPtr->bitmapSize.cy = (bmp.bmHeight != 0) ? bmp.bmHeight : 1;
desktopPtr->bitmapSize.cx = (bmp.bmWidth != 0) ? bmp.bmWidth : 1;
desktopPtr->bitmapSize.cy = (bmp.bmHeight != 0) ? bmp.bmHeight : 1;
}
return TRUE;
}
@ -243,10 +281,10 @@ BOOL32 WINAPI SetDeskWallPaper32( LPCSTR filename )
BOOL32 DESKTOP_SetPattern( LPCSTR pattern )
{
WND *wndPtr = WIN_GetDesktop();
DESKTOPINFO *infoPtr = (DESKTOPINFO *)wndPtr->wExtra;
DESKTOP *desktopPtr = (DESKTOP *)wndPtr->wExtra;
int pat[8];
if (infoPtr->hbrushPattern) DeleteObject32( infoPtr->hbrushPattern );
if (desktopPtr->hbrushPattern) DeleteObject32( desktopPtr->hbrushPattern );
memset( pat, 0, sizeof(pat) );
if (pattern && sscanf( pattern, " %d %d %d %d %d %d %d %d",
&pat[0], &pat[1], &pat[2], &pat[3],
@ -258,10 +296,10 @@ BOOL32 DESKTOP_SetPattern( LPCSTR pattern )
for (i = 0; i < 8; i++) pattern[i] = pat[i] & 0xffff;
hbitmap = CreateBitmap32( 8, 8, 1, 1, (LPSTR)pattern );
infoPtr->hbrushPattern = CreatePatternBrush32( hbitmap );
desktopPtr->hbrushPattern = CreatePatternBrush32( hbitmap );
DeleteObject32( hbitmap );
}
else infoPtr->hbrushPattern = CreateSolidBrush32( GetSysColor32(COLOR_BACKGROUND) );
else desktopPtr->hbrushPattern = CreateSolidBrush32( GetSysColor32(COLOR_BACKGROUND) );
return TRUE;
}

View File

@ -68,7 +68,7 @@ static WNDCLASS32A WIDGETS_BuiltinClasses[BIC32_NB_CLASSES] =
{ CS_GLOBALCLASS, MDIClientWndProc,
0, sizeof(MDICLIENTINFO), 0, 0, 0, STOCK_LTGRAY_BRUSH, 0, "MDIClient" },
/* BIC32_DESKTOP */
{ CS_GLOBALCLASS, DesktopWndProc, 0, sizeof(DESKTOPINFO),
{ CS_GLOBALCLASS, DesktopWndProc, 0, sizeof(DESKTOP),
0, 0, (HCURSOR32)IDC_ARROW32A, 0, 0, DESKTOP_CLASS_NAME },
/* BIC32_DIALOG */
{ CS_GLOBALCLASS | CS_SAVEBITS, DefDlgProc32A, 0, DLGWINDOWEXTRA,

View File

@ -7,6 +7,7 @@
*/
#include "ts_xlib.h"
#include "x11drv.h"
#include <stdio.h>
#include <signal.h>
@ -24,8 +25,6 @@
#include "neexe.h"
#include "process.h"
#include "main.h"
#include "ts_xlib.h"
#include "expr.h"
extern FILE * yyin;

View File

@ -15,22 +15,38 @@
*/
#include "config.h"
#include <unistd.h>
#include <assert.h>
#include "ts_xlib.h"
#include "ts_xutil.h"
#include <sys/signal.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include "windows.h"
#ifdef HAVE_LIBXXSHM
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include "ts_xshm.h"
#endif /* defined(HAVE_LIBXXSHM) */
#ifdef HAVE_LIBXXF86DGA
#include "ts_xf86dga.h"
#endif /* defined(HAVE_LIBXXF86DGA) */
#ifdef HAVE_LIBXXF86VM
/* X is retarted and insists on declaring INT32, INT16 etc in Xmd.h,
this is a crude hack to get around it */
#define XMD_H
#include "wintypes.h"
#include "ts_xf86vmode.h"
#endif
#endif /* defined(HAVE_LIBXXF86VM) */
#include "x11drv.h"
#include <unistd.h>
#include <assert.h>
#include <sys/signal.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include "windows.h"
#include "winerror.h"
#include "gdi.h"
@ -44,21 +60,9 @@
#include "debug.h"
#include "spy.h"
#include "message.h"
#include "x11drv.h"
#include "options.h"
#include "objbase.h"
#ifdef HAVE_LIBXXF86DGA
#include "ts_xf86dga.h"
#include <sys/mman.h>
#endif
#ifdef HAVE_LIBXXSHM
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include "ts_xshm.h"
#endif
#include "monitor.h"
/* This for all the enumeration and creation of D3D-related objects */
#include "d3d_private.h"
@ -444,7 +448,7 @@ static void Xlib_copy_surface_on_screen(LPDIRECTDRAWSURFACE4 this) {
if (this->s.ddraw->e.xlib.xshm_active)
TSXShmPutImage(display,
this->s.ddraw->d.drawable,
DefaultGCOfScreen(screen),
DefaultGCOfScreen(X11DRV_GetXScreen()),
this->t.xlib.image,
0, 0, 0, 0,
this->t.xlib.image->width,
@ -454,7 +458,7 @@ static void Xlib_copy_surface_on_screen(LPDIRECTDRAWSURFACE4 this) {
#endif
TSXPutImage( display,
this->s.ddraw->d.drawable,
DefaultGCOfScreen(screen),
DefaultGCOfScreen(X11DRV_GetXScreen()),
this->t.xlib.image,
0, 0, 0, 0,
this->t.xlib.image->width,
@ -570,7 +574,8 @@ static HRESULT WINAPI Xlib_IDirectDrawSurface4_SetPalette(
if( !(pal->cm) && (this->s.ddraw->d.screen_depth<=8))
{
pal->cm = TSXCreateColormap(display,this->s.ddraw->d.drawable,DefaultVisualOfScreen(screen),AllocAll);
pal->cm = TSXCreateColormap(display,this->s.ddraw->d.drawable,
DefaultVisualOfScreen(X11DRV_GetXScreen()),AllocAll);
if (!Options.managed)
TSXInstallColormap(display,pal->cm);
@ -2286,7 +2291,7 @@ static XImage *create_ximage(LPDIRECTDRAW2 this, LPDIRECTDRAWSURFACE4 lpdsf) {
#ifdef HAVE_LIBXXSHM
if (this->e.xlib.xshm_active) {
img = TSXShmCreateImage(display,
DefaultVisualOfScreen(screen),
DefaultVisualOfScreen(X11DRV_GetXScreen()),
this->d.screen_depth,
ZPixmap,
NULL,
@ -2345,7 +2350,7 @@ static XImage *create_ximage(LPDIRECTDRAW2 this, LPDIRECTDRAWSURFACE4 lpdsf) {
/* In this case, create an XImage */
img =
TSXCreateImage(display,
DefaultVisualOfScreen(screen),
DefaultVisualOfScreen(X11DRV_GetXScreen()),
this->d.screen_depth,
ZPixmap,
0,
@ -2510,7 +2515,7 @@ static HRESULT WINAPI IDirectDraw2_SetCooperativeLevel(
/* This will be overwritten in the case of Full Screen mode.
Windowed games could work with that :-) */
if (hwnd)
this->d.drawable = ((X11DRV_WND_DATA *) WIN_FindWndPtr(hwnd)->pDriverData)->window;
this->d.drawable = X11DRV_WND_GetXWindow(WIN_FindWndPtr(hwnd));
return DD_OK;
}
@ -2571,6 +2576,7 @@ static HRESULT WINAPI DGA_IDirectDraw_SetDisplayMode(
this->d.screen_depth = depth;
depths = TSXListDepths(display,DefaultScreen(display),&depcount);
for (i=0;i<depcount;i++)
if (depths[i]==depth)
break;
@ -2671,8 +2677,9 @@ static HRESULT WINAPI Xlib_IDirectDraw_SetDisplayMode(
/* We hope getting the asked for depth */
this->d.screen_depth = depth;
depths = TSXListDepths(display,DefaultScreen(display),&depcount);
for (i=0;i<depcount;i++)
if (depths[i]==depth)
break;
@ -2859,7 +2866,7 @@ static HRESULT WINAPI DGA_IDirectDraw2_CreatePalette(
if (res != 0) return res;
(*lpddpal)->lpvtbl = &dga_ddpalvt;
if (this->d.depth<=8) {
(*lpddpal)->cm = TSXCreateColormap(display,DefaultRootWindow(display),DefaultVisualOfScreen(screen),AllocAll);
(*lpddpal)->cm = TSXCreateColormap(display,DefaultRootWindow(display),DefaultVisualOfScreen(X11DRV_GetXScreen()),AllocAll);
} else {
FIXME(ddraw,"why are we doing CreatePalette in hi/truecolor?\n");
(*lpddpal)->cm = 0;
@ -3182,8 +3189,8 @@ static HRESULT WINAPI IDirectDraw2_EnumDisplayModes(
}
}
ddsfd.dwWidth = screenWidth;
ddsfd.dwHeight = screenHeight;
ddsfd.dwWidth = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
ddsfd.dwHeight = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
TRACE(ddraw," enumerating (%ldx%ldx%d)\n",ddsfd.dwWidth,ddsfd.dwHeight,depths[i]);
if (!modescb(&ddsfd,context)) return DD_OK;
@ -3212,8 +3219,8 @@ static HRESULT WINAPI DGA_IDirectDraw2_GetDisplayMode(
#ifdef HAVE_LIBXXF86DGA
TRACE(ddraw,"(%p)->(%p)\n",this,lpddsfd);
lpddsfd->dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PITCH|DDSD_BACKBUFFERCOUNT|DDSD_PIXELFORMAT|DDSD_CAPS;
lpddsfd->dwHeight = screenHeight;
lpddsfd->dwWidth = screenWidth;
lpddsfd->dwHeight = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
lpddsfd->dwWidth = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
lpddsfd->lPitch = this->e.dga.fb_width*this->d.depth/8;
lpddsfd->dwBackBufferCount = 1;
lpddsfd->x.dwRefreshRate = 60;
@ -3230,8 +3237,8 @@ static HRESULT WINAPI Xlib_IDirectDraw2_GetDisplayMode(
) {
TRACE(ddraw,"(%p)->GetDisplayMode(%p)\n",this,lpddsfd);
lpddsfd->dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PITCH|DDSD_BACKBUFFERCOUNT|DDSD_PIXELFORMAT|DDSD_CAPS;
lpddsfd->dwHeight = screenHeight;
lpddsfd->dwWidth = screenWidth;
lpddsfd->dwHeight = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
lpddsfd->dwWidth = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
/* POOLE FIXME: Xlib */
lpddsfd->lPitch = this->e.dga.fb_width*this->d.depth/8;
/* END FIXME: Xlib */
@ -3660,7 +3667,7 @@ HRESULT WINAPI DGA_DirectDrawCreate( LPDIRECTDRAW *lplpDD, LPUNKNOWN pUnkOuter)
TSXF86DGAGetViewPortSize(display,DefaultScreen(display),&width,&height);
TSXF86DGASetViewPort(display,DefaultScreen(display),0,0);
(*lplpDD)->e.dga.fb_height = screenHeight;
(*lplpDD)->e.dga.fb_height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
#ifdef DIABLO_HACK
(*lplpDD)->e.dga.vpmask = 1;
#else
@ -3668,8 +3675,8 @@ HRESULT WINAPI DGA_DirectDrawCreate( LPDIRECTDRAW *lplpDD, LPUNKNOWN pUnkOuter)
#endif
/* just assume the default depth is the DGA depth too */
(*lplpDD)->d.screen_depth = DefaultDepthOfScreen(screen);
(*lplpDD)->d.depth = DefaultDepthOfScreen(screen);
(*lplpDD)->d.screen_depth = DefaultDepthOfScreen(X11DRV_GetXScreen());
(*lplpDD)->d.depth = DefaultDepthOfScreen(X11DRV_GetXScreen());
#ifdef RESTORE_SIGNALS
if (SIGNAL_Reinit) SIGNAL_Reinit();
#endif
@ -3708,10 +3715,9 @@ HRESULT WINAPI Xlib_DirectDrawCreate( LPDIRECTDRAW *lplpDD, LPUNKNOWN pUnkOuter)
(*lplpDD)->ref = 1;
(*lplpDD)->d.drawable = 0; /* in SetDisplayMode */
(*lplpDD)->d.screen_depth = DefaultDepthOfScreen(screen);
(*lplpDD)->d.depth = DefaultDepthOfScreen(screen);
(*lplpDD)->d.height = screenHeight;
(*lplpDD)->d.width = screenWidth;
(*lplpDD)->d.screen_depth = DefaultDepthOfScreen(X11DRV_GetXScreen());
(*lplpDD)->d.height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
(*lplpDD)->d.width = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
#ifdef HAVE_LIBXXSHM
/* Test if XShm is available. */
@ -3771,6 +3777,7 @@ HRESULT WINAPI DirectDrawCreate( LPGUID lpGUID, LPDIRECTDRAW *lplpDD, LPUNKNOWN
else
goto err;
(*lplpDD)->d.winclass = RegisterClass32A(&wc);
return ret;

View File

@ -5,11 +5,13 @@
* Copyright 1997 Bertho A. Stultiens
*/
#include <math.h>
#include <stdlib.h>
#include <X11/Intrinsic.h>
#include "ts_xlib.h"
#include "ts_xutil.h"
#include <X11/Intrinsic.h>
#include "x11drv.h"
#include <math.h>
#include <stdlib.h>
#ifndef PI
#define PI M_PI
#endif
@ -19,13 +21,14 @@
#include "callback.h"
#include "heap.h"
#include "metafile.h"
#include "monitor.h"
#include "palette.h"
#include "cache.h"
#include "region.h"
#include "path.h"
#include "debug.h"
#include "winerror.h"
#include "x11drv.h"
/***********************************************************************
* LineTo16 (GDI.19)
@ -681,7 +684,7 @@ void WINAPI DrawFocusRect32( HDC32 hdc, const RECT32* rc )
oldBkMode = SetBkMode32(hdc, TRANSPARENT);
/* Hack: make sure the XORPEN operation has an effect */
physDev->pen.pixel = (1 << screenDepth) - 1;
physDev->pen.pixel = (1 << MONITOR_GetDepth(&MONITOR_PrimaryMonitor)) - 1;
if (X11DRV_SetupGCForPen( dc ))
TSXDrawRectangle( display, physDev->drawable, physDev->gc,

View File

@ -4,21 +4,26 @@
* Started by Robert Pouliot <krynos@clic.net>
*/
#include "config.h"
#include "ts_xlib.h"
#include "ts_xshm.h"
#ifdef HAVE_LIBXXSHM
#include <sys/types.h>
#include <sys/ipc.h>
#ifndef __EMX__
#include <sys/shm.h>
#endif
#endif /* !defined(__EMX__) */
#include "ts_xshm.h"
#endif /* defined(HAVE_LIBXXSHM) */
#include "x11drv.h"
#include "windows.h"
#include "bitmap.h"
#include "dc.h"
#include "gdi.h"
#include "xmalloc.h"
#include "x11drv.h"
#include "debug.h"
#include "gdi.h"
#include "monitor.h"
#include "wintypes.h"
#include "xmalloc.h"
typedef enum WING_DITHER_TYPE
{
@ -46,18 +51,20 @@ static void __initWinG(void)
{
if( __WinGOK < 0 )
{
#ifdef HAVE_LIBXXSHM
Status s = TSXShmQueryExtension(display);
if( s )
{
int i = TSXShmPixmapFormat(display);
if( i == ZPixmap && screenDepth == 8 )
if( i == ZPixmap && MONITOR_GetDepth(&MONITOR_PrimaryMonitor) == 8 )
{
__WinGOK = True;
__WinGOK = 1;
return;
}
}
#endif /* defined(HAVE_LIBXXSHM) */
FIXME(wing,"WinG: incorrect depth or unsupported card.\n");
__WinGOK = False;
__WinGOK = 0;
}
}
@ -126,7 +133,9 @@ HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 winDC, BITMAPINFO *header,
HBITMAP16 hbitmap = GDI_AllocObject( sizeof(BITMAPOBJ), BITMAP_MAGIC );
if (hbitmap)
{
__ShmBitmapCtl* p = (__ShmBitmapCtl*)xmalloc(sizeof(__ShmBitmapCtl));
#ifdef HAVE_LIBXXSHM
__ShmBitmapCtl* p = (__ShmBitmapCtl*)xmalloc(sizeof(__ShmBitmapCtl));
#endif /* defined(HAVE_LIBXXSHM) */
BITMAPOBJ* bmpObjPtr = (BITMAPOBJ *) GDI_HEAP_LOCK( hbitmap );
bmpObjPtr->size.cx = 0;
@ -138,6 +147,8 @@ HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 winDC, BITMAPINFO *header,
bmpObjPtr->bitmap.bmBitsPixel = (BYTE)bmpi->biBitCount;
bmpObjPtr->bitmap.bmWidthBytes =
(INT16)BITMAP_WIDTH_BYTES( bmpObjPtr->bitmap.bmWidth, bmpi->biBitCount );
#ifdef HAVE_LIBXXSHM
bmpObjPtr->bitmap.bmBits = (SEGPTR)p;
p->si.shmid = key;
@ -170,12 +181,16 @@ HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 winDC, BITMAPINFO *header,
GDI_FreeObject( hbitmap );
hbitmap = 0;
}
#else /* defined(HAVE_LIBXXSHM) */
bmpObjPtr->bitmap.bmBits = (SEGPTR) NULL;
bmpObjPtr->pixmap = NULL;
#endif /* defined(HAVE_LIBXXSHM) */
}
GDI_HEAP_UNLOCK( hbitmap );
return hbitmap;
}
}
#endif
#endif /* defined(PRELIMINARY_WING16_SUPPORT) */
}
return 0;
}
@ -186,6 +201,7 @@ HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 winDC, BITMAPINFO *header,
SEGPTR WINAPI WinGGetDIBPointer16(HBITMAP16 hWinGBitmap, BITMAPINFO* bmpi)
{
#ifdef PRELIMINARY_WING16_SUPPORT
#ifdef HAVE_LIBXXSHM
BITMAPOBJ* bmp = (BITMAPOBJ *) GDI_GetObjPtr( hWinGBitmap, BITMAP_MAGIC );
if( bmp )
@ -198,7 +214,8 @@ SEGPTR WINAPI WinGGetDIBPointer16(HBITMAP16 hWinGBitmap, BITMAPINFO* bmpi)
return p->bits;
}
}
#endif
#endif /* defined(HAVE_LIBXXSHM) */
#endif /* defined(PRELIMINARY_WING16_SUPPORT) */
return (SEGPTR)NULL;
}
@ -279,10 +296,12 @@ BOOL16 WINAPI WinGBitBlt16(HDC16 destDC, INT16 xDest, INT16 yDest,
widDest = widDest * dcDst->vportExtX / dcDst->wndExtX;
heiDest = heiDest * dcDst->vportExtY / dcDst->wndExtY;
TSXSetFunction( display, physDevDst->gc, GXcopy );
TSXCopyArea( display, physDevSrc->drawable,
physDevDst->drawable, physDevDst->gc,
xSrc, ySrc, widDest, heiDest, xDest, yDest );
return TRUE;
}

View File

@ -7,9 +7,9 @@
#ifndef __WINE_BITMAP_H
#define __WINE_BITMAP_H
#include <X11/Xlib.h>
#include "gdi.h"
#include "ts_xlib.h"
#include "ts_xutil.h"
/* Additional info for DIB section objects */
typedef struct

View File

@ -3,7 +3,6 @@
#include "palette.h"
#include "gdi.h"
#include "x11drv.h"
#define COLOR_FIXED 0x0001 /* read-only colormap - have to use XAllocColor (if not virtual)*/
#define COLOR_VIRTUAL 0x0002 /* no mapping needed - pixel == pixel color */
@ -21,7 +20,6 @@ extern COLORREF COLOR_ToLogical(int pixel);
extern int COLOR_ToPhysical( DC *dc, COLORREF color );
extern int COLOR_SetMapping( PALETTEOBJ* pal, UINT32 uStart, UINT32 uNum, BOOL32 mapOnly );
extern BOOL32 COLOR_IsSolid( COLORREF color );
extern Colormap COLOR_GetColormap(void);
extern UINT16 COLOR_GetSystemPaletteSize(void);
extern UINT16 COLOR_GetSystemPaletteFlags(void);
extern const PALETTEENTRY* COLOR_GetSystemPaletteTemplate(void);

View File

@ -1,16 +1,12 @@
#ifndef __WINE_DDRAW_H
#define __WINE_DDRAW_H
#include "wine/obj_base.h"
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include <X11/Xlib.h>
#ifdef HAVE_LIBXXSHM
#include <X11/extensions/XShm.h>
#endif /* defined(HAVE_LIBXXSHM) */
#endif /* !defined(X_DISPLAY_MISSING) */
#include "wine/obj_base.h"
#ifndef DIRECTDRAW_VERSION
#define DIRECTDRAW_VERSION 0x0500
@ -936,7 +932,7 @@ struct _dga_directdrawdata {
struct _xlib_directdrawdata {
#ifdef HAVE_LIBXXSHM
int xshm_active;
#endif
#endif /* defined(HAVE_LIBXXSHM) */
/* are these needed for anything? (draw_surf is the active surface)
IDirectDrawSurface *surfs;

View File

@ -139,21 +139,22 @@
#define dbch_tooltips 131
#define dbch_trackbar 132
#define dbch_treeview 133
#define dbch_tweak 134
#define dbch_uitools 135
#define dbch_updown 136
#define dbch_ver 137
#define dbch_virtual 138
#define dbch_vxd 139
#define dbch_wave 140
#define dbch_win 141
#define dbch_win16drv 142
#define dbch_win32 143
#define dbch_wing 144
#define dbch_winsock 145
#define dbch_wnet 146
#define dbch_x11 147
#define dbch_x11drv 148
#define dbch_ttydrv 134
#define dbch_tweak 135
#define dbch_uitools 136
#define dbch_updown 137
#define dbch_ver 138
#define dbch_virtual 139
#define dbch_vxd 140
#define dbch_wave 141
#define dbch_win 142
#define dbch_win16drv 143
#define dbch_win32 144
#define dbch_wing 145
#define dbch_winsock 146
#define dbch_wnet 147
#define dbch_x11 148
#define dbch_x11drv 149
/* Definitions for classes identifiers */
#define dbcl_fixme 0
#define dbcl_err 1

View File

@ -4,7 +4,7 @@
#include "debugtools.h"
#endif
#define DEBUG_CHANNEL_COUNT 149
#define DEBUG_CHANNEL_COUNT 150
#ifdef DEBUG_RUNTIME
short debug_msg_enabled[][DEBUG_CLASS_COUNT] = {
{1, 1, 0, 0},
@ -156,6 +156,7 @@ short debug_msg_enabled[][DEBUG_CLASS_COUNT] = {
{1, 1, 0, 0},
{1, 1, 0, 0},
{1, 1, 0, 0},
{1, 1, 0, 0},
};
const char* debug_ch_name[] = {
"accel",
@ -292,6 +293,7 @@ const char* debug_ch_name[] = {
"tooltips",
"trackbar",
"treeview",
"ttydrv",
"tweak",
"uitools",
"updown",

View File

@ -9,13 +9,29 @@
#include "windows.h"
typedef struct
struct tagMONITOR;
struct _DESKTOP_DRIVER;
typedef struct tagDESKTOP
{
HBRUSH32 hbrushPattern;
HBITMAP32 hbitmapWallPaper;
SIZE32 bitmapSize;
BOOL32 fTileWallPaper;
} DESKTOPINFO;
HBRUSH32 hbrushPattern;
HBITMAP32 hbitmapWallPaper;
SIZE32 bitmapSize;
BOOL32 fTileWallPaper;
struct tagMONITOR *pPrimaryMonitor;
struct _DESKTOP_DRIVER *pDriver; /* Desktop driver */
void *pDriverData; /* Desktop driver data */
} DESKTOP;
typedef struct _DESKTOP_DRIVER {
void (*pInitialize)(struct tagDESKTOP *pDesktop);
void (*pFinalize)(struct tagDESKTOP *pDesktop);
} DESKTOP_DRIVER;
extern int DESKTOP_GetScreenWidth();
extern int DESKTOP_GetScreenHeight();
extern int DESKTOP_GetScreenDepth();
extern BOOL32 DESKTOP_SetPattern( LPCSTR pattern );
extern LRESULT WINAPI DesktopWndProc( HWND32 hwnd, UINT32 message,

View File

@ -11,11 +11,11 @@
#include "wine/winuser16.h"
#pragma pack(1)
typedef struct _CURSORINFO
typedef struct tagCURSORINFO
{
WORD wXMickeys;
WORD wYMickeys;
} CURSORINFO, *LPCURSORINFO;
} CURSORINFO, *PCURSORINFO, *LPCURSORINFO;
#pragma pack(4)
typedef struct _MOUSE_DRIVER {

View File

@ -12,6 +12,9 @@ extern HINSTANCE32 MAIN_WinelibInit( int *argc, char *argv[] );
extern int MAIN_GetLanguageID(char*lang, char*country, char*charset, char*dialect);
extern BOOL32 MAIN_ParseDebugOptions(char *options);
extern void MAIN_ParseLanguageOption( char *arg );
extern void MAIN_ParseModeOption( char *arg );
extern BOOL32 RELAY_Init(void);
extern int RELAY_ShowDebugmsgRelay(const char *func);
extern void* CALL32_Init(void);

View File

@ -51,6 +51,8 @@ typedef enum
struct options
{
int *argc;
char **argv;
char * desktopGeometry; /* NULL when no desktop */
char * programName; /* To use when loading resources */
char * argv0; /* argv[0] of Wine process */
@ -71,6 +73,7 @@ struct options
int noDGA; /* Disable XFree86 DGA extensions */
char * configFileName; /* Command line config file */
char * consoleDrivers; /* Console driver list */
int screenDepth;
};
extern struct options Options;

View File

@ -5,22 +5,47 @@
#ifndef __WINE_TTYDRV_H
#define __WINE_TTYDRV_H
#include "clipboard.h"
#include "keyboard.h"
#include "message.h"
#include "windows.h"
#include "wine/winuser16.h"
struct tagCLASS;
struct tagDC;
struct tagDESKTOP;
struct tagWND;
/* TTY GDI driver */
typedef struct {
} TTYDRV_PDEVICE;
extern BOOL32 TTYDRV_GDI_Initialize();
extern void TTDRV_GDI_Finalize();
extern BOOL32 TTYDRV_GDI_CreateDC(struct tagDC *dc, LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODE16 *initData);
extern BOOL32 TTYDRV_GDI_DeleteDC(struct tagDC *dc);
extern INT32 TTYDRV_GDI_Escape(struct tagDC *dc, INT32 nEscape, INT32 cbInput, SEGPTR lpInData, SEGPTR lpOutData);
/* TTY clipboard driver */
extern CLIPBOARD_DRIVER TTYDRV_CLIPBOARD_Driver;
extern struct _CLIPBOARD_DRIVER TTYDRV_CLIPBOARD_Driver;
extern void TTYDRV_CLIPBOARD_EmptyClipboard();
extern void TTYDRV_CLIPBOARD_SetClipboardData(UINT32 wFormat);
extern BOOL32 TTYDRV_CLIPBOARD_RequestSelection();
extern void TTYDRV_CLIPBOARD_ResetOwner(WND *pWnd, BOOL32 bFooBar);
extern void TTYDRV_CLIPBOARD_ResetOwner(struct tagWND *pWnd, BOOL32 bFooBar);
/* TTY desktop driver */
extern struct _DESKTOP_DRIVER TTYDRV_DESKTOP_Driver;
extern void TTYDRV_DESKTOP_Initialize(struct tagDESKTOP *pDesktop);
extern void TTYDRV_DESKTOP_Finalize(struct tagDESKTOP *pDesktop);
extern int TTYDRV_DESKTOP_GetScreenWidth(struct tagDESKTOP *pDesktop);
extern int TTYDRV_DESKTOP_GetScreenHeight(struct tagDESKTOP *pDesktop);
extern int TTYDRV_DESKTOP_GetScreenDepth(struct tagDESKTOP *pDesktop);
/* TTY event driver */
extern EVENT_DRIVER TTYDRV_EVENT_Driver;
extern struct _EVENT_DRIVER TTYDRV_EVENT_Driver;
extern BOOL32 TTYDRV_EVENT_Init(void);
extern void TTYDRV_EVENT_AddIO(int fd, unsigned flag);
@ -35,7 +60,7 @@ extern BOOL16 TTYDRV_EVENT_IsUserIdle(void);
/* TTY keyboard driver */
extern KEYBOARD_DRIVER TTYDRV_KEYBOARD_Driver;
extern struct _KEYBOARD_DRIVER TTYDRV_KEYBOARD_Driver;
extern void TTYDRV_KEYBOARD_Init(void);
extern WORD TTYDRV_KEYBOARD_VkKeyScan(CHAR cChar);
@ -43,4 +68,58 @@ extern UINT16 TTYDRV_KEYBOARD_MapVirtualKey(UINT16 wCode, UINT16 wMapType);
extern INT16 TTYDRV_KEYBOARD_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize);
extern INT16 TTYDRV_KEYBOARD_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpKeyState, LPVOID lpChar, UINT16 flags);
/* TTY main driver */
extern void TTYDRV_MAIN_Finalize();
extern void TTYDRV_MAIN_Initialize();
extern void TTYDRV_MAIN_ParseOptions(int *argc, char *argv[]);
extern void TTYDRV_MAIN_Create();
extern void TTYDRV_MAIN_SaveSetup();
extern void TTYDRV_MAIN_RestoreSetup();
/* TTY monitor driver */
extern struct tagMONITOR_DRIVER TTYDRV_MONITOR_Driver;
typedef struct _TTYDRV_MONITOR_DATA {
int width;
int height;
int depth;
} TTYDRV_MONITOR_DATA;
struct tagMONITOR;
extern void TTYDRV_MONITOR_Initialize(struct tagMONITOR *pMonitor);
extern void TTYDRV_MONITOR_Finalize(struct tagMONITOR *pMonitor);
extern int TTYDRV_MONITOR_GetWidth(struct tagMONITOR *pMonitor);
extern int TTYDRV_MONITOR_GetHeight(struct tagMONITOR *pMonitor);
extern int TTYDRV_MONITOR_GetDepth(struct tagMONITOR *pMonitor);
/* TTY mouse driver */
extern struct _MOUSE_DRIVER TTYDRV_MOUSE_Driver;
extern void TTYDRV_MOUSE_SetCursor(CURSORICONINFO *lpCursor);
extern void TTYDRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY);
/* TTY windows driver */
extern struct _WND_DRIVER TTYDRV_WND_Driver;
extern void TTYDRV_WND_Initialize(struct tagWND *wndPtr);
extern void TTYDRV_WND_Finalize(struct tagWND *wndPtr);
extern BOOL32 TTYDRV_WND_CreateDesktopWindow(struct tagWND *wndPtr, struct tagCLASS *classPtr, BOOL32 bUnicode);
extern BOOL32 TTYDRV_WND_CreateWindow(struct tagWND *wndPtr, struct tagCLASS *classPtr, CREATESTRUCT32A *cs, BOOL32 bUnicode);
extern BOOL32 TTYDRV_WND_DestroyWindow(struct tagWND *pWnd);
extern struct tagWND *TTYDRV_WND_SetParent(struct tagWND *wndPtr, struct tagWND *pWndParent);
extern void TTYDRV_WND_ForceWindowRaise(struct tagWND *pWnd);
extern void TTYDRV_WND_SetWindowPos(struct tagWND *wndPtr, const WINDOWPOS32 *winpos, BOOL32 bSMC_SETXPOS);
extern void TTYDRV_WND_SetText(struct tagWND *wndPtr, LPCSTR text);
extern void TTYDRV_WND_SetFocus(struct tagWND *wndPtr);
extern void TTYDRV_WND_PreSizeMove(struct tagWND *wndPtr);
extern void TTYDRV_WND_PostSizeMove(struct tagWND *wndPtr);
extern void TTYDRV_WND_ScrollWindow(struct tagWND *wndPtr, struct tagDC *dcPtr, INT32 dx, INT32 dy, const RECT32 *clipRect, BOOL32 bUpdate);
extern void TTYDRV_WND_SetDrawable(struct tagWND *wndPtr, struct tagDC *dc, WORD flags, BOOL32 bSetClipOrigin);
extern BOOL32 TTYDRV_WND_IsSelfClipping(struct tagWND *wndPtr);
#endif /* !defined(__WINE_TTYDRV_H) */

View File

@ -7,14 +7,9 @@
#ifndef __WINE_WIN_H
#define __WINE_WIN_H
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include <X11/Xlib.h>
#endif /* !defined(X_DISPLAY_MISSING) */
#include "ldt.h"
#include "class.h"
#include "ldt.h"
#include "windows.h"
#include "winproc.h"
#define WND_MAGIC 0x444e4957 /* 'WIND' */
@ -54,6 +49,7 @@ typedef enum
#define RDW_C_USEHRGN 0x0001
#define RDW_C_DELETEHRGN 0x0002
struct tagCLASS;
struct tagDCE;
struct tagDC;
struct _WND_DRIVER;
@ -64,7 +60,7 @@ typedef struct tagWND
struct tagWND *child; /* First child */
struct tagWND *parent; /* Window parent (from CreateWindow) */
struct tagWND *owner; /* Window owner */
CLASS *class; /* Window class */
struct tagCLASS *class; /* Window class */
HWINDOWPROC winproc; /* Window procedure */
DWORD dwMagic; /* Magic number (must be WND_MAGIC) */
HWND32 hwndSelf; /* Handle of this window */
@ -84,9 +80,6 @@ typedef struct tagWND
UINT32 wIDmenu; /* ID or hmenu (from CreateWindow) */
DWORD helpContext; /* Help context ID */
WORD flags; /* Misc. flags (see below) */
#if 0
Window window; /* X window (only for top-level windows) */
#endif
HMENU16 hSysMenu; /* window's copy of System Menu */
DWORD userdata; /* User private data */
struct _WND_DRIVER *pDriver; /* Window driver */
@ -98,8 +91,8 @@ typedef struct _WND_DRIVER
{
void (*pInitialize)(WND *);
void (*pFinalize)(WND *);
BOOL32 (*pCreateDesktopWindow)(WND *, CLASS *, BOOL32);
BOOL32 (*pCreateWindow)(WND *, CLASS *, CREATESTRUCT32A *, BOOL32);
BOOL32 (*pCreateDesktopWindow)(WND *, struct tagCLASS *, BOOL32);
BOOL32 (*pCreateWindow)(WND *, struct tagCLASS *, CREATESTRUCT32A *, BOOL32);
BOOL32 (*pDestroyWindow)(WND *);
WND* (*pSetParent)(WND *, WND *);
void (*pForceWindowRaise)(WND *);
@ -181,8 +174,4 @@ extern BOOL32 ICONTITLE_Init( void );
/* windows/focus.c */
extern void FOCUS_SwitchFocus( HWND32 , HWND32 );
extern Display * display;
extern Screen * screen;
extern Window rootWindow;
#endif /* __WINE_WIN_H */

View File

@ -14,15 +14,14 @@
#include <X11/Xatom.h>
#endif /* !defined(X_DISPLAY_MISSING) */
#include "winbase.h"
#include "wintypes.h"
#include "display.h"
#include "gdi.h"
#include "xmalloc.h" /* for XCREATEIMAGE macro */
#include "clipboard.h"
#include "keyboard.h"
#include "message.h"
#include "win.h"
#include "wintypes.h"
#include "wine/winuser16.h"
struct tagCLASS;
struct tagDC;
struct tagDeviceCaps;
struct tagWND;
/* X physical pen */
typedef struct
@ -75,9 +74,6 @@ extern GC BITMAP_monoGC, BITMAP_colorGC;
/* Wine driver X11 functions */
struct tagDC;
struct tagDeviceCaps;
extern BOOL32 X11DRV_Init(void);
extern BOOL32 X11DRV_BitBlt( struct tagDC *dcDst, INT32 xDst, INT32 yDst,
INT32 width, INT32 height, struct tagDC *dcSrc,
@ -173,12 +169,6 @@ extern BOOL32 X11DRV_SetupGCForText( struct tagDC *dc );
extern const int X11DRV_XROPfunction[];
extern Display * display;
extern Screen * screen;
extern Window rootWindow;
extern int screenWidth, screenHeight, screenDepth;
/* Xlib critical section */
extern CRITICAL_SECTION X11DRV_CritSection;
@ -188,7 +178,7 @@ extern void _XInitImageFuncPtrs(XImage *);
#define XCREATEIMAGE(image,width,height,bpp) \
{ \
int width_bytes = X11DRV_DIB_GetXImageWidthBytes( (width), (bpp) ); \
(image) = TSXCreateImage(display, DefaultVisualOfScreen(screen), \
(image) = TSXCreateImage(display, DefaultVisualOfScreen(X11DRV_GetXScreen()), \
(bpp), ZPixmap, 0, xcalloc( (height)*width_bytes ),\
(width), (height), 32, width_bytes ); \
}
@ -224,67 +214,43 @@ extern int *X11DRV_DIB_BuildColorMap( struct tagDC *dc, WORD coloruse,
WORD depth, const BITMAPINFO *info,
int *nColors );
/* X11 windows driver */
extern WND_DRIVER X11DRV_WND_Driver;
typedef struct _X11DRV_WND_DATA {
Window window;
} X11DRV_WND_DATA;
extern Window X11DRV_WND_GetXWindow(WND *wndPtr);
extern Window X11DRV_WND_FindXWindow(WND *wndPtr);
extern void X11DRV_WND_Initialize(WND *wndPtr);
extern void X11DRV_WND_Finalize(WND *wndPtr);
extern BOOL32 X11DRV_WND_CreateDesktopWindow(WND *wndPtr, CLASS *classPtr, BOOL32 bUnicode);
extern BOOL32 X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCT32A *cs, BOOL32 bUnicode);
extern BOOL32 X11DRV_WND_DestroyWindow(WND *pWnd);
extern WND *X11DRV_WND_SetParent(WND *wndPtr, WND *pWndParent);
extern void X11DRV_WND_ForceWindowRaise(WND *pWnd);
extern void X11DRV_WND_SetWindowPos(WND *wndPtr, const WINDOWPOS32 *winpos, BOOL32 bSMC_SETXPOS);
extern void X11DRV_WND_SetText(WND *wndPtr, LPCSTR text);
extern void X11DRV_WND_SetFocus(WND *wndPtr);
extern void X11DRV_WND_PreSizeMove(WND *wndPtr);
extern void X11DRV_WND_PostSizeMove(WND *wndPtr);
extern void X11DRV_WND_ScrollWindow(WND *wndPtr, DC *dcPtr, INT32 dx, INT32 dy, const RECT32 *clipRect, BOOL32 bUpdate);
extern void X11DRV_WND_SetDrawable(WND *wndPtr, DC *dc, WORD flags, BOOL32 bSetClipOrigin);
extern BOOL32 X11DRV_WND_IsSelfClipping(WND *wndPtr);
/* X11 clipboard driver */
extern CLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver;
extern struct _CLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver;
extern void X11DRV_CLIPBOARD_EmptyClipboard();
extern void X11DRV_CLIPBOARD_SetClipboardData(UINT32 wFormat);
extern BOOL32 X11DRV_CLIPBOARD_RequestSelection();
extern void X11DRV_CLIPBOARD_ResetOwner(WND *pWnd, BOOL32 bFooBar);
extern void X11DRV_CLIPBOARD_ResetOwner(struct tagWND *pWnd, BOOL32 bFooBar);
void X11DRV_CLIPBOARD_ReadSelection(Window w, Atom prop);
void X11DRV_CLIPBOARD_ReleaseSelection(Window w, HWND32 hwnd);
/* X11 keyboard driver */
/* X11 color driver */
extern KEYBOARD_DRIVER X11DRV_KEYBOARD_Driver;
extern Colormap X11DRV_COLOR_GetColormap(void);
extern void X11DRV_KEYBOARD_Init(void);
extern WORD X11DRV_KEYBOARD_VkKeyScan(CHAR cChar);
extern UINT16 X11DRV_KEYBOARD_MapVirtualKey(UINT16 wCode, UINT16 wMapType);
extern INT16 X11DRV_KEYBOARD_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize);
extern INT16 X11DRV_KEYBOARD_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpKeyState, LPVOID lpChar, UINT16 flags);
extern void KEYBOARD_HandleEvent( WND *pWnd, XKeyEvent *event );
extern void KEYBOARD_UpdateState ( void );
/* X11 desktop driver */
/* X11 mouse driver */
extern struct _DESKTOP_DRIVER X11DRV_DESKTOP_Driver;
extern MOUSE_DRIVER X11DRV_MOUSE_Driver;
typedef struct _X11DRV_DESKTOP_DATA {
} X11DRV_DESKTOP_DATA;
extern void X11DRV_MOUSE_SetCursor(CURSORICONINFO *lpCursor);
extern void X11DRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY);
struct tagDESKTOP;
extern Screen *X11DRV_DESKTOP_GetXScreen(struct tagDESKTOP *pDesktop);
extern Window X11DRV_DESKTOP_GetXRootWindow(struct tagDESKTOP *pDesktop);
extern void X11DRV_DESKTOP_Initialize(struct tagDESKTOP *pDesktop);
extern void X11DRV_DESKTOP_Finalize(struct tagDESKTOP *pDesktop);
extern int X11DRV_DESKTOP_GetScreenWidth(struct tagDESKTOP *pDesktop);
extern int X11DRV_DESKTOP_GetScreenHeight(struct tagDESKTOP *pDesktop);
extern int X11DRV_DESKTOP_GetScreenDepth(struct tagDESKTOP *pDesktop);
/* X11 event driver */
extern EVENT_DRIVER X11DRV_EVENT_Driver;
extern struct _EVENT_DRIVER X11DRV_EVENT_Driver;
extern BOOL32 X11DRV_EVENT_Init(void);
extern void X11DRV_EVENT_AddIO(int fd, unsigned flag);
@ -297,4 +263,88 @@ extern void X11DRV_EVENT_DummyMotionNotify(void);
extern BOOL32 X11DRV_EVENT_Pending(void);
extern BOOL16 X11DRV_EVENT_IsUserIdle(void);
/* X11 keyboard driver */
extern struct _KEYBOARD_DRIVER X11DRV_KEYBOARD_Driver;
extern void X11DRV_KEYBOARD_Init(void);
extern WORD X11DRV_KEYBOARD_VkKeyScan(CHAR cChar);
extern UINT16 X11DRV_KEYBOARD_MapVirtualKey(UINT16 wCode, UINT16 wMapType);
extern INT16 X11DRV_KEYBOARD_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize);
extern INT16 X11DRV_KEYBOARD_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpKeyState, LPVOID lpChar, UINT16 flags);
extern void KEYBOARD_HandleEvent( struct tagWND *pWnd, XKeyEvent *event );
extern void KEYBOARD_UpdateState ( void );
/* X11 main driver */
extern Display *display;
extern Screen *X11DRV_GetXScreen();
extern Window X11DRV_GetXRootWindow();
extern void X11DRV_MAIN_Finalize();
extern void X11DRV_MAIN_Initialize();
extern void X11DRV_MAIN_ParseOptions(int *argc, char *argv[]);
extern void X11DRV_MAIN_Create();
extern void X11DRV_MAIN_SaveSetup();
extern void X11DRV_MAIN_RestoreSetup();
/* X11 monitor driver */
extern struct tagMONITOR_DRIVER X11DRV_MONITOR_Driver;
typedef struct _X11DRV_MONITOR_DATA {
Screen *screen;
Window rootWindow;
int width;
int height;
int depth;
} X11DRV_MONITOR_DATA;
struct tagMONITOR;
extern Screen *X11DRV_MONITOR_GetXScreen(struct tagMONITOR *pMonitor);
extern Window X11DRV_MONITOR_GetXRootWindow(struct tagMONITOR *pMonitor);
extern void X11DRV_MONITOR_Initialize(struct tagMONITOR *pMonitor);
extern void X11DRV_MONITOR_Finalize(struct tagMONITOR *pMonitor);
extern int X11DRV_MONITOR_GetWidth(struct tagMONITOR *pMonitor);
extern int X11DRV_MONITOR_GetHeight(struct tagMONITOR *pMonitor);
extern int X11DRV_MONITOR_GetDepth(struct tagMONITOR *pMonitor);
/* X11 mouse driver */
extern struct _MOUSE_DRIVER X11DRV_MOUSE_Driver;
extern void X11DRV_MOUSE_SetCursor(CURSORICONINFO *lpCursor);
extern void X11DRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY);
/* X11 windows driver */
extern struct _WND_DRIVER X11DRV_WND_Driver;
typedef struct _X11DRV_WND_DATA {
Window window;
} X11DRV_WND_DATA;
extern Window X11DRV_WND_GetXWindow(struct tagWND *wndPtr);
extern Window X11DRV_WND_FindXWindow(struct tagWND *wndPtr);
extern Screen *X11DRV_WND_GetXScreen(struct tagWND *wndPtr);
extern Window X11DRV_WND_GetXRootWindow(struct tagWND *wndPtr);
extern void X11DRV_WND_Initialize(struct tagWND *wndPtr);
extern void X11DRV_WND_Finalize(struct tagWND *wndPtr);
extern BOOL32 X11DRV_WND_CreateDesktopWindow(struct tagWND *wndPtr, struct tagCLASS *classPtr, BOOL32 bUnicode);
extern BOOL32 X11DRV_WND_CreateWindow(struct tagWND *wndPtr, struct tagCLASS *classPtr, CREATESTRUCT32A *cs, BOOL32 bUnicode);
extern BOOL32 X11DRV_WND_DestroyWindow(struct tagWND *pWnd);
extern struct tagWND *X11DRV_WND_SetParent(struct tagWND *wndPtr, struct tagWND *pWndParent);
extern void X11DRV_WND_ForceWindowRaise(struct tagWND *pWnd);
extern void X11DRV_WND_SetWindowPos(struct tagWND *wndPtr, const WINDOWPOS32 *winpos, BOOL32 bSMC_SETXPOS);
extern void X11DRV_WND_SetText(struct tagWND *wndPtr, LPCSTR text);
extern void X11DRV_WND_SetFocus(struct tagWND *wndPtr);
extern void X11DRV_WND_PreSizeMove(struct tagWND *wndPtr);
extern void X11DRV_WND_PostSizeMove(struct tagWND *wndPtr);
extern void X11DRV_WND_ScrollWindow(struct tagWND *wndPtr, struct tagDC *dcPtr, INT32 dx, INT32 dy, const RECT32 *clipRect, BOOL32 bUpdate);
extern void X11DRV_WND_SetDrawable(struct tagWND *wndPtr, struct tagDC *dc, WORD flags, BOOL32 bSetClipOrigin);
extern BOOL32 X11DRV_WND_IsSelfClipping(struct tagWND *wndPtr);
#endif /* __WINE_X11DRV_H */

View File

@ -4,19 +4,23 @@
* Copyright 1994 Alexandre Julliard
*/
#include <signal.h>
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include "ts_xlib.h"
#include "x11drv.h"
#else /* X_DISPLAY_MISSING */
#include "ttydrv.h"
#endif /* X_DISPLAY_MISSING */
#include <locale.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#ifdef MALLOC_DEBUGGING
# include <malloc.h>
#endif
#include "ts_xlib.h"
#include "ts_xresource.h"
#include "ts_xutil.h"
#include <X11/Xlocale.h>
#include <X11/cursorfont.h>
#include "winsock.h"
#include "heap.h"
#include "message.h"
@ -25,7 +29,6 @@
#include "color.h"
#include "options.h"
#include "desktop.h"
#include "process.h"
#include "shell.h"
#include "winbase.h"
#include "builtin32.h"
@ -34,8 +37,8 @@
#include "xmalloc.h"
#include "version.h"
#include "winnls.h"
#include "x11drv.h"
#include "console.h"
#include "monitor.h"
/* when adding new languages look at ole/ole2nls.c
* for proper iso name and Windows code (add 0x0400
@ -64,18 +67,10 @@ const WINE_LANGUAGE_DEF Languages[] =
WORD WINE_LanguageId = 0x409; /* english as default */
#define WINE_CLASS "Wine" /* Class name for resources */
#define WINE_APP_DEFAULTS "/usr/lib/X11/app-defaults/Wine"
Display *display;
Screen *screen;
Window rootWindow;
int screenWidth = 0, screenHeight = 0; /* Desktop window dimensions */
int screenDepth = 0; /* Screen depth to use */
struct options Options =
{ /* default options */
0, /* argc */
NULL, /* argv */
NULL, /* desktopGeometry */
NULL, /* programName */
NULL, /* argv0 */
@ -97,80 +92,53 @@ struct options Options =
FALSE, /* Perfect graphics */
FALSE, /* No DGA */
NULL, /* Alternate config file name */
NULL /* Console driver list */
NULL, /* Console driver list */
0 /* screenDepth */
};
static XrmOptionDescRec optionsTable[] =
{
{ "-backingstore", ".backingstore", XrmoptionNoArg, (caddr_t)"on" },
{ "-desktop", ".desktop", XrmoptionSepArg, (caddr_t)NULL },
{ "-depth", ".depth", XrmoptionSepArg, (caddr_t)NULL },
{ "-display", ".display", XrmoptionSepArg, (caddr_t)NULL },
{ "-iconic", ".iconic", XrmoptionNoArg, (caddr_t)"on" },
{ "-language", ".language", XrmoptionSepArg, (caddr_t)"En" },
{ "-name", ".name", XrmoptionSepArg, (caddr_t)NULL },
{ "-perfect", ".perfect", XrmoptionNoArg, (caddr_t)"on" },
{ "-privatemap", ".privatemap", XrmoptionNoArg, (caddr_t)"on" },
{ "-fixedmap", ".fixedmap", XrmoptionNoArg, (caddr_t)"on" },
{ "-synchronous", ".synchronous", XrmoptionNoArg, (caddr_t)"on" },
{ "-debug", ".debug", XrmoptionNoArg, (caddr_t)"on" },
{ "-debugmsg", ".debugmsg", XrmoptionSepArg, (caddr_t)NULL },
{ "-dll", ".dll", XrmoptionSepArg, (caddr_t)NULL },
{ "-failreadonly", ".failreadonly", XrmoptionNoArg, (caddr_t)"on" },
{ "-mode", ".mode", XrmoptionSepArg, (caddr_t)NULL },
{ "-managed", ".managed", XrmoptionNoArg, (caddr_t)"off"},
{ "-winver", ".winver", XrmoptionSepArg, (caddr_t)NULL },
{ "-config", ".config", XrmoptionSepArg, (caddr_t)NULL },
{ "-nodga", ".nodga", XrmoptionNoArg, (caddr_t)"off"},
{ "-console", ".console", XrmoptionSepArg, (caddr_t)NULL },
{ "-dosver", ".dosver", XrmoptionSepArg, (caddr_t)NULL }
};
#define NB_OPTIONS (sizeof(optionsTable) / sizeof(optionsTable[0]))
#define USAGE \
"%s\n" \
"Usage: %s [options] \"program_name [arguments]\"\n" \
"\n" \
"Options:\n" \
" -backingstore Turn on backing store\n" \
" -config name Specify config file to use\n" \
" -console driver Select which driver(s) to use for the console\n" \
" -debug Enter debugger before starting application\n" \
" -debugmsg name Turn debugging-messages on or off\n" \
" -depth n Change the depth to use for multiple-depth screens\n" \
" -desktop geom Use a desktop window of the given geometry\n" \
" -display name Use the specified display\n" \
" -dll name Enable or disable built-in DLLs\n" \
" -failreadonly Read only files may not be opened in write mode\n" \
" -fixedmap Use a \"standard\" color map\n" \
" -help Show this help message\n" \
" -iconic Start as an icon\n" \
" -language xx Set the language (one of Ca,Cs,Da,De,En,Eo,Es,Fi,Fr,Hu,It,\n Ko,No,Pl,Pt,Sv)\n" \
" -managed Allow the window manager to manage created windows\n" \
" -mode mode Start Wine in a particular mode (standard or enhanced)\n" \
" -name name Set the application name\n" \
" -nodga Disable XFree86 DGA extensions\n" \
" -perfect Favor correctness over speed for graphical operations\n" \
" -privatemap Use a private color map\n" \
" -synchronous Turn on synchronous display mode\n" \
" -version Display the Wine version\n" \
" -winver Windows version to imitate (one of win31,win95,nt351,nt40)\n" \
static char szUsage[] =
"%s\n"
"Usage: %s [options] \"program_name [arguments]\"\n"
#ifndef X_DISPLAY_MISSING
"\n"
"Options:\n"
" -backingstore Turn on backing store\n"
" -config name Specify config file to use\n"
" -console driver Select which driver(s) to use for the console\n"
" -debug Enter debugger before starting application\n"
" -debugmsg name Turn debugging-messages on or off\n"
" -depth n Change the depth to use for multiple-depth screens\n"
" -desktop geom Use a desktop window of the given geometry\n"
" -display name Use the specified display\n"
" -dll name Enable or disable built-in DLLs\n"
" -failreadonly Read only files may not be opened in write mode\n"
" -fixedmap Use a \"standard\" color map\n"
" -help Show this help message\n"
" -iconic Start as an icon\n"
" -language xx Set the language (one of Ca,Cs,Da,De,En,Eo,Es,Fi,Fr,Hu,It,\n"
" Ko,No,Pl,Pt,Sv)\n"
" -managed Allow the window manager to manage created windows\n"
" -mode mode Start Wine in a particular mode (standard or enhanced)\n"
" -name name Set the application name\n"
" -nodga Disable XFree86 DGA extensions\n"
" -perfect Favor correctness over speed for graphical operations\n"
" -privatemap Use a private color map\n"
" -synchronous Turn on synchronous display mode\n"
" -version Display the Wine version\n"
" -winver Version to imitate (one of win31,win95,nt351,nt40)\n"
" -dosver DOS version to imitate (x.xx, e.g. 6.22). Only valid with -winver win31\n"
#endif /* X_DISPLAY_MISSING */
;
/***********************************************************************
* MAIN_Usage
*/
void MAIN_Usage( char *name )
{
MSG( USAGE, WINE_RELEASE_INFO, name );
MSG( szUsage, WINE_RELEASE_INFO, name );
exit(1);
}
/***********************************************************************
* MAIN_GetProgramName
*
@ -191,33 +159,6 @@ static char *MAIN_GetProgramName( int argc, char *argv[] )
return argv[0];
}
/***********************************************************************
* MAIN_GetResource
*
* Fetch the value of resource 'name' using the correct instance name.
* 'name' must begin with '.' or '*'
*/
static int MAIN_GetResource( XrmDatabase db, char *name, XrmValue *value )
{
char *buff_instance, *buff_class;
char *dummy;
int retval;
buff_instance = (char *)xmalloc(strlen(Options.programName)+strlen(name)+1);
buff_class = (char *)xmalloc( strlen(WINE_CLASS) + strlen(name) + 1 );
strcpy( buff_instance, Options.programName );
strcat( buff_instance, name );
strcpy( buff_class, WINE_CLASS );
strcat( buff_class, name );
retval = TSXrmGetResource( db, buff_instance, buff_class, &dummy, value );
free( buff_instance );
free( buff_class );
return retval;
}
/***********************************************************************
* MAIN_ParseDebugOptions
*
@ -235,6 +176,7 @@ BOOL32 MAIN_ParseDebugOptions(char *options)
extern char **debug_snoop_includelist;
extern char **debug_snoop_excludelist;
int i;
int l, cls, dotracerelay = TRACE_ON(relay);
l = strlen(options);
@ -250,10 +192,10 @@ BOOL32 MAIN_ParseDebugOptions(char *options)
if(!lstrncmpi32A(options, debug_cl_name[j], strlen(debug_cl_name[j])))
break;
if(j==DEBUG_CLASS_COUNT)
return FALSE;
goto error;
options += strlen(debug_cl_name[j]);
if ((*options!='+')&&(*options!='-'))
return FALSE;
goto error;
cls = j;
}
else
@ -287,7 +229,7 @@ BOOL32 MAIN_ParseDebugOptions(char *options)
}
/* should never happen, maybe assert(i!=DEBUG_CHANNEL_COUNT)? */
if (i==DEBUG_CHANNEL_COUNT)
return FALSE;
goto error;
output = (*options == '+') ?
((*(options+1) == 'r') ?
&debug_relay_includelist :
@ -326,7 +268,7 @@ BOOL32 MAIN_ParseDebugOptions(char *options)
break;
}
if (i==DEBUG_CHANNEL_COUNT)
return FALSE;
goto error;
}
options+=l;
}
@ -336,10 +278,33 @@ BOOL32 MAIN_ParseDebugOptions(char *options)
if (dotracerelay != TRACE_ON(relay))
BUILTIN32_SwitchRelayDebug( TRACE_ON(relay) );
if (*options)
return FALSE;
else
if (!*options)
return TRUE;
error:
MSG("%s: Syntax: -debugmsg [class]+xxx,... or "
"-debugmsg [class]-xxx,...\n",Options.argv[0]);
MSG("Example: -debugmsg +all,warn-heap\n"
" turn on all messages except warning heap messages\n");
MSG("Special case: -debugmsg +relay=DLL:DLL.###:FuncName\n"
" turn on -debugmsg +relay only as specified\n"
"Special case: -debugmsg -relay=DLL:DLL.###:FuncName\n"
" turn on -debugmsg +relay except as specified\n"
"Also permitted, +snoop=..., -snoop=... as with relay.\n\n");
MSG("Available message classes:\n");
for(i=0;i<DEBUG_CLASS_COUNT;i++)
MSG( "%-9s", debug_cl_name[i]);
MSG("\n\n");
MSG("Available message types:\n");
MSG("%-9s ","all");
for(i=0;i<DEBUG_CHANNEL_COUNT;i++)
if(debug_ch_name[i])
MSG("%-9s%c",debug_ch_name[i],
(((i+2)%8==0)?'\n':' '));
MSG("\n\n");
exit(1);
}
/***********************************************************************
@ -697,7 +662,7 @@ end_MAIN_GetLanguageID:
*
* Parse -language option.
*/
static void MAIN_ParseLanguageOption( char *arg )
void MAIN_ParseLanguageOption( char *arg )
{
const WINE_LANGUAGE_DEF *p = Languages;
@ -728,7 +693,7 @@ static void MAIN_ParseLanguageOption( char *arg )
*
* Parse -mode option.
*/
static void MAIN_ParseModeOption( char *arg )
void MAIN_ParseModeOption( char *arg )
{
if (!lstrcmpi32A("enhanced", arg)) Options.mode = MODE_ENHANCED;
else if (!lstrcmpi32A("standard", arg)) Options.mode = MODE_STANDARD;
@ -747,22 +712,18 @@ static void MAIN_ParseModeOption( char *arg )
*/
static void MAIN_ParseOptions( int *argc, char *argv[] )
{
char *display_name = NULL;
XrmValue value;
XrmDatabase db = TSXrmGetFileDatabase(WINE_APP_DEFAULTS);
int i;
char *xrm_string;
Options.argc = argc;
Options.argv = argv;
Options.programName = MAIN_GetProgramName( *argc, argv );
Options.argv0 = argv[0];
/* initialise Options.language to 0 to tell "no language choosen yet" */
Options.language = 0;
/* Get display name from command line */
for (i = 1; i < *argc; i++)
{
if (!strcmp( argv[i], "-display" )) display_name = argv[i+1];
if (!strcmp( argv[i], "-v" ) || !strcmp( argv[i], "-version" ))
{
MSG( "%s\n", WINE_RELEASE_INFO );
@ -775,250 +736,25 @@ static void MAIN_ParseOptions( int *argc, char *argv[] )
}
}
/* Open display */
#ifndef X_DISPLAY_MISSING
X11DRV_MAIN_ParseOptions(argc,argv);
#else /* X_DISPLAY_MISSING */
TTYDRV_MAIN_ParseOptions(argc,argv);
#endif /* X_DISPLAY_MISSING */
if (display_name == NULL &&
MAIN_GetResource( db, ".display", &value )) display_name = value.addr;
if (!(display = TSXOpenDisplay( display_name )))
{
MSG( "%s: Can't open display: %s\n",
argv[0], display_name ? display_name : "(none specified)" );
exit(1);
}
/* tell the libX11 that we will do input method handling ourselves
* that keep libX11 from doing anything whith dead keys, allowing Wine
* to have total control over dead keys, that is this line allows
* them to work in Wine, even whith a libX11 including the dead key
* patches from Th.Quinot (http://Web.FdN.FR/~tquinot/dead-keys.en.html)
*/
TSXOpenIM(display,NULL,NULL,NULL);
/* Merge file and screen databases */
if ((xrm_string = TSXResourceManagerString( display )) != NULL)
{
XrmDatabase display_db = TSXrmGetStringDatabase( xrm_string );
TSXrmMergeDatabases( display_db, &db );
}
/* Parse command line */
TSXrmParseCommand( &db, optionsTable, NB_OPTIONS,
Options.programName, argc, argv );
/* Get all options */
if (MAIN_GetResource( db, ".iconic", &value ))
Options.cmdShow = SW_SHOWMINIMIZED;
if (MAIN_GetResource( db, ".privatemap", &value ))
Options.usePrivateMap = TRUE;
if (MAIN_GetResource( db, ".fixedmap", &value ))
Options.useFixedMap = TRUE;
if (MAIN_GetResource( db, ".synchronous", &value ))
Options.synchronous = TRUE;
if (MAIN_GetResource( db, ".backingstore", &value ))
Options.backingstore = TRUE;
if (MAIN_GetResource( db, ".debug", &value ))
Options.debug = TRUE;
if (MAIN_GetResource( db, ".failreadonly", &value ))
Options.failReadOnly = TRUE;
if (MAIN_GetResource( db, ".perfect", &value ))
Options.perfectGraphics = TRUE;
if (MAIN_GetResource( db, ".depth", &value))
screenDepth = atoi( value.addr );
if (MAIN_GetResource( db, ".desktop", &value))
Options.desktopGeometry = value.addr;
if (MAIN_GetResource( db, ".language", &value))
MAIN_ParseLanguageOption( (char *)value.addr );
if (MAIN_GetResource( db, ".managed", &value))
Options.managed = TRUE;
if (MAIN_GetResource( db, ".mode", &value))
MAIN_ParseModeOption( (char *)value.addr );
if (MAIN_GetResource( db, ".debugoptions", &value))
MAIN_ParseDebugOptions((char*)value.addr);
if (MAIN_GetResource( db, ".debugmsg", &value))
{
#ifndef DEBUG_RUNTIME
MSG("%s: Option \"-debugmsg\" not implemented.\n" \
" Recompile with DEBUG_RUNTIME in include/debugtools.h defined.\n",
argv[0]);
exit(1);
#else
if (MAIN_ParseDebugOptions((char*)value.addr)==FALSE)
{
int i;
MSG("%s: Syntax: -debugmsg [class]+xxx,... or "
"-debugmsg [class]-xxx,...\n",argv[0]);
MSG("Example: -debugmsg +all,warn-heap\n"
" turn on all messages except warning heap messages\n");
MSG("Special case: -debugmsg +relay=DLL:DLL.###:FuncName\n"
" turn on -debugmsg +relay only as specified\n"
"Special case: -debugmsg -relay=DLL:DLL.###:FuncName\n"
" turn on -debugmsg +relay except as specified\n"
"Also permitted, +snoop=..., -snoop=... as with relay.\n\n");
MSG("Available message classes:\n");
for(i=0;i<DEBUG_CLASS_COUNT;i++)
MSG( "%-9s", debug_cl_name[i]);
MSG("\n\n");
MSG("Available message types:\n");
MSG("%-9s ","all");
for(i=0;i<DEBUG_CHANNEL_COUNT;i++)
if(debug_ch_name[i])
MSG("%-9s%c",debug_ch_name[i],
(((i+2)%8==0)?'\n':' '));
MSG("\n\n");
exit(1);
}
#endif
}
if (MAIN_GetResource( db, ".dll", &value))
{
/* Hack: store option value in Options to be retrieved */
/* later on inside the emulator code. */
if (!__winelib)
{
if (Options.dllFlags)
{
/* don't overwrite previous value. Should we
* automatically add the ',' between multiple DLLs ?
*/
MSG("Only one -dll flag is allowed. Use ',' between multiple DLLs\n");
}
else
{
Options.dllFlags = xstrdup((char *)value.addr);
}
}
else
{
MSG("-dll not supported in Winelib\n" );
exit(1);
}
}
if (MAIN_GetResource( db, ".winver", &value))
VERSION_ParseWinVersion( (char*)value.addr );
if (MAIN_GetResource( db, ".dosver", &value))
VERSION_ParseDosVersion( (char*)value.addr );
if (MAIN_GetResource( db, ".config", &value))
Options.configFileName = xstrdup((char *)value.addr);
if (MAIN_GetResource( db, ".nodga", &value))
Options.noDGA = TRUE;
if (MAIN_GetResource( db, ".console", &value))
Options.consoleDrivers = xstrdup((char *)value.addr);
else
Options.consoleDrivers = CONSOLE_DEFAULT_DRIVER;
CONSOLE_Init(Options.consoleDrivers);
CONSOLE_Init(Options.consoleDrivers);
}
/***********************************************************************
* MAIN_CreateDesktop
*/
static void MAIN_CreateDesktop( int argc, char *argv[] )
{
int x, y, flags;
unsigned int width = 640, height = 480; /* Default size = 640x480 */
char *name = "Wine desktop";
XSizeHints *size_hints;
XWMHints *wm_hints;
XClassHint *class_hints;
XSetWindowAttributes win_attr;
XTextProperty window_name;
Atom XA_WM_DELETE_WINDOW;
flags = TSXParseGeometry( Options.desktopGeometry, &x, &y, &width, &height );
screenWidth = width;
screenHeight = height;
/* Create window */
win_attr.background_pixel = BlackPixel(display,0);
win_attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
PointerMotionMask | ButtonPressMask |
ButtonReleaseMask | EnterWindowMask;
win_attr.cursor = TSXCreateFontCursor( display, XC_top_left_arrow );
rootWindow = TSXCreateWindow( display, DefaultRootWindow(display),
x, y, width, height, 0,
CopyFromParent, InputOutput, CopyFromParent,
CWBackPixel | CWEventMask | CWCursor, &win_attr );
/* Set window manager properties */
size_hints = TSXAllocSizeHints();
wm_hints = TSXAllocWMHints();
class_hints = TSXAllocClassHint();
if (!size_hints || !wm_hints || !class_hints)
{
MSG("Not enough memory for window manager hints.\n" );
exit(1);
}
size_hints->min_width = size_hints->max_width = width;
size_hints->min_height = size_hints->max_height = height;
size_hints->flags = PMinSize | PMaxSize;
if (flags & (XValue | YValue)) size_hints->flags |= USPosition;
if (flags & (WidthValue | HeightValue)) size_hints->flags |= USSize;
else size_hints->flags |= PSize;
wm_hints->flags = InputHint | StateHint;
wm_hints->input = True;
wm_hints->initial_state = NormalState;
class_hints->res_name = argv[0];
class_hints->res_class = "Wine";
TSXStringListToTextProperty( &name, 1, &window_name );
TSXSetWMProperties( display, rootWindow, &window_name, &window_name,
argv, argc, size_hints, wm_hints, class_hints );
XA_WM_DELETE_WINDOW = TSXInternAtom( display, "WM_DELETE_WINDOW", False );
TSXSetWMProtocols( display, rootWindow, &XA_WM_DELETE_WINDOW, 1 );
TSXFree( size_hints );
TSXFree( wm_hints );
TSXFree( class_hints );
/* Map window */
TSXMapWindow( display, rootWindow );
}
XKeyboardState keyboard_state;
/***********************************************************************
* MAIN_SaveSetup
*/
static void MAIN_SaveSetup(void)
{
TSXGetKeyboardControl(display, &keyboard_state);
}
/***********************************************************************
* MAIN_RestoreSetup
*/
static void MAIN_RestoreSetup(void)
{
XKeyboardControl keyboard_value;
keyboard_value.key_click_percent = keyboard_state.key_click_percent;
keyboard_value.bell_percent = keyboard_state.bell_percent;
keyboard_value.bell_pitch = keyboard_state.bell_pitch;
keyboard_value.bell_duration = keyboard_state.bell_duration;
keyboard_value.auto_repeat_mode = keyboard_state.global_auto_repeat;
XChangeKeyboardControl(display, KBKeyClickPercent | KBBellPercent |
KBBellPitch | KBBellDuration | KBAutoRepeatMode, &keyboard_value);
}
/***********************************************************************
* called_at_exit
*/
static void called_at_exit(void)
{
MAIN_RestoreSetup();
#ifndef X_DISPLAY_MISSING
X11DRV_MAIN_RestoreSetup();
#else /* X_DISPLAY_MISSING */
TTYDRV_MAIN_RestoreSetup();
#endif /* X_DISPLAY_MISSING */
COLOR_Cleanup();
WINSOCK_Shutdown();
/* FIXME: should check for other processes or threads */
@ -1026,12 +762,6 @@ static void called_at_exit(void)
CONSOLE_Close();
}
static int WINE_X11_ErrorHandler(Display *display,XErrorEvent *error_evt)
{
kill( getpid(), SIGHUP ); /* force an entry in the debugger */
return 0;
}
/***********************************************************************
* MAIN_WineInit
*
@ -1039,8 +769,6 @@ static int WINE_X11_ErrorHandler(Display *display,XErrorEvent *error_evt)
*/
BOOL32 MAIN_WineInit( int *argc, char *argv[] )
{
int depth_count, i;
int *depth_list;
struct timeval tv;
#ifdef MALLOC_DEBUGGING
@ -1064,57 +792,30 @@ BOOL32 MAIN_WineInit( int *argc, char *argv[] )
setlocale(LC_CTYPE,"");
gettimeofday( &tv, NULL);
MSG_WineStartTicks = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
/* We need this before calling any Xlib function */
InitializeCriticalSection( &X11DRV_CritSection );
MakeCriticalSectionGlobal( &X11DRV_CritSection );
TSXrmInitialize();
putenv("XKB_DISABLE="); /* Disable XKB extension if present. */
#ifndef X_DISPLAY_MISSING
X11DRV_MAIN_Initialize();
MAIN_ParseOptions( argc, argv );
X11DRV_MAIN_Create();
X11DRV_MAIN_SaveSetup();
#else /* !defined(X_DISPLAY_MISSING) */
TTYDRV_MAIN_Initialize();
MAIN_ParseOptions( argc, argv );
TTYDRV_MAIN_Create();
TTYDRV_MAIN_SaveSetup();
#endif /* !defined(X_DISPLAY_MISSING) */
if (Options.synchronous) XSetErrorHandler( WINE_X11_ErrorHandler );
#ifndef X_DISPLAY_MISSING
MONITOR_PrimaryMonitor.pDriver = &X11DRV_MONITOR_Driver;
#else /* !defined(X_DISPLAY_MISSING) */
MONITOR_PrimaryMonitor.pDriver = &TTYDRV_MONITOR_Driver;
#endif /* !defined(X_DISPLAY_MISSING) */
MONITOR_Initialize(&MONITOR_PrimaryMonitor);
if (Options.desktopGeometry && Options.managed)
{
#if 0
MSG( "%s: -managed and -desktop options cannot be used together\n",
Options.programName );
exit(1);
#else
Options.managed = FALSE;
#endif
}
screen = DefaultScreenOfDisplay( display );
screenWidth = WidthOfScreen( screen );
screenHeight = HeightOfScreen( screen );
if (screenDepth) /* -depth option specified */
{
depth_list = TSXListDepths(display,DefaultScreen(display),&depth_count);
for (i = 0; i < depth_count; i++)
if (depth_list[i] == screenDepth) break;
TSXFree( depth_list );
if (i >= depth_count)
{
MSG( "%s: Depth %d not supported on this screen.\n",
Options.programName, screenDepth );
exit(1);
}
}
else screenDepth = DefaultDepthOfScreen( screen );
if (Options.synchronous) TSXSynchronize( display, True );
if (Options.desktopGeometry) MAIN_CreateDesktop( *argc, argv );
else rootWindow = DefaultRootWindow( display );
MAIN_SaveSetup();
atexit(called_at_exit);
return TRUE;
}
/***********************************************************************
* MessageBeep16 (USER.104)
*/
@ -1159,7 +860,8 @@ LONG WINAPI GetTimerResolution(void)
BOOL32 WINAPI SystemParametersInfo32A( UINT32 uAction, UINT32 uParam,
LPVOID lpvParam, UINT32 fuWinIni )
{
int timeout, temp;
int timeout;
int temp;
XKeyboardState keyboard_state;
switch (uAction) {
@ -1217,8 +919,11 @@ BOOL32 WINAPI SystemParametersInfo32A( UINT32 uAction, UINT32 uParam,
break;
case SPI_GETSCREENSAVETIMEOUT:
/* FIXME GetProfileInt( "windows", "ScreenSaveTimeout", 300 ); */
TSXGetScreenSaver(display, &timeout, &temp,&temp,&temp);
#ifndef X_DISPLAY_MISSING
TSXGetScreenSaver(display, &timeout, &temp,&temp,&temp);
#else /* X_DISPLAY_MISSING */
timeout = GetProfileInt32A( "windows", "ScreenSaveTimeout", 300 );
#endif /* X_DISPLAY_MISSING */
*(INT32 *) lpvParam = timeout * 1000;
break;
@ -1340,12 +1045,12 @@ BOOL32 WINAPI SystemParametersInfo32A( UINT32 uAction, UINT32 uParam,
BOOL16 WINAPI SystemParametersInfo16( UINT16 uAction, UINT16 uParam,
LPVOID lpvParam, UINT16 fuWinIni )
{
int timeout, temp;
int timeout;
char buffer[256];
int temp;
XKeyboardState keyboard_state;
XKeyboardControl keyboard_value;
switch (uAction)
{
case SPI_GETBEEP:
@ -1402,8 +1107,11 @@ BOOL16 WINAPI SystemParametersInfo16( UINT16 uAction, UINT16 uParam,
break;
case SPI_GETSCREENSAVETIMEOUT:
/* FIXME GetProfileInt( "windows", "ScreenSaveTimeout", 300 ); */
#ifndef X_DISPLAY_MISSING
TSXGetScreenSaver(display, &timeout, &temp,&temp,&temp);
#else /* X_DISPLAY_MISSING */
timeout = GetProfileInt32A( "windows", "ScreenSaveTimeout", 300 );
#endif /* X_DISPLAY_MISSING */
*(INT16 *) lpvParam = timeout;
break;

View File

@ -15,7 +15,8 @@
#include "sysmetrics.h"
#include "cursoricon.h"
#include "debug.h"
#include "x11drv.h"
#include "monitor.h"
#include "wine/winuser16.h"
/***********************************************************************
* BITMAP_GetPadding
@ -107,7 +108,7 @@ HBITMAP16 WINAPI CreateUserBitmap16( INT16 width, INT16 height, UINT16 planes,
HBITMAP16 WINAPI CreateUserDiscardableBitmap16( WORD dummy,
INT16 width, INT16 height )
{
return CreateUserBitmap16( width, height, 1, screenDepth, NULL );
return CreateUserBitmap16( width, height, 1, MONITOR_GetDepth(&MONITOR_PrimaryMonitor), NULL );
}

View File

@ -5,16 +5,18 @@
* Copyright 1996 Alex Korobka
*/
#include <stdlib.h>
#include "ts_xlib.h"
#include "x11drv.h"
#include <stdlib.h>
#include <string.h>
#include "windows.h"
#include "wintypes.h"
#include "options.h"
#include "gdi.h"
#include "color.h"
#include "debug.h"
#include "xmalloc.h"
#include "x11drv.h"
#include "monitor.h"
/* Palette indexed mode:
@ -121,7 +123,7 @@ int COLOR_mapEGAPixel[16];
/***********************************************************************
* Misc auxiliary functions
*/
Colormap COLOR_GetColormap(void)
Colormap X11DRV_COLOR_GetColormap(void)
{
return cSpace.colorMap;
}
@ -238,7 +240,6 @@ static void COLOR_FillDefaultColors(void)
(DoRed | DoGreen | DoBlue) };
TSXStoreColor(display, cSpace.colorMap, &color);
}
idx = COLOR_freeList[idx];
}
@ -327,6 +328,7 @@ static BOOL32 COLOR_BuildPrivateMap(CSPACE* cs)
COLOR_gapStart = 256; COLOR_gapEnd = -1;
COLOR_firstFree = (cs->size > NB_RESERVED_COLORS)?NB_RESERVED_COLORS/2 : -1;
return FALSE;
}
@ -369,7 +371,7 @@ static BOOL32 COLOR_BuildSharedMap(CSPACE* cs)
bp = BlackPixel(display, DefaultScreen(display));
wp = WhitePixel(display, DefaultScreen(display));
max = (0xffffffff)>>(32 - screenDepth);
max = (0xffffffff)>>(32 - MONITOR_GetDepth(&MONITOR_PrimaryMonitor));
if( max > 256 )
{
step = max/256;
@ -470,7 +472,7 @@ static BOOL32 COLOR_BuildSharedMap(CSPACE* cs)
* to maintain compatibility
*/
cs->size = 256;
TRACE(palette,"Virtual colorspace - screendepth %i\n", screenDepth);
TRACE(palette,"Virtual colorspace - screendepth %i\n", MONITOR_GetDepth(&MONITOR_PrimaryMonitor));
}
else cs->size = NB_RESERVED_COLORS; /* system palette only - however we can alloc a bunch
* of colors and map to them */
@ -493,7 +495,7 @@ static BOOL32 COLOR_BuildSharedMap(CSPACE* cs)
/* setup system palette entry <-> pixel mappings and fill in 20 fixed entries */
if( screenDepth <= 8 )
if( MONITOR_GetDepth(&MONITOR_PrimaryMonitor) <= 8 )
{
COLOR_PixelToPalette = (int*)xmalloc(sizeof(int)*256);
memset( COLOR_PixelToPalette, 0, 256*sizeof(int) );
@ -536,6 +538,7 @@ static BOOL32 COLOR_BuildSharedMap(CSPACE* cs)
}
if( pixDynMapping ) free(pixDynMapping);
return TRUE;
}
@ -576,8 +579,8 @@ BOOL32 COLOR_Init(void)
TRACE(palette,"initializing palette manager...\n");
white = WhitePixelOfScreen( screen );
black = BlackPixelOfScreen( screen );
white = WhitePixelOfScreen( X11DRV_GetXScreen() );
black = BlackPixelOfScreen( X11DRV_GetXScreen() );
cSpace.monoPlane = 1;
for( mask = 1; !((white & mask)^(black & mask)); mask <<= 1 )
cSpace.monoPlane++;
@ -594,7 +597,7 @@ BOOL32 COLOR_Init(void)
{
XSetWindowAttributes win_attr;
cSpace.colorMap = TSXCreateColormap( display, rootWindow,
cSpace.colorMap = TSXCreateColormap( display, X11DRV_GetXRootWindow(),
visual, AllocAll );
if (cSpace.colorMap)
{
@ -604,22 +607,22 @@ BOOL32 COLOR_Init(void)
for( white = cSpace.size - 1; !(white & 1); white >>= 1 )
cSpace.monoPlane++;
if( rootWindow != DefaultRootWindow(display) )
if( X11DRV_GetXRootWindow() != DefaultRootWindow(display) )
{
win_attr.colormap = cSpace.colorMap;
TSXChangeWindowAttributes( display, rootWindow,
TSXChangeWindowAttributes( display, X11DRV_GetXRootWindow(),
CWColormap, &win_attr );
}
break;
}
}
cSpace.colorMap = DefaultColormapOfScreen( screen );
cSpace.colorMap = DefaultColormapOfScreen( X11DRV_GetXScreen() );
break;
case StaticGray:
cSpace.colorMap = DefaultColormapOfScreen( screen );
cSpace.colorMap = DefaultColormapOfScreen( X11DRV_GetXScreen() );
cSpace.flags |= COLOR_FIXED;
COLOR_Graymax = (1<<screenDepth)-1;
COLOR_Graymax = (1<<MONITOR_GetDepth(&MONITOR_PrimaryMonitor))-1;
break;
case TrueColor:
@ -635,12 +638,12 @@ BOOL32 COLOR_Init(void)
for( white = cSpace.size - 1; !(white & 1); white >>= 1 )
cSpace.monoPlane++;
cSpace.flags = (white & mask) ? COLOR_WHITESET : 0;
cSpace.colorMap = DefaultColormapOfScreen( screen );
cSpace.colorMap = DefaultColormapOfScreen( X11DRV_GetXScreen() );
TSXFree(depths);
break;
}
TSXFree(depths);
cSpace.colorMap = DefaultColormapOfScreen( screen );
cSpace.colorMap = DefaultColormapOfScreen( X11DRV_GetXScreen() );
cSpace.flags |= COLOR_FIXED;
COLOR_Computeshifts(visual->red_mask, &COLOR_Redshift, &COLOR_Redmax);
COLOR_Computeshifts(visual->green_mask, &COLOR_Greenshift, &COLOR_Greenmax);
@ -822,7 +825,7 @@ COLORREF COLOR_ToLogical(int pixel)
#if 0
/* truecolor visual */
if (screenDepth >= 24) return pixel;
if (MONITOR_GetDepth(&MONITOR_PrimaryMonitor) >= 24) return pixel;
#endif
/* check for hicolor visuals first */
@ -839,7 +842,7 @@ COLORREF COLOR_ToLogical(int pixel)
/* check if we can bypass X */
if ((screenDepth <= 8) && (pixel < 256) &&
if ((MONITOR_GetDepth(&MONITOR_PrimaryMonitor) <= 8) && (pixel < 256) &&
!(cSpace.flags & (COLOR_VIRTUAL | COLOR_FIXED)) )
return ( *(COLORREF*)(COLOR_sysPal +
((COLOR_PixelToPalette)?COLOR_PixelToPalette[pixel]:pixel)) ) & 0x00ffffff;

View File

@ -5,6 +5,9 @@
*
*/
#include "ts_xlib.h"
#include "x11drv.h"
#include <stdlib.h>
#include <string.h>
#include "dc.h"
@ -14,8 +17,7 @@
#include "debug.h"
#include "font.h"
#include "winerror.h"
#include "x11drv.h"
#include "ts_xlib.h"
#include "wine/winuser16.h"
/***********************************************************************
* DC_Init_DC_INFO

View File

@ -6,6 +6,9 @@
* TODO: Still contains some references to X11DRV.
*/
#include "ts_xlib.h"
#include "x11drv.h"
#include <stdlib.h>
#include "dc.h"
#include "bitmap.h"
@ -13,7 +16,9 @@
#include "palette.h"
#include "global.h"
#include "debug.h"
#include "x11drv.h"
#include "local.h"
#include "xmalloc.h" /* for XCREATEIMAGE macro */
#include "monitor.h"
/***********************************************************************
@ -696,7 +701,7 @@ HBITMAP32 WINAPI CreateDIBitmap32( HDC32 hdc, const BITMAPINFOHEADER *header,
/* Now create the bitmap */
handle = fColor ? CreateBitmap32( width, height, 1, screenDepth, NULL ) :
handle = fColor ? CreateBitmap32( width, height, 1, MONITOR_GetDepth(&MONITOR_PrimaryMonitor), NULL ) :
CreateBitmap32( width, height, 1, 1, NULL );
if (!handle) return 0;

View File

@ -4,6 +4,14 @@
* Copyright 1993 Alexandre Julliard
*/
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include "x11drv.h"
#else /* !defined(X_DISPLAY_MISSING) */
#include "ttydrv.h"
#endif /* !defined(X_DISPLAY_MISSING) */
#include <stdlib.h>
#include "bitmap.h"
#include "brush.h"
@ -16,7 +24,6 @@
#include "region.h"
#include "debug.h"
#include "gdi.h"
#include "x11drv.h"
/***********************************************************************
* GDI stock objects
@ -243,8 +250,13 @@ BOOL32 GDI_Init(void)
/* Initialize drivers */
#ifndef X_DISPLAY_MISSING
if( ! X11DRV_Init() )
return FALSE;
#else /* !defined(X_DISPLAY_MISSING) */
if( ! TTYDRV_GDI_Initialize() )
return FALSE;
#endif /* !defined(X_DISPLAY_MISSING) */
/* Create default palette */

View File

@ -15,6 +15,7 @@
#include "palette.h"
#include "xmalloc.h"
#include "debug.h"
#include "wine/winuser16.h"
FARPROC32 pfnSelectPalette = NULL;
FARPROC32 pfnRealizePalette = NULL;

View File

@ -22,7 +22,11 @@
#include "xmalloc.h"
#include "debug.h"
#ifndef X_DISPLAY_MISSING
extern CLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver;
#else /* X_DISPLAY_MISSING */
extern CLIPBOARD_DRIVER TTYDRV_CLIPBOARD_Driver;
#endif /* X_DISPLAY_MISSING */
#define CF_REGFORMATBASE 0xC000
@ -75,7 +79,11 @@ static LPCLIPFORMAT __lookup_format( LPCLIPFORMAT lpFormat, WORD wID )
*/
CLIPBOARD_DRIVER *CLIPBOARD_GetDriver()
{
return &X11DRV_CLIPBOARD_Driver;
#ifndef X_DISPLAY_MISSING
return &X11DRV_CLIPBOARD_Driver;
#else /* X_DISPLAY_MISSING */
return &TTYDRV_CLIPBOARD_Driver;
#endif /* X_DISPLAY_MISSING */
};
/**************************************************************************

View File

@ -17,6 +17,8 @@
* DCX_WINDOWPAINT - BeginPaint() is in effect
*/
#include "x11drv.h"
#include "options.h"
#include "dce.h"
#include "class.h"
@ -25,6 +27,7 @@
#include "region.h"
#include "heap.h"
#include "sysmetrics.h"
#include "local.h"
#include "debug.h"
#include "wine/winuser16.h"
@ -725,7 +728,7 @@ HDC32 WINAPI GetDCEx32( HWND32 hwnd, HRGN32 hrgnClip, DWORD flags )
}
else
if ((hwnd == GetDesktopWindow32()) &&
(rootWindow == DefaultRootWindow(display)))
(X11DRV_WND_GetXRootWindow(wndPtr) == DefaultRootWindow(display)))
hrgnVisible = CreateRectRgn32( 0, 0, SYSMETRICS_CXSCREEN,
SYSMETRICS_CYSCREEN );
else

View File

@ -5,18 +5,28 @@
*
*/
#include "config.h"
#include "debug.h"
#include "display.h"
#include "wintypes.h"
#ifndef X_DISPLAY_MISSING
extern MOUSE_DRIVER X11DRV_MOUSE_Driver;
#else /* X_DISPLAY_MISSING */
extern MOUSE_DRIVER TTYDRV_MOUSE_Driver;
#endif /* X_DISPLAY_MISSING */
/***********************************************************************
* MOUSE_GetDriver()
*/
MOUSE_DRIVER *MOUSE_GetDriver()
{
#ifndef X_DISPLAY_MISSING
return &X11DRV_MOUSE_Driver;
#else /* X_DISPLAY_MISSING */
return &TTYDRV_MOUSE_Driver;
#endif /* X_DISPLAY_MISSING */
}
/***********************************************************************

View File

@ -5,16 +5,26 @@
*
*/
#include "config.h"
#include "message.h"
#ifndef X_DISPLAY_MISSING
extern EVENT_DRIVER X11DRV_EVENT_Driver;
#else /* X_DISPLAY_MISSING */
extern EVENT_DRIVER TTYDRV_EVENT_Driver;
#endif /* X_DISPLAY_MISSING */
/***********************************************************************
* EVENT_GetDriver
*/
EVENT_DRIVER *EVENT_GetDriver(void)
{
#ifndef X_DISPLAY_MISSING
return &X11DRV_EVENT_Driver;
#else /* X_DISPLAY_MISSING */
return &TTYDRV_EVENT_Driver;
#endif /* X_DISPLAY_MISSING */
}
/***********************************************************************

View File

@ -9,6 +9,8 @@
*
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
@ -26,14 +28,22 @@
static LPKEYBD_EVENT_PROC DefKeybEventProc = NULL;
LPBYTE pKeyStateTable = NULL;
#ifndef X_DISPLAY_MISSING
extern KEYBOARD_DRIVER X11DRV_KEYBOARD_Driver;
#else /* X_DISPLAY_MISSING */
extern KEYBOARD_DRIVER TTYDRV_KEYBOARD_Driver;
#endif /* X_DISPLAY_MISSING */
/***********************************************************************
* KEYBOARD_GetDriver
*/
KEYBOARD_DRIVER *KEYBOARD_GetDriver()
{
#ifndef X_DISPLAY_MISSING
return &X11DRV_KEYBOARD_Driver;
#else /* X_DISPLAY_MISSING */
return &TTYDRV_KEYBOARD_Driver;
#endif /* X_DISPLAY_MISSING */
}
/***********************************************************************

View File

@ -11,7 +11,11 @@
#include "mouse.h"
#include "debug.h"
#include "debugtools.h"
#include "x11drv.h"
#include "desktop.h"
/**********************************************************************/
extern BOOL32 X11DRV_MOUSE_DisableWarpPointer;
static LPMOUSE_EVENT_PROC DefMouseEventProc = NULL;
@ -55,7 +59,6 @@ VOID WINAPI MOUSE_Disable(VOID)
void MOUSE_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
DWORD keyState, DWORD time, HWND32 hWnd )
{
extern BOOL32 DISPLAY_DisableWarpPointer;
WINE_MOUSEEVENT wme;
if ( !DefMouseEventProc ) return;
@ -63,16 +66,16 @@ void MOUSE_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
TRACE( event, "(%04lX,%ld,%ld)\n", mouseStatus, posX, posY );
mouseStatus |= MOUSEEVENTF_ABSOLUTE;
posX = (((long)posX << 16) + screenWidth-1) / screenWidth;
posY = (((long)posY << 16) + screenHeight-1) / screenHeight;
posX = (((long)posX << 16) + DESKTOP_GetScreenWidth()-1) / DESKTOP_GetScreenWidth();
posY = (((long)posY << 16) + DESKTOP_GetScreenHeight()-1) / DESKTOP_GetScreenHeight();
wme.magic = WINE_MOUSEEVENT_MAGIC;
wme.keyState = keyState;
wme.time = time;
wme.hWnd = hWnd;
DISPLAY_DisableWarpPointer = TRUE;
X11DRV_MOUSE_DisableWarpPointer = TRUE;
DefMouseEventProc( mouseStatus, posX, posY, 0, (DWORD)&wme );
DISPLAY_DisableWarpPointer = FALSE;
X11DRV_MOUSE_DisableWarpPointer = FALSE;
}

View File

@ -7,10 +7,10 @@
#include <stdio.h>
#include "gdi.h"
#include "monitor.h"
#include "options.h"
#include "tweak.h"
#include "sysmetrics.h"
#include "x11drv.h"
#include "tweak.h"
short sysMetrics[SM_CMETRICS+1];
@ -35,8 +35,8 @@ void SYSMETRICS_Init(void)
{
sysMetrics[SM_CXCURSOR] = 32;
sysMetrics[SM_CYCURSOR] = 32;
sysMetrics[SM_CXSCREEN] = screenWidth;
sysMetrics[SM_CYSCREEN] = screenHeight;
sysMetrics[SM_CXSCREEN] = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
sysMetrics[SM_CYSCREEN] = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
sysMetrics[SM_CXVSCROLL] =
PROFILE_GetWineIniInt("Tweak.Layout", "ScrollBarWidth", 16) + 1;
sysMetrics[SM_CYHSCROLL] = sysMetrics[SM_CXVSCROLL];

View File

@ -24,7 +24,9 @@
#include "miscemu.h"
#include "shell.h"
#include "callback.h"
#include "x11drv.h"
#include "local.h"
#include "class.h"
#include "desktop.h"
/***********************************************************************
* GetFreeSystemResources (USER.284)
@ -312,9 +314,9 @@ LONG WINAPI ChangeDisplaySettings32A( LPDEVMODE32A devmode, DWORD flags )
FIXME(system, ": stub\n");
if (devmode==NULL)
FIXME(system," devmode=NULL (return to default mode)\n");
else if ( (devmode->dmBitsPerPel != DefaultDepthOfScreen(screen))
|| (devmode->dmPelsHeight != screenHeight)
|| (devmode->dmPelsWidth != screenWidth) )
else if ( (devmode->dmBitsPerPel != DESKTOP_GetScreenDepth())
|| (devmode->dmPelsHeight != DESKTOP_GetScreenHeight())
|| (devmode->dmPelsWidth != DESKTOP_GetScreenWidth()) )
{
@ -353,9 +355,9 @@ BOOL32 WINAPI EnumDisplaySettings32A(
TRACE(system,"(%s,%ld,%p)\n",name,n,devmode);
if (n==0) {
devmode->dmBitsPerPel = DefaultDepthOfScreen(screen);
devmode->dmPelsHeight = screenHeight;
devmode->dmPelsWidth = screenWidth;
devmode->dmBitsPerPel = DESKTOP_GetScreenDepth();
devmode->dmPelsHeight = DESKTOP_GetScreenHeight();
devmode->dmPelsWidth = DESKTOP_GetScreenWidth();
return TRUE;
}
if ((n-1)<NRMODES*NRDEPTHS) {

View File

@ -4,6 +4,8 @@
* Copyright 1993, 1994 Alexandre Julliard
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include "options.h"
@ -31,8 +33,16 @@
#include "debug.h"
#include "winerror.h"
#include "mdi.h"
#include "local.h"
#include "desktop.h"
#ifndef X_DISPLAY_MISSING
extern DESKTOP_DRIVER X11DRV_DESKTOP_Driver;
extern WND_DRIVER X11DRV_WND_Driver;
#else /* X_DISPLAY_MISSING */
extern DESKTOP_DRIVER TTYDRV_DESKTOP_Driver;
extern WND_DRIVER TTYDRV_WND_Driver;
#endif /* X_DISPLAY_MISSING */
/* Desktop window */
static WND *pWndDesktop = NULL;
@ -387,6 +397,7 @@ BOOL32 WIN_CreateDesktopWindow(void)
{
CLASS *class;
HWND32 hwndDesktop;
DESKTOP *pDesktop;
TRACE(win,"Creating desktop window\n");
@ -399,7 +410,16 @@ BOOL32 WIN_CreateDesktopWindow(void)
if (!hwndDesktop) return FALSE;
pWndDesktop = (WND *) USER_HEAP_LIN_ADDR( hwndDesktop );
pDesktop = (DESKTOP *) pWndDesktop->wExtra;
#ifndef X_DISPLAY_MISSING
pDesktop->pDriver = &X11DRV_DESKTOP_Driver;
pWndDesktop->pDriver = &X11DRV_WND_Driver;
#else /* X_DISPLAY_MISSING */
pDesktop->pDriver = &TTYDRV_DESKTOP_Driver;
pWndDesktop->pDriver = &TTYDRV_WND_Driver;
#endif /* X_DISPLAY_MISSING */
pDesktop->pDriver->pInitialize(pDesktop);
pWndDesktop->pDriver->pInitialize(pWndDesktop);
pWndDesktop->next = NULL;

View File

@ -5,6 +5,8 @@
* 1995, 1996 Alex Korobka
*/
#include "x11drv.h"
#include <string.h>
#include "sysmetrics.h"
#include "heap.h"
@ -20,7 +22,8 @@
#include "dce.h"
#include "nonclient.h"
#include "debug.h"
#include "x11drv.h"
#include "local.h"
#include "ldt.h"
#define HAS_DLGFRAME(style,exStyle) \
(((exStyle) & WS_EX_DLGMODALFRAME) || \
@ -2120,7 +2123,7 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter,
if( wnd->next == wndPtr ) flags |= SWP_NOZORDER;
}
}
else if (!((X11DRV_WND_DATA *) wndPtr->pDriverData)->window)
else if (!X11DRV_WND_GetXWindow(wndPtr))
{
/* FIXME: the following optimization is no good for "X-ed" windows */
if (hwndInsertAfter == HWND_TOP)
@ -2177,21 +2180,21 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter,
if( wndPtr->parent == WIN_GetDesktop() )
hwndInsertAfter = WINPOS_ReorderOwnedPopups( hwndInsertAfter,
wndPtr, winpos.flags );
if (X11DRV_WND_GetXWindow(wndPtr))
if (((X11DRV_WND_DATA *) wndPtr->pDriverData)->window)
{
WIN_UnlinkWindow( winpos.hwnd );
WIN_LinkWindow( winpos.hwnd, hwndInsertAfter );
}
else WINPOS_MoveWindowZOrder( winpos.hwnd, hwndInsertAfter );
else
WINPOS_MoveWindowZOrder( winpos.hwnd, hwndInsertAfter );
}
if ( !((X11DRV_WND_DATA *) wndPtr->pDriverData)->window && !(winpos.flags & SWP_NOREDRAW) &&
if ( !X11DRV_WND_GetXWindow(wndPtr) && !(winpos.flags & SWP_NOREDRAW) &&
((winpos.flags & (SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED))
!= (SWP_NOMOVE | SWP_NOSIZE)) )
visRgn = DCE_GetVisRgn(hwnd, DCX_WINDOW | DCX_CLIPSIBLINGS);
/* Send WM_NCCALCSIZE message to get new client area */
if( (winpos.flags & (SWP_FRAMECHANGED | SWP_NOSIZE)) != SWP_NOSIZE )
{
@ -2234,7 +2237,7 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter,
oldWindowRect = wndPtr->rectWindow;
if (((X11DRV_WND_DATA *) wndPtr->pDriverData)->window)
if (X11DRV_WND_GetXWindow(wndPtr))
{
RECT32 oldClientRect = wndPtr->rectClient;
@ -2337,7 +2340,7 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter,
if (flags & SWP_SHOWWINDOW)
{
wndPtr->dwStyle |= WS_VISIBLE;
if (((X11DRV_WND_DATA *) wndPtr->pDriverData)->window)
if (X11DRV_WND_GetXWindow(wndPtr))
{
HWND32 focus, curr;
@ -2371,8 +2374,7 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter,
else if (flags & SWP_HIDEWINDOW)
{
wndPtr->dwStyle &= ~WS_VISIBLE;
if (((X11DRV_WND_DATA *) wndPtr->pDriverData)->window)
if (X11DRV_WND_GetXWindow(wndPtr))
{
wndPtr->pDriver->pSetWindowPos(wndPtr, &winpos, uFlags & SMC_SETXPOS );
if( uFlags & SMC_SETXPOS )
@ -2402,7 +2404,7 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter,
/* Repaint the window */
if (((X11DRV_WND_DATA *) wndPtr->pDriverData)->window)
if (X11DRV_WND_GetXWindow(wndPtr))
EVENT_Synchronize(); /* Wait for all expose events */
if (!GetCapture32())