A few simplifications and optimizations in the x11 driver.
This commit is contained in:
parent
77d5ebbb37
commit
9383eb94a7
|
@ -1017,8 +1017,8 @@ static HRESULT WINAPI Xlib_IDirectDrawSurface4Impl_SetPalette(
|
|||
|
||||
if( !(ipal->cm) && (This->s.ddraw->d.screen_pixelformat.u.dwRGBBitCount<=8))
|
||||
{
|
||||
ipal->cm = TSXCreateColormap(display,This->s.ddraw->d.drawable,
|
||||
DefaultVisualOfScreen(X11DRV_GetXScreen()),AllocAll);
|
||||
ipal->cm = TSXCreateColormap(display,This->s.ddraw->d.drawable,
|
||||
X11DRV_GetVisual(),AllocAll);
|
||||
|
||||
if (!Options.managed)
|
||||
TSXInstallColormap(display,ipal->cm);
|
||||
|
@ -3228,8 +3228,7 @@ static XImage *create_xshmimage(IDirectDraw2Impl* This, IDirectDrawSurface4Impl*
|
|||
XImage *img;
|
||||
int (*WineXHandler)(Display *, XErrorEvent *);
|
||||
|
||||
img = TSXShmCreateImage(display,
|
||||
DefaultVisualOfScreen(X11DRV_GetXScreen()),
|
||||
img = TSXShmCreateImage(display, X11DRV_GetVisual(),
|
||||
This->d.pixmap_depth,
|
||||
ZPixmap,
|
||||
NULL,
|
||||
|
@ -3348,8 +3347,7 @@ static XImage *create_ximage(IDirectDraw2Impl* This, IDirectDrawSurface4Impl* lp
|
|||
}
|
||||
|
||||
/* In this case, create an XImage */
|
||||
img = TSXCreateImage(display,
|
||||
DefaultVisualOfScreen(X11DRV_GetXScreen()),
|
||||
img = TSXCreateImage(display, X11DRV_GetVisual(),
|
||||
This->d.pixmap_depth,
|
||||
ZPixmap,
|
||||
0,
|
||||
|
@ -4268,7 +4266,7 @@ static HRESULT WINAPI DGA_IDirectDraw2Impl_CreatePalette(
|
|||
if (res != 0) return res;
|
||||
ICOM_VTBL(*ilpddpal) = &dga_ddpalvt;
|
||||
if (This->d.directdraw_pixelformat.u.dwRGBBitCount<=8) {
|
||||
(*ilpddpal)->cm = TSXCreateColormap(display,DefaultRootWindow(display),DefaultVisualOfScreen(X11DRV_GetXScreen()),AllocAll);
|
||||
(*ilpddpal)->cm = TSXCreateColormap(display,DefaultRootWindow(display),X11DRV_GetVisual(),AllocAll);
|
||||
} else {
|
||||
FIXME("why are we doing CreatePalette in hi/truecolor?\n");
|
||||
(*ilpddpal)->cm = 0;
|
||||
|
@ -5377,7 +5375,6 @@ static HRESULT WINAPI DGA_DirectDrawCreate( LPDIRECTDRAW *lplpDD, LPUNKNOWN pUnk
|
|||
IDirectDrawImpl** ilplpDD=(IDirectDrawImpl**)lplpDD;
|
||||
int memsize,banksize,major,minor,flags;
|
||||
char *addr;
|
||||
int depth;
|
||||
int dga_version;
|
||||
int width, height;
|
||||
|
||||
|
@ -5423,8 +5420,8 @@ static HRESULT WINAPI DGA_DirectDrawCreate( LPDIRECTDRAW *lplpDD, LPUNKNOWN pUnk
|
|||
(*ilplpDD)->e.dga.vpmask = 0;
|
||||
|
||||
/* just assume the default depth is the DGA depth too */
|
||||
depth = DefaultDepthOfScreen(X11DRV_GetXScreen());
|
||||
_common_depth_to_pixelformat(depth, &((*ilplpDD)->d.directdraw_pixelformat), &((*ilplpDD)->d.screen_pixelformat), NULL);
|
||||
_common_depth_to_pixelformat(X11DRV_GetDepth(), &((*ilplpDD)->d.directdraw_pixelformat),
|
||||
&((*ilplpDD)->d.screen_pixelformat), NULL);
|
||||
#ifdef RESTORE_SIGNALS
|
||||
SIGNAL_Init();
|
||||
#endif
|
||||
|
@ -5510,7 +5507,6 @@ DDRAW_XSHM_Available(void)
|
|||
|
||||
static HRESULT WINAPI Xlib_DirectDrawCreate( LPDIRECTDRAW *lplpDD, LPUNKNOWN pUnkOuter) {
|
||||
IDirectDrawImpl** ilplpDD=(IDirectDrawImpl**)lplpDD;
|
||||
int depth;
|
||||
|
||||
*ilplpDD = (IDirectDrawImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirectDrawImpl));
|
||||
ICOM_VTBL(*ilplpDD) = &xlib_ddvt;
|
||||
|
@ -5518,8 +5514,7 @@ static HRESULT WINAPI Xlib_DirectDrawCreate( LPDIRECTDRAW *lplpDD, LPUNKNOWN pUn
|
|||
(*ilplpDD)->d.drawable = 0; /* in SetDisplayMode */
|
||||
|
||||
/* At DirectDraw creation, the depth is the default depth */
|
||||
depth = DefaultDepthOfScreen(X11DRV_GetXScreen());
|
||||
_common_depth_to_pixelformat(depth,
|
||||
_common_depth_to_pixelformat(X11DRV_GetDepth(),
|
||||
&((*ilplpDD)->d.directdraw_pixelformat),
|
||||
&((*ilplpDD)->d.screen_pixelformat),
|
||||
&((*ilplpDD)->d.pixmap_depth));
|
||||
|
|
|
@ -50,6 +50,10 @@ static USER_DRIVER user_driver =
|
|||
static XKeyboardState keyboard_state;
|
||||
|
||||
Display *display;
|
||||
Screen *screen;
|
||||
Visual *visual;
|
||||
int screen_depth;
|
||||
Window root_window;
|
||||
|
||||
/***********************************************************************
|
||||
* error_handler
|
||||
|
@ -85,7 +89,28 @@ static void process_attach(void)
|
|||
argv0, Options.display ? Options.display : "(none specified)" );
|
||||
ExitProcess(1);
|
||||
}
|
||||
|
||||
screen = DefaultScreenOfDisplay( display );
|
||||
visual = DefaultVisual( display, DefaultScreen(display) );
|
||||
root_window = DefaultRootWindow( display );
|
||||
|
||||
/* Initialize screen depth */
|
||||
|
||||
screen_depth = PROFILE_GetWineIniInt( "x11drv", "ScreenDepth", 0 );
|
||||
if (screen_depth) /* depth specified */
|
||||
{
|
||||
int depth_count, i;
|
||||
int *depth_list = TSXListDepths(display, DefaultScreen(display), &depth_count);
|
||||
for (i = 0; i < depth_count; i++)
|
||||
if (depth_list[i] == screen_depth) break;
|
||||
TSXFree( depth_list );
|
||||
if (i >= depth_count)
|
||||
{
|
||||
MESSAGE( "%s: Depth %d not supported on this screen.\n", argv0, screen_depth );
|
||||
ExitProcess(1);
|
||||
}
|
||||
}
|
||||
else screen_depth = DefaultDepthOfScreen( screen );
|
||||
|
||||
/* 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
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "dc.h"
|
||||
#include "bitmap.h"
|
||||
#include "heap.h"
|
||||
#include "monitor.h"
|
||||
#include "debugtools.h"
|
||||
#include "xmalloc.h"
|
||||
#include "local.h"
|
||||
|
@ -28,7 +27,7 @@
|
|||
#include "windef.h"
|
||||
#include "wine/winuser16.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(x11drv)
|
||||
DEFAULT_DEBUG_CHANNEL(x11drv);
|
||||
|
||||
/* GCs used for B&W and color bitmap operations */
|
||||
GC BITMAP_monoGC = 0, BITMAP_colorGC = 0;
|
||||
|
@ -53,12 +52,10 @@ BOOL X11DRV_BITMAP_Init(void)
|
|||
TSXFreePixmap( display, tmpPixmap );
|
||||
}
|
||||
|
||||
if (MONITOR_GetDepth(&MONITOR_PrimaryMonitor) != 1)
|
||||
if (X11DRV_GetDepth() != 1)
|
||||
{
|
||||
if ((tmpPixmap = TSXCreatePixmap(display,
|
||||
X11DRV_GetXRootWindow(),
|
||||
1, 1,
|
||||
MONITOR_GetDepth(&MONITOR_PrimaryMonitor))))
|
||||
if ((tmpPixmap = TSXCreatePixmap(display, X11DRV_GetXRootWindow(),
|
||||
1, 1, X11DRV_GetDepth())))
|
||||
{
|
||||
BITMAP_colorGC = TSXCreateGC( display, tmpPixmap, 0, NULL );
|
||||
TSXSetGraphicsExposures( display, BITMAP_colorGC, False );
|
||||
|
@ -200,7 +197,8 @@ BOOL X11DRV_CreateBitmap( HBITMAP hbitmap )
|
|||
/* Check parameters */
|
||||
if (bmp->bitmap.bmPlanes != 1) return 0;
|
||||
if ((bmp->bitmap.bmBitsPixel != 1) &&
|
||||
(bmp->bitmap.bmBitsPixel != MONITOR_GetDepth(&MONITOR_PrimaryMonitor))) {
|
||||
(bmp->bitmap.bmBitsPixel != X11DRV_GetDepth()))
|
||||
{
|
||||
ERR("Trying to make bitmap with planes=%d, bpp=%d\n",
|
||||
bmp->bitmap.bmPlanes, bmp->bitmap.bmBitsPixel);
|
||||
GDI_HEAP_UNLOCK( hbitmap );
|
||||
|
@ -395,8 +393,7 @@ static LONG X11DRV_SetBitmapBits(BITMAPOBJ *bmp, void *bits, LONG count)
|
|||
height = count / bmp->bitmap.bmWidthBytes;
|
||||
|
||||
EnterCriticalSection( &X11DRV_CritSection );
|
||||
image = XCreateImage( display, DefaultVisualOfScreen(X11DRV_GetXScreen()),
|
||||
bmp->bitmap.bmBitsPixel, ZPixmap, 0, NULL,
|
||||
image = XCreateImage( display, X11DRV_GetVisual(), bmp->bitmap.bmBitsPixel, ZPixmap, 0, NULL,
|
||||
bmp->bitmap.bmWidth, height, 32, 0 );
|
||||
image->data = (LPBYTE)xmalloc(image->bytes_per_line * height);
|
||||
|
||||
|
|
|
@ -16,10 +16,9 @@
|
|||
#include "color.h"
|
||||
#include "x11drv.h"
|
||||
#include "debugtools.h"
|
||||
#include "monitor.h"
|
||||
#include "local.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(gdi)
|
||||
DEFAULT_DEBUG_CHANNEL(gdi);
|
||||
|
||||
static const char HatchBrushes[NB_HATCH_STYLES + 1][8] =
|
||||
{
|
||||
|
@ -102,7 +101,7 @@ static XImage *ditherImage = NULL;
|
|||
*/
|
||||
BOOL X11DRV_BRUSH_Init(void)
|
||||
{
|
||||
XCREATEIMAGE( ditherImage, MATRIX_SIZE, MATRIX_SIZE, MONITOR_GetDepth(&MONITOR_PrimaryMonitor) );
|
||||
XCREATEIMAGE( ditherImage, MATRIX_SIZE, MATRIX_SIZE, X11DRV_GetDepth() );
|
||||
return (ditherImage != NULL);
|
||||
}
|
||||
|
||||
|
@ -139,7 +138,7 @@ static Pixmap BRUSH_DitherColor( DC *dc, COLORREF color )
|
|||
}
|
||||
|
||||
pixmap = XCreatePixmap( display, X11DRV_GetXRootWindow(),
|
||||
MATRIX_SIZE, MATRIX_SIZE, MONITOR_GetDepth(&MONITOR_PrimaryMonitor) );
|
||||
MATRIX_SIZE, MATRIX_SIZE, X11DRV_GetDepth() );
|
||||
XPutImage( display, pixmap, BITMAP_colorGC, ditherImage, 0, 0,
|
||||
0, 0, MATRIX_SIZE, MATRIX_SIZE );
|
||||
LeaveCriticalSection( &X11DRV_CritSection );
|
||||
|
@ -154,7 +153,7 @@ static void BRUSH_SelectSolidBrush( DC *dc, COLORREF color )
|
|||
{
|
||||
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
|
||||
|
||||
if ((dc->w.bitsPerPixel > 1) && (MONITOR_GetDepth(&MONITOR_PrimaryMonitor) <= 8) && !COLOR_IsSolid( color ))
|
||||
if ((dc->w.bitsPerPixel > 1) && (X11DRV_GetDepth() <= 8) && !COLOR_IsSolid( color ))
|
||||
{
|
||||
/* Dithered brush */
|
||||
physDev->brush.pixmap = BRUSH_DitherColor( dc, color );
|
||||
|
|
|
@ -50,7 +50,7 @@ BOOL X11DRV_DIB_Init(void)
|
|||
|
||||
for( i = 0; bitmapDepthTable[i]; i++ )
|
||||
{
|
||||
testimage = TSXCreateImage(display, DefaultVisualOfScreen(X11DRV_GetXScreen()),
|
||||
testimage = TSXCreateImage(display, X11DRV_GetVisual(),
|
||||
bitmapDepthTable[i], ZPixmap, 0, NULL, 1, 1, 32, 20 );
|
||||
if( testimage ) ximageDepthTable[i] = testimage->bits_per_pixel;
|
||||
else return FALSE;
|
||||
|
@ -2506,9 +2506,7 @@ int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
|
|||
if (descr->image)
|
||||
bmpImage = descr->image;
|
||||
else {
|
||||
bmpImage = XCreateImage( display,
|
||||
DefaultVisualOfScreen(X11DRV_GetXScreen()),
|
||||
descr->depth, ZPixmap, 0, NULL,
|
||||
bmpImage = XCreateImage( display, X11DRV_GetVisual(), descr->depth, ZPixmap, 0, NULL,
|
||||
descr->infoWidth, lines, 32, 0 );
|
||||
bmpImage->data = calloc( lines, bmpImage->bytes_per_line );
|
||||
if(bmpImage->data == NULL) {
|
||||
|
@ -2611,9 +2609,7 @@ int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
|
|||
if (descr->image)
|
||||
bmpImage = descr->image;
|
||||
else {
|
||||
bmpImage = XCreateImage( display,
|
||||
DefaultVisualOfScreen(X11DRV_GetXScreen()),
|
||||
descr->depth, ZPixmap, 0, NULL,
|
||||
bmpImage = XCreateImage( display, X11DRV_GetVisual(), descr->depth, ZPixmap, 0, NULL,
|
||||
descr->infoWidth, lines, 32, 0 );
|
||||
bmpImage->data = calloc( lines, bmpImage->bytes_per_line );
|
||||
if(bmpImage->data == NULL) {
|
||||
|
@ -3232,8 +3228,7 @@ extern BOOL X11DRV_XShmCreateImage(XImage** image, int width, int height, int bp
|
|||
{
|
||||
int (*WineXHandler)(Display *, XErrorEvent *);
|
||||
|
||||
*image = TSXShmCreateImage(display, DefaultVisualOfScreen(X11DRV_GetXScreen()),
|
||||
bpp, ZPixmap, NULL, shminfo, width, height);
|
||||
*image = TSXShmCreateImage(display, X11DRV_GetVisual(), bpp, ZPixmap, NULL, shminfo, width, height);
|
||||
if( *image != NULL )
|
||||
{
|
||||
EnterCriticalSection( &X11DRV_CritSection );
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "bitmap.h"
|
||||
#include "gdi.h"
|
||||
#include "dc.h"
|
||||
#include "monitor.h"
|
||||
#include "callback.h"
|
||||
#include "metafile.h"
|
||||
#include "palette.h"
|
||||
|
@ -41,7 +40,7 @@
|
|||
#include "struct32.h"
|
||||
#include "debugtools.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(graphics)
|
||||
DEFAULT_DEBUG_CHANNEL(graphics);
|
||||
|
||||
#define ABS(x) ((x)<0?(-(x)):(x))
|
||||
|
||||
|
@ -131,10 +130,8 @@ BOOL X11DRV_SetupGCForPatBlt( DC * dc, GC gc, BOOL fMapColors )
|
|||
register int x, y;
|
||||
XImage *image;
|
||||
EnterCriticalSection( &X11DRV_CritSection );
|
||||
pixmap = XCreatePixmap( display,
|
||||
X11DRV_GetXRootWindow(),
|
||||
8, 8,
|
||||
MONITOR_GetDepth(&MONITOR_PrimaryMonitor) );
|
||||
pixmap = XCreatePixmap( display, X11DRV_GetXRootWindow(),
|
||||
8, 8, X11DRV_GetDepth() );
|
||||
image = XGetImage( display, physDev->brush.pixmap, 0, 0, 8, 8,
|
||||
AllPlanes, ZPixmap );
|
||||
for (y = 0; y < 8; y++)
|
||||
|
|
|
@ -191,7 +191,7 @@ BOOL X11DRV_GDI_Initialize(void)
|
|||
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);
|
||||
X11DRV_DevCaps.bitsPixel = X11DRV_GetDepth();
|
||||
|
||||
/* Resolution will be adjusted during the font init */
|
||||
|
||||
|
@ -260,7 +260,7 @@ static BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
|
|||
{
|
||||
physDev->drawable = X11DRV_GetXRootWindow();
|
||||
physDev->gc = TSXCreateGC( display, physDev->drawable, 0, NULL );
|
||||
dc->w.bitsPerPixel = MONITOR_GetDepth(&MONITOR_PrimaryMonitor);
|
||||
dc->w.bitsPerPixel = X11DRV_GetDepth();
|
||||
|
||||
dc->w.totalExtent.left = 0;
|
||||
dc->w.totalExtent.top = 0;
|
||||
|
|
|
@ -29,7 +29,6 @@ typedef unsigned long Pixel;
|
|||
#include "gdi.h"
|
||||
#include "heap.h"
|
||||
#include "local.h"
|
||||
#include "monitor.h"
|
||||
#include "tweak.h"
|
||||
#include "x11drv.h"
|
||||
|
||||
|
@ -392,7 +391,7 @@ static BOOL OBM_CreateBitmaps( OBM_BITMAP_DESCR *descr )
|
|||
XpmAttributesSize() );
|
||||
attrs->valuemask = XpmColormap | XpmDepth | XpmColorSymbols |XpmHotspot;
|
||||
attrs->colormap = X11DRV_PALETTE_PaletteXColormap;
|
||||
attrs->depth = descr->color ? MONITOR_GetDepth(&MONITOR_PrimaryMonitor) : 1;
|
||||
attrs->depth = descr->color ? X11DRV_GetDepth() : 1;
|
||||
attrs->colorsymbols = (attrs->depth > 1) ? OBM_Colors : OBM_BlackAndWhite;
|
||||
attrs->numsymbols = (attrs->depth > 1) ? NB_COLOR_SYMBOLS : 2;
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "color.h"
|
||||
#include "debugtools.h"
|
||||
#include "gdi.h"
|
||||
#include "monitor.h"
|
||||
#include "options.h"
|
||||
#include "palette.h"
|
||||
#include "windef.h"
|
||||
|
@ -102,7 +101,7 @@ BOOL X11DRV_PALETTE_Init(void)
|
|||
int mask, white, black;
|
||||
int monoPlane;
|
||||
|
||||
Visual *visual = DefaultVisual( display, DefaultScreen(display) );
|
||||
Visual *visual = X11DRV_GetVisual();
|
||||
|
||||
TRACE("initializing palette manager...\n");
|
||||
|
||||
|
@ -149,7 +148,7 @@ BOOL X11DRV_PALETTE_Init(void)
|
|||
case StaticGray:
|
||||
X11DRV_PALETTE_PaletteXColormap = DefaultColormapOfScreen( X11DRV_GetXScreen() );
|
||||
X11DRV_PALETTE_PaletteFlags |= X11DRV_PALETTE_FIXED;
|
||||
X11DRV_PALETTE_Graymax = (1<<MONITOR_GetDepth(&MONITOR_PrimaryMonitor))-1;
|
||||
X11DRV_PALETTE_Graymax = (1 << X11DRV_GetDepth())-1;
|
||||
break;
|
||||
|
||||
case TrueColor:
|
||||
|
@ -343,7 +342,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void)
|
|||
bp = BlackPixel(display, DefaultScreen(display));
|
||||
wp = WhitePixel(display, DefaultScreen(display));
|
||||
|
||||
max = (0xffffffff)>>(32 - MONITOR_GetDepth(&MONITOR_PrimaryMonitor));
|
||||
max = (0xffffffff)>>(32 - X11DRV_GetDepth());
|
||||
if( max > 256 )
|
||||
{
|
||||
step = max/256;
|
||||
|
@ -444,7 +443,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void)
|
|||
* to maintain compatibility
|
||||
*/
|
||||
X11DRV_DevCaps.sizePalette = 256;
|
||||
TRACE("Virtual colorspace - screendepth %i\n", MONITOR_GetDepth(&MONITOR_PrimaryMonitor));
|
||||
TRACE("Virtual colorspace - screendepth %i\n", X11DRV_GetDepth());
|
||||
}
|
||||
else X11DRV_DevCaps.sizePalette = NB_RESERVED_COLORS; /* system palette only - however we can alloc a bunch
|
||||
* of colors and map to them */
|
||||
|
@ -471,7 +470,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void)
|
|||
|
||||
/* setup system palette entry <-> pixel mappings and fill in 20 fixed entries */
|
||||
|
||||
if( MONITOR_GetDepth(&MONITOR_PrimaryMonitor) <= 8 )
|
||||
if (X11DRV_GetDepth() <= 8)
|
||||
{
|
||||
X11DRV_PALETTE_XPixelToPalette = (int*)calloc(256, sizeof(int));
|
||||
if(X11DRV_PALETTE_XPixelToPalette == NULL) {
|
||||
|
@ -632,7 +631,7 @@ COLORREF X11DRV_PALETTE_ToLogical(int pixel)
|
|||
#if 0
|
||||
/* truecolor visual */
|
||||
|
||||
if (MONITOR_GetDepth(&MONITOR_PrimaryMonitor) >= 24) return pixel;
|
||||
if (X11DRV_GetDepth() >= 24) return pixel;
|
||||
#endif
|
||||
|
||||
/* check for hicolor visuals first */
|
||||
|
@ -649,7 +648,7 @@ COLORREF X11DRV_PALETTE_ToLogical(int pixel)
|
|||
|
||||
/* check if we can bypass X */
|
||||
|
||||
if ((MONITOR_GetDepth(&MONITOR_PrimaryMonitor) <= 8) && (pixel < 256) &&
|
||||
if ((X11DRV_GetDepth() <= 8) && (pixel < 256) &&
|
||||
!(X11DRV_PALETTE_PaletteFlags & (X11DRV_PALETTE_VIRTUAL | X11DRV_PALETTE_FIXED)) )
|
||||
return ( *(COLORREF*)(COLOR_sysPal +
|
||||
((X11DRV_PALETTE_XPixelToPalette)?X11DRV_PALETTE_XPixelToPalette[pixel]:pixel)) ) & 0x00ffffff;
|
||||
|
|
|
@ -191,7 +191,7 @@ extern void _XInitImageFuncPtrs(XImage *);
|
|||
#define XCREATEIMAGE(image,width,height,bpp) \
|
||||
{ \
|
||||
int width_bytes = X11DRV_DIB_GetXImageWidthBytes( (width), (bpp) ); \
|
||||
(image) = TSXCreateImage(display, DefaultVisualOfScreen(X11DRV_GetXScreen()), \
|
||||
(image) = TSXCreateImage(display, X11DRV_GetVisual(), \
|
||||
(bpp), ZPixmap, 0, calloc( (height), width_bytes ),\
|
||||
(width), (height), 32, width_bytes ); \
|
||||
}
|
||||
|
@ -311,8 +311,15 @@ extern BOOL X11DRV_PALETTE_IsDark(int pixel);
|
|||
*/
|
||||
|
||||
extern Display *display;
|
||||
extern Screen *X11DRV_GetXScreen(void);
|
||||
extern Window X11DRV_GetXRootWindow(void);
|
||||
extern Screen *screen;
|
||||
extern Visual *visual;
|
||||
extern Window root_window;
|
||||
extern int screen_depth;
|
||||
|
||||
static inline Screen *X11DRV_GetXScreen(void) { return screen; }
|
||||
static inline Visual *X11DRV_GetVisual(void) { return visual; }
|
||||
static inline Window X11DRV_GetXRootWindow(void) { return root_window; }
|
||||
static inline int X11DRV_GetDepth(void) { return screen_depth; }
|
||||
|
||||
/* X11 clipboard driver */
|
||||
|
||||
|
@ -334,13 +341,6 @@ extern Atom X11DRV_CLIPBOARD_MapFormatToProperty(UINT id);
|
|||
extern void X11DRV_CLIPBOARD_ResetOwner(struct tagWND *pWnd, BOOL bFooBar);
|
||||
extern void X11DRV_CLIPBOARD_ReleaseSelection(Atom selType, Window w, HWND hwnd);
|
||||
|
||||
/* X11 desktop driver */
|
||||
|
||||
struct tagDESKTOP;
|
||||
|
||||
extern Screen *X11DRV_DESKTOP_GetXScreen(struct tagDESKTOP *pDesktop);
|
||||
extern Window X11DRV_DESKTOP_GetXRootWindow(struct tagDESKTOP *pDesktop);
|
||||
|
||||
/* X11 event driver */
|
||||
|
||||
extern WORD X11DRV_EVENT_XStateToKeyState( int state ) ;
|
||||
|
@ -383,18 +383,12 @@ extern void X11DRV_KEYBOARD_HandleEvent(struct tagWND *pWnd, XKeyEvent *event);
|
|||
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 BOOL X11DRV_MONITOR_IsSingleWindow(struct tagMONITOR *pMonitor);
|
||||
|
@ -425,8 +419,6 @@ typedef struct _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);
|
||||
|
|
|
@ -11,7 +11,6 @@ C_SRCS = \
|
|||
event.c \
|
||||
init.c \
|
||||
keyboard.c \
|
||||
main.c \
|
||||
monitor.c \
|
||||
mouse.c \
|
||||
wnd.c
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
/*
|
||||
* TTY main driver
|
||||
*
|
||||
* Copyright 1998 Patrik Stridvall
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "clipboard.h"
|
||||
#include "desktop.h"
|
||||
#include "message.h"
|
||||
#include "keyboard.h"
|
||||
#include "monitor.h"
|
||||
#include "mouse.h"
|
||||
#include "ttydrv.h"
|
||||
#include "win.h"
|
||||
|
|
@ -7,11 +7,9 @@ MODULE = x11drv
|
|||
|
||||
C_SRCS = \
|
||||
clipboard.c \
|
||||
desktop.c \
|
||||
event.c \
|
||||
init.c \
|
||||
keyboard.c \
|
||||
main.c \
|
||||
monitor.c \
|
||||
mouse.c \
|
||||
wnd.c
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* X11 desktop driver
|
||||
*
|
||||
* Copyright 1998 Patrik Stridvall
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef X_DISPLAY_MISSING
|
||||
|
||||
#include "debugtools.h"
|
||||
#include "desktop.h"
|
||||
#include "monitor.h"
|
||||
#include "options.h"
|
||||
#include "win.h"
|
||||
#include "windef.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);
|
||||
}
|
||||
|
||||
#endif /* X_DISPLAY_MISSING */
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
* 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 "clipboard.h"
|
||||
#include "debugtools.h"
|
||||
#include "desktop.h"
|
||||
#include "keyboard.h"
|
||||
#include "main.h"
|
||||
#include "message.h"
|
||||
#include "monitor.h"
|
||||
#include "mouse.h"
|
||||
#include "options.h"
|
||||
#include "win.h"
|
||||
#include "windef.h"
|
||||
#include "x11drv.h"
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* 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);
|
||||
}
|
||||
|
||||
#endif /* X_DISPLAY_MISSING */
|
|
@ -21,36 +21,6 @@
|
|||
#include "windef.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
|
||||
|
@ -87,8 +57,7 @@ static void X11DRV_MONITOR_CreateDesktop(MONITOR *pMonitor)
|
|||
ButtonReleaseMask | EnterWindowMask;
|
||||
win_attr.cursor = TSXCreateFontCursor( display, XC_top_left_arrow );
|
||||
|
||||
pX11Monitor->rootWindow =
|
||||
TSXCreateWindow( display,
|
||||
root_window = TSXCreateWindow( display,
|
||||
DefaultRootWindow(display),
|
||||
x, y, width, height, 0,
|
||||
CopyFromParent, InputOutput, CopyFromParent,
|
||||
|
@ -118,17 +87,17 @@ static void X11DRV_MONITOR_CreateDesktop(MONITOR *pMonitor)
|
|||
class_hints->res_class = "Wine";
|
||||
|
||||
TSXStringListToTextProperty( &name, 1, &window_name );
|
||||
TSXSetWMProperties( display, pX11Monitor->rootWindow, &window_name, &window_name,
|
||||
TSXSetWMProperties( display, root_window, &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 );
|
||||
TSXSetWMProtocols( display, root_window, &XA_WM_DELETE_WINDOW, 1 );
|
||||
TSXFree( size_hints );
|
||||
TSXFree( wm_hints );
|
||||
TSXFree( class_hints );
|
||||
|
||||
/* Map window */
|
||||
|
||||
TSXMapWindow( display, pX11Monitor->rootWindow );
|
||||
TSXMapWindow( display, root_window );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -139,37 +108,12 @@ 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( screen );
|
||||
pX11Monitor->height = HeightOfScreen( screen );
|
||||
|
||||
pX11Monitor->width = WidthOfScreen( pX11Monitor->screen );
|
||||
pX11Monitor->height = HeightOfScreen( pX11Monitor->screen );
|
||||
|
||||
pX11Monitor->depth = PROFILE_GetWineIniInt( "x11drv", "ScreenDepth", 0 );
|
||||
if (pX11Monitor->depth) /* depth 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)
|
||||
{
|
||||
MESSAGE( "%s: Depth %d not supported on this screen.\n", argv0, pX11Monitor->depth );
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
pX11Monitor->depth = DefaultDepthOfScreen( pX11Monitor->screen );
|
||||
|
||||
if (Options.desktopGeometry)
|
||||
X11DRV_MONITOR_CreateDesktop(pMonitor);
|
||||
else
|
||||
pX11Monitor->rootWindow =
|
||||
DefaultRootWindow( display );
|
||||
if (Options.desktopGeometry) X11DRV_MONITOR_CreateDesktop(pMonitor);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -185,10 +129,7 @@ void X11DRV_MONITOR_Finalize(MONITOR *pMonitor)
|
|||
*/
|
||||
BOOL X11DRV_MONITOR_IsSingleWindow(MONITOR *pMonitor)
|
||||
{
|
||||
X11DRV_MONITOR_DATA *pX11Monitor =
|
||||
(X11DRV_MONITOR_DATA *) pMonitor->pDriverData;
|
||||
|
||||
return (pX11Monitor->rootWindow != DefaultRootWindow(display));
|
||||
return (root_window != DefaultRootWindow(display));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -224,10 +165,7 @@ int X11DRV_MONITOR_GetHeight(MONITOR *pMonitor)
|
|||
*/
|
||||
int X11DRV_MONITOR_GetDepth(MONITOR *pMonitor)
|
||||
{
|
||||
X11DRV_MONITOR_DATA *pX11Monitor =
|
||||
(X11DRV_MONITOR_DATA *) pMonitor->pDriverData;
|
||||
|
||||
return pX11Monitor->depth;
|
||||
return screen_depth;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -66,7 +66,7 @@ static BOOL X11DRV_MOUSE_DoSetCursor( CURSORICONINFO *ptr )
|
|||
*/
|
||||
pixmapAll = XCreatePixmap( display, X11DRV_GetXRootWindow(),
|
||||
ptr->nWidth, ptr->nHeight * 2, 1 );
|
||||
image = XCreateImage( display, DefaultVisualOfScreen(X11DRV_GetXScreen()),
|
||||
image = XCreateImage( display, X11DRV_GetVisual(),
|
||||
1, ZPixmap, 0, (char *)(ptr + 1), ptr->nWidth,
|
||||
ptr->nHeight * 2, 16, ptr->nWidthBytes);
|
||||
if (image)
|
||||
|
|
|
@ -81,28 +81,6 @@ 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
|
||||
*
|
||||
|
@ -172,8 +150,7 @@ BOOL X11DRV_WND_CreateDesktopWindow(WND *wndPtr, CLASS *classPtr, BOOL bUnicode)
|
|||
if (kwmDockWindow == None)
|
||||
kwmDockWindow = TSXInternAtom( display, "KWM_DOCKWINDOW", False );
|
||||
|
||||
((X11DRV_WND_DATA *) wndPtr->pDriverData)->window =
|
||||
X11DRV_WND_GetXRootWindow( wndPtr );
|
||||
((X11DRV_WND_DATA *) wndPtr->pDriverData)->window = X11DRV_GetXRootWindow();
|
||||
X11DRV_WND_RegisterWindow( wndPtr );
|
||||
|
||||
return TRUE;
|
||||
|
@ -188,8 +165,7 @@ BOOL X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BO
|
|||
/* Create the X window (only for top-level windows, and then only */
|
||||
/* when there's no desktop window) */
|
||||
|
||||
if (!(cs->style & WS_CHILD) &&
|
||||
(X11DRV_WND_GetXRootWindow(wndPtr) == DefaultRootWindow(display)))
|
||||
if (!(cs->style & WS_CHILD) && (X11DRV_GetXRootWindow() == DefaultRootWindow(display)))
|
||||
{
|
||||
Window wGroupLeader;
|
||||
XWMHints* wm_hints;
|
||||
|
@ -222,8 +198,7 @@ BOOL X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BO
|
|||
((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconBitmap = 0;
|
||||
((X11DRV_WND_DATA *) wndPtr->pDriverData)->bit_gravity = win_attr.bit_gravity;
|
||||
((X11DRV_WND_DATA *) wndPtr->pDriverData)->window =
|
||||
TSXCreateWindow( display,
|
||||
X11DRV_WND_GetXRootWindow(wndPtr),
|
||||
TSXCreateWindow( display, X11DRV_GetXRootWindow(),
|
||||
cs->x, cs->y, cs->cx, cs->cy,
|
||||
0, CopyFromParent,
|
||||
InputOutput, CopyFromParent,
|
||||
|
@ -384,7 +359,7 @@ WND *X11DRV_WND_SetParent(WND *wndPtr, WND *pWndParent)
|
|||
{
|
||||
wndPtr->dwStyle &= ~WS_CHILD;
|
||||
wndPtr->wIDmenu = 0;
|
||||
if( X11DRV_WND_GetXRootWindow(wndPtr) == DefaultRootWindow(display) )
|
||||
if( X11DRV_GetXRootWindow() == DefaultRootWindow(display) )
|
||||
{
|
||||
CREATESTRUCTA cs;
|
||||
cs.lpCreateParams = NULL;
|
||||
|
@ -609,7 +584,7 @@ void X11DRV_WND_SetFocus(WND *wndPtr)
|
|||
|
||||
/* Only mess with the X focus if there's */
|
||||
/* no desktop window and if the window is not managed by the WM. */
|
||||
if ((X11DRV_WND_GetXRootWindow(wndPtr) != DefaultRootWindow(display))
|
||||
if ((X11DRV_GetXRootWindow() != DefaultRootWindow(display))
|
||||
|| (wndPtr->flags & WIN_MANAGED)) return;
|
||||
|
||||
if (!hwnd) /* If setting the focus to 0, uninstall the colormap */
|
||||
|
@ -638,8 +613,7 @@ void X11DRV_WND_SetFocus(WND *wndPtr)
|
|||
*/
|
||||
void X11DRV_WND_PreSizeMove(WND *wndPtr)
|
||||
{
|
||||
if (!(wndPtr->dwStyle & WS_CHILD) &&
|
||||
(X11DRV_WND_GetXRootWindow(wndPtr) == DefaultRootWindow(display)))
|
||||
if (!(wndPtr->dwStyle & WS_CHILD) && (X11DRV_GetXRootWindow() == DefaultRootWindow(display)))
|
||||
TSXGrabServer( display );
|
||||
}
|
||||
|
||||
|
@ -698,7 +672,7 @@ void X11DRV_WND_SetDrawable(WND *wndPtr, DC *dc, WORD flags, BOOL bSetClipOrigin
|
|||
{
|
||||
dc->w.DCOrgX = 0;
|
||||
dc->w.DCOrgY = 0;
|
||||
physDev->drawable = X11DRV_WND_GetXRootWindow(wndPtr);
|
||||
physDev->drawable = X11DRV_GetXRootWindow();
|
||||
TSXSetSubwindowMode( display, physDev->gc, IncludeInferiors );
|
||||
}
|
||||
else
|
||||
|
@ -832,7 +806,7 @@ BOOL X11DRV_WND_SetHostAttr(WND* wnd, INT ha, INT value)
|
|||
ev.window = w;
|
||||
|
||||
if( TSXSendEvent (display,
|
||||
RootWindow( display, XScreenNumberOfScreen(X11DRV_WND_GetXScreen(wnd)) ),
|
||||
RootWindow( display, XScreenNumberOfScreen(X11DRV_GetXScreen()) ),
|
||||
True, (SubstructureRedirectMask | SubstructureNotifyMask), (XEvent*)&ev))
|
||||
{
|
||||
XEvent xe;
|
||||
|
|
Loading…
Reference in New Issue