Reimplemented DXGrab with improvements; it no longer depends on
XVidMode, and it releases the grab if the app exits full-screen DirectDraw. Also made the UseDGA option available for AppDefaults configuration.
This commit is contained in:
parent
b3086a7593
commit
6753dea682
|
@ -18,10 +18,11 @@
|
|||
#include "wingdi.h"
|
||||
#include "ddrawi.h"
|
||||
#include "debugtools.h"
|
||||
#include "options.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(x11drv);
|
||||
|
||||
extern int usedga;
|
||||
|
||||
LPDDHALMODEINFO xf86dga2_modes;
|
||||
unsigned xf86dga2_mode_count;
|
||||
static XDGAMode* modes;
|
||||
|
@ -52,7 +53,7 @@ void X11DRV_XF86DGA2_Init(void)
|
|||
/* if in desktop mode, don't use DGA */
|
||||
if (X11DRV_GetXRootWindow() != DefaultRootWindow(display)) return;
|
||||
|
||||
if (!PROFILE_GetWineIniBool("x11drv", "UseDGA", 1)) return;
|
||||
if (!usedga) return;
|
||||
|
||||
if (!TSXDGAQueryExtension(display, &dga_event, &dga_error)) return;
|
||||
|
||||
|
|
|
@ -18,10 +18,13 @@
|
|||
#include "wingdi.h"
|
||||
#include "ddrawi.h"
|
||||
#include "bitmap.h"
|
||||
#include "win.h"
|
||||
#include "debugtools.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(x11drv);
|
||||
|
||||
extern int dxgrab;
|
||||
|
||||
LPDDRAWI_DDRAWSURFACE_LCL X11DRV_DD_Primary;
|
||||
LPDDRAWI_DDRAWSURFACE_GBL X11DRV_DD_PrimaryGbl;
|
||||
HWND X11DRV_DD_PrimaryWnd;
|
||||
|
@ -43,6 +46,28 @@ static void SetPrimaryDIB(HBITMAP hBmp)
|
|||
}
|
||||
}
|
||||
|
||||
static void GrabPointer(HWND hWnd)
|
||||
{
|
||||
if (hWnd) {
|
||||
WND *tmpWnd;
|
||||
Window win;
|
||||
/* find the X11 window that ddraw uses */
|
||||
tmpWnd = WIN_FindWndPtr(hWnd);
|
||||
win = X11DRV_WND_GetXWindow(tmpWnd);
|
||||
TRACE("WND: %p win: %ld\n", tmpWnd, win);
|
||||
WIN_ReleaseWndPtr(tmpWnd);
|
||||
if (!win) {
|
||||
TRACE("host off desktop\n");
|
||||
tmpWnd = WIN_FindWndPtr(GetDesktopWindow());
|
||||
win = X11DRV_WND_GetXWindow(tmpWnd);
|
||||
TRACE("Owner WND: %p win: %ld\n", tmpWnd, win);
|
||||
WIN_ReleaseWndPtr(tmpWnd);
|
||||
}
|
||||
TSXGrabPointer(display, win, True, 0, GrabModeAsync, GrabModeAsync, win, None, CurrentTime);
|
||||
}
|
||||
else TSXUngrabPointer(display, CurrentTime);
|
||||
}
|
||||
|
||||
static DWORD PASCAL X11DRV_DDHAL_DestroyDriver(LPDDHAL_DESTROYDRIVERDATA data)
|
||||
{
|
||||
data->ddRVal = DD_OK;
|
||||
|
@ -57,6 +82,7 @@ static DWORD PASCAL X11DRV_DDHAL_CreateSurface(LPDDHAL_CREATESURFACEDATA data)
|
|||
X11DRV_DD_PrimaryGbl = X11DRV_DD_Primary->lpGbl;
|
||||
SetPrimaryDIB(GET_LPDDRAWSURFACE_GBL_MORE(X11DRV_DD_PrimaryGbl)->hKernelSurface);
|
||||
X11DRV_DD_UserClass = GlobalFindAtomA("WINE_DDRAW");
|
||||
if (dxgrab) GrabPointer(X11DRV_DD_PrimaryWnd);
|
||||
}
|
||||
data->ddRVal = DD_OK;
|
||||
return DDHAL_DRIVER_NOTHANDLED;
|
||||
|
@ -94,6 +120,7 @@ static DWORD PASCAL X11DRV_DDHAL_DestroySurface(LPDDHAL_DESTROYSURFACEDATA data)
|
|||
X11DRV_DD_PrimaryGbl = NULL;
|
||||
SetPrimaryDIB(0);
|
||||
X11DRV_DD_UserClass = 0;
|
||||
if (dxgrab) GrabPointer(0);
|
||||
}
|
||||
data->ddRVal = DD_OK;
|
||||
return DDHAL_DRIVER_HANDLED;
|
||||
|
|
|
@ -56,6 +56,7 @@ unsigned int screen_width;
|
|||
unsigned int screen_height;
|
||||
unsigned int screen_depth;
|
||||
Window root_window;
|
||||
int dxgrab, usedga;
|
||||
|
||||
unsigned int X11DRV_server_startticks;
|
||||
|
||||
|
@ -207,6 +208,12 @@ static void setup_options(void)
|
|||
if (!IS_OPTION_FALSE(buffer[0])) desktop_geometry = strdup(buffer);
|
||||
}
|
||||
|
||||
if (!get_config_key( hkey, appkey, "DXGrab", buffer, sizeof(buffer) ))
|
||||
dxgrab = IS_OPTION_TRUE( buffer[0] );
|
||||
|
||||
if (!get_config_key( hkey, appkey, "UseDGA", buffer, sizeof(buffer) ))
|
||||
usedga = IS_OPTION_TRUE( buffer[0] );
|
||||
|
||||
screen_depth = 0;
|
||||
if (!get_config_key( hkey, appkey, "ScreenDepth", buffer, sizeof(buffer) ))
|
||||
screen_depth = atoi(buffer);
|
||||
|
|
|
@ -116,7 +116,11 @@ void X11DRV_XF86VM_SetCurrentMode(int mode)
|
|||
if (!xf86vm_modes) return; /* no XVidMode */
|
||||
|
||||
TSXF86VidModeSwitchToMode(display, DefaultScreen(display), modes[mode]);
|
||||
#if 0 /* it is said that SetViewPort causes problems with some X servers */
|
||||
TSXF86VidModeSetViewPort(display, DefaultScreen(display), 0, 0);
|
||||
#else
|
||||
TSXWarpPointer(display, None, DefaultRootWindow(display), 0, 0, 0, 0, 0, 0);
|
||||
#endif
|
||||
TSXSync(display, False);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue