1996-08-24 20:26:35 +02:00
|
|
|
/*
|
|
|
|
* X11 graphics driver initialisation functions
|
|
|
|
*
|
|
|
|
* Copyright 1996 Alexandre Julliard
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1996-08-24 20:26:35 +02:00
|
|
|
*/
|
|
|
|
|
1999-02-04 12:11:01 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
1996-08-24 20:26:35 +02:00
|
|
|
#include <string.h>
|
1999-04-01 10:16:08 +02:00
|
|
|
|
2002-12-10 23:56:43 +01:00
|
|
|
#include "windef.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winbase.h"
|
2005-06-01 13:08:39 +02:00
|
|
|
#include "winreg.h"
|
1999-04-01 10:16:08 +02:00
|
|
|
#include "x11drv.h"
|
2002-03-23 22:43:56 +01:00
|
|
|
#include "x11font.h"
|
2001-04-17 19:29:59 +02:00
|
|
|
#include "ddrawi.h"
|
2002-06-02 23:40:24 +02:00
|
|
|
#include "wine/debug.h"
|
1998-02-15 20:40:49 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
2001-05-11 02:17:47 +02:00
|
|
|
Display *gdi_display; /* display to use for all GDI functions */
|
|
|
|
|
2001-07-28 02:18:02 +02:00
|
|
|
/* a few dynamic device caps */
|
|
|
|
static int log_pixels_x; /* pixels per logical inch in x direction */
|
|
|
|
static int log_pixels_y; /* pixels per logical inch in y direction */
|
|
|
|
static int horz_size; /* horz. size of screen in millimeters */
|
|
|
|
static int vert_size; /* vert. size of screen in millimeters */
|
|
|
|
static int palette_size;
|
2005-06-29 21:28:06 +02:00
|
|
|
static int device_init_done;
|
2002-04-03 23:18:50 +02:00
|
|
|
unsigned int text_caps = (TC_OP_CHARACTER | TC_OP_STROKE | TC_CP_STROKE |
|
|
|
|
TC_CR_ANY | TC_SA_DOUBLE | TC_SA_INTEGER |
|
|
|
|
TC_SA_CONTIN | TC_UA_ABLE | TC_SO_ABLE | TC_RA_ABLE);
|
|
|
|
/* X11R6 adds TC_SF_X_YINDEP, Xrender adds TC_VA_ABLE */
|
2001-07-28 02:18:02 +02:00
|
|
|
|
2004-08-26 20:24:49 +02:00
|
|
|
|
|
|
|
static const WCHAR dpi_key_name[] = {'S','o','f','t','w','a','r','e','\\','F','o','n','t','s','\0'};
|
|
|
|
static const WCHAR dpi_value_name[] = {'L','o','g','P','i','x','e','l','s','\0'};
|
|
|
|
|
2011-09-07 15:36:58 +02:00
|
|
|
static const struct gdi_dc_funcs x11drv_funcs;
|
2011-09-12 11:39:17 +02:00
|
|
|
static const struct gdi_dc_funcs *xrender_funcs;
|
2004-08-26 20:24:49 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* get_dpi
|
|
|
|
*
|
|
|
|
* get the dpi from the registry
|
|
|
|
*/
|
|
|
|
static DWORD get_dpi( void )
|
|
|
|
{
|
|
|
|
DWORD dpi = 96;
|
|
|
|
HKEY hkey;
|
|
|
|
|
|
|
|
if (RegOpenKeyW(HKEY_CURRENT_CONFIG, dpi_key_name, &hkey) == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
DWORD type, size, new_dpi;
|
|
|
|
|
|
|
|
size = sizeof(new_dpi);
|
|
|
|
if(RegQueryValueExW(hkey, dpi_value_name, NULL, &type, (void *)&new_dpi, &size) == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
if(type == REG_DWORD && new_dpi != 0)
|
|
|
|
dpi = new_dpi;
|
|
|
|
}
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
}
|
|
|
|
return dpi;
|
|
|
|
}
|
|
|
|
|
1996-08-24 20:26:35 +02:00
|
|
|
/**********************************************************************
|
2005-06-29 21:28:06 +02:00
|
|
|
* device_init
|
|
|
|
*
|
|
|
|
* Perform initializations needed upon creation of the first device.
|
1996-08-24 20:26:35 +02:00
|
|
|
*/
|
2005-06-29 21:28:06 +02:00
|
|
|
static void device_init(void)
|
1996-08-24 20:26:35 +02:00
|
|
|
{
|
2005-06-29 21:28:06 +02:00
|
|
|
device_init_done = TRUE;
|
1999-04-01 10:16:08 +02:00
|
|
|
|
2005-03-24 22:04:10 +01:00
|
|
|
/* Initialize XRender */
|
2011-09-12 11:39:17 +02:00
|
|
|
xrender_funcs = X11DRV_XRender_Init();
|
2005-03-24 22:04:10 +01:00
|
|
|
|
2007-03-22 20:06:19 +01:00
|
|
|
/* Init Xcursor */
|
|
|
|
X11DRV_Xcursor_Init();
|
|
|
|
|
2001-07-28 02:18:02 +02:00
|
|
|
palette_size = X11DRV_PALETTE_Init();
|
1997-06-16 19:43:53 +02:00
|
|
|
|
2004-07-13 05:49:52 +02:00
|
|
|
X11DRV_BITMAP_Init();
|
1997-02-02 20:01:52 +01:00
|
|
|
|
2004-08-26 20:24:49 +02:00
|
|
|
/* Initialize device caps */
|
|
|
|
log_pixels_x = log_pixels_y = get_dpi();
|
2001-07-28 02:18:02 +02:00
|
|
|
horz_size = MulDiv( screen_width, 254, log_pixels_x * 10 );
|
|
|
|
vert_size = MulDiv( screen_height, 254, log_pixels_y * 10 );
|
2004-08-26 20:24:49 +02:00
|
|
|
|
|
|
|
/* Initialize fonts and text caps */
|
|
|
|
X11DRV_FONT_Init(log_pixels_x, log_pixels_y);
|
1996-08-24 20:26:35 +02:00
|
|
|
}
|
|
|
|
|
1999-04-01 10:16:08 +02:00
|
|
|
/**********************************************************************
|
|
|
|
* X11DRV_GDI_Finalize
|
|
|
|
*/
|
|
|
|
void X11DRV_GDI_Finalize(void)
|
|
|
|
{
|
2001-05-11 02:17:47 +02:00
|
|
|
X11DRV_PALETTE_Cleanup();
|
2006-08-03 19:29:44 +02:00
|
|
|
/* don't bother to close the display, it often triggers X bugs */
|
|
|
|
/* XCloseDisplay( gdi_display ); */
|
1999-04-01 10:16:08 +02:00
|
|
|
}
|
|
|
|
|
2011-09-07 15:36:58 +02:00
|
|
|
|
|
|
|
static X11DRV_PDEVICE *create_x11_physdev( Drawable drawable )
|
1996-08-24 20:26:35 +02:00
|
|
|
{
|
|
|
|
X11DRV_PDEVICE *physDev;
|
|
|
|
|
2005-06-29 21:28:06 +02:00
|
|
|
if (!device_init_done) device_init();
|
|
|
|
|
2011-09-07 15:36:58 +02:00
|
|
|
if (!(physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev) ))) return NULL;
|
1996-08-24 20:26:35 +02:00
|
|
|
|
2011-09-07 15:36:58 +02:00
|
|
|
if (!(physDev->region = CreateRectRgn( 0, 0, 0, 0 )))
|
1996-08-24 20:26:35 +02:00
|
|
|
{
|
2011-09-07 15:36:58 +02:00
|
|
|
HeapFree( GetProcessHeap(), 0, physDev );
|
|
|
|
return NULL;
|
1996-08-24 20:26:35 +02:00
|
|
|
}
|
2001-05-11 02:17:47 +02:00
|
|
|
|
|
|
|
wine_tsx11_lock();
|
2011-09-07 15:36:58 +02:00
|
|
|
physDev->drawable = drawable;
|
|
|
|
physDev->gc = XCreateGC( gdi_display, drawable, 0, NULL );
|
2001-05-11 02:17:47 +02:00
|
|
|
XSetGraphicsExposures( gdi_display, physDev->gc, False );
|
|
|
|
XSetSubwindowMode( gdi_display, physDev->gc, IncludeInferiors );
|
|
|
|
XFlush( gdi_display );
|
|
|
|
wine_tsx11_unlock();
|
2011-09-07 15:36:58 +02:00
|
|
|
return physDev;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* X11DRV_CreateDC
|
|
|
|
*/
|
2011-09-07 17:01:29 +02:00
|
|
|
static BOOL X11DRV_CreateDC( PHYSDEV *pdev, LPCWSTR driver, LPCWSTR device,
|
|
|
|
LPCWSTR output, const DEVMODEW* initData )
|
2011-09-07 15:36:58 +02:00
|
|
|
{
|
|
|
|
X11DRV_PDEVICE *physDev = create_x11_physdev( root_window );
|
|
|
|
|
|
|
|
if (!physDev) return FALSE;
|
|
|
|
|
|
|
|
physDev->depth = screen_depth;
|
|
|
|
physDev->color_shifts = &X11DRV_PALETTE_default_shifts;
|
|
|
|
physDev->drawable_rect = virtual_screen_rect;
|
|
|
|
SetRect( &physDev->dc_rect, 0, 0, virtual_screen_rect.right - virtual_screen_rect.left,
|
|
|
|
virtual_screen_rect.bottom - virtual_screen_rect.top );
|
2011-09-07 17:01:29 +02:00
|
|
|
push_dc_driver( pdev, &physDev->dev, &x11drv_funcs );
|
2011-09-12 11:39:17 +02:00
|
|
|
if (!xrender_funcs) return TRUE;
|
|
|
|
return xrender_funcs->pCreateDC( pdev, driver, device, output, initData );
|
2011-09-07 15:36:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* X11DRV_CreateCompatibleDC
|
|
|
|
*/
|
|
|
|
static BOOL X11DRV_CreateCompatibleDC( PHYSDEV orig, PHYSDEV *pdev )
|
|
|
|
{
|
|
|
|
X11DRV_PDEVICE *physDev = create_x11_physdev( BITMAP_stock_phys_bitmap.pixmap );
|
|
|
|
|
|
|
|
if (!physDev) return FALSE;
|
|
|
|
|
|
|
|
if (!BITMAP_stock_phys_bitmap.hbitmap)
|
|
|
|
BITMAP_stock_phys_bitmap.hbitmap = GetCurrentObject( (*pdev)->hdc, OBJ_BITMAP );
|
|
|
|
|
|
|
|
physDev->bitmap = &BITMAP_stock_phys_bitmap;
|
|
|
|
physDev->depth = 1;
|
|
|
|
SetRect( &physDev->drawable_rect, 0, 0, 1, 1 );
|
|
|
|
physDev->dc_rect = physDev->drawable_rect;
|
|
|
|
push_dc_driver( pdev, &physDev->dev, &x11drv_funcs );
|
2011-09-12 11:39:17 +02:00
|
|
|
if (orig) return TRUE; /* we already went through Xrender if we have an orig device */
|
|
|
|
if (!xrender_funcs) return TRUE;
|
|
|
|
return xrender_funcs->pCreateCompatibleDC( NULL, pdev );
|
1996-08-24 20:26:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* X11DRV_DeleteDC
|
|
|
|
*/
|
2011-07-14 13:14:36 +02:00
|
|
|
static BOOL X11DRV_DeleteDC( PHYSDEV dev )
|
1996-08-24 20:26:35 +02:00
|
|
|
{
|
2011-07-08 15:55:11 +02:00
|
|
|
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
|
|
|
|
|
2004-02-13 21:26:27 +01:00
|
|
|
DeleteObject( physDev->region );
|
2001-05-11 02:17:47 +02:00
|
|
|
wine_tsx11_lock();
|
|
|
|
XFreeGC( gdi_display, physDev->gc );
|
|
|
|
wine_tsx11_unlock();
|
1998-11-25 13:36:03 +01:00
|
|
|
HeapFree( GetProcessHeap(), 0, physDev );
|
1996-08-24 20:26:35 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
1997-06-16 19:43:53 +02:00
|
|
|
|
2001-07-28 02:18:02 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetDeviceCaps (X11DRV.@)
|
|
|
|
*/
|
2011-07-14 13:14:36 +02:00
|
|
|
static INT X11DRV_GetDeviceCaps( PHYSDEV dev, INT cap )
|
2001-07-28 02:18:02 +02:00
|
|
|
{
|
|
|
|
switch(cap)
|
|
|
|
{
|
|
|
|
case DRIVERVERSION:
|
|
|
|
return 0x300;
|
|
|
|
case TECHNOLOGY:
|
|
|
|
return DT_RASDISPLAY;
|
|
|
|
case HORZSIZE:
|
|
|
|
return horz_size;
|
|
|
|
case VERTSIZE:
|
|
|
|
return vert_size;
|
|
|
|
case HORZRES:
|
|
|
|
return screen_width;
|
|
|
|
case VERTRES:
|
|
|
|
return screen_height;
|
2006-12-12 14:59:55 +01:00
|
|
|
case DESKTOPHORZRES:
|
|
|
|
return virtual_screen_rect.right - virtual_screen_rect.left;
|
|
|
|
case DESKTOPVERTRES:
|
|
|
|
return virtual_screen_rect.bottom - virtual_screen_rect.top;
|
2001-07-28 02:18:02 +02:00
|
|
|
case BITSPIXEL:
|
2007-12-16 14:00:45 +01:00
|
|
|
return screen_bpp;
|
2001-07-28 02:18:02 +02:00
|
|
|
case PLANES:
|
|
|
|
return 1;
|
|
|
|
case NUMBRUSHES:
|
|
|
|
return -1;
|
|
|
|
case NUMPENS:
|
|
|
|
return -1;
|
|
|
|
case NUMMARKERS:
|
|
|
|
return 0;
|
|
|
|
case NUMFONTS:
|
|
|
|
return 0;
|
|
|
|
case NUMCOLORS:
|
|
|
|
/* MSDN: Number of entries in the device's color table, if the device has
|
|
|
|
* a color depth of no more than 8 bits per pixel.For devices with greater
|
|
|
|
* color depths, -1 is returned. */
|
|
|
|
return (screen_depth > 8) ? -1 : (1 << screen_depth);
|
|
|
|
case PDEVICESIZE:
|
|
|
|
return sizeof(X11DRV_PDEVICE);
|
|
|
|
case CURVECAPS:
|
|
|
|
return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
|
|
|
|
CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT);
|
|
|
|
case LINECAPS:
|
|
|
|
return (LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
|
|
|
|
LC_STYLED | LC_WIDESTYLED | LC_INTERIORS);
|
|
|
|
case POLYGONALCAPS:
|
|
|
|
return (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON | PC_SCANLINE |
|
|
|
|
PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS);
|
|
|
|
case TEXTCAPS:
|
|
|
|
return text_caps;
|
|
|
|
case CLIPCAPS:
|
|
|
|
return CP_REGION;
|
2010-06-15 07:26:20 +02:00
|
|
|
case COLORRES:
|
|
|
|
/* The observed correspondence between BITSPIXEL and COLORRES is:
|
|
|
|
* BITSPIXEL: 8 -> COLORRES: 18
|
|
|
|
* BITSPIXEL: 16 -> COLORRES: 16
|
|
|
|
* BITSPIXEL: 24 -> COLORRES: 24
|
|
|
|
* BITSPIXEL: 32 -> COLORRES: 24 */
|
2011-07-06 12:38:31 +02:00
|
|
|
return (screen_bpp <= 8) ? 18 : min( 24, screen_bpp );
|
2001-07-28 02:18:02 +02:00
|
|
|
case RASTERCAPS:
|
|
|
|
return (RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 | RC_DI_BITMAP |
|
|
|
|
RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS |
|
|
|
|
(palette_size ? RC_PALETTE : 0));
|
2005-11-10 12:05:30 +01:00
|
|
|
case SHADEBLENDCAPS:
|
|
|
|
return (SB_GRAD_RECT | SB_GRAD_TRI | SB_CONST_ALPHA | SB_PIXEL_ALPHA);
|
2001-07-28 02:18:02 +02:00
|
|
|
case ASPECTX:
|
|
|
|
case ASPECTY:
|
|
|
|
return 36;
|
|
|
|
case ASPECTXY:
|
|
|
|
return 51;
|
|
|
|
case LOGPIXELSX:
|
|
|
|
return log_pixels_x;
|
|
|
|
case LOGPIXELSY:
|
|
|
|
return log_pixels_y;
|
|
|
|
case CAPS1:
|
2011-07-08 16:03:59 +02:00
|
|
|
FIXME("(%p): CAPS1 is unimplemented, will return 0\n", dev->hdc );
|
2001-07-28 02:18:02 +02:00
|
|
|
/* please see wingdi.h for the possible bit-flag values that need
|
2008-03-01 05:35:20 +01:00
|
|
|
to be returned. */
|
2001-07-28 02:18:02 +02:00
|
|
|
return 0;
|
|
|
|
case SIZEPALETTE:
|
|
|
|
return palette_size;
|
|
|
|
case NUMRESERVED:
|
|
|
|
case PHYSICALWIDTH:
|
|
|
|
case PHYSICALHEIGHT:
|
|
|
|
case PHYSICALOFFSETX:
|
|
|
|
case PHYSICALOFFSETY:
|
|
|
|
case SCALINGFACTORX:
|
|
|
|
case SCALINGFACTORY:
|
|
|
|
case VREFRESH:
|
2006-06-13 11:24:11 +02:00
|
|
|
case BLTALIGNMENT:
|
2001-07-28 02:18:02 +02:00
|
|
|
return 0;
|
|
|
|
default:
|
2011-07-08 16:03:59 +02:00
|
|
|
FIXME("(%p): unsupported capability %d, will return 0\n", dev->hdc, cap );
|
2001-07-28 02:18:02 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1997-06-16 19:43:53 +02:00
|
|
|
/**********************************************************************
|
2001-07-29 22:25:14 +02:00
|
|
|
* ExtEscape (X11DRV.@)
|
1997-06-16 19:43:53 +02:00
|
|
|
*/
|
2011-07-14 13:14:36 +02:00
|
|
|
static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_data,
|
2011-07-13 14:56:12 +02:00
|
|
|
INT out_count, LPVOID out_data )
|
1997-06-16 19:43:53 +02:00
|
|
|
{
|
2011-07-08 15:55:11 +02:00
|
|
|
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
|
|
|
|
|
2001-07-29 22:25:14 +02:00
|
|
|
switch(escape)
|
1997-06-16 19:43:53 +02:00
|
|
|
{
|
2001-07-29 22:25:14 +02:00
|
|
|
case QUERYESCSUPPORT:
|
|
|
|
if (in_data)
|
|
|
|
{
|
2004-11-30 22:38:57 +01:00
|
|
|
switch (*(const INT *)in_data)
|
2001-07-29 22:25:14 +02:00
|
|
|
{
|
|
|
|
case DCICOMMAND:
|
|
|
|
return DD_HAL_VERSION;
|
2002-03-23 22:43:56 +01:00
|
|
|
case X11DRV_ESCAPE:
|
|
|
|
return TRUE;
|
2001-07-29 22:25:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2002-03-23 22:43:56 +01:00
|
|
|
case X11DRV_ESCAPE:
|
|
|
|
if (in_data && in_count >= sizeof(enum x11drv_escape_codes))
|
|
|
|
{
|
2004-11-30 22:38:57 +01:00
|
|
|
switch(*(const enum x11drv_escape_codes *)in_data)
|
2002-03-23 22:43:56 +01:00
|
|
|
{
|
|
|
|
case X11DRV_GET_DISPLAY:
|
|
|
|
if (out_count >= sizeof(Display *))
|
|
|
|
{
|
|
|
|
*(Display **)out_data = gdi_display;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case X11DRV_GET_DRAWABLE:
|
|
|
|
if (out_count >= sizeof(Drawable))
|
|
|
|
{
|
|
|
|
*(Drawable *)out_data = physDev->drawable;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case X11DRV_GET_FONT:
|
|
|
|
if (out_count >= sizeof(Font))
|
|
|
|
{
|
|
|
|
fontObject* pfo = XFONT_GetFontObject( physDev->font );
|
2002-07-03 03:16:45 +02:00
|
|
|
if (pfo == NULL) return FALSE;
|
2002-03-23 22:43:56 +01:00
|
|
|
*(Font *)out_data = pfo->fs->fid;
|
|
|
|
return TRUE;
|
|
|
|
}
|
2004-01-14 05:53:11 +01:00
|
|
|
break;
|
|
|
|
case X11DRV_SET_DRAWABLE:
|
|
|
|
if (in_count >= sizeof(struct x11drv_escape_set_drawable))
|
|
|
|
{
|
2009-01-19 10:23:40 +01:00
|
|
|
const struct x11drv_escape_set_drawable *data = in_data;
|
2006-12-07 16:43:59 +01:00
|
|
|
physDev->dc_rect = data->dc_rect;
|
2004-01-14 05:53:11 +01:00
|
|
|
physDev->drawable = data->drawable;
|
2006-12-07 16:43:59 +01:00
|
|
|
physDev->drawable_rect = data->drawable_rect;
|
2007-09-15 22:02:32 +02:00
|
|
|
physDev->current_pf = pixelformat_from_fbconfig_id( data->fbconfig_id );
|
2007-09-25 19:20:58 +02:00
|
|
|
physDev->gl_drawable = data->gl_drawable;
|
2007-09-26 17:17:13 +02:00
|
|
|
physDev->pixmap = data->pixmap;
|
2008-05-28 17:52:06 +02:00
|
|
|
physDev->gl_copy = data->gl_copy;
|
2004-01-14 05:53:11 +01:00
|
|
|
wine_tsx11_lock();
|
|
|
|
XSetSubwindowMode( gdi_display, physDev->gc, data->mode );
|
|
|
|
wine_tsx11_unlock();
|
2008-06-09 16:57:38 +02:00
|
|
|
TRACE( "SET_DRAWABLE hdc %p drawable %lx gl_drawable %lx pf %u dc_rect %s drawable_rect %s\n",
|
2011-07-08 16:03:59 +02:00
|
|
|
dev->hdc, physDev->drawable, physDev->gl_drawable, physDev->current_pf,
|
2008-06-09 16:57:38 +02:00
|
|
|
wine_dbgstr_rect(&physDev->dc_rect), wine_dbgstr_rect(&physDev->drawable_rect) );
|
2004-01-14 05:53:11 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case X11DRV_START_EXPOSURES:
|
|
|
|
wine_tsx11_lock();
|
|
|
|
XSetGraphicsExposures( gdi_display, physDev->gc, True );
|
|
|
|
wine_tsx11_unlock();
|
|
|
|
physDev->exposures = 0;
|
|
|
|
return TRUE;
|
|
|
|
case X11DRV_END_EXPOSURES:
|
|
|
|
if (out_count >= sizeof(HRGN))
|
|
|
|
{
|
|
|
|
HRGN hrgn = 0, tmp = 0;
|
|
|
|
|
|
|
|
wine_tsx11_lock();
|
|
|
|
XSetGraphicsExposures( gdi_display, physDev->gc, False );
|
2007-09-27 18:02:26 +02:00
|
|
|
wine_tsx11_unlock();
|
2004-01-14 05:53:11 +01:00
|
|
|
if (physDev->exposures)
|
|
|
|
{
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
XEvent event;
|
|
|
|
|
2007-09-27 18:02:26 +02:00
|
|
|
wine_tsx11_lock();
|
2004-01-14 05:53:11 +01:00
|
|
|
XWindowEvent( gdi_display, physDev->drawable, ~0, &event );
|
2007-09-27 18:02:26 +02:00
|
|
|
wine_tsx11_unlock();
|
2004-01-14 05:53:11 +01:00
|
|
|
if (event.type == NoExpose) break;
|
|
|
|
if (event.type == GraphicsExpose)
|
|
|
|
{
|
2010-10-04 20:41:11 +02:00
|
|
|
RECT rect;
|
2004-01-14 05:53:11 +01:00
|
|
|
|
2010-10-04 20:41:11 +02:00
|
|
|
rect.left = event.xgraphicsexpose.x - physDev->dc_rect.left;
|
|
|
|
rect.top = event.xgraphicsexpose.y - physDev->dc_rect.top;
|
|
|
|
rect.right = rect.left + event.xgraphicsexpose.width;
|
|
|
|
rect.bottom = rect.top + event.xgraphicsexpose.height;
|
2011-07-08 16:03:59 +02:00
|
|
|
if (GetLayout( dev->hdc ) & LAYOUT_RTL)
|
2010-10-04 20:41:11 +02:00
|
|
|
mirror_rect( &physDev->dc_rect, &rect );
|
|
|
|
|
|
|
|
TRACE( "got %s count %d\n", wine_dbgstr_rect(&rect),
|
2004-01-14 05:53:11 +01:00
|
|
|
event.xgraphicsexpose.count );
|
|
|
|
|
2010-10-04 20:41:11 +02:00
|
|
|
if (!tmp) tmp = CreateRectRgnIndirect( &rect );
|
|
|
|
else SetRectRgn( tmp, rect.left, rect.top, rect.right, rect.bottom );
|
2004-01-14 05:53:11 +01:00
|
|
|
if (hrgn) CombineRgn( hrgn, hrgn, tmp, RGN_OR );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
hrgn = tmp;
|
|
|
|
tmp = 0;
|
|
|
|
}
|
|
|
|
if (!event.xgraphicsexpose.count) break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR( "got unexpected event %d\n", event.type );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (tmp) DeleteObject( tmp );
|
|
|
|
}
|
|
|
|
*(HRGN *)out_data = hrgn;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2005-03-27 19:58:41 +02:00
|
|
|
case X11DRV_GET_DCE:
|
|
|
|
case X11DRV_SET_DCE:
|
2008-02-18 11:25:14 +01:00
|
|
|
FIXME( "%x escape no longer supported\n", *(const enum x11drv_escape_codes *)in_data );
|
2005-03-27 19:58:41 +02:00
|
|
|
break;
|
2005-09-26 13:04:12 +02:00
|
|
|
case X11DRV_GET_GLX_DRAWABLE:
|
|
|
|
if (out_count >= sizeof(Drawable))
|
|
|
|
{
|
2006-06-23 13:13:55 +02:00
|
|
|
*(Drawable *)out_data = get_glxdrawable(physDev);
|
2005-09-26 13:04:12 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2006-02-02 13:23:55 +01:00
|
|
|
case X11DRV_SYNC_PIXMAP:
|
|
|
|
if(physDev->bitmap)
|
|
|
|
{
|
2007-10-12 17:44:13 +02:00
|
|
|
X11DRV_CoerceDIBSection(physDev, DIB_Status_GdiMod);
|
2006-02-02 13:23:55 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
2007-10-10 17:33:35 +02:00
|
|
|
case X11DRV_FLUSH_GL_DRAWABLE:
|
|
|
|
flush_gl_drawable(physDev);
|
|
|
|
return TRUE;
|
2002-03-23 22:43:56 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
1997-06-16 19:43:53 +02:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2011-07-13 14:05:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
static const struct gdi_dc_funcs x11drv_funcs =
|
|
|
|
{
|
|
|
|
NULL, /* pAbortDoc */
|
|
|
|
NULL, /* pAbortPath */
|
2011-09-12 12:20:01 +02:00
|
|
|
NULL, /* pAlphaBlend */
|
2011-07-13 14:05:07 +02:00
|
|
|
NULL, /* pAngleArc */
|
|
|
|
X11DRV_Arc, /* pArc */
|
|
|
|
NULL, /* pArcTo */
|
|
|
|
NULL, /* pBeginPath */
|
2011-09-14 11:57:45 +02:00
|
|
|
NULL, /* pBlendImage */
|
2011-07-13 14:05:07 +02:00
|
|
|
X11DRV_ChoosePixelFormat, /* pChoosePixelFormat */
|
|
|
|
X11DRV_Chord, /* pChord */
|
|
|
|
NULL, /* pCloseFigure */
|
2011-11-07 22:04:00 +01:00
|
|
|
X11DRV_CopyBitmap, /* pCopyBitmap */
|
2011-07-13 14:05:07 +02:00
|
|
|
X11DRV_CreateBitmap, /* pCreateBitmap */
|
2011-09-07 15:36:58 +02:00
|
|
|
X11DRV_CreateCompatibleDC, /* pCreateCompatibleDC */
|
2011-07-13 14:05:07 +02:00
|
|
|
X11DRV_CreateDC, /* pCreateDC */
|
|
|
|
X11DRV_CreateDIBSection, /* pCreateDIBSection */
|
|
|
|
X11DRV_DeleteBitmap, /* pDeleteBitmap */
|
|
|
|
X11DRV_DeleteDC, /* pDeleteDC */
|
|
|
|
NULL, /* pDeleteObject */
|
|
|
|
X11DRV_DescribePixelFormat, /* pDescribePixelFormat */
|
|
|
|
NULL, /* pDeviceCapabilities */
|
|
|
|
X11DRV_Ellipse, /* pEllipse */
|
|
|
|
NULL, /* pEndDoc */
|
|
|
|
NULL, /* pEndPage */
|
|
|
|
NULL, /* pEndPath */
|
2011-10-19 15:37:10 +02:00
|
|
|
X11DRV_EnumFonts, /* pEnumFonts */
|
2011-07-13 14:05:07 +02:00
|
|
|
X11DRV_EnumICMProfiles, /* pEnumICMProfiles */
|
|
|
|
NULL, /* pExcludeClipRect */
|
|
|
|
NULL, /* pExtDeviceMode */
|
|
|
|
X11DRV_ExtEscape, /* pExtEscape */
|
|
|
|
X11DRV_ExtFloodFill, /* pExtFloodFill */
|
|
|
|
NULL, /* pExtSelectClipRgn */
|
|
|
|
X11DRV_ExtTextOut, /* pExtTextOut */
|
|
|
|
NULL, /* pFillPath */
|
|
|
|
NULL, /* pFillRgn */
|
|
|
|
NULL, /* pFlattenPath */
|
2011-10-19 21:51:39 +02:00
|
|
|
NULL, /* pFontIsLinked */
|
2011-07-13 14:05:07 +02:00
|
|
|
NULL, /* pFrameRgn */
|
|
|
|
NULL, /* pGdiComment */
|
2011-10-19 21:51:39 +02:00
|
|
|
NULL, /* pGdiRealizationInfo */
|
|
|
|
NULL, /* pGetCharABCWidths */
|
|
|
|
NULL, /* pGetCharABCWidthsI */
|
2011-07-13 14:05:07 +02:00
|
|
|
X11DRV_GetCharWidth, /* pGetCharWidth */
|
|
|
|
X11DRV_GetDeviceCaps, /* pGetDeviceCaps */
|
|
|
|
X11DRV_GetDeviceGammaRamp, /* pGetDeviceGammaRamp */
|
2011-10-19 21:51:39 +02:00
|
|
|
NULL, /* pGetFontData */
|
|
|
|
NULL, /* pGetFontUnicodeRanges */
|
|
|
|
NULL, /* pGetGlyphIndices */
|
|
|
|
NULL, /* pGetGlyphOutline */
|
2011-07-13 14:05:07 +02:00
|
|
|
X11DRV_GetICMProfile, /* pGetICMProfile */
|
2011-07-14 12:37:04 +02:00
|
|
|
X11DRV_GetImage, /* pGetImage */
|
2011-10-19 21:51:39 +02:00
|
|
|
NULL, /* pGetKerningPairs */
|
2011-07-13 14:05:07 +02:00
|
|
|
X11DRV_GetNearestColor, /* pGetNearestColor */
|
2011-10-19 21:51:39 +02:00
|
|
|
NULL, /* pGetOutlineTextMetrics */
|
2011-07-13 14:05:07 +02:00
|
|
|
X11DRV_GetPixel, /* pGetPixel */
|
|
|
|
X11DRV_GetPixelFormat, /* pGetPixelFormat */
|
|
|
|
X11DRV_GetSystemPaletteEntries, /* pGetSystemPaletteEntries */
|
2011-10-19 21:51:39 +02:00
|
|
|
NULL, /* pGetTextCharsetInfo */
|
2011-07-13 14:05:07 +02:00
|
|
|
X11DRV_GetTextExtentExPoint, /* pGetTextExtentExPoint */
|
2011-10-19 21:51:39 +02:00
|
|
|
NULL, /* pGetTextExtentExPointI */
|
|
|
|
NULL, /* pGetTextFace */
|
2011-07-13 14:05:07 +02:00
|
|
|
X11DRV_GetTextMetrics, /* pGetTextMetrics */
|
2011-10-31 23:51:38 +01:00
|
|
|
NULL, /* pGradientFill */
|
2011-07-13 14:05:07 +02:00
|
|
|
NULL, /* pIntersectClipRect */
|
|
|
|
NULL, /* pInvertRgn */
|
|
|
|
X11DRV_LineTo, /* pLineTo */
|
|
|
|
NULL, /* pModifyWorldTransform */
|
|
|
|
NULL, /* pMoveTo */
|
|
|
|
NULL, /* pOffsetClipRgn */
|
|
|
|
NULL, /* pOffsetViewportOrg */
|
|
|
|
NULL, /* pOffsetWindowOrg */
|
|
|
|
X11DRV_PaintRgn, /* pPaintRgn */
|
|
|
|
X11DRV_PatBlt, /* pPatBlt */
|
|
|
|
X11DRV_Pie, /* pPie */
|
|
|
|
NULL, /* pPolyBezier */
|
|
|
|
NULL, /* pPolyBezierTo */
|
|
|
|
NULL, /* pPolyDraw */
|
|
|
|
X11DRV_PolyPolygon, /* pPolyPolygon */
|
|
|
|
X11DRV_PolyPolyline, /* pPolyPolyline */
|
|
|
|
X11DRV_Polygon, /* pPolygon */
|
|
|
|
X11DRV_Polyline, /* pPolyline */
|
|
|
|
NULL, /* pPolylineTo */
|
2011-07-14 12:59:48 +02:00
|
|
|
X11DRV_PutImage, /* pPutImage */
|
2011-07-13 14:05:07 +02:00
|
|
|
X11DRV_RealizeDefaultPalette, /* pRealizeDefaultPalette */
|
|
|
|
X11DRV_RealizePalette, /* pRealizePalette */
|
|
|
|
X11DRV_Rectangle, /* pRectangle */
|
|
|
|
NULL, /* pResetDC */
|
|
|
|
NULL, /* pRestoreDC */
|
|
|
|
X11DRV_RoundRect, /* pRoundRect */
|
|
|
|
NULL, /* pSaveDC */
|
|
|
|
NULL, /* pScaleViewportExt */
|
|
|
|
NULL, /* pScaleWindowExt */
|
|
|
|
X11DRV_SelectBitmap, /* pSelectBitmap */
|
|
|
|
X11DRV_SelectBrush, /* pSelectBrush */
|
|
|
|
NULL, /* pSelectClipPath */
|
|
|
|
X11DRV_SelectFont, /* pSelectFont */
|
|
|
|
NULL, /* pSelectPalette */
|
|
|
|
X11DRV_SelectPen, /* pSelectPen */
|
|
|
|
NULL, /* pSetArcDirection */
|
|
|
|
X11DRV_SetBkColor, /* pSetBkColor */
|
|
|
|
NULL, /* pSetBkMode */
|
|
|
|
X11DRV_SetDCBrushColor, /* pSetDCBrushColor */
|
|
|
|
X11DRV_SetDCPenColor, /* pSetDCPenColor */
|
|
|
|
X11DRV_SetDIBColorTable, /* pSetDIBColorTable */
|
2011-09-06 14:44:11 +02:00
|
|
|
NULL, /* pSetDIBitsToDevice */
|
2011-07-13 14:05:07 +02:00
|
|
|
X11DRV_SetDeviceClipping, /* pSetDeviceClipping */
|
|
|
|
X11DRV_SetDeviceGammaRamp, /* pSetDeviceGammaRamp */
|
|
|
|
NULL, /* pSetLayout */
|
|
|
|
NULL, /* pSetMapMode */
|
|
|
|
NULL, /* pSetMapperFlags */
|
|
|
|
X11DRV_SetPixel, /* pSetPixel */
|
|
|
|
X11DRV_SetPixelFormat, /* pSetPixelFormat */
|
|
|
|
NULL, /* pSetPolyFillMode */
|
|
|
|
NULL, /* pSetROP2 */
|
|
|
|
NULL, /* pSetRelAbs */
|
|
|
|
NULL, /* pSetStretchBltMode */
|
|
|
|
NULL, /* pSetTextAlign */
|
|
|
|
NULL, /* pSetTextCharacterExtra */
|
|
|
|
X11DRV_SetTextColor, /* pSetTextColor */
|
|
|
|
NULL, /* pSetTextJustification */
|
|
|
|
NULL, /* pSetViewportExt */
|
|
|
|
NULL, /* pSetViewportOrg */
|
|
|
|
NULL, /* pSetWindowExt */
|
|
|
|
NULL, /* pSetWindowOrg */
|
|
|
|
NULL, /* pSetWorldTransform */
|
|
|
|
NULL, /* pStartDoc */
|
|
|
|
NULL, /* pStartPage */
|
|
|
|
X11DRV_StretchBlt, /* pStretchBlt */
|
|
|
|
NULL, /* pStretchDIBits */
|
|
|
|
NULL, /* pStrokeAndFillPath */
|
|
|
|
NULL, /* pStrokePath */
|
|
|
|
X11DRV_SwapBuffers, /* pSwapBuffers */
|
|
|
|
X11DRV_UnrealizePalette, /* pUnrealizePalette */
|
|
|
|
NULL, /* pWidenPath */
|
|
|
|
X11DRV_wglCopyContext, /* pwglCopyContext */
|
|
|
|
X11DRV_wglCreateContext, /* pwglCreateContext */
|
|
|
|
X11DRV_wglCreateContextAttribsARB, /* pwglCreateContextAttribsARB */
|
|
|
|
X11DRV_wglDeleteContext, /* pwglDeleteContext */
|
|
|
|
X11DRV_wglGetPbufferDCARB, /* pwglGetPbufferDCARB */
|
2011-07-13 14:22:59 +02:00
|
|
|
X11DRV_wglGetProcAddress, /* pwglGetProcAddress */
|
2011-07-13 14:05:07 +02:00
|
|
|
X11DRV_wglMakeContextCurrentARB, /* pwglMakeContextCurrentARB */
|
2011-07-13 14:22:59 +02:00
|
|
|
X11DRV_wglMakeCurrent, /* pwglMakeCurrent */
|
2011-07-13 14:05:07 +02:00
|
|
|
X11DRV_wglSetPixelFormatWINE, /* pwglSetPixelFormatWINE */
|
|
|
|
X11DRV_wglShareLists, /* pwglShareLists */
|
|
|
|
X11DRV_wglUseFontBitmapsA, /* pwglUseFontBitmapsA */
|
|
|
|
X11DRV_wglUseFontBitmapsW, /* pwglUseFontBitmapsW */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* X11DRV_get_gdi_driver
|
|
|
|
*/
|
|
|
|
const struct gdi_dc_funcs * CDECL X11DRV_get_gdi_driver( unsigned int version )
|
|
|
|
{
|
|
|
|
if (version != WINE_GDI_DRIVER_VERSION)
|
|
|
|
{
|
|
|
|
ERR( "version mismatch, gdi32 wants %u but winex11 has %u\n", version, WINE_GDI_DRIVER_VERSION );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return &x11drv_funcs;
|
|
|
|
}
|