X11 driver changes.

This commit is contained in:
Patrik Stridvall 1999-02-04 11:11:01 +00:00 committed by Alexandre Julliard
parent 48b5de8388
commit ab121e7838
22 changed files with 1007 additions and 203 deletions

View File

@ -4,8 +4,12 @@
* Copyright 1993, 1994 Alexandre Julliard
*/
#include "ts_xlib.h"
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include <X11/Intrinsic.h>
#include "ts_xlib.h"
#include <assert.h>
#include <stdio.h>
@ -18,7 +22,7 @@
#include "options.h"
#include "x11drv.h"
#include "debug.h"
#include "xmalloc.h"
#include "xmalloc.h" /* for XCREATEIMAGE macro */
#define DST 0 /* Destination drawable */
@ -1203,8 +1207,8 @@ static BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
/* Xor is much better when we do not have full colormap. */
/* Using white^black ensures that we invert at least black */
/* and white. */
Pixel xor_pix = (WhitePixelOfScreen(screen) ^
BlackPixelOfScreen(screen));
Pixel xor_pix = (WhitePixelOfScreen(X11DRV_GetXScreen()) ^
BlackPixelOfScreen(X11DRV_GetXScreen()));
XSetFunction( display, physDevDst->gc, GXxor );
XSetForeground( display, physDevDst->gc, xor_pix);
XSetFillStyle( display, physDevDst->gc, FillSolid );
@ -1286,11 +1290,11 @@ static BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
}
tmpGC = XCreateGC( display, physDevDst->drawable, 0, NULL );
pixmaps[DST] = XCreatePixmap( display, rootWindow, width, height,
pixmaps[DST] = XCreatePixmap( display, X11DRV_GetXRootWindow(), width, height,
dcDst->w.bitsPerPixel );
if (useSrc)
{
pixmaps[SRC] = XCreatePixmap( display, rootWindow, width, height,
pixmaps[SRC] = XCreatePixmap( display, X11DRV_GetXRootWindow(), width, height,
dcDst->w.bitsPerPixel );
if (fStretch)
BITBLT_GetSrcAreaStretch( dcSrc, dcDst, pixmaps[SRC], tmpGC,
@ -1315,7 +1319,7 @@ static BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
case OP_ARGS(DST,TMP):
case OP_ARGS(SRC,TMP):
if (!pixmaps[TMP])
pixmaps[TMP] = XCreatePixmap( display, rootWindow,
pixmaps[TMP] = XCreatePixmap( display, X11DRV_GetXRootWindow(),
width, height,
dcDst->w.bitsPerPixel );
/* fall through */
@ -1330,7 +1334,7 @@ static BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
case OP_ARGS(PAT,TMP):
if (!pixmaps[TMP] && !fNullBrush)
pixmaps[TMP] = XCreatePixmap( display, rootWindow,
pixmaps[TMP] = XCreatePixmap( display, X11DRV_GetXRootWindow(),
width, height,
dcDst->w.bitsPerPixel );
/* fall through */
@ -1439,3 +1443,5 @@ BOOL32 X11DRV_StretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
DIB_UpdateDIBSection( dcDst, TRUE );
return result;
}
#endif /* !defined(X_DISPLAY_MISSING) */

View File

@ -4,18 +4,26 @@
* Copyright 1993 Alexandre Julliard
*/
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include "ts_xlib.h"
#include "ts_xutil.h"
#include <stdio.h>
#include <stdlib.h>
#include "gdi.h"
#include "callback.h"
#include "dc.h"
#include "bitmap.h"
#include "heap.h"
#include "monitor.h"
#include "debug.h"
#include "xmalloc.h"
#include "local.h"
#include "x11drv.h"
#include "wine/winuser16.h"
/* GCs used for B&W and color bitmap operations */
GC BITMAP_monoGC = 0, BITMAP_colorGC = 0;
@ -30,16 +38,22 @@ BOOL32 X11DRV_BITMAP_Init(void)
/* Create the necessary GCs */
if ((tmpPixmap = TSXCreatePixmap( display, rootWindow, 1, 1, 1 )))
if ((tmpPixmap = TSXCreatePixmap(display,
X11DRV_GetXRootWindow(),
1, 1,
1)))
{
BITMAP_monoGC = TSXCreateGC( display, tmpPixmap, 0, NULL );
TSXSetGraphicsExposures( display, BITMAP_monoGC, False );
TSXFreePixmap( display, tmpPixmap );
}
if (screenDepth != 1)
if (MONITOR_GetDepth(&MONITOR_PrimaryMonitor) != 1)
{
if ((tmpPixmap = TSXCreatePixmap(display, rootWindow, 1,1,screenDepth)))
if ((tmpPixmap = TSXCreatePixmap(display,
X11DRV_GetXRootWindow(),
1, 1,
MONITOR_GetDepth(&MONITOR_PrimaryMonitor))))
{
BITMAP_colorGC = TSXCreateGC( display, tmpPixmap, 0, NULL );
TSXSetGraphicsExposures( display, BITMAP_colorGC, False );
@ -180,7 +194,7 @@ BOOL32 X11DRV_CreateBitmap( HBITMAP32 hbitmap )
/* Check parameters */
if (bmp->bitmap.bmPlanes != 1) return 0;
if ((bmp->bitmap.bmBitsPixel != 1) &&
(bmp->bitmap.bmBitsPixel != screenDepth)) {
(bmp->bitmap.bmBitsPixel != MONITOR_GetDepth(&MONITOR_PrimaryMonitor))) {
ERR(x11drv, "Trying to make bitmap with planes=%d, bpp=%d\n",
bmp->bitmap.bmPlanes, bmp->bitmap.bmBitsPixel);
GDI_HEAP_UNLOCK( hbitmap );
@ -194,7 +208,7 @@ BOOL32 X11DRV_CreateBitmap( HBITMAP32 hbitmap )
if(!pbitmap) return FALSE;
/* Create the pixmap */
pbitmap->pixmap = TSXCreatePixmap(display, rootWindow, bmp->bitmap.bmWidth,
pbitmap->pixmap = TSXCreatePixmap(display, X11DRV_GetXRootWindow(), bmp->bitmap.bmWidth,
bmp->bitmap.bmHeight, bmp->bitmap.bmBitsPixel);
if (!pbitmap->pixmap) {
WARN(x11drv, "Can't create Pixmap\n");
@ -380,7 +394,7 @@ static LONG X11DRV_SetBitmapBits(BITMAPOBJ *bmp, void *bits, LONG count)
height = count / bmp->bitmap.bmWidthBytes;
EnterCriticalSection( &X11DRV_CritSection );
image = XCreateImage( display, DefaultVisualOfScreen(screen),
image = XCreateImage( display, DefaultVisualOfScreen(X11DRV_GetXScreen()),
bmp->bitmap.bmBitsPixel, ZPixmap, 0, NULL,
bmp->bitmap.bmWidth, height, 32, 0 );
image->data = (LPBYTE)xmalloc(image->bytes_per_line * height);
@ -510,3 +524,5 @@ BOOL32 X11DRV_BITMAP_DeleteObject( HBITMAP32 hbitmap, BITMAPOBJ * bmp )
return TRUE;
}
#endif /* !defined(X_DISPLAY_MISSING) */

View File

@ -4,6 +4,10 @@
* Copyright 1993, 1994 Alexandre Julliard
*/
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include "ts_xlib.h"
#include <stdlib.h>
@ -12,6 +16,9 @@
#include "color.h"
#include "x11drv.h"
#include "debug.h"
#include "xmalloc.h" /* for XCREATEIMAGE macro */
#include "monitor.h"
#include "local.h"
static const char HatchBrushes[NB_HATCH_STYLES + 1][8] =
{
@ -94,7 +101,7 @@ static XImage *ditherImage = NULL;
*/
BOOL32 X11DRV_BRUSH_Init(void)
{
XCREATEIMAGE( ditherImage, MATRIX_SIZE, MATRIX_SIZE, screenDepth );
XCREATEIMAGE( ditherImage, MATRIX_SIZE, MATRIX_SIZE, MONITOR_GetDepth(&MONITOR_PrimaryMonitor) );
return (ditherImage != NULL);
}
@ -130,8 +137,8 @@ static Pixmap BRUSH_DitherColor( DC *dc, COLORREF color )
prevColor = color;
}
pixmap = XCreatePixmap( display, rootWindow,
MATRIX_SIZE, MATRIX_SIZE, screenDepth );
pixmap = XCreatePixmap( display, X11DRV_GetXRootWindow(),
MATRIX_SIZE, MATRIX_SIZE, MONITOR_GetDepth(&MONITOR_PrimaryMonitor) );
XPutImage( display, pixmap, BITMAP_colorGC, ditherImage, 0, 0,
0, 0, MATRIX_SIZE, MATRIX_SIZE );
LeaveCriticalSection( &X11DRV_CritSection );
@ -146,7 +153,7 @@ static void BRUSH_SelectSolidBrush( DC *dc, COLORREF color )
{
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if ((dc->w.bitsPerPixel > 1) && (screenDepth <= 8) && !COLOR_IsSolid( color ))
if ((dc->w.bitsPerPixel > 1) && (MONITOR_GetDepth(&MONITOR_PrimaryMonitor) <= 8) && !COLOR_IsSolid( color ))
{
/* Dithered brush */
physDev->brush.pixmap = BRUSH_DitherColor( dc, color );
@ -186,14 +193,14 @@ static BOOL32 BRUSH_SelectPatternBrush( DC * dc, HBITMAP32 hbitmap )
if ((dc->w.bitsPerPixel == 1) && (bmp->bitmap.bmBitsPixel != 1))
{
/* Special case: a color pattern on a monochrome DC */
physDev->brush.pixmap = TSXCreatePixmap( display, rootWindow, 8, 8, 1);
physDev->brush.pixmap = TSXCreatePixmap( display, X11DRV_GetXRootWindow(), 8, 8, 1);
/* FIXME: should probably convert to monochrome instead */
TSXCopyPlane( display, pbitmap->pixmap, physDev->brush.pixmap,
BITMAP_monoGC, 0, 0, 8, 8, 0, 0, 1 );
}
else
{
physDev->brush.pixmap = TSXCreatePixmap( display, rootWindow,
physDev->brush.pixmap = TSXCreatePixmap( display, X11DRV_GetXRootWindow(),
8, 8, bmp->bitmap.bmBitsPixel );
TSXCopyArea( display, pbitmap->pixmap, physDev->brush.pixmap,
BITMAP_GC(bmp), 0, 0, 8, 8, 0, 0 );
@ -252,7 +259,7 @@ HBRUSH32 X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush, BRUSHOBJ * brush )
case BS_HATCHED:
TRACE(gdi, "BS_HATCHED\n" );
physDev->brush.pixel = COLOR_ToPhysical( dc, brush->logbrush.lbColor );
physDev->brush.pixmap = TSXCreateBitmapFromData( display, rootWindow,
physDev->brush.pixmap = TSXCreateBitmapFromData( display, X11DRV_GetXRootWindow(),
HatchBrushes[brush->logbrush.lbHatch], 8, 8 );
physDev->brush.fillStyle = FillStippled;
break;
@ -281,3 +288,6 @@ HBRUSH32 X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush, BRUSHOBJ * brush )
return prevHandle;
}
#endif /* !defined(X_DISPLAY_MISSING) */

View File

@ -4,6 +4,10 @@
* Copyright 1998 Huw Davies
*/
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include "ts_xlib.h"
#include <stdio.h>
@ -12,6 +16,7 @@
#include "region.h"
#include "debug.h"
#include "heap.h"
#include "local.h"
/***********************************************************************
* X11DRV_SetDeviceClipping
@ -65,3 +70,6 @@ void X11DRV_SetDeviceClipping( DC * dc )
GDI_HEAP_UNLOCK( dc->w.hGCClipRgn );
}
#endif /* !defined(X_DISPLAY_MISSING) */

View File

@ -4,15 +4,21 @@
* Copyright 1993,1994 Alexandre Julliard
*/
#include "windows.h"
#include "bitmap.h"
#include "x11drv.h"
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include "ts_xlib.h"
#include "ts_xutil.h"
#include "wintypes.h"
#include "bitmap.h"
#include "x11drv.h"
#include "debug.h"
#include "dc.h"
#include "color.h"
#include "callback.h"
#include "xmalloc.h" /* for XCREATEIMAGE macro */
static int bitmapDepthTable[] = { 8, 1, 32, 16, 24, 15, 4, 0 };
static int ximageDepthTable[] = { 0, 0, 0, 0, 0, 0, 0 };
@ -27,7 +33,7 @@ BOOL32 X11DRV_DIB_Init(void)
for( i = 0; bitmapDepthTable[i]; i++ )
{
testimage = TSXCreateImage(display, DefaultVisualOfScreen(screen),
testimage = TSXCreateImage(display, DefaultVisualOfScreen(X11DRV_GetXScreen()),
bitmapDepthTable[i], ZPixmap, 0, NULL, 1, 1, 32, 20 );
if( testimage ) ximageDepthTable[i] = testimage->bits_per_pixel;
else return FALSE;
@ -1151,3 +1157,5 @@ INT32 X11DRV_SetDIBitsToDevice( DC *dc, INT32 xDest, INT32 yDest, DWORD cx,
HeapFree(GetProcessHeap(), 0, descr.colorMap);
return result;
}
#endif /* !defined(X_DISPLAY_MISSING) */

View File

@ -4,20 +4,24 @@
* Copyright 1993,1994 Alexandre Julliard
*/
/*
* FIXME: none of these functions obey the GM_ADVANCED
* graphics mode
*/
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include <X11/Intrinsic.h>
#include "ts_xlib.h"
#include "ts_xutil.h"
#include <math.h>
#ifdef HAVE_FLOAT_H
# include <float.h>
#endif
#include <stdlib.h>
#include "ts_xlib.h"
#include "ts_xutil.h"
#include <X11/Intrinsic.h>
#ifndef PI
#define PI M_PI
#endif
@ -28,6 +32,7 @@
#include "bitmap.h"
#include "gdi.h"
#include "dc.h"
#include "monitor.h"
#include "bitmap.h"
#include "callback.h"
#include "metafile.h"
@ -107,7 +112,7 @@ BOOL32 X11DRV_SetupGCForPatBlt( DC * dc, GC gc, BOOL32 fMapColors )
*/
if (val.function == GXinvert)
{
val.foreground = BlackPixelOfScreen(screen) ^ WhitePixelOfScreen(screen);
val.foreground = BlackPixelOfScreen(X11DRV_GetXScreen()) ^ WhitePixelOfScreen(X11DRV_GetXScreen());
val.function = GXxor;
}
val.fill_style = physDev->brush.fillStyle;
@ -126,7 +131,10 @@ BOOL32 X11DRV_SetupGCForPatBlt( DC * dc, GC gc, BOOL32 fMapColors )
register int x, y;
XImage *image;
EnterCriticalSection( &X11DRV_CritSection );
pixmap = XCreatePixmap( display, rootWindow, 8, 8, screenDepth );
pixmap = XCreatePixmap( display,
X11DRV_GetXRootWindow(),
8, 8,
MONITOR_GetDepth(&MONITOR_PrimaryMonitor) );
image = XGetImage( display, physDev->brush.pixmap, 0, 0, 8, 8,
AllPlanes, ZPixmap );
for (y = 0; y < 8; y++)
@ -189,11 +197,11 @@ BOOL32 X11DRV_SetupGCForPen( DC * dc )
switch (dc->w.ROPmode)
{
case R2_BLACK :
val.foreground = BlackPixelOfScreen( screen );
val.foreground = BlackPixelOfScreen( X11DRV_GetXScreen() );
val.function = GXcopy;
break;
case R2_WHITE :
val.foreground = WhitePixelOfScreen( screen );
val.foreground = WhitePixelOfScreen( X11DRV_GetXScreen() );
val.function = GXcopy;
break;
case R2_XORPEN :
@ -201,8 +209,8 @@ BOOL32 X11DRV_SetupGCForPen( DC * dc )
/* It is very unlikely someone wants to XOR with 0 */
/* This fixes the rubber-drawings in paintbrush */
if (val.foreground == 0)
val.foreground = BlackPixelOfScreen( screen )
^ WhitePixelOfScreen( screen );
val.foreground = BlackPixelOfScreen( X11DRV_GetXScreen() )
^ WhitePixelOfScreen( X11DRV_GetXScreen() );
val.function = GXxor;
break;
default :
@ -854,7 +862,7 @@ X11DRV_GetPixel( DC *dc, INT32 x, INT32 y )
{
/* If we are reading from the screen, use a temporary copy */
/* to avoid a BadMatch error */
if (!pixmap) pixmap = XCreatePixmap( display, rootWindow,
if (!pixmap) pixmap = XCreatePixmap( display, X11DRV_GetXRootWindow(),
1, 1, dc->w.bitsPerPixel );
XCopyArea( display, physDev->drawable, pixmap, BITMAP_colorGC,
x, y, 1, 1, 0, 0 );
@ -1427,3 +1435,5 @@ X11DRV_SetTextColor( DC *dc, COLORREF color )
return oldColor;
}
#endif /* !defined(X_DISPLAY_MISSING) */

View File

@ -4,6 +4,10 @@
* Copyright 1996 Alexandre Julliard
*/
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include "ts_xlib.h"
#include <string.h>
@ -11,7 +15,10 @@
#include "color.h"
#include "bitmap.h"
#include "winnt.h"
#include "local.h"
#include "debug.h"
#include "ldt.h"
#include "monitor.h"
static BOOL32 X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
LPCSTR output, const DEVMODE16* initData );
@ -129,16 +136,16 @@ BOOL32 X11DRV_Init(void)
#if 0
TRACE(x11drv, "Height = %-4i pxl, %-4i mm, Width = %-4i pxl, %-4i mm\n",
HeightOfScreen(screen), HeightMMOfScreen(screen),
WidthOfScreen(screen), WidthMMOfScreen(screen) );
HeightOfScreen(X11DRV_GetXScreen()), HeightMMOfScreen(X11DRV_GetXScreen()),
WidthOfScreen(X11DRV_GetXScreen()), WidthMMOfScreen(X11DRV_GetXScreen()) );
#endif
X11DRV_DevCaps.version = 0x300;
X11DRV_DevCaps.horzSize = WidthMMOfScreen(screen) * screenWidth / WidthOfScreen(screen);
X11DRV_DevCaps.vertSize = HeightMMOfScreen(screen) * screenHeight / HeightOfScreen(screen);
X11DRV_DevCaps.horzRes = screenWidth;
X11DRV_DevCaps.vertRes = screenHeight;
X11DRV_DevCaps.bitsPixel = screenDepth;
X11DRV_DevCaps.horzSize = WidthMMOfScreen(X11DRV_GetXScreen()) * MONITOR_GetWidth(&MONITOR_PrimaryMonitor) / WidthOfScreen(X11DRV_GetXScreen());
X11DRV_DevCaps.vertSize = HeightMMOfScreen(X11DRV_GetXScreen()) * MONITOR_GetHeight(&MONITOR_PrimaryMonitor) / HeightOfScreen(X11DRV_GetXScreen());
X11DRV_DevCaps.horzRes = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
X11DRV_DevCaps.vertRes = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
X11DRV_DevCaps.bitsPixel = MONITOR_GetDepth(&MONITOR_PrimaryMonitor);
if( COLOR_GetSystemPaletteFlags() & COLOR_VIRTUAL )
X11DRV_DevCaps.sizePalette = 0;
@ -205,14 +212,14 @@ static BOOL32 X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
}
else
{
physDev->drawable = rootWindow;
physDev->drawable = X11DRV_GetXRootWindow();
physDev->gc = TSXCreateGC( display, physDev->drawable, 0, NULL );
dc->w.bitsPerPixel = screenDepth;
dc->w.bitsPerPixel = MONITOR_GetDepth(&MONITOR_PrimaryMonitor);
dc->w.totalExtent.left = 0;
dc->w.totalExtent.top = 0;
dc->w.totalExtent.right = screenWidth;
dc->w.totalExtent.bottom = screenHeight;
dc->w.totalExtent.right = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
dc->w.totalExtent.bottom = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
dc->w.hVisRgn = CreateRectRgnIndirect32( &dc->w.totalExtent );
}
@ -261,3 +268,4 @@ static INT32 X11DRV_Escape( DC *dc, INT32 nEscape, INT32 cbInput,
return 0;
}
#endif /* !defined(X_DISPLAY_MISSING) */

View File

@ -4,12 +4,17 @@
* Copyright 1993 Alexandre Julliard
*/
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include <stdlib.h>
#include <stdio.h>
#include "bitmap.h"
#include "brush.h"
#include "font.h"
#include "pen.h"
#include "local.h"
#include "debug.h"
@ -80,3 +85,5 @@ BOOL32 X11DRV_DeleteObject( HGDIOBJ32 handle )
GDI_HEAP_UNLOCK( handle );
return ret;
}
#endif /* !defined(X_DISPLAY_MISSING) */

View File

@ -5,20 +5,33 @@
*
*/
#include <stdlib.h>
#include <string.h>
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include "ts_xlib.h"
#include "ts_xutil.h"
#ifdef HAVE_LIBXXPM
#include "ts_xpm.h"
#include "gdi.h"
#include "x11drv.h"
#else /* defined(HAVE_LIBXXPM) */
typedef unsigned long Pixel;
#endif /* defined(HAVE_LIBXXPM) */
#include <stdlib.h>
#include <string.h>
#include "bitmap.h"
#include "callback.h"
#include "color.h"
#include "cursoricon.h"
#include "heap.h"
#include "tweak.h"
#include "debug.h"
#include "gdi.h"
#include "heap.h"
#include "local.h"
#include "monitor.h"
#include "tweak.h"
#include "x11drv.h"
/* Include OEM pixmaps */
#include "bitmaps/obm_cdrom"
@ -234,14 +247,17 @@ static HGLOBAL16 OBM_Cursors[NB_CURSORS];
/* palette indexes, but system colors that will be converted to */
/* indexes later on. */
#if 0
static const struct
#ifdef HAVE_LIBXXPM
static XpmColorSymbol
#else /* defined(HAVE_LIBXXPM) */
static struct
{
char * name;
COLORREF color;
} OBM_SymbolicColors[] =
#endif
static XpmColorSymbol OBM_Colors[] =
char *name;
char *value;
Pixel pixel;
}
#endif /* defined(HAVE_LIBXXPM) */
OBM_Colors[] =
{
{ "black", NULL, (Pixel)RGB(0,0,0) },
{ "white", NULL, (Pixel)RGB(255,255,255) },
@ -269,11 +285,14 @@ static XpmColorSymbol OBM_Colors[] =
/* This is needed to make sure that black is always 0 and */
/* white always 1, as required by Windows. */
#ifdef HAVE_LIBXXPM
static XpmColorSymbol OBM_BlackAndWhite[2] =
{
{ "black", NULL, 0 },
{ "white", NULL, 0xffffffff }
};
#endif /* defined(HAVE_LIBXXPM) */
/* This structure holds the arguments for OBM_CreateBitmaps() */
typedef struct
@ -315,6 +334,7 @@ static BOOL32 OBM_InitColorSymbols()
*
* Allocate a GDI bitmap.
*/
#ifdef HAVE_LIBXXPM
static HBITMAP16 OBM_MakeBitmap( WORD width, WORD height,
WORD bpp, Pixmap pixmap )
{
@ -346,7 +366,7 @@ static HBITMAP16 OBM_MakeBitmap( WORD width, WORD height,
GDI_HEAP_UNLOCK( hbitmap );
return hbitmap;
}
#endif /* defined(HAVE_LIBXXPM) */
/***********************************************************************
* OBM_CreateBitmaps
@ -357,6 +377,7 @@ static HBITMAP16 OBM_MakeBitmap( WORD width, WORD height,
*/
static BOOL32 OBM_CreateBitmaps( OBM_BITMAP_DESCR *descr )
{
#ifdef HAVE_LIBXXPM
Pixmap pixmap, pixmask;
XpmAttributes *attrs;
int err;
@ -364,12 +385,12 @@ static BOOL32 OBM_CreateBitmaps( OBM_BITMAP_DESCR *descr )
attrs = (XpmAttributes *)HEAP_xalloc( GetProcessHeap(), 0,
XpmAttributesSize() );
attrs->valuemask = XpmColormap | XpmDepth | XpmColorSymbols |XpmHotspot;
attrs->colormap = COLOR_GetColormap();
attrs->depth = descr->color ? screenDepth : 1;
attrs->colormap = X11DRV_COLOR_GetColormap();
attrs->depth = descr->color ? MONITOR_GetDepth(&MONITOR_PrimaryMonitor) : 1;
attrs->colorsymbols = (attrs->depth > 1) ? OBM_Colors : OBM_BlackAndWhite;
attrs->numsymbols = (attrs->depth > 1) ? NB_COLOR_SYMBOLS : 2;
err = XpmCreatePixmapFromData( display, rootWindow, descr->data,
err = XpmCreatePixmapFromData( display, X11DRV_GetXRootWindow(), descr->data,
&pixmap, &pixmask, attrs );
if (err != XpmSuccess)
@ -394,6 +415,13 @@ static BOOL32 OBM_CreateBitmaps( OBM_BITMAP_DESCR *descr )
return FALSE;
}
else return TRUE;
#else /* defined(HAVE_LIBXXPM) */
FIXME(x11drv,
"Xpm support not in the binary, "
"please install Xpm and recompile\n"
);
return FALSE;
#endif /* defined(HAVE_LIBXXPM) */
}
@ -595,3 +623,5 @@ BOOL32 X11DRV_OBM_Init(void)
return 1;
}
#endif /* !defined(X_DISPLAY_MISSING) */

View File

@ -4,8 +4,13 @@
* Copyright 1993 Alexandre Julliard
*/
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include "pen.h"
#include "color.h"
#include "x11drv.h"
#include "debug.h"
static const char PEN_dash[] = { 5,3 }; /* ----- ----- ----- */
@ -63,3 +68,5 @@ HPEN32 X11DRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen )
return prevHandle;
}
#endif /* !defined(X_DISPLAY_MISSING) */

View File

@ -4,17 +4,20 @@
* Copyright 1993,1994 Alexandre Julliard
*/
#include <stdlib.h>
#include "ts_xlib.h"
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include <X11/Xatom.h>
#include "windows.h"
#include "ts_xlib.h"
#include <stdlib.h>
#include "wintypes.h"
#include <math.h>
#include "dc.h"
#include "gdi.h"
/*#include "callback.h"*/
#include "heap.h"
#include "x11font.h"
#include "debugstr.h"
#include "debug.h"
#define SWAP_INT(a,b) { int t = a; a = b; b = t; }
@ -347,3 +350,4 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
return TRUE;
}
#endif /* !defined(X_DISPLAY_MISSING) */

View File

@ -7,6 +7,14 @@
* have to be changed for that), dynamic font loading (FreeType).
*/
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include <X11/Xatom.h>
#include "ts_xlib.h"
#include "x11font.h"
#endif /* !defined(X_DISPLAY_MISSING) */
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
@ -16,15 +24,15 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "ts_xlib.h"
#include <X11/Xatom.h>
#include <math.h>
#include <assert.h>
#include "heap.h"
#include "options.h"
#include "x11font.h"
#include "font.h"
#include "debug.h"
#include "ldt.h"
#ifndef X_DISPLAY_MISSING
#define X_PFONT_MAGIC (0xFADE0000)
#define X_FMC_MAGIC (0x0000CAFE)
@ -2687,6 +2695,8 @@ BOOL32 X11DRV_GetCharWidth( DC *dc, UINT32 firstChar, UINT32 lastChar,
return FALSE;
}
#endif /* !defined(X_DISPLAY_MISSING) */
/***********************************************************************
* *
* Font Resource API *
@ -2780,4 +2790,3 @@ BOOL32 WINAPI RemoveFontResource32W( LPCWSTR str )
return TRUE;
}

View File

@ -7,9 +7,12 @@ MODULE = x11drv
C_SRCS = \
clipboard.c \
desktop.c \
event.c \
init.c \
keyboard.c \
main.c \
monitor.c \
mouse.c \
wnd.c

View File

@ -12,13 +12,11 @@
#include <X11/Xatom.h>
#include "ts_xlib.h"
#include "windows.h"
#include "wintypes.h"
#include "clipboard.h"
#include "debug.h"
#include "message.h"
#include "win.h"
#include "wintypes.h"
#include "x11drv.h"
extern HWND32 hWndClipOwner;

85
windows/x11drv/desktop.c Normal file
View File

@ -0,0 +1,85 @@
/*
* X11 desktop driver
*
* Copyright 1998 Patrik Stridvall
*
*/
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include "debug.h"
#include "desktop.h"
#include "monitor.h"
#include "options.h"
#include "win.h"
#include "wintypes.h"
#include "x11drv.h"
/***********************************************************************
* X11DRV_DESKTOP_GetXScreen
*
* Return the X screen associated to the desktop.
*/
Screen *X11DRV_DESKTOP_GetXScreen(DESKTOP *pDesktop)
{
return X11DRV_MONITOR_GetXScreen(pDesktop->pPrimaryMonitor);
}
/***********************************************************************
* X11DRV_DESKTOP_GetXRootWindow
*
* Return the X root window associated to the desktop.
*/
Window X11DRV_DESKTOP_GetXRootWindow(DESKTOP *pDesktop)
{
return X11DRV_MONITOR_GetXRootWindow(pDesktop->pPrimaryMonitor);
}
/***********************************************************************
* X11DRV_DESKTOP_Initialize
*/
void X11DRV_DESKTOP_Initialize(DESKTOP *pDesktop)
{
pDesktop->pPrimaryMonitor = &MONITOR_PrimaryMonitor;
}
/***********************************************************************
* X11DRV_DESKTOP_Finalize
*/
void X11DRV_DESKTOP_Finalize(DESKTOP *pDesktop)
{
}
/***********************************************************************
* X11DRV_DESKTOP_GetScreenWidth
*
* Return the width of the screen associated to the desktop.
*/
int X11DRV_DESKTOP_GetScreenWidth(DESKTOP *pDesktop)
{
return MONITOR_GetWidth(pDesktop->pPrimaryMonitor);
}
/***********************************************************************
* X11DRV_DESKTOP_GetScreenHeight
*
* Return the width of the screen associated to the desktop.
*/
int X11DRV_DESKTOP_GetScreenHeight(DESKTOP *pDesktop)
{
return MONITOR_GetHeight(pDesktop->pPrimaryMonitor);
}
/***********************************************************************
* X11DRV_DESKTOP_GetScreenDepth
*
* Return the depth of the screen associated to the desktop.
*/
int X11DRV_DESKTOP_GetScreenDepth(DESKTOP *pDesktop)
{
return MONITOR_GetDepth(pDesktop->pPrimaryMonitor);
}
#endif /* X_DISPLAY_MISSING */

View File

@ -15,34 +15,26 @@
#include "ts_xutil.h"
#include <assert.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
#include <errno.h>
#include "windows.h"
#include "winnt.h"
#include "gdi.h"
#include "heap.h"
#include "queue.h"
#include "class.h"
#include "dce.h"
#include "module.h"
#include "options.h"
#include "winpos.h"
#include "drive.h"
#include "shell.h"
#include "callback.h"
#include "keyboard.h"
#include "mouse.h"
#include "debug.h"
#include "class.h"
#include "clipboard.h"
#include "dce.h"
#include "dde_proc.h"
#include "winsock.h"
#include "debug.h"
#include "drive.h"
#include "heap.h"
#include "keyboard.h"
#include "message.h"
#include "mouse.h"
#include "options.h"
#include "queue.h"
#include "shell.h"
#include "winpos.h"
#include "winsock.h"
#include "wintypes.h"
#include "x11drv.h"
/* X context to associate a hwnd to an X window */
extern XContext winContext;
@ -51,6 +43,9 @@ extern Atom wmDeleteWindow;
extern Atom dndProtocol;
extern Atom dndSelection;
extern void X11DRV_KEYBOARD_UpdateState(void);
extern void X11DRV_KEYBOARD_HandleEvent(WND *pWnd, XKeyEvent *event);
#define NB_BUTTONS 3 /* Windows can handle 3 buttons */
#define DndNotDnd -1 /* OffiX drag&drop */
@ -339,7 +334,7 @@ static void EVENT_ProcessEvent( XEvent *event )
Window root, child;
int root_x, root_y, child_x, child_y;
unsigned u;
TSXQueryPointer( display, rootWindow, &root, &child,
TSXQueryPointer( display, X11DRV_GetXRootWindow(), &root, &child,
&root_x, &root_y, &child_x, &child_y, &u);
if (TSXFindContext( display, child, winContext, (char **)&pWnd ) != 0)
return;
@ -585,7 +580,7 @@ BOOL32 X11DRV_EVENT_QueryPointer(DWORD *posX, DWORD *posY, DWORD *state)
int rootX, rootY, winX, winY;
unsigned int xstate;
if (!TSXQueryPointer( display, rootWindow, &root, &child,
if (!TSXQueryPointer( display, X11DRV_GetXRootWindow(), &root, &child,
&rootX, &rootY, &winX, &winY, &xstate ))
return FALSE;
@ -647,7 +642,7 @@ static void EVENT_GraphicsExpose( WND *pWnd, XGraphicsExposeEvent *event )
*/
static void EVENT_Key( WND *pWnd, XKeyEvent *event )
{
KEYBOARD_HandleEvent( pWnd, event );
X11DRV_KEYBOARD_HandleEvent( pWnd, event );
}
@ -788,7 +783,7 @@ static void EVENT_FocusIn( WND *pWnd, XFocusChangeEvent *event )
if (hwnd != GetActiveWindow32())
{
WINPOS_ChangeActiveWindow( hwnd, FALSE );
KEYBOARD_UpdateState();
X11DRV_KEYBOARD_UpdateState();
}
if ((hwnd != GetFocus32()) && !IsChild32( hwnd, GetFocus32()))
SetFocus32( hwnd );
@ -845,7 +840,7 @@ static void EVENT_GetGeometry( Window win, int *px, int *py,
if (!TSXGetGeometry( display, win, &root, px, py, pwidth, pheight,
&border, &depth )) return;
if (win == rootWindow)
if (win == X11DRV_GetXRootWindow())
{
*px = *py = 0;
return;
@ -856,7 +851,7 @@ static void EVENT_GetGeometry( Window win, int *px, int *py,
if (!TSXQueryTree(display, win, &root, &parent, &children, &nb_children))
return;
TSXFree( children );
if (parent == rootWindow) break;
if (parent == X11DRV_GetXRootWindow()) break;
win = parent;
if (!TSXGetGeometry( display, win, &root, &xpos, &ypos,
&width, &height, &border, &depth )) return;
@ -1209,7 +1204,7 @@ static void EVENT_DropURLs( WND *pWnd, XClientMessageEvent *event )
}
if( drop_len && drop_len < 65535 ) {
TSXQueryPointer( display, rootWindow, &u.w_aux, &u.w_aux,
TSXQueryPointer( display, X11DRV_GetXRootWindow(), &u.w_aux, &u.w_aux,
&x, &y, &u.i, &u.i, &u.i);
pDropWnd = WIN_FindWndPtr( pWnd->hwndSelf );
@ -1342,9 +1337,9 @@ static void EVENT_ClientMessage( WND *pWnd, XClientMessageEvent *event )
#if 0
void EVENT_EnterNotify( WND *pWnd, XCrossingEvent *event )
{
if( !Options.managed && rootWindow == DefaultRootWindow(display) &&
if( !Options.managed && X11DRV_GetXRootWindow() == DefaultRootWindow(display) &&
(COLOR_GetSystemPaletteFlags() & COLOR_PRIVATE) && GetFocus32() )
TSXInstallColormap( display, COLOR_GetColormap() );
TSXInstallColormap( display, X11DRV_COLOR_GetColormap() );
}
#endif
@ -1370,6 +1365,3 @@ BOOL32 X11DRV_EVENT_Pending()
}
#endif /* !defined(X_DISPLAY_MISSING) */

View File

@ -8,8 +8,67 @@
#ifndef X_DISPLAY_MISSING
#include "clipboard.h"
#include "desktop.h"
#include "display.h"
#include "keyboard.h"
#include "message.h"
#include "monitor.h"
#include "win.h"
#include "x11drv.h"
CLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver =
{
X11DRV_CLIPBOARD_EmptyClipboard,
X11DRV_CLIPBOARD_SetClipboardData,
X11DRV_CLIPBOARD_RequestSelection,
X11DRV_CLIPBOARD_ResetOwner
};
DESKTOP_DRIVER X11DRV_DESKTOP_Driver =
{
X11DRV_DESKTOP_Initialize,
X11DRV_DESKTOP_Finalize
};
EVENT_DRIVER X11DRV_EVENT_Driver =
{
X11DRV_EVENT_Init,
X11DRV_EVENT_AddIO,
X11DRV_EVENT_DeleteIO,
X11DRV_EVENT_WaitNetEvent,
X11DRV_EVENT_Synchronize,
X11DRV_EVENT_CheckFocus,
X11DRV_EVENT_QueryPointer,
X11DRV_EVENT_DummyMotionNotify,
X11DRV_EVENT_Pending,
X11DRV_EVENT_IsUserIdle
};
KEYBOARD_DRIVER X11DRV_KEYBOARD_Driver =
{
X11DRV_KEYBOARD_Init,
X11DRV_KEYBOARD_VkKeyScan,
X11DRV_KEYBOARD_MapVirtualKey,
X11DRV_KEYBOARD_GetKeyNameText,
X11DRV_KEYBOARD_ToAscii
};
MONITOR_DRIVER X11DRV_MONITOR_Driver =
{
X11DRV_MONITOR_Initialize,
X11DRV_MONITOR_Finalize,
X11DRV_MONITOR_GetWidth,
X11DRV_MONITOR_GetHeight,
X11DRV_MONITOR_GetDepth
};
MOUSE_DRIVER X11DRV_MOUSE_Driver =
{
X11DRV_MOUSE_SetCursor,
X11DRV_MOUSE_MoveCursor
};
WND_DRIVER X11DRV_WND_Driver =
{
X11DRV_WND_Initialize,
@ -29,43 +88,6 @@ WND_DRIVER X11DRV_WND_Driver =
X11DRV_WND_IsSelfClipping
};
CLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver =
{
X11DRV_CLIPBOARD_EmptyClipboard,
X11DRV_CLIPBOARD_SetClipboardData,
X11DRV_CLIPBOARD_RequestSelection,
X11DRV_CLIPBOARD_ResetOwner
};
KEYBOARD_DRIVER X11DRV_KEYBOARD_Driver =
{
X11DRV_KEYBOARD_Init,
X11DRV_KEYBOARD_VkKeyScan,
X11DRV_KEYBOARD_MapVirtualKey,
X11DRV_KEYBOARD_GetKeyNameText,
X11DRV_KEYBOARD_ToAscii
};
EVENT_DRIVER X11DRV_EVENT_Driver =
{
X11DRV_EVENT_Init,
X11DRV_EVENT_AddIO,
X11DRV_EVENT_DeleteIO,
X11DRV_EVENT_WaitNetEvent,
X11DRV_EVENT_Synchronize,
X11DRV_EVENT_CheckFocus,
X11DRV_EVENT_QueryPointer,
X11DRV_EVENT_DummyMotionNotify,
X11DRV_EVENT_Pending,
X11DRV_EVENT_IsUserIdle
};
MOUSE_DRIVER X11DRV_MOUSE_Driver =
{
X11DRV_MOUSE_SetCursor,
X11DRV_MOUSE_MoveCursor
};
#endif /* !defined(X_DISPLAY_MISSING) */

View File

@ -19,6 +19,7 @@
#include "ts_xutil.h"
#include "debug.h"
#include "keyboard.h"
#include "message.h"
#include "wintypes.h"
#include "x11drv.h"
@ -168,7 +169,7 @@ void KEYBOARD_UpdateOneState ( int vkey, int state )
}
/***********************************************************************
* KEYBOARD_UpdateState
* X11DRV_KEYBOARD_UpdateState
*
* Update modifiers state (Ctrl, Alt, Shift)
* when window is activated (called by EVENT_FocusIn in event.c)
@ -178,7 +179,7 @@ void KEYBOARD_UpdateOneState ( int vkey, int state )
* Toggle keys are handled in HandleEvent. (because XQueryKeymap says nothing
* about them)
*/
void KEYBOARD_UpdateState ( void )
void X11DRV_KEYBOARD_UpdateState ( void )
{
/* extract a bit from the char[32] bit suite */
#define KeyState(keycode) ((keys_return[keycode/8] & (1<<(keycode%8)))!=0)
@ -199,11 +200,11 @@ void KEYBOARD_UpdateState ( void )
}
/***********************************************************************
* KEYBOARD_HandleEvent
* X11DRV_KEYBOARD_HandleEvent
*
* Handle a X key event
*/
void KEYBOARD_HandleEvent( WND *pWnd, XKeyEvent *event )
void X11DRV_KEYBOARD_HandleEvent( WND *pWnd, XKeyEvent *event )
{
char Str[24];
XComposeStatus cs;
@ -229,11 +230,11 @@ void KEYBOARD_HandleEvent( WND *pWnd, XKeyEvent *event )
{
TRACE(key, "Alt Gr key event received\n");
event->keycode = kcControl; /* Simulate Control */
KEYBOARD_HandleEvent( pWnd, event );
X11DRV_KEYBOARD_HandleEvent( pWnd, event );
event->keycode = kcAlt; /* Simulate Alt */
force_extended = TRUE;
KEYBOARD_HandleEvent( pWnd, event );
X11DRV_KEYBOARD_HandleEvent( pWnd, event );
force_extended = FALSE;
return;
}

319
windows/x11drv/main.c Normal file
View File

@ -0,0 +1,319 @@
/*
* X11 main driver
*
* Copyright 1998 Patrik Stridvall
*
*/
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include <X11/Xlocale.h>
#include "ts_xlib.h"
#include "ts_xresource.h"
#include "ts_xutil.h"
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "console.h"
#include "debug.h"
#include "desktop.h"
#include "main.h"
#include "monitor.h"
#include "options.h"
#include "win.h"
#include "wintypes.h"
#include "x11drv.h"
#include "xmalloc.h"
#include "version.h"
/**********************************************************************/
#define WINE_CLASS "Wine" /* Class name for resources */
#define WINE_APP_DEFAULTS "/usr/lib/X11/app-defaults/Wine"
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]))
/**********************************************************************/
static XKeyboardState X11DRV_XKeyboardState;
Display *display;
/***********************************************************************
* X11DRV_GetXScreen
*
* Return the X screen associated to the current desktop.
*/
Screen *X11DRV_GetXScreen()
{
return X11DRV_MONITOR_GetXScreen(&MONITOR_PrimaryMonitor);
}
/***********************************************************************
* X11DRV_GetXRootWindow
*
* Return the X display associated to the current desktop.
*/
Window X11DRV_GetXRootWindow()
{
return X11DRV_MONITOR_GetXRootWindow(&MONITOR_PrimaryMonitor);
}
/***********************************************************************
* X11DRV_MAIN_Initialize
*/
void X11DRV_MAIN_Initialize()
{
/* We need this before calling any Xlib function */
InitializeCriticalSection( &X11DRV_CritSection );
MakeCriticalSectionGlobal( &X11DRV_CritSection );
TSXrmInitialize();
putenv("XKB_DISABLE="); /* Disable XKB extension if present. */
}
/***********************************************************************
* X11DRV_MAIN_Finalize
*/
void X11DRV_MAIN_Finalize()
{
}
/***********************************************************************
* X11DRV_MAIN_GetResource
*
* Fetch the value of resource 'name' using the correct instance name.
* 'name' must begin with '.' or '*'
*/
static int X11DRV_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;
}
/***********************************************************************
* X11DRV_MAIN_ParseOptions
* Parse command line options and open display.
*/
void X11DRV_MAIN_ParseOptions(int *argc, char *argv[])
{
int i;
char *display_name = NULL;
XrmValue value;
XrmDatabase db = TSXrmGetFileDatabase(WINE_APP_DEFAULTS);
char *xrm_string;
/* Get display name from command line */
for (i = 1; i < *argc; i++)
{
if (!strcmp( argv[i], "-display" )) display_name = argv[i+1];
}
/* Open display */
if (display_name == NULL &&
X11DRV_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 (X11DRV_MAIN_GetResource( db, ".iconic", &value ))
Options.cmdShow = SW_SHOWMINIMIZED;
if (X11DRV_MAIN_GetResource( db, ".privatemap", &value ))
Options.usePrivateMap = TRUE;
if (X11DRV_MAIN_GetResource( db, ".fixedmap", &value ))
Options.useFixedMap = TRUE;
if (X11DRV_MAIN_GetResource( db, ".synchronous", &value ))
Options.synchronous = TRUE;
if (X11DRV_MAIN_GetResource( db, ".backingstore", &value ))
Options.backingstore = TRUE;
if (X11DRV_MAIN_GetResource( db, ".debug", &value ))
Options.debug = TRUE;
if (X11DRV_MAIN_GetResource( db, ".failreadonly", &value ))
Options.failReadOnly = TRUE;
if (X11DRV_MAIN_GetResource( db, ".perfect", &value ))
Options.perfectGraphics = TRUE;
if (X11DRV_MAIN_GetResource( db, ".depth", &value))
Options.screenDepth = atoi( value.addr );
if (X11DRV_MAIN_GetResource( db, ".desktop", &value))
Options.desktopGeometry = value.addr;
if (X11DRV_MAIN_GetResource( db, ".language", &value))
MAIN_ParseLanguageOption( (char *)value.addr );
if (X11DRV_MAIN_GetResource( db, ".managed", &value))
Options.managed = TRUE;
if (X11DRV_MAIN_GetResource( db, ".mode", &value))
MAIN_ParseModeOption( (char *)value.addr );
if (X11DRV_MAIN_GetResource( db, ".debugoptions", &value))
MAIN_ParseDebugOptions((char*)value.addr);
if (X11DRV_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
MAIN_ParseDebugOptions((char*)value.addr);
#endif
}
if (X11DRV_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 (X11DRV_MAIN_GetResource( db, ".winver", &value))
VERSION_ParseWinVersion( (char*)value.addr );
if (X11DRV_MAIN_GetResource( db, ".dosver", &value))
VERSION_ParseDosVersion( (char*)value.addr );
if (X11DRV_MAIN_GetResource( db, ".config", &value))
Options.configFileName = xstrdup((char *)value.addr);
if (X11DRV_MAIN_GetResource( db, ".nodga", &value))
Options.noDGA = TRUE;
if (X11DRV_MAIN_GetResource( db, ".console", &value))
Options.consoleDrivers = xstrdup((char *)value.addr);
else
Options.consoleDrivers = CONSOLE_DEFAULT_DRIVER;
}
/***********************************************************************
* X11DRV_MAIN_ErrorHandler
*/
static int X11DRV_MAIN_ErrorHandler(Display *display, XErrorEvent *error_evt)
{
kill( getpid(), SIGHUP ); /* force an entry in the debugger */
return 0;
}
/***********************************************************************
* X11DRV_MAIN_Create
*/
void X11DRV_MAIN_Create()
{
if (Options.synchronous) XSetErrorHandler( X11DRV_MAIN_ErrorHandler );
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
}
}
/***********************************************************************
* X11DRV_MAIN_SaveSetup
*/
void X11DRV_MAIN_SaveSetup()
{
TSXGetKeyboardControl(display, &X11DRV_XKeyboardState);
}
/***********************************************************************
* X11DRV_MAIN_RestoreSetup
*/
void X11DRV_MAIN_RestoreSetup()
{
XKeyboardControl keyboard_value;
keyboard_value.key_click_percent = X11DRV_XKeyboardState.key_click_percent;
keyboard_value.bell_percent = X11DRV_XKeyboardState.bell_percent;
keyboard_value.bell_pitch = X11DRV_XKeyboardState.bell_pitch;
keyboard_value.bell_duration = X11DRV_XKeyboardState.bell_duration;
keyboard_value.auto_repeat_mode = X11DRV_XKeyboardState.global_auto_repeat;
XChangeKeyboardControl(display, KBKeyClickPercent | KBBellPercent |
KBBellPitch | KBBellDuration | KBAutoRepeatMode, &keyboard_value);
}
#endif /* X_DISPLAY_MISSING */

226
windows/x11drv/monitor.c Normal file
View File

@ -0,0 +1,226 @@
/*
* X11 monitor driver
*
* Copyright 1998 Patrik Stridvall
*
*/
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include <X11/cursorfont.h>
#include "ts_xlib.h"
#include "ts_xutil.h"
#include "debug.h"
#include "heap.h"
#include "monitor.h"
#include "options.h"
#include "wintypes.h"
#include "x11drv.h"
/**********************************************************************/
extern Display *display;
/***********************************************************************
* X11DRV_MONITOR_GetXScreen
*
* Return the X screen associated to the MONITOR.
*/
Screen *X11DRV_MONITOR_GetXScreen(MONITOR *pMonitor)
{
X11DRV_MONITOR_DATA *pX11Monitor =
(X11DRV_MONITOR_DATA *) pMonitor->pDriverData;
return pX11Monitor->screen;
}
/***********************************************************************
* X11DRV_MONITOR_GetXRootWindow
*
* Return the X screen associated to the MONITOR.
*/
Window X11DRV_MONITOR_GetXRootWindow(MONITOR *pMonitor)
{
X11DRV_MONITOR_DATA *pX11Monitor =
(X11DRV_MONITOR_DATA *) pMonitor->pDriverData;
return pX11Monitor->rootWindow;
}
/***********************************************************************
* X11DRV_MONITOR_CreateDesktop
* FIXME
* The desktop should create created in X11DRV_DESKTOP_Initialize
* instead but it can't be yet because some code depends on that
* the desktop always exists.
*
*/
static void X11DRV_MONITOR_CreateDesktop(MONITOR *pMonitor)
{
X11DRV_MONITOR_DATA *pX11Monitor =
(X11DRV_MONITOR_DATA *) pMonitor->pDriverData;
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 );
pX11Monitor->width = width;
pX11Monitor->height = 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 );
pX11Monitor->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 = Options.argv[0]; /* FIXME: Options.argv0 insteed? */
class_hints->res_class = "Wine";
TSXStringListToTextProperty( &name, 1, &window_name );
TSXSetWMProperties( display, pX11Monitor->rootWindow, &window_name, &window_name,
Options.argv, *Options.argc, size_hints, wm_hints, class_hints );
XA_WM_DELETE_WINDOW = TSXInternAtom( display, "WM_DELETE_WINDOW", False );
TSXSetWMProtocols( display, pX11Monitor->rootWindow, &XA_WM_DELETE_WINDOW, 1 );
TSXFree( size_hints );
TSXFree( wm_hints );
TSXFree( class_hints );
/* Map window */
TSXMapWindow( display, pX11Monitor->rootWindow );
}
/***********************************************************************
* X11DRV_MONITOR_Initialize
*/
void X11DRV_MONITOR_Initialize(MONITOR *pMonitor)
{
X11DRV_MONITOR_DATA *pX11Monitor = (X11DRV_MONITOR_DATA *)
HeapAlloc(SystemHeap, 0, sizeof(X11DRV_MONITOR_DATA));
int depth_count, i;
int *depth_list;
pMonitor->pDriverData = pX11Monitor;
pX11Monitor->screen = DefaultScreenOfDisplay( display );
pX11Monitor->width = WidthOfScreen( pX11Monitor->screen );
pX11Monitor->height = HeightOfScreen( pX11Monitor->screen );
pX11Monitor->depth = Options.screenDepth;
if (pX11Monitor->depth) /* -depth option specified */
{
depth_list = TSXListDepths(display, DefaultScreen(display), &depth_count);
for (i = 0; i < depth_count; i++)
if (depth_list[i] == pX11Monitor->depth) break;
TSXFree( depth_list );
if (i >= depth_count)
{
MSG( "%s: Depth %d not supported on this screen.\n",
Options.programName, pX11Monitor->depth );
exit(1);
}
}
else
pX11Monitor->depth = DefaultDepthOfScreen( pX11Monitor->screen );
if (Options.synchronous) TSXSynchronize( display, True );
if (Options.desktopGeometry)
X11DRV_MONITOR_CreateDesktop(pMonitor);
else
pX11Monitor->rootWindow =
DefaultRootWindow( display );
}
/***********************************************************************
* X11DRV_MONITOR_Finalize
*/
void X11DRV_MONITOR_Finalize(MONITOR *pMonitor)
{
HeapFree(SystemHeap, 0, pMonitor->pDriverData);
}
/***********************************************************************
* X11DRV_MONITOR_GetWidth
*
* Return the width of the monitor
*/
int X11DRV_MONITOR_GetWidth(MONITOR *pMonitor)
{
X11DRV_MONITOR_DATA *pX11Monitor =
(X11DRV_MONITOR_DATA *) pMonitor->pDriverData;
return pX11Monitor->width;
}
/***********************************************************************
* X11DRV_MONITOR_GetHeight
*
* Return the height of the monitor
*/
int X11DRV_MONITOR_GetHeight(MONITOR *pMonitor)
{
X11DRV_MONITOR_DATA *pX11Monitor =
(X11DRV_MONITOR_DATA *) pMonitor->pDriverData;
return pX11Monitor->height;
}
/***********************************************************************
* X11DRV_MONITOR_GetDepth
*
* Return the depth of the monitor
*/
int X11DRV_MONITOR_GetDepth(MONITOR *pMonitor)
{
X11DRV_MONITOR_DATA *pX11Monitor =
(X11DRV_MONITOR_DATA *) pMonitor->pDriverData;
return pX11Monitor->depth;
}
#endif /* X_DISPLAY_MISSING */

View File

@ -10,16 +10,18 @@
#include "ts_xlib.h"
#include "debug.h"
#include "callback.h"
#include "debug.h"
#include "display.h"
#include "win.h"
#include "wintypes.h"
#include "x11drv.h"
/**********************************************************************/
Cursor DISPLAY_XCursor = None; /* Current X cursor */
Cursor X11DRV_MOUSE_XCursor = None; /* Current X cursor */
BOOL32 DISPLAY_DisableWarpPointer = FALSE; /* hack; see DISPLAY_MoveCursor */
BOOL32 X11DRV_MOUSE_DisableWarpPointer = FALSE; /* hack; see DISPLAY_MoveCursor */
/***********************************************************************
* X11DRV_MOUSE_DoSetCursor
@ -35,7 +37,7 @@ static BOOL32 X11DRV_MOUSE_DoSetCursor( CURSORICONINFO *ptr )
static const char data[] = { 0 };
bg.red = bg.green = bg.blue = 0x0000;
pixmapBits = XCreateBitmapFromData( display, rootWindow, data, 1, 1 );
pixmapBits = XCreateBitmapFromData( display, X11DRV_GetXRootWindow(), data, 1, 1 );
if (pixmapBits)
{
cursor = XCreatePixmapCursor( display, pixmapBits, pixmapBits,
@ -60,9 +62,9 @@ static BOOL32 X11DRV_MOUSE_DoSetCursor( CURSORICONINFO *ptr )
* as the Windows cursor data). Perhaps use a more generic
* algorithm here.
*/
pixmapAll = XCreatePixmap( display, rootWindow,
pixmapAll = XCreatePixmap( display, X11DRV_GetXRootWindow(),
ptr->nWidth, ptr->nHeight * 2, 1 );
image = XCreateImage( display, DefaultVisualOfScreen(screen),
image = XCreateImage( display, DefaultVisualOfScreen(X11DRV_GetXScreen()),
1, ZPixmap, 0, (char *)(ptr + 1), ptr->nWidth,
ptr->nHeight * 2, 16, ptr->nWidthBytes);
if (image)
@ -80,9 +82,9 @@ static BOOL32 X11DRV_MOUSE_DoSetCursor( CURSORICONINFO *ptr )
/* Now create the 2 pixmaps for bits and mask */
pixmapBits = XCreatePixmap( display, rootWindow,
pixmapBits = XCreatePixmap( display, X11DRV_GetXRootWindow(),
ptr->nWidth, ptr->nHeight, 1 );
pixmapMask = XCreatePixmap( display, rootWindow,
pixmapMask = XCreatePixmap( display, X11DRV_GetXRootWindow(),
ptr->nWidth, ptr->nHeight, 1 );
/* Make sure everything went OK so far */
@ -136,13 +138,13 @@ static BOOL32 X11DRV_MOUSE_DoSetCursor( CURSORICONINFO *ptr )
}
if (cursor == None) return FALSE;
if (DISPLAY_XCursor != None) XFreeCursor( display, DISPLAY_XCursor );
DISPLAY_XCursor = cursor;
if (X11DRV_MOUSE_XCursor != None) XFreeCursor( display, X11DRV_MOUSE_XCursor );
X11DRV_MOUSE_XCursor = cursor;
if (rootWindow != DefaultRootWindow(display) || !WIN_GetDesktop())
if (X11DRV_GetXRootWindow() != DefaultRootWindow(display) || !WIN_GetDesktop())
{
/* Set the cursor on the desktop window */
XDefineCursor( display, rootWindow, cursor );
XDefineCursor( display, X11DRV_GetXRootWindow(), cursor );
}
else
{
@ -198,9 +200,9 @@ void X11DRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY)
int rootX, rootY, winX, winY;
unsigned int xstate;
if (DISPLAY_DisableWarpPointer) return;
if (X11DRV_MOUSE_DisableWarpPointer) return;
if (!TSXQueryPointer( display, rootWindow, &root, &child,
if (!TSXQueryPointer( display, X11DRV_GetXRootWindow(), &root, &child,
&rootX, &rootY, &winX, &winY, &xstate ))
return;
@ -209,7 +211,8 @@ void X11DRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY)
TRACE( cursor, "(%d,%d): moving from (%d,%d)\n", wAbsX, wAbsY, winX, winY );
TSXWarpPointer( display, rootWindow, rootWindow, 0, 0, 0, 0, wAbsX, wAbsY );
TSXWarpPointer( display, X11DRV_GetXRootWindow(), X11DRV_GetXRootWindow(),
0, 0, 0, 0, wAbsX, wAbsY );
}
#endif /* !defined(X_DISPLAY_MISSING) */

View File

@ -25,11 +25,12 @@
#include "heap.h"
#include "win.h"
#include "wintypes.h"
#include "class.h"
#include "x11drv.h"
/**********************************************************************/
extern Cursor DISPLAY_XCursor; /* Current X cursor */
extern Cursor X11DRV_MOUSE_XCursor; /* Current X cursor */
/**********************************************************************/
@ -66,17 +67,39 @@ Window X11DRV_WND_FindXWindow(WND *wndPtr)
((X11DRV_WND_DATA *) wndPtr->pDriverData)->window : 0;
}
/***********************************************************************
* X11DRV_WND_GetXScreen
*
* Return the X screen associated to the window.
*/
Screen *X11DRV_WND_GetXScreen(WND *wndPtr)
{
while(wndPtr->parent) wndPtr = wndPtr->parent;
return X11DRV_DESKTOP_GetXScreen((struct tagDESKTOP *) wndPtr->wExtra);
}
/***********************************************************************
* X11DRV_WND_GetXRootWindow
*
* Return the X display associated to the window.
*/
Window X11DRV_WND_GetXRootWindow(WND *wndPtr)
{
while(wndPtr->parent) wndPtr = wndPtr->parent;
return X11DRV_DESKTOP_GetXRootWindow((struct tagDESKTOP *) wndPtr->wExtra);
}
/***********************************************************************
* X11DRV_WND_RegisterWindow
*
* Associate an X window to a HWND.
*/
static void X11DRV_WND_RegisterWindow(WND *pWnd)
static void X11DRV_WND_RegisterWindow(WND *wndPtr)
{
TSXSetWMProtocols( display, X11DRV_WND_GetXWindow(pWnd), &wmDeleteWindow, 1 );
TSXSetWMProtocols( display, X11DRV_WND_GetXWindow(wndPtr), &wmDeleteWindow, 1 );
if (!winContext) winContext = TSXUniqueContext();
TSXSaveContext( display, X11DRV_WND_GetXWindow(pWnd), winContext, (char *)pWnd );
TSXSaveContext( display, X11DRV_WND_GetXWindow(wndPtr), winContext, (char *) wndPtr );
}
/**********************************************************************
@ -130,7 +153,8 @@ BOOL32 X11DRV_WND_CreateDesktopWindow(WND *wndPtr, CLASS *classPtr, BOOL32 bUnic
if( dndSelection == None )
dndSelection = TSXInternAtom( display, "DndSelection" , False );
((X11DRV_WND_DATA *) wndPtr->pDriverData)->window = rootWindow;
((X11DRV_WND_DATA *) wndPtr->pDriverData)->window =
X11DRV_WND_GetXRootWindow( wndPtr );
X11DRV_WND_RegisterWindow( wndPtr );
return TRUE;
@ -144,7 +168,8 @@ BOOL32 X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCT32A *cs
/* Create the X window (only for top-level windows, and then only */
/* when there's no desktop window) */
if (!(cs->style & WS_CHILD) && (rootWindow == DefaultRootWindow(display)))
if (!(cs->style & WS_CHILD) &&
(X11DRV_WND_GetXRootWindow(wndPtr) == DefaultRootWindow(display)))
{
XSetWindowAttributes win_attr;
@ -166,13 +191,15 @@ BOOL32 X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCT32A *cs
FocusChangeMask;
win_attr.override_redirect = TRUE;
}
win_attr.colormap = COLOR_GetColormap();
win_attr.colormap = X11DRV_COLOR_GetColormap();
win_attr.backing_store = Options.backingstore ? WhenMapped : NotUseful;
win_attr.save_under = ((classPtr->style & CS_SAVEBITS) != 0);
win_attr.cursor = DISPLAY_XCursor;
win_attr.cursor = X11DRV_MOUSE_XCursor;
((X11DRV_WND_DATA *) wndPtr->pDriverData)->window =
TSXCreateWindow( display, rootWindow, cs->x, cs->y,
cs->cx, cs->cy, 0, CopyFromParent,
TSXCreateWindow( display,
X11DRV_WND_GetXRootWindow(wndPtr),
cs->x, cs->y, cs->cx, cs->cy,
0, CopyFromParent,
InputOutput, CopyFromParent,
CWEventMask | CWOverrideRedirect |
CWColormap | CWCursor | CWSaveUnder |
@ -218,15 +245,15 @@ BOOL32 X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCT32A *cs
/***********************************************************************
* X11DRV_WND_DestroyWindow
*/
BOOL32 X11DRV_WND_DestroyWindow(WND *pWnd)
BOOL32 X11DRV_WND_DestroyWindow(WND *wndPtr)
{
if (X11DRV_WND_GetXWindow(pWnd))
if (X11DRV_WND_GetXWindow(wndPtr))
{
XEvent xe;
TSXDeleteContext( display, X11DRV_WND_GetXWindow(pWnd), winContext );
TSXDestroyWindow( display, X11DRV_WND_GetXWindow(pWnd) );
while( TSXCheckWindowEvent(display, X11DRV_WND_GetXWindow(pWnd), NoEventMask, &xe) );
((X11DRV_WND_DATA *) pWnd->pDriverData)->window = None;
TSXDeleteContext( display, X11DRV_WND_GetXWindow(wndPtr), winContext );
TSXDestroyWindow( display, X11DRV_WND_GetXWindow(wndPtr) );
while( TSXCheckWindowEvent(display, X11DRV_WND_GetXWindow(wndPtr), NoEventMask, &xe) );
((X11DRV_WND_DATA *) wndPtr->pDriverData)->window = None;
}
return TRUE;
@ -265,7 +292,7 @@ WND *X11DRV_WND_SetParent(WND *wndPtr, WND *pWndParent)
{
wndPtr->dwStyle &= ~WS_CHILD;
wndPtr->wIDmenu = 0;
if( rootWindow == DefaultRootWindow(display) )
if( X11DRV_WND_GetXRootWindow(wndPtr) == DefaultRootWindow(display) )
{
CREATESTRUCT32A cs;
cs.lpCreateParams = NULL;
@ -315,28 +342,28 @@ WND *X11DRV_WND_SetParent(WND *wndPtr, WND *pWndParent)
* Raise a window on top of the X stacking order, while preserving
* the correct Windows Z order.
*/
void X11DRV_WND_ForceWindowRaise(WND *pWnd)
void X11DRV_WND_ForceWindowRaise(WND *wndPtr)
{
XWindowChanges winChanges;
WND *wndPrev;
if( !pWnd || !X11DRV_WND_GetXWindow(pWnd) || (pWnd->flags & WIN_MANAGED) )
if( !wndPtr || !X11DRV_WND_GetXWindow(wndPtr) || (wndPtr->flags & WIN_MANAGED) )
return;
/* Raise all windows up to pWnd according to their Z order.
/* Raise all windows up to wndPtr according to their Z order.
* (it would be easier with sibling-related Below but it doesn't
* work very well with SGI mwm for instance)
*/
winChanges.stack_mode = Above;
while (pWnd)
while (wndPtr)
{
if (X11DRV_WND_GetXWindow(pWnd))
TSXReconfigureWMWindow( display, X11DRV_WND_GetXWindow(pWnd), 0,
if (X11DRV_WND_GetXWindow(wndPtr))
TSXReconfigureWMWindow( display, X11DRV_WND_GetXWindow(wndPtr), 0,
CWStackMode, &winChanges );
wndPrev = WIN_GetDesktop()->child;
if (wndPrev == pWnd) break;
while (wndPrev && (wndPrev->next != pWnd)) wndPrev = wndPrev->next;
pWnd = wndPrev;
if (wndPrev == wndPtr) break;
while (wndPrev && (wndPrev->next != wndPtr)) wndPrev = wndPrev->next;
wndPtr = wndPrev;
}
}
@ -377,6 +404,8 @@ void X11DRV_WND_SetWindowPos(WND *wndPtr, const WINDOWPOS32 *winpos, BOOL32 bSMC
XWindowChanges winChanges;
int changeMask = 0;
WND *winposPtr = WIN_FindWndPtr( winpos->hwnd );
if(!wndPtr->hwndSelf) wndPtr = NULL; /* FIXME: WND destroyed, shouldn't happend!!! */
if (!(winpos->flags & SWP_SHOWWINDOW) && (winpos->flags & SWP_HIDEWINDOW))
{
@ -477,12 +506,13 @@ void X11DRV_WND_SetFocus(WND *wndPtr)
/* Only mess with the X focus if there's */
/* no desktop window and no window manager. */
if ((rootWindow != DefaultRootWindow(display)) || Options.managed) return;
if ((X11DRV_WND_GetXRootWindow(wndPtr) != DefaultRootWindow(display))
|| Options.managed) return;
if (!hwnd) /* If setting the focus to 0, uninstall the colormap */
{
if (COLOR_GetSystemPaletteFlags() & COLOR_PRIVATE)
TSXUninstallColormap( display, COLOR_GetColormap() );
TSXUninstallColormap( display, X11DRV_COLOR_GetColormap() );
return;
}
@ -495,7 +525,7 @@ void X11DRV_WND_SetFocus(WND *wndPtr)
TSXSetInputFocus( display, win, RevertToParent, CurrentTime );
if (COLOR_GetSystemPaletteFlags() & COLOR_PRIVATE)
TSXInstallColormap( display, COLOR_GetColormap() );
TSXInstallColormap( display, X11DRV_COLOR_GetColormap() );
EVENT_Synchronize();
}
@ -505,7 +535,8 @@ void X11DRV_WND_SetFocus(WND *wndPtr)
*/
void X11DRV_WND_PreSizeMove(WND *wndPtr)
{
if (!(wndPtr->dwStyle & WS_CHILD) && (rootWindow == DefaultRootWindow(display)))
if (!(wndPtr->dwStyle & WS_CHILD) &&
(X11DRV_WND_GetXRootWindow(wndPtr) == DefaultRootWindow(display)))
TSXGrabServer( display );
}
@ -514,7 +545,8 @@ void X11DRV_WND_PreSizeMove(WND *wndPtr)
*/
void X11DRV_WND_PostSizeMove(WND *wndPtr)
{
if (!(wndPtr->dwStyle & WS_CHILD) && (rootWindow == DefaultRootWindow(display)))
if (!(wndPtr->dwStyle & WS_CHILD) &&
(X11DRV_GetXRootWindow(wndPtr) == DefaultRootWindow(display)))
TSXUngrabServer( display );
}
@ -566,7 +598,7 @@ void X11DRV_WND_SetDrawable(WND *wndPtr, DC *dc, WORD flags, BOOL32 bSetClipOrig
{
dc->w.DCOrgX = 0;
dc->w.DCOrgY = 0;
physDev->drawable = rootWindow;
physDev->drawable = X11DRV_WND_GetXRootWindow(wndPtr);
TSXSetSubwindowMode( display, physDev->gc, IncludeInferiors );
}
else