diff options
Diffstat (limited to 'xorg-server/hw/xwin')
54 files changed, 1730 insertions, 2711 deletions
diff --git a/xorg-server/hw/xwin/InitInput.c b/xorg-server/hw/xwin/InitInput.c index 6a850cd44..bce7ac54e 100644 --- a/xorg-server/hw/xwin/InitInput.c +++ b/xorg-server/hw/xwin/InitInput.c @@ -30,10 +30,8 @@ #include <xwin-config.h> #endif #include "win.h" -#ifdef XWIN_CLIPBOARD -# include "../../Xext/xf86miscproc.h" -#endif #include "dixstruct.h" +#include "inputstr.h" /* @@ -104,6 +102,11 @@ ProcessInputEvents (void) #endif } +void DDXRingBell(int volume, int pitch, int duration) +{ + /* winKeybdBell is used instead */ + return; +} int TimeSinceLastInputEvent () @@ -147,8 +150,10 @@ InitInput (int argc, char *argv[]) RegisterPointerDevice (pMouse); RegisterKeyboardDevice (pKeyboard); - miRegisterPointerDevice (screenInfo.screens[0], pMouse); - mieqInit ((DevicePtr)pKeyboard, (DevicePtr)pMouse); + pMouse->name = strdup("Windows mouse"); + pKeyboard->name = strdup("Windows keyboard"); + + mieqInit (); /* Initialize the mode key states */ winInitializeModeKeyStates (); diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c index d2159813c..545437437 100644 --- a/xorg-server/hw/xwin/InitOutput.c +++ b/xorg-server/hw/xwin/InitOutput.c @@ -1,6 +1,7 @@ /* Copyright 1993, 1998 The Open Group +Copyright (C) Colin Harrison 2005-2008 Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that @@ -45,14 +46,16 @@ from The Open Group. #if defined(XKB) && defined(WIN32) #include <xkbsrv.h> #endif + #ifdef RELOCATE_PROJECTROOT +#undef Status #include <shlobj.h> -typedef HRESULT (*SHGETFOLDERPATHPROC)( +typedef HRESULT (__stdcall * SHGETFOLDERPATHPROC)( HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, - LPTSTR pszPath + LPSTR pszPath ); #endif @@ -73,6 +76,7 @@ extern int g_iLogVerbose; Bool g_fLogInited; extern Bool g_fXdmcpEnabled; +extern Bool g_fAuthEnabled; #ifdef HAS_DEVWINDOWS extern int g_fdMessageQueue; #endif @@ -132,6 +136,9 @@ const char * winGetBaseDir(void); #endif +static +void glx_debugging(void); + /* * For the depth 24 pixmap we default to 32 bits per pixel, but * we change this pixmap format later if we detect that the display @@ -241,7 +248,7 @@ ddxGiveUp (void) #endif if (!g_fLogInited) { - LogInit (g_pszLogFile, NULL); + g_pszLogFile = LogInit (g_pszLogFile, NULL); g_fLogInited = TRUE; } LogClose (); @@ -424,7 +431,17 @@ winFixupPaths (void) #ifdef READ_FONTDIRS { /* Open fontpath configuration file */ +#if defined WIN32 && defined __MINGW32__ + static Bool once = False; + char buffer[MAX_PATH]; + snprintf(buffer, sizeof(buffer), "%s\\font-dirs", basedir); + buffer[sizeof(buffer)-1] = 0; + FILE *fontdirs = fopen(buffer, "rt"); + if (once) fontdirs = NULL; + else once = True; +#else FILE *fontdirs = fopen(ETCX11DIR "/font-dirs", "rt"); +#endif if (fontdirs != NULL) { char buffer[256]; @@ -624,6 +641,14 @@ winFixupPaths (void) buffer[sizeof(buffer)-1] = 0; putenv(buffer); } + if (getenv("XHOSTPREFIX") == NULL) + { + char buffer[MAX_PATH]; + snprintf(buffer, sizeof(buffer), "XHOSTPREFIX=%s\\X", + basedir); + buffer[sizeof(buffer)-1] = 0; + putenv(buffer); + } if (getenv("HOME") == NULL) { HMODULE shfolder; @@ -661,9 +686,10 @@ winFixupPaths (void) if (size && size < sizeof(buffer)) { snprintf(buffer + size, sizeof(buffer) - size, - "XWin.%s.log", display); + "VCXSrv.%s.log", display); buffer[sizeof(buffer)-1] = 0; g_pszLogFile = buffer; + GetLongPathName(buffer, buffer, MAX_PATH); winMsg (X_DEFAULT, "Logfile set to \"%s\"\n", g_pszLogFile); } } @@ -671,7 +697,7 @@ winFixupPaths (void) { static char xkbbasedir[MAX_PATH]; - snprintf(xkbbasedir, sizeof(xkbbasedir), "%s\\xkb", basedir); + snprintf(xkbbasedir, sizeof(xkbbasedir), "%s\\xkbdata", basedir); if (sizeof(xkbbasedir) > 0) xkbbasedir[sizeof(xkbbasedir)-1] = 0; XkbBaseDirectory = xkbbasedir; @@ -687,9 +713,6 @@ OsVendorInit (void) /* Re-initialize global variables on server reset */ winInitializeGlobals (); - LogInit (NULL, NULL); - LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose); - winFixupPaths(); #ifdef DDXOSVERRORF @@ -704,7 +727,7 @@ OsVendorInit (void) * avoid the second call */ g_fLogInited = TRUE; - LogInit (g_pszLogFile, NULL); + g_pszLogFile = LogInit (g_pszLogFile, NULL); } LogSetParameter (XLOG_FLUSH, 1); LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose); @@ -877,7 +900,7 @@ winUseMsg (void) #endif ErrorF ("-logfile filename\n" - "\tWrite logmessages to <filename> instead of /tmp/Xwin.log.\n"); + "\tWrite logmessages to <filename>.\n"); ErrorF ("-logverbose verbosity\n" "\tSet the verbosity of logmessages. [NOTE: Only a few messages\n" @@ -907,7 +930,7 @@ ddxUseMsg(void) /* Log file will not be opened for UseMsg unless we open it now */ if (!g_fLogInited) { - LogInit (g_pszLogFile, NULL); + g_pszLogFile = LogInit (g_pszLogFile, NULL); g_fLogInited = TRUE; } LogClose (); @@ -915,9 +938,9 @@ ddxUseMsg(void) /* Notify user where UseMsg text can be found.*/ if (!g_fNoHelpMessageBox) winMessageBoxF ("The " PROJECT_NAME " help text has been printed to " - "/tmp/XWin.log.\n" - "Please open /tmp/XWin.log to read the help text.\n", - MB_ICONINFORMATION); + "%s.\n" + "Please open %s to read the help text.\n", + MB_ICONINFORMATION, g_pszLogFile, g_pszLogFile); } /* ddxInitGlobals - called by |InitGlobals| from os/util.c */ @@ -965,9 +988,6 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) if (!winReadConfigfile ()) winErrorFVerb (1, "InitOutput - Error reading config file\n"); #else - winMsg(X_INFO, "XF86Config is not supported\n"); - winMsg(X_INFO, "See http://x.cygwin.com/docs/faq/cygwin-x-faq.html " - "for more information\n"); winConfigFiles (); #endif @@ -1031,7 +1051,7 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) #if defined(XCSECURITY) /* Generate a cookie used by internal clients for authorization */ - if (g_fXdmcpEnabled) + if (g_fXdmcpEnabled || g_fAuthEnabled) winGenerateAuthorization (); #endif @@ -1043,6 +1063,8 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) * Apply locale specified in LANG environment variable. */ setlocale (LC_ALL, ""); + + glx_debugging(); } #endif @@ -1071,7 +1093,7 @@ winCheckDisplayNumber () /* Check display range */ nDisp = atoi (display); - if (nDisp < 0 || nDisp > 65535) + if (nDisp < 0 || nDisp > 59535) { ErrorF ("winCheckDisplayNumber - Bad display number: %d\n", nDisp); return FALSE; @@ -1118,7 +1140,7 @@ winCheckDisplayNumber () if (GetLastError () == ERROR_ALREADY_EXISTS) { ErrorF ("winCheckDisplayNumber - " - PROJECT_NAME " is already running on display %d\n", + "VCXsrv, Xming or Cygwin/X is already running on display %d\n", nDisp); return FALSE; } @@ -1126,19 +1148,21 @@ winCheckDisplayNumber () return TRUE; } -#ifdef DPMSExtension -Bool DPMSSupported(void) -{ - return FALSE; -} +/* GLX debugging helpers */ +#include <../glx/glapi.h> -void DPMSSet(int level) -{ - return; +static +void warn_func(void * p1, const char *format, ...) { + va_list v; + va_start(v, format); + vfprintf(stderr, format, v); + va_end(v); + fprintf(stderr,"\n"); } -int DPMSGet(int *plevel) +static +void glx_debugging(void) { - return 0; + _glapi_set_warning_func(warn_func); + _glapi_noop_enable_warnings(TRUE); } -#endif diff --git a/xorg-server/hw/xwin/X.ico b/xorg-server/hw/xwin/X.ico Binary files differindex d47168fca..5d69818b5 100644 --- a/xorg-server/hw/xwin/X.ico +++ b/xorg-server/hw/xwin/X.ico diff --git a/xorg-server/hw/xwin/XWin.exe.manifest b/xorg-server/hw/xwin/XWin.exe.manifest new file mode 100644 index 000000000..221150d52 --- /dev/null +++ b/xorg-server/hw/xwin/XWin.exe.manifest @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <description>The XWin X Windows server for Cygwin.</description> + <dependency> + <dependentAssembly> + <assemblyIdentity + type="win32" + name="Microsoft.Windows.Common-Controls" + version="6.0.0.0" + processorArchitecture="X86" + publicKeyToken="6595b64144ccf1df" + language="*" + /> + </dependentAssembly> + </dependency> +</assembly> diff --git a/xorg-server/hw/xwin/XWin.rc b/xorg-server/hw/xwin/XWin.rc index 749c0f5f5..cbe5244e9 100644 --- a/xorg-server/hw/xwin/XWin.rc +++ b/xorg-server/hw/xwin/XWin.rc @@ -1,5 +1,6 @@ /* *Copyright (C) 2002-2004 Harold L Hunt II All Rights Reserved. + *Copyright (C) 2008 Yaakov Selkowitz All Rights Reserved * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -20,62 +21,58 @@ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - *Except as contained in this notice, the name of Harold L Hunt II + *Except as contained in this notice, the names of the authors *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. + *from the authors. * - * Authors: Harold L Hunt II + * Authors: Harold L Hunt II, Yaakov Selkowitz */ -#include "windows.h" +#include <windows.h> #include "winresource.h" +#include "xwin-config.h" /* * Dialogs */ /* About */ -ABOUT_BOX DIALOG DISCARDABLE 32, 32, 240, 105 +ABOUT_BOX DIALOGEX 32, 32, 260, 95 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP | DS_CENTERMOUSE -CAPTION "About " PROJECT_NAME -FONT 8, "MS Sans Serif" +CAPTION "About XSrv" +FONT 8, "MS Shell Dlg 2" BEGIN - CONTROL PROJECT_NAME " Website", ID_ABOUT_WEBSITE, "Button", - BS_OWNERDRAW | WS_TABSTOP, 30, 45, 75, 15 - CONTROL "Change Log", ID_ABOUT_CHANGELOG, "Button", - BS_OWNERDRAW | WS_TABSTOP, 135, 45, 75, 15 - CONTROL "User's Guide", ID_ABOUT_UG, "Button", - BS_OWNERDRAW | WS_TABSTOP, 30, 65, 75, 15 - CONTROL "FAQ", ID_ABOUT_FAQ, "Button", - BS_OWNERDRAW | WS_TABSTOP, 135, 65, 75, 15 - - DEFPUSHBUTTON "Dismiss", IDOK, 95, 85, 50, 15 - - CTEXT "Welcome to the preliminary About box for the " PROJECT_NAME " X Server. This dialog was created on 2004/03/25 and will eventually be filled with more useful information. For now, use the links below to learn more about the " PROJECT_NAME " project.", IDC_STATIC, 5, 5, 230, 35 + CONTROL IDI_XWIN, IDC_STATIC, "Static", SS_ICON, 8, 8, 32, 32 + LTEXT "XSrv X Server ", IDC_STATIC, 36, 8, 220, 8 + LTEXT "Version 0.0 (1 Jan 2009)", IDC_STATIC, 36, 18, 220, 8 + LTEXT "This product is licensed under the terms of the MIT/X11 License.", IDC_STATIC, 36, 38, 220, 20 + CONTROL __VENDORDWEBSUPPORT__, ID_ABOUT_WEBSITE, "Button", + BS_OWNERDRAW | WS_TABSTOP, 36, 58, 68, 8 + DEFPUSHBUTTON "OK", IDOK, 105, 75, 50, 15 END /* Depth change */ -DEPTH_CHANGE_BOX DIALOG DISCARDABLE 32, 32, 180, 100 +DEPTH_CHANGE_BOX DIALOGEX 32, 32, 180, 100 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | DS_CENTERMOUSE -FONT 8, "MS Sans Serif" -CAPTION PROJECT_NAME +FONT 8, "MS Shell Dlg 2" +CAPTION "XSrv" BEGIN DEFPUSHBUTTON "Dismiss", IDOK, 66, 80, 50, 14 - CTEXT PROJECT_NAME, IDC_STATIC, 40, 12, 100, 8 + CTEXT "VCXSrv", IDC_STATIC, 40, 12, 100, 8 CTEXT "Disruptive screen configuration change.", IDC_STATIC, 7, 40, 166, 8 - CTEXT "Restore previous resolution to use " PROJECT_NAME ".", IDC_STATIC, 7, 52, 166, 8 + CTEXT "Restore previous resolution to use VCXSrv.", IDC_STATIC, 7, 52, 166, 8 END /* Exit */ -EXIT_DIALOG DIALOG DISCARDABLE 32, 32, 180, 78 +EXIT_DIALOG DIALOGEX 32, 32, 180, 78 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP | DS_CENTERMOUSE -FONT 8, "MS Sans Serif" -CAPTION PROJECT_NAME " - Exit?" +FONT 8, "MS Shell Dlg 2" +CAPTION "Exit VCXSrv?" BEGIN PUSHBUTTON "E&xit", IDOK, 55, 56, 30, 14 DEFPUSHBUTTON "&Cancel", IDCANCEL, 95, 56, 30, 14 @@ -89,14 +86,14 @@ END * Menus */ -IDM_TRAYICON_MENU MENU DISCARDABLE +IDM_TRAYICON_MENU MENU BEGIN POPUP "TRAYICON_MENU" BEGIN MENUITEM "&Hide Root Window", ID_APP_HIDE_ROOT MENUITEM "&About...", ID_APP_ABOUT MENUITEM SEPARATOR - MENUITEM "E&xit", ID_APP_EXIT + MENUITEM "E&xit...", ID_APP_EXIT END END @@ -105,5 +102,5 @@ END * Icons */ -IDI_XWIN ICON DISCARDABLE "X.ico" -IDI_XWIN_BOXED ICON DISCARDABLE "X-boxed.ico" +IDI_XWIN ICON "X.ico" +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "XWin.exe.manifest" diff --git a/xorg-server/hw/xwin/ddraw.h b/xorg-server/hw/xwin/ddraw.h deleted file mode 100644 index 2eb7c2674..000000000 --- a/xorg-server/hw/xwin/ddraw.h +++ /dev/null @@ -1,2106 +0,0 @@ -#ifndef __XWIN_DDRAW_H -#define __XWIN_DDRAW_H - -#include <winnt.h> -#include <wingdi.h> -#include <objbase.h> - -#if defined(NONAMELESSUNION) && !defined(DUMMYUNIONNAME1) -#define DUMMYUNIONNAME1 u1 -#endif - -#define ICOM_CALL_( xfn, p, args) (p)->lpVtbl->xfn args - -# ifdef UNICODE -# define WINELIB_NAME_AW(func) func##W -# else -# define WINELIB_NAME_AW(func) func##A -# endif /* UNICODE */ -#define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type; - -#ifdef __cplusplus -extern "C" { -#endif /* defined(__cplusplus) */ - -#ifndef DIRECTDRAW_VERSION -#define DIRECTDRAW_VERSION 0x0700 -#endif /* DIRECTDRAW_VERSION */ - -/***************************************************************************** - * Predeclare the interfaces - */ -DEFINE_GUID( CLSID_DirectDraw, 0xD7B70EE0,0x4340,0x11CF,0xB0,0x63,0x00,0x20,0xAF,0xC2,0xCD,0x35 ); -DEFINE_GUID( CLSID_DirectDraw7, 0x3C305196,0x50DB,0x11D3,0x9C,0xFE,0x00,0xC0,0x4F,0xD9,0x30,0xC5 ); -DEFINE_GUID( CLSID_DirectDrawClipper, 0x593817A0,0x7DB3,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xb9,0x33,0x56 ); -DEFINE_GUID( IID_IDirectDraw, 0x6C14DB80,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); -DEFINE_GUID( IID_IDirectDraw2, 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 ); -DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 ); -DEFINE_GUID( IID_IDirectDraw7, 0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b ); -DEFINE_GUID( IID_IDirectDrawSurface, 0x6C14DB81,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); -DEFINE_GUID( IID_IDirectDrawSurface2, 0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27 ); -DEFINE_GUID( IID_IDirectDrawSurface3, 0xDA044E00,0x69B2,0x11D0,0xA1,0xD5,0x00,0xAA,0x00,0xB8,0xDF,0xBB ); -DEFINE_GUID( IID_IDirectDrawSurface4, 0x0B2B8630,0xAD35,0x11D0,0x8E,0xA6,0x00,0x60,0x97,0x97,0xEA,0x5B ); -DEFINE_GUID( IID_IDirectDrawSurface7, 0x06675a80,0x3b9b,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b ); -DEFINE_GUID( IID_IDirectDrawPalette, 0x6C14DB84,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); -DEFINE_GUID( IID_IDirectDrawClipper, 0x6C14DB85,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); -DEFINE_GUID( IID_IDirectDrawColorControl,0x4B9F0EE0,0x0D7E,0x11D0,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8 ); -DEFINE_GUID( IID_IDirectDrawGammaControl,0x69C11C3E,0xB46B,0x11D1,0xAD,0x7A,0x00,0xC0,0x4F,0xC2,0x9B,0x4E ); - -typedef struct IDirectDraw *LPDIRECTDRAW; -typedef struct IDirectDraw2 *LPDIRECTDRAW2; -typedef struct IDirectDraw4 *LPDIRECTDRAW4; -typedef struct IDirectDraw7 *LPDIRECTDRAW7; -typedef struct IDirectDrawClipper *LPDIRECTDRAWCLIPPER; -typedef struct IDirectDrawPalette *LPDIRECTDRAWPALETTE; -typedef struct IDirectDrawSurface *LPDIRECTDRAWSURFACE; -typedef struct IDirectDrawSurface2 *LPDIRECTDRAWSURFACE2; -typedef struct IDirectDrawSurface3 *LPDIRECTDRAWSURFACE3; -typedef struct IDirectDrawSurface4 *LPDIRECTDRAWSURFACE4; -typedef struct IDirectDrawSurface7 *LPDIRECTDRAWSURFACE7; -typedef struct IDirectDrawColorControl *LPDIRECTDRAWCOLORCONTROL; -typedef struct IDirectDrawGammaControl *LPDIRECTDRAWGAMMACONTROL; - - -#define DDENUMRET_CANCEL 0 -#define DDENUMRET_OK 1 - -#define DD_OK 0 - - -#define _FACDD 0x876 -#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) - -#define DDERR_ALREADYINITIALIZED MAKE_DDHRESULT( 5 ) -#define DDERR_CANNOTATTACHSURFACE MAKE_DDHRESULT( 10 ) -#define DDERR_CANNOTDETACHSURFACE MAKE_DDHRESULT( 20 ) -#define DDERR_CURRENTLYNOTAVAIL MAKE_DDHRESULT( 40 ) -#define DDERR_EXCEPTION MAKE_DDHRESULT( 55 ) -#define DDERR_GENERIC E_FAIL -#define DDERR_HEIGHTALIGN MAKE_DDHRESULT( 90 ) -#define DDERR_INCOMPATIBLEPRIMARY MAKE_DDHRESULT( 95 ) -#define DDERR_INVALIDCAPS MAKE_DDHRESULT( 100 ) -#define DDERR_INVALIDCLIPLIST MAKE_DDHRESULT( 110 ) -#define DDERR_INVALIDMODE MAKE_DDHRESULT( 120 ) -#define DDERR_INVALIDOBJECT MAKE_DDHRESULT( 130 ) -#define DDERR_INVALIDPARAMS E_INVALIDARG -#define DDERR_INVALIDPIXELFORMAT MAKE_DDHRESULT( 145 ) -#define DDERR_INVALIDRECT MAKE_DDHRESULT( 150 ) -#define DDERR_LOCKEDSURFACES MAKE_DDHRESULT( 160 ) -#define DDERR_NO3D MAKE_DDHRESULT( 170 ) -#define DDERR_NOALPHAHW MAKE_DDHRESULT( 180 ) -#define DDERR_NOSTEREOHARDWARE MAKE_DDHRESULT( 181 ) -#define DDERR_NOSURFACELEFT MAKE_DDHRESULT( 182 ) -#define DDERR_NOCLIPLIST MAKE_DDHRESULT( 205 ) -#define DDERR_NOCOLORCONVHW MAKE_DDHRESULT( 210 ) -#define DDERR_NOCOOPERATIVELEVELSET MAKE_DDHRESULT( 212 ) -#define DDERR_NOCOLORKEY MAKE_DDHRESULT( 215 ) -#define DDERR_NOCOLORKEYHW MAKE_DDHRESULT( 220 ) -#define DDERR_NODIRECTDRAWSUPPORT MAKE_DDHRESULT( 222 ) -#define DDERR_NOEXCLUSIVEMODE MAKE_DDHRESULT( 225 ) -#define DDERR_NOFLIPHW MAKE_DDHRESULT( 230 ) -#define DDERR_NOGDI MAKE_DDHRESULT( 240 ) -#define DDERR_NOMIRRORHW MAKE_DDHRESULT( 250 ) -#define DDERR_NOTFOUND MAKE_DDHRESULT( 255 ) -#define DDERR_NOOVERLAYHW MAKE_DDHRESULT( 260 ) -#define DDERR_OVERLAPPINGRECTS MAKE_DDHRESULT( 270 ) -#define DDERR_NORASTEROPHW MAKE_DDHRESULT( 280 ) -#define DDERR_NOROTATIONHW MAKE_DDHRESULT( 290 ) -#define DDERR_NOSTRETCHHW MAKE_DDHRESULT( 310 ) -#define DDERR_NOT4BITCOLOR MAKE_DDHRESULT( 316 ) -#define DDERR_NOT4BITCOLORINDEX MAKE_DDHRESULT( 317 ) -#define DDERR_NOT8BITCOLOR MAKE_DDHRESULT( 320 ) -#define DDERR_NOTEXTUREHW MAKE_DDHRESULT( 330 ) -#define DDERR_NOVSYNCHW MAKE_DDHRESULT( 335 ) -#define DDERR_NOZBUFFERHW MAKE_DDHRESULT( 340 ) -#define DDERR_NOZOVERLAYHW MAKE_DDHRESULT( 350 ) -#define DDERR_OUTOFCAPS MAKE_DDHRESULT( 360 ) -#define DDERR_OUTOFMEMORY E_OUTOFMEMORY -#define DDERR_OUTOFVIDEOMEMORY MAKE_DDHRESULT( 380 ) -#define DDERR_OVERLAYCANTCLIP MAKE_DDHRESULT( 382 ) -#define DDERR_OVERLAYCOLORKEYONLYONEACTIVE MAKE_DDHRESULT( 384 ) -#define DDERR_PALETTEBUSY MAKE_DDHRESULT( 387 ) -#define DDERR_COLORKEYNOTSET MAKE_DDHRESULT( 400 ) -#define DDERR_SURFACEALREADYATTACHED MAKE_DDHRESULT( 410 ) -#define DDERR_SURFACEALREADYDEPENDENT MAKE_DDHRESULT( 420 ) -#define DDERR_SURFACEBUSY MAKE_DDHRESULT( 430 ) -#define DDERR_CANTLOCKSURFACE MAKE_DDHRESULT( 435 ) -#define DDERR_SURFACEISOBSCURED MAKE_DDHRESULT( 440 ) -#define DDERR_SURFACELOST MAKE_DDHRESULT( 450 ) -#define DDERR_SURFACENOTATTACHED MAKE_DDHRESULT( 460 ) -#define DDERR_TOOBIGHEIGHT MAKE_DDHRESULT( 470 ) -#define DDERR_TOOBIGSIZE MAKE_DDHRESULT( 480 ) -#define DDERR_TOOBIGWIDTH MAKE_DDHRESULT( 490 ) -#define DDERR_UNSUPPORTED E_NOTIMPL -#define DDERR_UNSUPPORTEDFORMAT MAKE_DDHRESULT( 510 ) -#define DDERR_UNSUPPORTEDMASK MAKE_DDHRESULT( 520 ) -#define DDERR_INVALIDSTREAM MAKE_DDHRESULT( 521 ) -#define DDERR_VERTICALBLANKINPROGRESS MAKE_DDHRESULT( 537 ) -#define DDERR_WASSTILLDRAWING MAKE_DDHRESULT( 540 ) -#define DDERR_DDSCAPSCOMPLEXREQUIRED MAKE_DDHRESULT( 542 ) -#define DDERR_XALIGN MAKE_DDHRESULT( 560 ) -#define DDERR_INVALIDDIRECTDRAWGUID MAKE_DDHRESULT( 561 ) -#define DDERR_DIRECTDRAWALREADYCREATED MAKE_DDHRESULT( 562 ) -#define DDERR_NODIRECTDRAWHW MAKE_DDHRESULT( 563 ) -#define DDERR_PRIMARYSURFACEALREADYEXISTS MAKE_DDHRESULT( 564 ) -#define DDERR_NOEMULATION MAKE_DDHRESULT( 565 ) -#define DDERR_REGIONTOOSMALL MAKE_DDHRESULT( 566 ) -#define DDERR_CLIPPERISUSINGHWND MAKE_DDHRESULT( 567 ) -#define DDERR_NOCLIPPERATTACHED MAKE_DDHRESULT( 568 ) -#define DDERR_NOHWND MAKE_DDHRESULT( 569 ) -#define DDERR_HWNDSUBCLASSED MAKE_DDHRESULT( 570 ) -#define DDERR_HWNDALREADYSET MAKE_DDHRESULT( 571 ) -#define DDERR_NOPALETTEATTACHED MAKE_DDHRESULT( 572 ) -#define DDERR_NOPALETTEHW MAKE_DDHRESULT( 573 ) -#define DDERR_BLTFASTCANTCLIP MAKE_DDHRESULT( 574 ) -#define DDERR_NOBLTHW MAKE_DDHRESULT( 575 ) -#define DDERR_NODDROPSHW MAKE_DDHRESULT( 576 ) -#define DDERR_OVERLAYNOTVISIBLE MAKE_DDHRESULT( 577 ) -#define DDERR_NOOVERLAYDEST MAKE_DDHRESULT( 578 ) -#define DDERR_INVALIDPOSITION MAKE_DDHRESULT( 579 ) -#define DDERR_NOTAOVERLAYSURFACE MAKE_DDHRESULT( 580 ) -#define DDERR_EXCLUSIVEMODEALREADYSET MAKE_DDHRESULT( 581 ) -#define DDERR_NOTFLIPPABLE MAKE_DDHRESULT( 582 ) -#define DDERR_CANTDUPLICATE MAKE_DDHRESULT( 583 ) -#define DDERR_NOTLOCKED MAKE_DDHRESULT( 584 ) -#define DDERR_CANTCREATEDC MAKE_DDHRESULT( 585 ) -#define DDERR_NODC MAKE_DDHRESULT( 586 ) -#define DDERR_WRONGMODE MAKE_DDHRESULT( 587 ) -#define DDERR_IMPLICITLYCREATED MAKE_DDHRESULT( 588 ) -#define DDERR_NOTPALETTIZED MAKE_DDHRESULT( 589 ) -#define DDERR_UNSUPPORTEDMODE MAKE_DDHRESULT( 590 ) -#define DDERR_NOMIPMAPHW MAKE_DDHRESULT( 591 ) -#define DDERR_INVALIDSURFACETYPE MAKE_DDHRESULT( 592 ) -#define DDERR_NOOPTIMIZEHW MAKE_DDHRESULT( 600 ) -#define DDERR_NOTLOADED MAKE_DDHRESULT( 601 ) -#define DDERR_NOFOCUSWINDOW MAKE_DDHRESULT( 602 ) -#define DDERR_NOTONMIPMAPSUBLEVEL MAKE_DDHRESULT( 603 ) -#define DDERR_DCALREADYCREATED MAKE_DDHRESULT( 620 ) -#define DDERR_NONONLOCALVIDMEM MAKE_DDHRESULT( 630 ) -#define DDERR_CANTPAGELOCK MAKE_DDHRESULT( 640 ) -#define DDERR_CANTPAGEUNLOCK MAKE_DDHRESULT( 660 ) -#define DDERR_NOTPAGELOCKED MAKE_DDHRESULT( 680 ) -#define DDERR_MOREDATA MAKE_DDHRESULT( 690 ) -#define DDERR_EXPIRED MAKE_DDHRESULT( 691 ) -#define DDERR_TESTFINISHED MAKE_DDHRESULT( 692 ) -#define DDERR_NEWMODE MAKE_DDHRESULT( 693 ) -#define DDERR_D3DNOTINITIALIZED MAKE_DDHRESULT( 694 ) -#define DDERR_VIDEONOTACTIVE MAKE_DDHRESULT( 695 ) -#define DDERR_NOMONITORINFORMATION MAKE_DDHRESULT( 696 ) -#define DDERR_NODRIVERSUPPORT MAKE_DDHRESULT( 697 ) -#define DDERR_DEVICEDOESNTOWNSURFACE MAKE_DDHRESULT( 699 ) -#define DDERR_NOTINITIALIZED CO_E_NOTINITIALIZED - -/* dwFlags for Blt* */ -#define DDBLT_ALPHADEST 0x00000001 -#define DDBLT_ALPHADESTCONSTOVERRIDE 0x00000002 -#define DDBLT_ALPHADESTNEG 0x00000004 -#define DDBLT_ALPHADESTSURFACEOVERRIDE 0x00000008 -#define DDBLT_ALPHAEDGEBLEND 0x00000010 -#define DDBLT_ALPHASRC 0x00000020 -#define DDBLT_ALPHASRCCONSTOVERRIDE 0x00000040 -#define DDBLT_ALPHASRCNEG 0x00000080 -#define DDBLT_ALPHASRCSURFACEOVERRIDE 0x00000100 -#define DDBLT_ASYNC 0x00000200 -#define DDBLT_COLORFILL 0x00000400 -#define DDBLT_DDFX 0x00000800 -#define DDBLT_DDROPS 0x00001000 -#define DDBLT_KEYDEST 0x00002000 -#define DDBLT_KEYDESTOVERRIDE 0x00004000 -#define DDBLT_KEYSRC 0x00008000 -#define DDBLT_KEYSRCOVERRIDE 0x00010000 -#define DDBLT_ROP 0x00020000 -#define DDBLT_ROTATIONANGLE 0x00040000 -#define DDBLT_ZBUFFER 0x00080000 -#define DDBLT_ZBUFFERDESTCONSTOVERRIDE 0x00100000 -#define DDBLT_ZBUFFERDESTOVERRIDE 0x00200000 -#define DDBLT_ZBUFFERSRCCONSTOVERRIDE 0x00400000 -#define DDBLT_ZBUFFERSRCOVERRIDE 0x00800000 -#define DDBLT_WAIT 0x01000000 -#define DDBLT_DEPTHFILL 0x02000000 -#define DDBLT_DONOTWAIT 0x08000000 - -/* dwTrans for BltFast */ -#define DDBLTFAST_NOCOLORKEY 0x00000000 -#define DDBLTFAST_SRCCOLORKEY 0x00000001 -#define DDBLTFAST_DESTCOLORKEY 0x00000002 -#define DDBLTFAST_WAIT 0x00000010 -#define DDBLTFAST_DONOTWAIT 0x00000020 - -/* dwFlags for Flip */ -#define DDFLIP_WAIT 0x00000001 -#define DDFLIP_EVEN 0x00000002 /* only valid for overlay */ -#define DDFLIP_ODD 0x00000004 /* only valid for overlay */ -#define DDFLIP_NOVSYNC 0x00000008 -#define DDFLIP_STEREO 0x00000010 -#define DDFLIP_DONOTWAIT 0x00000020 - -/* dwFlags for GetBltStatus */ -#define DDGBS_CANBLT 0x00000001 -#define DDGBS_ISBLTDONE 0x00000002 - -/* dwFlags for IDirectDrawSurface7::GetFlipStatus */ -#define DDGFS_CANFLIP 1L -#define DDGFS_ISFLIPDONE 2L - -/* dwFlags for IDirectDrawSurface7::SetPrivateData */ -#define DDSPD_IUNKNOWNPTR 1L -#define DDSPD_VOLATILE 2L - -/* DDSCAPS.dwCaps */ -/* reserved1, was 3d capable */ -#define DDSCAPS_RESERVED1 0x00000001 -/* surface contains alpha information */ -#define DDSCAPS_ALPHA 0x00000002 -/* this surface is a backbuffer */ -#define DDSCAPS_BACKBUFFER 0x00000004 -/* complex surface structure */ -#define DDSCAPS_COMPLEX 0x00000008 -/* part of surface flipping structure */ -#define DDSCAPS_FLIP 0x00000010 -/* this surface is the frontbuffer surface */ -#define DDSCAPS_FRONTBUFFER 0x00000020 -/* this is a plain offscreen surface */ -#define DDSCAPS_OFFSCREENPLAIN 0x00000040 -/* overlay */ -#define DDSCAPS_OVERLAY 0x00000080 -/* palette objects can be created and attached to us */ -#define DDSCAPS_PALETTE 0x00000100 -/* primary surface (the one the user looks at currently)(right eye)*/ -#define DDSCAPS_PRIMARYSURFACE 0x00000200 -/* primary surface for left eye */ -#define DDSCAPS_PRIMARYSURFACELEFT 0x00000400 -/* surface exists in systemmemory */ -#define DDSCAPS_SYSTEMMEMORY 0x00000800 -/* surface can be used as a texture */ -#define DDSCAPS_TEXTURE 0x00001000 -/* surface may be destination for 3d rendering */ -#define DDSCAPS_3DDEVICE 0x00002000 -/* surface exists in videomemory */ -#define DDSCAPS_VIDEOMEMORY 0x00004000 -/* surface changes immediately visible */ -#define DDSCAPS_VISIBLE 0x00008000 -/* write only surface */ -#define DDSCAPS_WRITEONLY 0x00010000 -/* zbuffer surface */ -#define DDSCAPS_ZBUFFER 0x00020000 -/* has its own DC */ -#define DDSCAPS_OWNDC 0x00040000 -/* surface should be able to receive live video */ -#define DDSCAPS_LIVEVIDEO 0x00080000 -/* should be able to have a hw codec decompress stuff into it */ -#define DDSCAPS_HWCODEC 0x00100000 -/* mode X (320x200 or 320x240) surface */ -#define DDSCAPS_MODEX 0x00200000 -/* one mipmap surface (1 level) */ -#define DDSCAPS_MIPMAP 0x00400000 -#define DDSCAPS_RESERVED2 0x00800000 -/* memory allocation delayed until Load() */ -#define DDSCAPS_ALLOCONLOAD 0x04000000 -/* Indicates that the surface will receive data from a video port */ -#define DDSCAPS_VIDEOPORT 0x08000000 -/* surface is in local videomemory */ -#define DDSCAPS_LOCALVIDMEM 0x10000000 -/* surface is in nonlocal videomemory */ -#define DDSCAPS_NONLOCALVIDMEM 0x20000000 -/* surface is a standard VGA mode surface (NOT ModeX) */ -#define DDSCAPS_STANDARDVGAMODE 0x40000000 -/* optimized? surface */ -#define DDSCAPS_OPTIMIZED 0x80000000 - -typedef struct _DDSCAPS { - DWORD dwCaps; /* capabilities of surface wanted */ -} DDSCAPS,*LPDDSCAPS; - -/* DDSCAPS2.dwCaps2 */ -/* indicates the surface will receive data from a video port using - deinterlacing hardware. */ -#define DDSCAPS2_HARDWAREDEINTERLACE 0x00000002 -/* indicates the surface will be locked very frequently. */ -#define DDSCAPS2_HINTDYNAMIC 0x00000004 -/* indicates surface can be re-ordered or retiled on load() */ -#define DDSCAPS2_HINTSTATIC 0x00000008 -/* indicates surface to be managed by directdraw/direct3D */ -#define DDSCAPS2_TEXTUREMANAGE 0x00000010 -/* reserved bits */ -#define DDSCAPS2_RESERVED1 0x00000020 -#define DDSCAPS2_RESERVED2 0x00000040 -/* indicates surface will never be locked again */ -#define DDSCAPS2_OPAQUE 0x00000080 -/* set at CreateSurface() time to indicate antialising will be used */ -#define DDSCAPS2_HINTANTIALIASING 0x00000100 -/* set at CreateSurface() time to indicate cubic environment map */ -#define DDSCAPS2_CUBEMAP 0x00000200 -/* face flags for cube maps */ -#define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400 -#define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800 -#define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000 -#define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000 -#define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000 -#define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000 -/* specifies all faces of a cube for CreateSurface() */ -#define DDSCAPS2_CUBEMAP_ALLFACES ( DDSCAPS2_CUBEMAP_POSITIVEX |\ - DDSCAPS2_CUBEMAP_NEGATIVEX |\ - DDSCAPS2_CUBEMAP_POSITIVEY |\ - DDSCAPS2_CUBEMAP_NEGATIVEY |\ - DDSCAPS2_CUBEMAP_POSITIVEZ |\ - DDSCAPS2_CUBEMAP_NEGATIVEZ ) -/* set for mipmap sublevels on DirectX7 and later. ignored by CreateSurface() */ -#define DDSCAPS2_MIPMAPSUBLEVEL 0x00010000 -/* indicates texture surface to be managed by Direct3D *only* */ -#define DDSCAPS2_D3DTEXTUREMANAGE 0x00020000 -/* indicates managed surface that can safely be lost */ -#define DDSCAPS2_DONOTPERSIST 0x00040000 -/* indicates surface is part of a stereo flipping chain */ -#define DDSCAPS2_STEREOSURFACELEFT 0x00080000 - -typedef struct _DDSCAPS2 { - DWORD dwCaps; /* capabilities of surface wanted */ - DWORD dwCaps2; /* additional capabilities */ - DWORD dwCaps3; /* reserved capabilities */ - DWORD dwCaps4; /* more reserved capabilities */ -} DDSCAPS2,*LPDDSCAPS2; - -#define DD_ROP_SPACE (256/32) /* space required to store ROP array */ - -typedef struct _DDCAPS_DX7 /* DirectX 7 version of caps struct */ -{ - DWORD dwSize; /* size of the DDDRIVERCAPS structure */ - DWORD dwCaps; /* driver specific capabilities */ - DWORD dwCaps2; /* more driver specific capabilites */ - DWORD dwCKeyCaps; /* color key capabilities of the surface */ - DWORD dwFXCaps; /* driver specific stretching and effects capabilites */ - DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */ - DWORD dwPalCaps; /* palette capabilities */ - DWORD dwSVCaps; /* stereo vision capabilities */ - DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */ - DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */ - DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */ - DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */ - DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */ - DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */ - DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */ - DWORD dwVidMemTotal; /* total amount of video memory */ - DWORD dwVidMemFree; /* amount of free video memory */ - DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */ - DWORD dwCurrVisibleOverlays; /* current number of visible overlays */ - DWORD dwNumFourCCCodes; /* number of four cc codes */ - DWORD dwAlignBoundarySrc; /* source rectangle alignment */ - DWORD dwAlignSizeSrc; /* source rectangle byte size */ - DWORD dwAlignBoundaryDest; /* dest rectangle alignment */ - DWORD dwAlignSizeDest; /* dest rectangle byte size */ - DWORD dwAlignStrideAlign; /* stride alignment */ - DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */ - DDSCAPS ddsOldCaps; /* old DDSCAPS - superceded for DirectX6+ */ - DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwReserved1; - DWORD dwReserved2; - DWORD dwReserved3; - DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */ - DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */ - DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */ - DWORD dwSVBRops[DD_ROP_SPACE];/* ROPS supported for System->Vmem blts */ - DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */ - DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */ - DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */ - DWORD dwVSBRops[DD_ROP_SPACE];/* ROPS supported for Vmem->System blts */ - DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */ - DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */ - DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */ - DWORD dwSSBRops[DD_ROP_SPACE];/* ROPS supported for System->System blts */ - DWORD dwMaxVideoPorts; /* maximum number of usable video ports */ - DWORD dwCurrVideoPorts; /* current number of video ports used */ - DWORD dwSVBCaps2; /* more driver specific capabilities for System->Vmem blts */ - DWORD dwNLVBCaps; /* driver specific capabilities for non-local->local vidmem blts */ - DWORD dwNLVBCaps2; /* more driver specific capabilities non-local->local vidmem blts */ - DWORD dwNLVBCKeyCaps; /* driver color key capabilities for non-local->local vidmem blts */ - DWORD dwNLVBFXCaps; /* driver FX capabilities for non-local->local blts */ - DWORD dwNLVBRops[DD_ROP_SPACE]; /* ROPS supported for non-local->local blts */ - DDSCAPS2 ddsCaps; /* surface capabilities */ -} DDCAPS_DX7,*LPDDCAPS_DX7; - -typedef struct _DDCAPS_DX6 /* DirectX 6 version of caps struct */ -{ - DWORD dwSize; /* size of the DDDRIVERCAPS structure */ - DWORD dwCaps; /* driver specific capabilities */ - DWORD dwCaps2; /* more driver specific capabilites */ - DWORD dwCKeyCaps; /* color key capabilities of the surface */ - DWORD dwFXCaps; /* driver specific stretching and effects capabilites */ - DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */ - DWORD dwPalCaps; /* palette capabilities */ - DWORD dwSVCaps; /* stereo vision capabilities */ - DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */ - DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */ - DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */ - DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */ - DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */ - DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */ - DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */ - DWORD dwVidMemTotal; /* total amount of video memory */ - DWORD dwVidMemFree; /* amount of free video memory */ - DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */ - DWORD dwCurrVisibleOverlays; /* current number of visible overlays */ - DWORD dwNumFourCCCodes; /* number of four cc codes */ - DWORD dwAlignBoundarySrc; /* source rectangle alignment */ - DWORD dwAlignSizeSrc; /* source rectangle byte size */ - DWORD dwAlignBoundaryDest; /* dest rectangle alignment */ - DWORD dwAlignSizeDest; /* dest rectangle byte size */ - DWORD dwAlignStrideAlign; /* stride alignment */ - DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */ - DDSCAPS ddsOldCaps; /* old DDSCAPS - superceded for DirectX6+ */ - DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwReserved1; - DWORD dwReserved2; - DWORD dwReserved3; - DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */ - DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */ - DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */ - DWORD dwSVBRops[DD_ROP_SPACE];/* ROPS supported for System->Vmem blts */ - DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */ - DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */ - DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */ - DWORD dwVSBRops[DD_ROP_SPACE];/* ROPS supported for Vmem->System blts */ - DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */ - DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */ - DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */ - DWORD dwSSBRops[DD_ROP_SPACE];/* ROPS supported for System->System blts */ - DWORD dwMaxVideoPorts; /* maximum number of usable video ports */ - DWORD dwCurrVideoPorts; /* current number of video ports used */ - DWORD dwSVBCaps2; /* more driver specific capabilities for System->Vmem blts */ - DWORD dwNLVBCaps; /* driver specific capabilities for non-local->local vidmem blts */ - DWORD dwNLVBCaps2; /* more driver specific capabilities non-local->local vidmem blts */ - DWORD dwNLVBCKeyCaps; /* driver color key capabilities for non-local->local vidmem blts */ - DWORD dwNLVBFXCaps; /* driver FX capabilities for non-local->local blts */ - DWORD dwNLVBRops[DD_ROP_SPACE]; /* ROPS supported for non-local->local blts */ - /* and one new member for DirectX 6 */ - DDSCAPS2 ddsCaps; /* surface capabilities */ -} DDCAPS_DX6,*LPDDCAPS_DX6; - -typedef struct _DDCAPS_DX5 /* DirectX5 version of caps struct */ -{ - DWORD dwSize; /* size of the DDDRIVERCAPS structure */ - DWORD dwCaps; /* driver specific capabilities */ - DWORD dwCaps2; /* more driver specific capabilites */ - DWORD dwCKeyCaps; /* color key capabilities of the surface */ - DWORD dwFXCaps; /* driver specific stretching and effects capabilites */ - DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */ - DWORD dwPalCaps; /* palette capabilities */ - DWORD dwSVCaps; /* stereo vision capabilities */ - DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */ - DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */ - DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */ - DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */ - DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */ - DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */ - DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */ - DWORD dwVidMemTotal; /* total amount of video memory */ - DWORD dwVidMemFree; /* amount of free video memory */ - DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */ - DWORD dwCurrVisibleOverlays; /* current number of visible overlays */ - DWORD dwNumFourCCCodes; /* number of four cc codes */ - DWORD dwAlignBoundarySrc; /* source rectangle alignment */ - DWORD dwAlignSizeSrc; /* source rectangle byte size */ - DWORD dwAlignBoundaryDest; /* dest rectangle alignment */ - DWORD dwAlignSizeDest; /* dest rectangle byte size */ - DWORD dwAlignStrideAlign; /* stride alignment */ - DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */ - DDSCAPS ddsCaps; /* DDSCAPS structure has all the general capabilities */ - DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwReserved1; - DWORD dwReserved2; - DWORD dwReserved3; - DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */ - DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */ - DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */ - DWORD dwSVBRops[DD_ROP_SPACE];/* ROPS supported for System->Vmem blts */ - DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */ - DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */ - DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */ - DWORD dwVSBRops[DD_ROP_SPACE];/* ROPS supported for Vmem->System blts */ - DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */ - DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */ - DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */ - DWORD dwSSBRops[DD_ROP_SPACE];/* ROPS supported for System->System blts */ - /* the following are the new DirectX 5 members */ - DWORD dwMaxVideoPorts; /* maximum number of usable video ports */ - DWORD dwCurrVideoPorts; /* current number of video ports used */ - DWORD dwSVBCaps2; /* more driver specific capabilities for System->Vmem blts */ - DWORD dwNLVBCaps; /* driver specific capabilities for non-local->local vidmem blts */ - DWORD dwNLVBCaps2; /* more driver specific capabilities non-local->local vidmem blts */ - DWORD dwNLVBCKeyCaps; /* driver color key capabilities for non-local->local vidmem blts */ - DWORD dwNLVBFXCaps; /* driver FX capabilities for non-local->local blts */ - DWORD dwNLVBRops[DD_ROP_SPACE]; /* ROPS supported for non-local->local blts */ -} DDCAPS_DX5,*LPDDCAPS_DX5; - -typedef struct _DDCAPS_DX3 /* DirectX3 version of caps struct */ -{ - DWORD dwSize; /* size of the DDDRIVERCAPS structure */ - DWORD dwCaps; /* driver specific capabilities */ - DWORD dwCaps2; /* more driver specific capabilites */ - DWORD dwCKeyCaps; /* color key capabilities of the surface */ - DWORD dwFXCaps; /* driver specific stretching and effects capabilites */ - DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */ - DWORD dwPalCaps; /* palette capabilities */ - DWORD dwSVCaps; /* stereo vision capabilities */ - DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */ - DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */ - DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */ - DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */ - DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */ - DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */ - DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */ - DWORD dwVidMemTotal; /* total amount of video memory */ - DWORD dwVidMemFree; /* amount of free video memory */ - DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */ - DWORD dwCurrVisibleOverlays; /* current number of visible overlays */ - DWORD dwNumFourCCCodes; /* number of four cc codes */ - DWORD dwAlignBoundarySrc; /* source rectangle alignment */ - DWORD dwAlignSizeSrc; /* source rectangle byte size */ - DWORD dwAlignBoundaryDest; /* dest rectangle alignment */ - DWORD dwAlignSizeDest; /* dest rectangle byte size */ - DWORD dwAlignStrideAlign; /* stride alignment */ - DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */ - DDSCAPS ddsCaps; /* DDSCAPS structure has all the general capabilities */ - DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ - DWORD dwReserved1; - DWORD dwReserved2; - DWORD dwReserved3; - DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */ - DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */ - DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */ - DWORD dwSVBRops[DD_ROP_SPACE];/* ROPS supported for System->Vmem blts */ - DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */ - DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */ - DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */ - DWORD dwVSBRops[DD_ROP_SPACE];/* ROPS supported for Vmem->System blts */ - DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */ - DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */ - DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */ - DWORD dwSSBRops[DD_ROP_SPACE];/* ROPS supported for System->System blts */ - DWORD dwReserved4; - DWORD dwReserved5; - DWORD dwReserved6; -} DDCAPS_DX3,*LPDDCAPS_DX3; - -/* set caps struct according to DIRECTDRAW_VERSION */ - -#if DIRECTDRAW_VERSION <= 0x300 -typedef DDCAPS_DX3 DDCAPS; -#elif DIRECTDRAW_VERSION <= 0x500 -typedef DDCAPS_DX5 DDCAPS; -#elif DIRECTDRAW_VERSION <= 0x600 -typedef DDCAPS_DX6 DDCAPS; -#else -typedef DDCAPS_DX7 DDCAPS; -#endif - -typedef DDCAPS *LPDDCAPS; - -/* DDCAPS.dwCaps */ -#define DDCAPS_3D 0x00000001 -#define DDCAPS_ALIGNBOUNDARYDEST 0x00000002 -#define DDCAPS_ALIGNSIZEDEST 0x00000004 -#define DDCAPS_ALIGNBOUNDARYSRC 0x00000008 -#define DDCAPS_ALIGNSIZESRC 0x00000010 -#define DDCAPS_ALIGNSTRIDE 0x00000020 -#define DDCAPS_BLT 0x00000040 -#define DDCAPS_BLTQUEUE 0x00000080 -#define DDCAPS_BLTFOURCC 0x00000100 -#define DDCAPS_BLTSTRETCH 0x00000200 -#define DDCAPS_GDI 0x00000400 -#define DDCAPS_OVERLAY 0x00000800 -#define DDCAPS_OVERLAYCANTCLIP 0x00001000 -#define DDCAPS_OVERLAYFOURCC 0x00002000 -#define DDCAPS_OVERLAYSTRETCH 0x00004000 -#define DDCAPS_PALETTE 0x00008000 -#define DDCAPS_PALETTEVSYNC 0x00010000 -#define DDCAPS_READSCANLINE 0x00020000 -#define DDCAPS_STEREOVIEW 0x00040000 -#define DDCAPS_VBI 0x00080000 -#define DDCAPS_ZBLTS 0x00100000 -#define DDCAPS_ZOVERLAYS 0x00200000 -#define DDCAPS_COLORKEY 0x00400000 -#define DDCAPS_ALPHA 0x00800000 -#define DDCAPS_COLORKEYHWASSIST 0x01000000 -#define DDCAPS_NOHARDWARE 0x02000000 -#define DDCAPS_BLTCOLORFILL 0x04000000 -#define DDCAPS_BANKSWITCHED 0x08000000 -#define DDCAPS_BLTDEPTHFILL 0x10000000 -#define DDCAPS_CANCLIP 0x20000000 -#define DDCAPS_CANCLIPSTRETCHED 0x40000000 -#define DDCAPS_CANBLTSYSMEM 0x80000000 - -/* DDCAPS.dwCaps2 */ -#define DDCAPS2_CERTIFIED 0x00000001 -#define DDCAPS2_NO2DDURING3DSCENE 0x00000002 -#define DDCAPS2_VIDEOPORT 0x00000004 -#define DDCAPS2_AUTOFLIPOVERLAY 0x00000008 -#define DDCAPS2_CANBOBINTERLEAVED 0x00000010 -#define DDCAPS2_CANBOBNONINTERLEAVED 0x00000020 -#define DDCAPS2_COLORCONTROLOVERLAY 0x00000040 -#define DDCAPS2_COLORCONTROLPRIMARY 0x00000080 -#define DDCAPS2_CANDROPZ16BIT 0x00000100 -#define DDCAPS2_NONLOCALVIDMEM 0x00000200 -#define DDCAPS2_NONLOCALVIDMEMCAPS 0x00000400 -#define DDCAPS2_NOPAGELOCKREQUIRED 0x00000800 -#define DDCAPS2_WIDESURFACES 0x00001000 -#define DDCAPS2_CANFLIPODDEVEN 0x00002000 -#define DDCAPS2_CANBOBHARDWARE 0x00004000 -#define DDCAPS2_COPYFOURCC 0x00008000 -#define DDCAPS2_PRIMARYGAMMA 0x00020000 -#define DDCAPS2_CANRENDERWINDOWED 0x00080000 -#define DDCAPS2_CANCALIBRATEGAMMA 0x00100000 -#define DDCAPS2_FLIPINTERVAL 0x00200000 -#define DDCAPS2_FLIPNOVSYNC 0x00400000 -#define DDCAPS2_CANMANAGETEXTURE 0x00800000 -#define DDCAPS2_TEXMANINNONLOCALVIDMEM 0x01000000 -#define DDCAPS2_STEREO 0x02000000 -#define DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL 0x04000000 - - -/* Set/Get Colour Key Flags */ -#define DDCKEY_COLORSPACE 0x00000001 /* Struct is single colour space */ -#define DDCKEY_DESTBLT 0x00000002 /* To be used as dest for blt */ -#define DDCKEY_DESTOVERLAY 0x00000004 /* To be used as dest for CK overlays */ -#define DDCKEY_SRCBLT 0x00000008 /* To be used as src for blt */ -#define DDCKEY_SRCOVERLAY 0x00000010 /* To be used as src for CK overlays */ - -typedef struct _DDCOLORKEY -{ - DWORD dwColorSpaceLowValue;/* low boundary of color space that is to - * be treated as Color Key, inclusive - */ - DWORD dwColorSpaceHighValue;/* high boundary of color space that is - * to be treated as Color Key, inclusive - */ -} DDCOLORKEY,*LPDDCOLORKEY; - -/* ddCKEYCAPS bits */ -#define DDCKEYCAPS_DESTBLT 0x00000001 -#define DDCKEYCAPS_DESTBLTCLRSPACE 0x00000002 -#define DDCKEYCAPS_DESTBLTCLRSPACEYUV 0x00000004 -#define DDCKEYCAPS_DESTBLTYUV 0x00000008 -#define DDCKEYCAPS_DESTOVERLAY 0x00000010 -#define DDCKEYCAPS_DESTOVERLAYCLRSPACE 0x00000020 -#define DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV 0x00000040 -#define DDCKEYCAPS_DESTOVERLAYONEACTIVE 0x00000080 -#define DDCKEYCAPS_DESTOVERLAYYUV 0x00000100 -#define DDCKEYCAPS_SRCBLT 0x00000200 -#define DDCKEYCAPS_SRCBLTCLRSPACE 0x00000400 -#define DDCKEYCAPS_SRCBLTCLRSPACEYUV 0x00000800 -#define DDCKEYCAPS_SRCBLTYUV 0x00001000 -#define DDCKEYCAPS_SRCOVERLAY 0x00002000 -#define DDCKEYCAPS_SRCOVERLAYCLRSPACE 0x00004000 -#define DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV 0x00008000 -#define DDCKEYCAPS_SRCOVERLAYONEACTIVE 0x00010000 -#define DDCKEYCAPS_SRCOVERLAYYUV 0x00020000 -#define DDCKEYCAPS_NOCOSTOVERLAY 0x00040000 - -typedef struct _DDPIXELFORMAT { - DWORD dwSize; /* 0: size of structure */ - DWORD dwFlags; /* 4: pixel format flags */ - DWORD dwFourCC; /* 8: (FOURCC code) */ - union { - DWORD dwRGBBitCount; /* C: how many bits per pixel */ - DWORD dwYUVBitCount; /* C: how many bits per pixel */ - DWORD dwZBufferBitDepth; /* C: how many bits for z buffers */ - DWORD dwAlphaBitDepth; /* C: how many bits for alpha channels*/ - DWORD dwLuminanceBitCount; - DWORD dwBumpBitCount; - } DUMMYUNIONNAME1; - union { - DWORD dwRBitMask; /* 10: mask for red bit*/ - DWORD dwYBitMask; /* 10: mask for Y bits*/ - DWORD dwStencilBitDepth; - DWORD dwLuminanceBitMask; - DWORD dwBumpDuBitMask; - } DUMMYUNIONNAME2; - union { - DWORD dwGBitMask; /* 14: mask for green bits*/ - DWORD dwUBitMask; /* 14: mask for U bits*/ - DWORD dwZBitMask; - DWORD dwBumpDvBitMask; - } DUMMYUNIONNAME3; - union { - DWORD dwBBitMask; /* 18: mask for blue bits*/ - DWORD dwVBitMask; /* 18: mask for V bits*/ - DWORD dwStencilBitMask; - DWORD dwBumpLuminanceBitMask; - } DUMMYUNIONNAME4; - union { - DWORD dwRGBAlphaBitMask; /* 1C: mask for alpha channel */ - DWORD dwYUVAlphaBitMask; /* 1C: mask for alpha channel */ - DWORD dwLuminanceAlphaBitMask; - DWORD dwRGBZBitMask; /* 1C: mask for Z channel */ - DWORD dwYUVZBitMask; /* 1C: mask for Z channel */ - } DUMMYUNIONNAME5; - /* 20: next structure */ -} DDPIXELFORMAT,*LPDDPIXELFORMAT; - -/* DDCAPS.dwFXCaps */ -#define DDFXCAPS_BLTALPHA 0x00000001 -#define DDFXCAPS_OVERLAYALPHA 0x00000004 -#define DDFXCAPS_BLTARITHSTRETCHYN 0x00000010 -#define DDFXCAPS_BLTARITHSTRETCHY 0x00000020 -#define DDFXCAPS_BLTMIRRORLEFTRIGHT 0x00000040 -#define DDFXCAPS_BLTMIRRORUPDOWN 0x00000080 -#define DDFXCAPS_BLTROTATION 0x00000100 -#define DDFXCAPS_BLTROTATION90 0x00000200 -#define DDFXCAPS_BLTSHRINKX 0x00000400 -#define DDFXCAPS_BLTSHRINKXN 0x00000800 -#define DDFXCAPS_BLTSHRINKY 0x00001000 -#define DDFXCAPS_BLTSHRINKYN 0x00002000 -#define DDFXCAPS_BLTSTRETCHX 0x00004000 -#define DDFXCAPS_BLTSTRETCHXN 0x00008000 -#define DDFXCAPS_BLTSTRETCHY 0x00010000 -#define DDFXCAPS_BLTSTRETCHYN 0x00020000 -#define DDFXCAPS_OVERLAYARITHSTRETCHY 0x00040000 -#define DDFXCAPS_OVERLAYARITHSTRETCHYN 0x00000008 -#define DDFXCAPS_OVERLAYSHRINKX 0x00080000 -#define DDFXCAPS_OVERLAYSHRINKXN 0x00100000 -#define DDFXCAPS_OVERLAYSHRINKY 0x00200000 -#define DDFXCAPS_OVERLAYSHRINKYN 0x00400000 -#define DDFXCAPS_OVERLAYSTRETCHX 0x00800000 -#define DDFXCAPS_OVERLAYSTRETCHXN 0x01000000 -#define DDFXCAPS_OVERLAYSTRETCHY 0x02000000 -#define DDFXCAPS_OVERLAYSTRETCHYN 0x04000000 -#define DDFXCAPS_OVERLAYMIRRORLEFTRIGHT 0x08000000 -#define DDFXCAPS_OVERLAYMIRRORUPDOWN 0x10000000 - -#define DDFXCAPS_OVERLAYFILTER DDFXCAPS_OVERLAYARITHSTRETCHY - -/* DDCAPS.dwFXAlphaCaps */ -#define DDFXALPHACAPS_BLTALPHAEDGEBLEND 0x00000001 -#define DDFXALPHACAPS_BLTALPHAPIXELS 0x00000002 -#define DDFXALPHACAPS_BLTALPHAPIXELSNEG 0x00000004 -#define DDFXALPHACAPS_BLTALPHASURFACES 0x00000008 -#define DDFXALPHACAPS_BLTALPHASURFACESNEG 0x00000010 -#define DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND 0x00000020 -#define DDFXALPHACAPS_OVERLAYALPHAPIXELS 0x00000040 -#define DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG 0x00000080 -#define DDFXALPHACAPS_OVERLAYALPHASURFACES 0x00000100 -#define DDFXALPHACAPS_OVERLAYALPHASURFACESNEG 0x00000200 - -/* DDCAPS.dwPalCaps */ -#define DDPCAPS_4BIT 0x00000001 -#define DDPCAPS_8BITENTRIES 0x00000002 -#define DDPCAPS_8BIT 0x00000004 -#define DDPCAPS_INITIALIZE 0x00000008 -#define DDPCAPS_PRIMARYSURFACE 0x00000010 -#define DDPCAPS_PRIMARYSURFACELEFT 0x00000020 -#define DDPCAPS_ALLOW256 0x00000040 -#define DDPCAPS_VSYNC 0x00000080 -#define DDPCAPS_1BIT 0x00000100 -#define DDPCAPS_2BIT 0x00000200 -#define DDPCAPS_ALPHA 0x00000400 - -/* DDCAPS.dwSVCaps */ -/* the first 4 of these are now obsolete */ -#if DIRECTDRAW_VERSION >= 0x700 /* FIXME: I'm not sure when this switch occured */ -#define DDSVCAPS_RESERVED1 0x00000001 -#define DDSVCAPS_RESERVED2 0x00000002 -#define DDSVCAPS_RESERVED3 0x00000004 -#define DDSVCAPS_RESERVED4 0x00000008 -#else -#define DDSVCAPS_ENIGMA 0x00000001 -#define DDSVCAPS_FLICKER 0x00000002 -#define DDSVCAPS_REDBLUE 0x00000004 -#define DDSVCAPS_SPLIT 0x00000008 -#endif -#define DDSVCAPS_STEREOSEQUENTIAL 0x00000010 - -/* BitDepths */ -#define DDBD_1 0x00004000 -#define DDBD_2 0x00002000 -#define DDBD_4 0x00001000 -#define DDBD_8 0x00000800 -#define DDBD_16 0x00000400 -#define DDBD_24 0x00000200 -#define DDBD_32 0x00000100 - -/* DDOVERLAYFX.dwDDFX */ -#define DDOVERFX_ARITHSTRETCHY 0x00000001 -#define DDOVERFX_MIRRORLEFTRIGHT 0x00000002 -#define DDOVERFX_MIRRORUPDOWN 0x00000004 - -/* UpdateOverlay flags */ -#define DDOVER_ALPHADEST 0x00000001 -#define DDOVER_ALPHADESTCONSTOVERRIDE 0x00000002 -#define DDOVER_ALPHADESTNEG 0x00000004 -#define DDOVER_ALPHADESTSURFACEOVERRIDE 0x00000008 -#define DDOVER_ALPHAEDGEBLEND 0x00000010 -#define DDOVER_ALPHASRC 0x00000020 -#define DDOVER_ALPHASRCCONSTOVERRIDE 0x00000040 -#define DDOVER_ALPHASRCNEG 0x00000080 -#define DDOVER_ALPHASRCSURFACEOVERRIDE 0x00000100 -#define DDOVER_HIDE 0x00000200 -#define DDOVER_KEYDEST 0x00000400 -#define DDOVER_KEYDESTOVERRIDE 0x00000800 -#define DDOVER_KEYSRC 0x00001000 -#define DDOVER_KEYSRCOVERRIDE 0x00002000 -#define DDOVER_SHOW 0x00004000 -#define DDOVER_ADDDIRTYRECT 0x00008000 -#define DDOVER_REFRESHDIRTYRECTS 0x00010000 -#define DDOVER_REFRESHALL 0x00020000 -#define DDOVER_DDFX 0x00080000 -#define DDOVER_AUTOFLIP 0x00100000 -#define DDOVER_BOB 0x00200000 -#define DDOVER_OVERRIDEBOBWEAVE 0x00400000 -#define DDOVER_INTERLEAVED 0x00800000 - -/* DDCOLORKEY.dwFlags */ -#define DDPF_ALPHAPIXELS 0x00000001 -#define DDPF_ALPHA 0x00000002 -#define DDPF_FOURCC 0x00000004 -#define DDPF_PALETTEINDEXED4 0x00000008 -#define DDPF_PALETTEINDEXEDTO8 0x00000010 -#define DDPF_PALETTEINDEXED8 0x00000020 -#define DDPF_RGB 0x00000040 -#define DDPF_COMPRESSED 0x00000080 -#define DDPF_RGBTOYUV 0x00000100 -#define DDPF_YUV 0x00000200 -#define DDPF_ZBUFFER 0x00000400 -#define DDPF_PALETTEINDEXED1 0x00000800 -#define DDPF_PALETTEINDEXED2 0x00001000 -#define DDPF_ZPIXELS 0x00002000 -#define DDPF_STENCILBUFFER 0x00004000 -#define DDPF_ALPHAPREMULT 0x00008000 -#define DDPF_LUMINANCE 0x00020000 -#define DDPF_BUMPLUMINANCE 0x00040000 -#define DDPF_BUMPDUDV 0x00080000 - -/* SetCooperativeLevel dwFlags */ -#define DDSCL_FULLSCREEN 0x00000001 -#define DDSCL_ALLOWREBOOT 0x00000002 -#define DDSCL_NOWINDOWCHANGES 0x00000004 -#define DDSCL_NORMAL 0x00000008 -#define DDSCL_EXCLUSIVE 0x00000010 -#define DDSCL_ALLOWMODEX 0x00000040 -#define DDSCL_SETFOCUSWINDOW 0x00000080 -#define DDSCL_SETDEVICEWINDOW 0x00000100 -#define DDSCL_CREATEDEVICEWINDOW 0x00000200 -#define DDSCL_MULTITHREADED 0x00000400 -#define DDSCL_FPUSETUP 0x00000800 -#define DDSCL_FPUPRESERVE 0x00001000 - - -/* DDSURFACEDESC.dwFlags */ -#define DDSD_CAPS 0x00000001 -#define DDSD_HEIGHT 0x00000002 -#define DDSD_WIDTH 0x00000004 -#define DDSD_PITCH 0x00000008 -#define DDSD_BACKBUFFERCOUNT 0x00000020 -#define DDSD_ZBUFFERBITDEPTH 0x00000040 -#define DDSD_ALPHABITDEPTH 0x00000080 -#define DDSD_LPSURFACE 0x00000800 -#define DDSD_PIXELFORMAT 0x00001000 -#define DDSD_CKDESTOVERLAY 0x00002000 -#define DDSD_CKDESTBLT 0x00004000 -#define DDSD_CKSRCOVERLAY 0x00008000 -#define DDSD_CKSRCBLT 0x00010000 -#define DDSD_MIPMAPCOUNT 0x00020000 -#define DDSD_REFRESHRATE 0x00040000 -#define DDSD_LINEARSIZE 0x00080000 -#define DDSD_TEXTURESTAGE 0x00100000 -#define DDSD_FVF 0x00200000 -#define DDSD_SRCVBHANDLE 0x00400000 -#define DDSD_ALL 0x007ff9ee - -/* EnumSurfaces flags */ -#define DDENUMSURFACES_ALL 0x00000001 -#define DDENUMSURFACES_MATCH 0x00000002 -#define DDENUMSURFACES_NOMATCH 0x00000004 -#define DDENUMSURFACES_CANBECREATED 0x00000008 -#define DDENUMSURFACES_DOESEXIST 0x00000010 - -/* SetDisplayMode flags */ -#define DDSDM_STANDARDVGAMODE 0x00000001 - -/* EnumDisplayModes flags */ -#define DDEDM_REFRESHRATES 0x00000001 -#define DDEDM_STANDARDVGAMODES 0x00000002 - -/* WaitForVerticalDisplay flags */ - -#define DDWAITVB_BLOCKBEGIN 0x00000001 -#define DDWAITVB_BLOCKBEGINEVENT 0x00000002 -#define DDWAITVB_BLOCKEND 0x00000004 - -typedef struct _DDSURFACEDESC -{ - DWORD dwSize; /* 0: size of the DDSURFACEDESC structure*/ - DWORD dwFlags; /* 4: determines what fields are valid*/ - DWORD dwHeight; /* 8: height of surface to be created*/ - DWORD dwWidth; /* C: width of input surface*/ - union { - LONG lPitch; /* 10: distance to start of next line (return value only)*/ - DWORD dwLinearSize; - } DUMMYUNIONNAME1; - DWORD dwBackBufferCount;/* 14: number of back buffers requested*/ - union { - DWORD dwMipMapCount;/* 18:number of mip-map levels requested*/ - DWORD dwZBufferBitDepth;/*18: depth of Z buffer requested*/ - DWORD dwRefreshRate;/* 18:refresh rate (used when display mode is described)*/ - } DUMMYUNIONNAME2; - DWORD dwAlphaBitDepth;/* 1C:depth of alpha buffer requested*/ - DWORD dwReserved; /* 20:reserved*/ - LPVOID lpSurface; /* 24:pointer to the associated surface memory*/ - DDCOLORKEY ddckCKDestOverlay;/* 28: CK for dest overlay use*/ - DDCOLORKEY ddckCKDestBlt; /* 30: CK for destination blt use*/ - DDCOLORKEY ddckCKSrcOverlay;/* 38: CK for source overlay use*/ - DDCOLORKEY ddckCKSrcBlt; /* 40: CK for source blt use*/ - DDPIXELFORMAT ddpfPixelFormat;/* 48: pixel format description of the surface*/ - DDSCAPS ddsCaps; /* 68: direct draw surface caps */ -} DDSURFACEDESC,*LPDDSURFACEDESC; - -typedef struct _DDSURFACEDESC2 -{ - DWORD dwSize; /* 0: size of the DDSURFACEDESC structure*/ - DWORD dwFlags; /* 4: determines what fields are valid*/ - DWORD dwHeight; /* 8: height of surface to be created*/ - DWORD dwWidth; /* C: width of input surface*/ - union { - LONG lPitch; /*10: distance to start of next line (return value only)*/ - DWORD dwLinearSize; /*10: formless late-allocated optimized surface size */ - } DUMMYUNIONNAME1; - DWORD dwBackBufferCount;/* 14: number of back buffers requested*/ - union { - DWORD dwMipMapCount;/* 18:number of mip-map levels requested*/ - DWORD dwRefreshRate;/* 18:refresh rate (used when display mode is described)*/ - DWORD dwSrcVBHandle;/* 18:source used in VB::Optimize */ - } DUMMYUNIONNAME2; - DWORD dwAlphaBitDepth;/* 1C:depth of alpha buffer requested*/ - DWORD dwReserved; /* 20:reserved*/ - LPVOID lpSurface; /* 24:pointer to the associated surface memory*/ - union { - DDCOLORKEY ddckCKDestOverlay; /* 28: CK for dest overlay use*/ - DWORD dwEmptyFaceColor; /* 28: color for empty cubemap faces */ - } DUMMYUNIONNAME3; - DDCOLORKEY ddckCKDestBlt; /* 30: CK for destination blt use*/ - DDCOLORKEY ddckCKSrcOverlay;/* 38: CK for source overlay use*/ - DDCOLORKEY ddckCKSrcBlt; /* 40: CK for source blt use*/ - - union { - DDPIXELFORMAT ddpfPixelFormat;/* 48: pixel format description of the surface*/ - DWORD dwFVF; /* 48: vertex format description of vertex buffers */ - } DUMMYUNIONNAME4; - DDSCAPS2 ddsCaps; /* 68: DDraw surface caps */ - DWORD dwTextureStage; /* 78: stage in multitexture cascade */ -} DDSURFACEDESC2,*LPDDSURFACEDESC2; - -/* DDCOLORCONTROL.dwFlags */ -#define DDCOLOR_BRIGHTNESS 0x00000001 -#define DDCOLOR_CONTRAST 0x00000002 -#define DDCOLOR_HUE 0x00000004 -#define DDCOLOR_SATURATION 0x00000008 -#define DDCOLOR_SHARPNESS 0x00000010 -#define DDCOLOR_GAMMA 0x00000020 -#define DDCOLOR_COLORENABLE 0x00000040 - -typedef struct { - DWORD dwSize; - DWORD dwFlags; - LONG lBrightness; - LONG lContrast; - LONG lHue; - LONG lSaturation; - LONG lSharpness; - LONG lGamma; - LONG lColorEnable; - DWORD dwReserved1; -} DDCOLORCONTROL,*LPDDCOLORCONTROL; - -typedef struct { - WORD red[256]; - WORD green[256]; - WORD blue[256]; -} DDGAMMARAMP,*LPDDGAMMARAMP; - -typedef BOOL CALLBACK (*LPDDENUMCALLBACKA)(GUID *, LPSTR, LPSTR, LPVOID); -typedef BOOL CALLBACK (*LPDDENUMCALLBACKW)(GUID *, LPWSTR, LPWSTR, LPVOID); -DECL_WINELIB_TYPE_AW(LPDDENUMCALLBACK) - -typedef HRESULT CALLBACK (*LPDDENUMMODESCALLBACK)(LPDDSURFACEDESC, LPVOID); -typedef HRESULT CALLBACK (*LPDDENUMMODESCALLBACK2)(LPDDSURFACEDESC2, LPVOID); -typedef HRESULT CALLBACK (*LPDDENUMSURFACESCALLBACK)(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, LPVOID); -typedef HRESULT CALLBACK (*LPDDENUMSURFACESCALLBACK2)(LPDIRECTDRAWSURFACE4, LPDDSURFACEDESC2, LPVOID); -typedef HRESULT CALLBACK (*LPDDENUMSURFACESCALLBACK7)(LPDIRECTDRAWSURFACE7, LPDDSURFACEDESC2, LPVOID); - -typedef BOOL CALLBACK (*LPDDENUMCALLBACKEXA)(GUID *, LPSTR, LPSTR, LPVOID, HMONITOR); -typedef BOOL CALLBACK (*LPDDENUMCALLBACKEXW)(GUID *, LPWSTR, LPWSTR, LPVOID, HMONITOR); -DECL_WINELIB_TYPE_AW(LPDDENUMCALLBACKEX) - -HRESULT WINAPI DirectDrawEnumerateExA( LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags); -HRESULT WINAPI DirectDrawEnumerateExW( LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext, DWORD dwFlags); -#define DirectDrawEnumerateEx WINELIB_NAME_AW(DirectDrawEnumerateEx) - -/* flags for DirectDrawEnumerateEx */ -#define DDENUM_ATTACHEDSECONDARYDEVICES 0x00000001 -#define DDENUM_DETACHEDSECONDARYDEVICES 0x00000002 -#define DDENUM_NONDISPLAYDEVICES 0x00000004 - -/* flags for DirectDrawCreate or IDirectDraw::Initialize */ -#define DDCREATE_HARDWAREONLY 1L -#define DDCREATE_EMULATIONONLY 2L - -typedef struct _DDBLTFX -{ - DWORD dwSize; /* size of structure */ - DWORD dwDDFX; /* FX operations */ - DWORD dwROP; /* Win32 raster operations */ - DWORD dwDDROP; /* Raster operations new for DirectDraw */ - DWORD dwRotationAngle; /* Rotation angle for blt */ - DWORD dwZBufferOpCode; /* ZBuffer compares */ - DWORD dwZBufferLow; /* Low limit of Z buffer */ - DWORD dwZBufferHigh; /* High limit of Z buffer */ - DWORD dwZBufferBaseDest; /* Destination base value */ - DWORD dwZDestConstBitDepth; /* Bit depth used to specify Z constant for destination */ - union - { - DWORD dwZDestConst; /* Constant to use as Z buffer for dest */ - LPDIRECTDRAWSURFACE lpDDSZBufferDest; /* Surface to use as Z buffer for dest */ - } DUMMYUNIONNAME1; - DWORD dwZSrcConstBitDepth; /* Bit depth used to specify Z constant for source */ - union - { - DWORD dwZSrcConst; /* Constant to use as Z buffer for src */ - LPDIRECTDRAWSURFACE lpDDSZBufferSrc; /* Surface to use as Z buffer for src */ - } DUMMYUNIONNAME2; - DWORD dwAlphaEdgeBlendBitDepth; /* Bit depth used to specify constant for alpha edge blend */ - DWORD dwAlphaEdgeBlend; /* Alpha for edge blending */ - DWORD dwReserved; - DWORD dwAlphaDestConstBitDepth; /* Bit depth used to specify alpha constant for destination */ - union - { - DWORD dwAlphaDestConst; /* Constant to use as Alpha Channel */ - LPDIRECTDRAWSURFACE lpDDSAlphaDest; /* Surface to use as Alpha Channel */ - } DUMMYUNIONNAME3; - DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */ - union - { - DWORD dwAlphaSrcConst; /* Constant to use as Alpha Channel */ - LPDIRECTDRAWSURFACE lpDDSAlphaSrc; /* Surface to use as Alpha Channel */ - } DUMMYUNIONNAME4; - union - { - DWORD dwFillColor; /* color in RGB or Palettized */ - DWORD dwFillDepth; /* depth value for z-buffer */ - DWORD dwFillPixel; /* pixel val for RGBA or RGBZ */ - LPDIRECTDRAWSURFACE lpDDSPattern; /* Surface to use as pattern */ - } DUMMYUNIONNAME5; - DDCOLORKEY ddckDestColorkey; /* DestColorkey override */ - DDCOLORKEY ddckSrcColorkey; /* SrcColorkey override */ -} DDBLTFX,*LPDDBLTFX; - -/* dwDDFX */ -/* arithmetic stretching along y axis */ -#define DDBLTFX_ARITHSTRETCHY 0x00000001 -/* mirror on y axis */ -#define DDBLTFX_MIRRORLEFTRIGHT 0x00000002 -/* mirror on x axis */ -#define DDBLTFX_MIRRORUPDOWN 0x00000004 -/* do not tear */ -#define DDBLTFX_NOTEARING 0x00000008 -/* 180 degrees clockwise rotation */ -#define DDBLTFX_ROTATE180 0x00000010 -/* 270 degrees clockwise rotation */ -#define DDBLTFX_ROTATE270 0x00000020 -/* 90 degrees clockwise rotation */ -#define DDBLTFX_ROTATE90 0x00000040 -/* dwZBufferLow and dwZBufferHigh specify limits to the copied Z values */ -#define DDBLTFX_ZBUFFERRANGE 0x00000080 -/* add dwZBufferBaseDest to every source z value before compare */ -#define DDBLTFX_ZBUFFERBASEDEST 0x00000100 - -typedef struct _DDOVERLAYFX -{ - DWORD dwSize; /* size of structure */ - DWORD dwAlphaEdgeBlendBitDepth; /* Bit depth used to specify constant for alpha edge blend */ - DWORD dwAlphaEdgeBlend; /* Constant to use as alpha for edge blend */ - DWORD dwReserved; - DWORD dwAlphaDestConstBitDepth; /* Bit depth used to specify alpha constant for destination */ - union - { - DWORD dwAlphaDestConst; /* Constant to use as alpha channel for dest */ - LPDIRECTDRAWSURFACE lpDDSAlphaDest; /* Surface to use as alpha channel for dest */ - } DUMMYUNIONNAME1; - DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */ - union - { - DWORD dwAlphaSrcConst; /* Constant to use as alpha channel for src */ - LPDIRECTDRAWSURFACE lpDDSAlphaSrc; /* Surface to use as alpha channel for src */ - } DUMMYUNIONNAME2; - DDCOLORKEY dckDestColorkey; /* DestColorkey override */ - DDCOLORKEY dckSrcColorkey; /* DestColorkey override */ - DWORD dwDDFX; /* Overlay FX */ - DWORD dwFlags; /* flags */ -} DDOVERLAYFX,*LPDDOVERLAYFX; - -typedef struct _DDBLTBATCH -{ - LPRECT lprDest; - LPDIRECTDRAWSURFACE lpDDSSrc; - LPRECT lprSrc; - DWORD dwFlags; - LPDDBLTFX lpDDBltFx; -} DDBLTBATCH,*LPDDBLTBATCH; - -#define MAX_DDDEVICEID_STRING 512 - -typedef struct tagDDDEVICEIDENTIFIER { - char szDriver[MAX_DDDEVICEID_STRING]; - char szDescription[MAX_DDDEVICEID_STRING]; - LARGE_INTEGER liDriverVersion; - DWORD dwVendorId; - DWORD dwDeviceId; - DWORD dwSubSysId; - DWORD dwRevision; - GUID guidDeviceIdentifier; -} DDDEVICEIDENTIFIER, * LPDDDEVICEIDENTIFIER; - -typedef struct tagDDDEVICEIDENTIFIER2 { - char szDriver[MAX_DDDEVICEID_STRING]; /* user readable driver name */ - char szDescription[MAX_DDDEVICEID_STRING]; /* user readable description */ - LARGE_INTEGER liDriverVersion; /* driver version */ - DWORD dwVendorId; /* vendor ID, zero if unknown */ - DWORD dwDeviceId; /* chipset ID, zero if unknown */ - DWORD dwSubSysId; /* board ID, zero if unknown */ - DWORD dwRevision; /* chipset version, zero if unknown */ - GUID guidDeviceIdentifier; /* unique ID for this driver/chipset combination */ - DWORD dwWHQLLevel; /* Windows Hardware Quality Lab certification level */ -} DDDEVICEIDENTIFIER2, * LPDDDEVICEIDENTIFIER2; - -/***************************************************************************** - * IDirectDrawPalette interface - */ -#undef INTERFACE -#define INTERFACE IDirectDrawPalette -DECLARE_INTERFACE_(IDirectDrawPalette,IUnknown) -{ - STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - STDMETHOD(GetCaps)(THIS_ LPDWORD lpdwCaps) PURE; - STDMETHOD(GetEntries)(THIS_ DWORD dwFlags, DWORD dwBase, DWORD dwNumEntries, LPPALETTEENTRY lpEntries) PURE; - STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, DWORD dwFlags, LPPALETTEENTRY lpDDColorTable) PURE; - STDMETHOD(SetEntries)(THIS_ DWORD dwFlags, DWORD dwStartingEntry, DWORD dwCount, LPPALETTEENTRY lpEntries) PURE; -}; - - /*** IUnknown methods ***/ -#define IDirectDrawPalette_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) -#define IDirectDrawPalette_AddRef(p) ICOM_CALL_(AddRef,p,(p)) -#define IDirectDrawPalette_Release(p) ICOM_CALL_(Release,p,(p)) - /*** IDirectDrawPalette methods ***/ -#define IDirectDrawPalette_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a)) -#define IDirectDrawPalette_GetEntries(p,a,b,c,d) ICOM_CALL_(GetEntries,p,(p,a,b,c,d)) -#define IDirectDrawPalette_Initialize(p,a,b,c) ICOM_CALL_(Initialize,p,(p,a,b,c)) -#define IDirectDrawPalette_SetEntries(p,a,b,c,d) ICOM_CALL_(SetEntries,p,(p,a,b,c,d)) - - -/***************************************************************************** - * IDirectDrawClipper interface - */ -#undef INTERFACE -#define INTERFACE IDirectDrawClipper -DECLARE_INTERFACE_(IDirectDrawClipper,IUnknown) -{ - STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - STDMETHOD(GetClipList)(THIS_ LPRECT lpRect, LPRGNDATA lpClipList, LPDWORD lpdwSize) PURE; - STDMETHOD(GetHWnd)(THIS_ HWND* lphWnd) PURE; - STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, DWORD dwFlags) PURE; - STDMETHOD(IsClipListChanged)(THIS_ BOOL* lpbChanged) PURE; - STDMETHOD(SetClipList)(THIS_ LPRGNDATA lpClipList, DWORD dwFlags) PURE; - STDMETHOD(SetHWnd)(THIS_ DWORD dwFlags, HWND hWnd) PURE; -}; - - /*** IUnknown methods ***/ -#define IDirectDrawClipper_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) -#define IDirectDrawClipper_AddRef(p) ICOM_CALL_(AddRef,p,(p)) -#define IDirectDrawClipper_Release(p) ICOM_CALL_(Release,p,(p)) - /*** IDirectDrawClipper methods ***/ -#define IDirectDrawClipper_GetClipList(p,a,b,c) ICOM_CALL_(GetClipList,p,(p,a,b,c)) -#define IDirectDrawClipper_GetHWnd(p,a) ICOM_CALL_(GetHWnd,p,(p,a)) -#define IDirectDrawClipper_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b)) -#define IDirectDrawClipper_IsClipListChanged(p,a) ICOM_CALL_(IsClipListChanged,p,(p,a)) -#define IDirectDrawClipper_SetClipList(p,a,b) ICOM_CALL_(SetClipList,p,(p,a,b)) -#define IDirectDrawClipper_SetHWnd(p,a,b) ICOM_CALL_(SetHWnd,p,(p,a,b)) - - -/***************************************************************************** - * IDirectDraw interface - */ -#undef INTERFACE -#define INTERFACE IDirectDraw -DECLARE_INTERFACE_(IDirectDraw,IUnknown) -{ - STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - STDMETHOD(Compact)(THIS) PURE; - STDMETHOD(CreateClipper)(THIS_ DWORD dwFlags, LPDIRECTDRAWCLIPPER* lplpDDClipper, IUnknown* pUnkOuter) PURE; - STDMETHOD(CreatePalette)(THIS_ DWORD dwFlags, LPPALETTEENTRY lpColorTable, LPDIRECTDRAWPALETTE* lplpDDPalette, IUnknown* pUnkOuter) PURE; - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc, LPDIRECTDRAWSURFACE* lplpDDSurface, IUnknown* pUnkOuter) PURE; - STDMETHOD(DuplicateSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDSurface, LPDIRECTDRAWSURFACE* lplpDupDDSurface) PURE; - STDMETHOD(EnumDisplayModes)(THIS_ DWORD dwFlags, LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK lpEnumModesCallback) PURE; - STDMETHOD(EnumSurfaces)(THIS_ DWORD dwFlags, LPDDSURFACEDESC lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE; - STDMETHOD(FlipToGDISurface)(THIS) PURE; - STDMETHOD(GetCaps)(THIS_ LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps) PURE; - STDMETHOD(GetDisplayMode)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE; - STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD lpNumCodes, LPDWORD lpCodes) PURE; - STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE* lplpGDIDDSurface) PURE; - STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD lpdwFrequency) PURE; - STDMETHOD(GetScanLine)(THIS_ LPDWORD lpdwScanLine) PURE; - STDMETHOD(GetVerticalBlankStatus)(THIS_ BOOL* lpbIsInVB) PURE; - STDMETHOD(Initialize)(THIS_ GUID* lpGUID) PURE; - STDMETHOD(RestoreDisplayMode)(THIS) PURE; - STDMETHOD(SetCooperativeLevel)(THIS_ HWND hWnd, DWORD dwFlags) PURE; - STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD, DWORD) PURE; - STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD dwFlags, HANDLE hEvent) PURE; -}; - - /*** IUnknown methods ***/ -#define IDirectDraw_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) -#define IDirectDraw_AddRef(p) ICOM_CALL_(AddRef,p,(p)) -#define IDirectDraw_Release(p) ICOM_CALL_(Release,p,(p)) - /*** IDirectDraw methods ***/ -#define IDirectDraw_Compact(p) ICOM_CALL_(Compact,p,(p)) -#define IDirectDraw_CreateClipper(p,a,b,c) ICOM_CALL_(CreateClipper,p,(p,a,b,c)) -#define IDirectDraw_CreatePalette(p,a,b,c,d) ICOM_CALL_(CreatePalette,p,(p,a,b,c,d)) -#define IDirectDraw_CreateSurface(p,a,b,c) ICOM_CALL_(CreateSurface,p,(p,a,b,c)) -#define IDirectDraw_DuplicateSurface(p,a,b) ICOM_CALL_(DuplicateSurface,p,(p,a,b)) -#define IDirectDraw_EnumDisplayModes(p,a,b,c,d) ICOM_CALL_(EnumDisplayModes,p,(p,a,b,c,d)) -#define IDirectDraw_EnumSurfaces(p,a,b,c,d) ICOM_CALL_(EnumSurfaces,p,(p,a,b,c,d)) -#define IDirectDraw_FlipToGDISurface(p) ICOM_CALL_(FlipToGDISurface,p,(p)) -#define IDirectDraw_GetCaps(p,a,b) ICOM_CALL_(GetCaps,p,(p,a,b)) -#define IDirectDraw_GetDisplayMode(p,a) ICOM_CALL_(GetDisplayMode,p,(p,a)) -#define IDirectDraw_GetFourCCCodes(p,a,b) ICOM_CALL_(GetFourCCCodes,p,(p,a,b)) -#define IDirectDraw_GetGDISurface(p,a) ICOM_CALL_(GetGDISurface,p,(p,a)) -#define IDirectDraw_GetMonitorFrequency(p,a) ICOM_CALL_(GetMonitorFrequency,p,(p,a)) -#define IDirectDraw_GetScanLine(p,a) ICOM_CALL_(GetScanLine,p,(p,a)) -#define IDirectDraw_GetVerticalBlankStatus(p,a) ICOM_CALL_(GetVerticalBlankStatus,p,(p,a)) -#define IDirectDraw_Initialize(p,a) ICOM_CALL_(Initialize,p,(p,a)) -#define IDirectDraw_RestoreDisplayMode(p) ICOM_CALL_(RestoreDisplayMode,p,(p)) -#define IDirectDraw_SetCooperativeLevel(p,a,b) ICOM_CALL_(SetCooperativeLevel,p,(p,a,b)) -#define IDirectDraw_SetDisplayMode(p,a,b,c) ICOM_CALL_(SetDisplayMode,p,(p,a,b,c)) -#define IDirectDraw_WaitForVerticalBlank(p,a,b) ICOM_CALL_(WaitForVerticalBlank,p,(p,a,b)) - - -/* flags for Lock() */ -#define DDLOCK_SURFACEMEMORYPTR 0x00000000 -#define DDLOCK_WAIT 0x00000001 -#define DDLOCK_EVENT 0x00000002 -#define DDLOCK_READONLY 0x00000010 -#define DDLOCK_WRITEONLY 0x00000020 -#define DDLOCK_NOSYSLOCK 0x00000800 - - -/***************************************************************************** - * IDirectDraw2 interface - */ -/* Note: IDirectDraw2 cannot derive from IDirectDraw because the number of - * arguments of SetDisplayMode has changed ! - */ -#undef INTERFACE -#define INTERFACE IDirectDraw2 -DECLARE_INTERFACE_(IDirectDraw2,IUnknown) -{ - STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - STDMETHOD(Compact)(THIS) PURE; - STDMETHOD(CreateClipper)(THIS_ DWORD dwFlags, LPDIRECTDRAWCLIPPER* lplpDDClipper, IUnknown* pUnkOuter) PURE; - STDMETHOD(CreatePalette)(THIS_ DWORD dwFlags, LPPALETTEENTRY lpColorTable, LPDIRECTDRAWPALETTE* lplpDDPalette, IUnknown* pUnkOuter) PURE; - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc, LPDIRECTDRAWSURFACE2* lplpDDSurface, IUnknown* pUnkOuter) PURE; - STDMETHOD(DuplicateSurface)(THIS_ LPDIRECTDRAWSURFACE2 lpDDSurface, LPDIRECTDRAWSURFACE2* lplpDupDDSurface) PURE; - STDMETHOD(EnumDisplayModes)(THIS_ DWORD dwFlags, LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK lpEnumModesCallback) PURE; - STDMETHOD(EnumSurfaces)(THIS_ DWORD dwFlags, LPDDSURFACEDESC lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE; - STDMETHOD(FlipToGDISurface)(THIS) PURE; - STDMETHOD(GetCaps)(THIS_ LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps) PURE; - STDMETHOD(GetDisplayMode)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE; - STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD lpNumCodes, LPDWORD lpCodes) PURE; - STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE2* lplpGDIDDSurface) PURE; - STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD lpdwFrequency) PURE; - STDMETHOD(GetScanLine)(THIS_ LPDWORD lpdwScanLine) PURE; - STDMETHOD(GetVerticalBlankStatus)(THIS_ BOOL* lpbIsInVB) PURE; - STDMETHOD(Initialize)(THIS_ GUID* lpGUID) PURE; - STDMETHOD(RestoreDisplayMode)(THIS) PURE; - STDMETHOD(SetCooperativeLevel)(THIS_ HWND hWnd, DWORD dwFlags) PURE; - STDMETHOD(SetDisplayMode)(THIS_ DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags) PURE; - STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD dwFlags, HANDLE hEvent) PURE; - - STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS lpDDCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) PURE; -}; - - /*** IUnknown methods ***/ -#define IDirectDraw2_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) -#define IDirectDraw2_AddRef(p) ICOM_CALL_(AddRef,p,(p)) -#define IDirectDraw2_Release(p) ICOM_CALL_(Release,p,(p)) - /*** IDirectDraw methods ***/ -#define IDirectDraw2_Compact(p) ICOM_CALL_(Compact,p,(p)) -#define IDirectDraw2_CreateClipper(p,a,b,c) ICOM_CALL_(CreateClipper,p,(p,a,b,c)) -#define IDirectDraw2_CreatePalette(p,a,b,c,d) ICOM_CALL_(CreatePalette,p,(p,a,b,c,d)) -#define IDirectDraw2_CreateSurface(p,a,b,c) ICOM_CALL_(CreateSurface,p,(p,a,b,c)) -#define IDirectDraw2_DuplicateSurface(p,a,b) ICOM_CALL_(DuplicateSurface,p,(p,a,b)) -#define IDirectDraw2_EnumDisplayModes(p,a,b,c,d) ICOM_CALL_(EnumDisplayModes,p,(p,a,b,c,d)) -#define IDirectDraw2_EnumSurfaces(p,a,b,c,d) ICOM_CALL_(EnumSurfaces,p,(p,a,b,c,d)) -#define IDirectDraw2_FlipToGDISurface(p) ICOM_CALL_(FlipToGDISurface,p,(p)) -#define IDirectDraw2_GetCaps(p,a,b) ICOM_CALL_(GetCaps,p,(p,a,b)) -#define IDirectDraw2_GetDisplayMode(p,a) ICOM_CALL_(GetDisplayMode,p,(p,a)) -#define IDirectDraw2_GetFourCCCodes(p,a,b) ICOM_CALL_(GetFourCCCodes,p,(p,a,b)) -#define IDirectDraw2_GetGDISurface(p,a) ICOM_CALL_(GetGDISurface,p,(p,a)) -#define IDirectDraw2_GetMonitorFrequency(p,a) ICOM_CALL_(GetMonitorFrequency,p,(p,a)) -#define IDirectDraw2_GetScanLine(p,a) ICOM_CALL_(GetScanLine,p,(p,a)) -#define IDirectDraw2_GetVerticalBlankStatus(p,a) ICOM_CALL_(GetVerticalBlankStatus,p,(p,a)) -#define IDirectDraw2_Initialize(p,a) ICOM_CALL_(Initialize,p,(p,a)) -#define IDirectDraw2_RestoreDisplayMode(p) ICOM_CALL_(RestoreDisplayMode,p,(p)) -#define IDirectDraw2_SetCooperativeLevel(p,a,b) ICOM_CALL_(SetCooperativeLevel,p,(p,a,b)) -#define IDirectDraw2_SetDisplayMode(p,a,b,c,d,e) ICOM_CALL_(SetDisplayMode,p,(p,a,b,c,d,e)) -#define IDirectDraw2_WaitForVerticalBlank(p,a,b) ICOM_CALL_(WaitForVerticalBlank,p,(p,a,b)) -/*** IDirectDraw2 methods ***/ -#define IDirectDraw2_GetAvailableVidMem(p,a,b,c) ICOM_CALL_(GetAvailableVidMem,p,(p,a,b,c)) - - -/***************************************************************************** - * IDirectDraw4 interface - */ -#undef INTERFACE -#define INTERFACE IDirectDraw4 -DECLARE_INTERFACE_(IDirectDraw4,IUnknown) -{ - STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - STDMETHOD(Compact)(THIS) PURE; - STDMETHOD(CreateClipper)(THIS_ DWORD dwFlags, LPDIRECTDRAWCLIPPER* lplpDDClipper, IUnknown* pUnkOuter) PURE; - STDMETHOD(CreatePalette)(THIS_ DWORD dwFlags, LPPALETTEENTRY lpColorTable, LPDIRECTDRAWPALETTE* lplpDDPalette, IUnknown* pUnkOuter) PURE; - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC2 lpDDSurfaceDesc, LPDIRECTDRAWSURFACE4* lplpDDSurface, IUnknown* pUnkOuter) PURE; - STDMETHOD(DuplicateSurface)(THIS_ LPDIRECTDRAWSURFACE4 lpDDSurface, LPDIRECTDRAWSURFACE4* lplpDupDDSurface) PURE; - STDMETHOD(EnumDisplayModes)(THIS_ DWORD dwFlags, LPDDSURFACEDESC2 lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK2 lpEnumModesCallback) PURE; - STDMETHOD(EnumSurfaces)(THIS_ DWORD dwFlags, LPDDSURFACEDESC2 lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK2 lpEnumSurfacesCallback) PURE; - STDMETHOD(FlipToGDISurface)(THIS) PURE; - STDMETHOD(GetCaps)(THIS_ LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps) PURE; - STDMETHOD(GetDisplayMode)(THIS_ LPDDSURFACEDESC2 lpDDSurfaceDesc) PURE; - STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD lpNumCodes, LPDWORD lpCodes) PURE; - STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE4* lplpGDIDDSurface) PURE; - STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD lpdwFrequency) PURE; - STDMETHOD(GetScanLine)(THIS_ LPDWORD lpdwScanLine) PURE; - STDMETHOD(GetVerticalBlankStatus)(THIS_ BOOL* lpbIsInVB) PURE; - STDMETHOD(Initialize)(THIS_ GUID* lpGUID) PURE; - STDMETHOD(RestoreDisplayMode)(THIS) PURE; - STDMETHOD(SetCooperativeLevel)(THIS_ HWND hWnd, DWORD dwFlags) PURE; - STDMETHOD(SetDisplayMode)(THIS_ DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags) PURE; - STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD dwFlags, HANDLE hEvent) PURE; - - STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS2 lpDDCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) PURE; - - STDMETHOD(GetSurfaceFromDC)(THIS_ HDC , LPDIRECTDRAWSURFACE4* ) PURE; - STDMETHOD(RestoreAllSurfaces)(THIS) PURE; - STDMETHOD(TestCooperativeLevel)(THIS) PURE; - STDMETHOD(GetDeviceIdentifier)(THIS_ LPDDDEVICEIDENTIFIER , DWORD ) PURE; -}; - - /*** IUnknown methods ***/ -#define IDirectDraw4_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) -#define IDirectDraw4_AddRef(p) ICOM_CALL_(AddRef,p,(p)) -#define IDirectDraw4_Release(p) ICOM_CALL_(Release,p,(p)) - /*** IDirectDraw methods ***/ -#define IDirectDraw4_Compact(p) ICOM_CALL_(Compact,p,(p)) -#define IDirectDraw4_CreateClipper(p,a,b,c) ICOM_CALL_(CreateClipper,p,(p,a,b,c)) -#define IDirectDraw4_CreatePalette(p,a,b,c,d) ICOM_CALL_(CreatePalette,p,(p,a,b,c,d)) -#define IDirectDraw4_CreateSurface(p,a,b,c) ICOM_CALL_(CreateSurface,p,(p,a,b,c)) -#define IDirectDraw4_DuplicateSurface(p,a,b) ICOM_CALL_(DuplicateSurface,p,(p,a,b)) -#define IDirectDraw4_EnumDisplayModes(p,a,b,c,d) ICOM_CALL_(EnumDisplayModes,p,(p,a,b,c,d)) -#define IDirectDraw4_EnumSurfaces(p,a,b,c,d) ICOM_CALL_(EnumSurfaces,p,(p,a,b,c,d)) -#define IDirectDraw4_FlipToGDISurface(p) ICOM_CALL_(FlipToGDISurface,p,(p)) -#define IDirectDraw4_GetCaps(p,a,b) ICOM_CALL_(GetCaps,p,(p,a,b)) -#define IDirectDraw4_GetDisplayMode(p,a) ICOM_CALL_(GetDisplayMode,p,(p,a)) -#define IDirectDraw4_GetFourCCCodes(p,a,b) ICOM_CALL_(GetFourCCCodes,p,(p,a,b)) -#define IDirectDraw4_GetGDISurface(p,a) ICOM_CALL_(GetGDISurface,p,(p,a)) -#define IDirectDraw4_GetMonitorFrequency(p,a) ICOM_CALL_(GetMonitorFrequency,p,(p,a)) -#define IDirectDraw4_GetScanLine(p,a) ICOM_CALL_(GetScanLine,p,(p,a)) -#define IDirectDraw4_GetVerticalBlankStatus(p,a) ICOM_CALL_(GetVerticalBlankStatus,p,(p,a)) -#define IDirectDraw4_Initialize(p,a) ICOM_CALL_(Initialize,p,(p,a)) -#define IDirectDraw4_RestoreDisplayMode(p) ICOM_CALL_(RestoreDisplayMode,p,(p)) -#define IDirectDraw4_SetCooperativeLevel(p,a,b) ICOM_CALL_(SetCooperativeLevel,p,(p,a,b)) -#define IDirectDraw4_SetDisplayMode(p,a,b,c,d,e) ICOM_CALL_(SetDisplayMode,p,(p,a,b,c,d,e)) -#define IDirectDraw4_WaitForVerticalBlank(p,a,b) ICOM_CALL_(WaitForVerticalBlank,p,(p,a,b)) -/*** IDirectDraw2 methods ***/ -#define IDirectDraw4_GetAvailableVidMem(p,a,b,c) ICOM_CALL_(GetAvailableVidMem,p,(p,a,b,c)) -/*** IDirectDraw4 methods ***/ -#define IDirectDraw4_GetSurfaceFromDC(p,a,b) ICOM_CALL_(GetSurfaceFromDC,p,(p,a,b)) -#define IDirectDraw4_RestoreAllSurfaces(pc) ICOM_CALL_(RestoreAllSurfaces,p,(p)) -#define IDirectDraw4_TestCooperativeLevel(p) ICOM_CALL_(TestCooperativeLevel,p,(p)) -#define IDirectDraw4_GetDeviceIdentifier(p,a,b) ICOM_CALL_(GetDeviceIdentifier,p,(p,a,b)) - - -/***************************************************************************** - * IDirectDraw7 interface - */ -/* Note: IDirectDraw7 cannot derive from IDirectDraw4; it is even documented - * as not interchangeable with earlier DirectDraw interfaces. - */ -#undef INTERFACE -#define INTERFACE IDirectDraw7 -DECLARE_INTERFACE_(IDirectDraw7,IUnknown) -{ - STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - STDMETHOD(Compact)(THIS) PURE; - STDMETHOD(CreateClipper)(THIS_ DWORD dwFlags, LPDIRECTDRAWCLIPPER* lplpDDClipper, IUnknown* pUnkOuter) PURE; - STDMETHOD(CreatePalette)(THIS_ DWORD dwFlags, LPPALETTEENTRY lpColorTable, LPDIRECTDRAWPALETTE* lplpDDPalette, IUnknown* pUnkOuter) PURE; - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC2 lpDDSurfaceDesc, LPDIRECTDRAWSURFACE7* lplpDDSurface, IUnknown* pUnkOuter) PURE; - STDMETHOD(DuplicateSurface)(THIS_ LPDIRECTDRAWSURFACE7 lpDDSurface, LPDIRECTDRAWSURFACE7* lplpDupDDSurface) PURE; - STDMETHOD(EnumDisplayModes)(THIS_ DWORD dwFlags, LPDDSURFACEDESC2 lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK2 lpEnumModesCallback) PURE; - STDMETHOD(EnumSurfaces)(THIS_ DWORD dwFlags, LPDDSURFACEDESC2 lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpEnumSurfacesCallback) PURE; - STDMETHOD(FlipToGDISurface)(THIS) PURE; - STDMETHOD(GetCaps)(THIS_ LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps) PURE; - STDMETHOD(GetDisplayMode)(THIS_ LPDDSURFACEDESC2 lpDDSurfaceDesc) PURE; - STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD lpNumCodes, LPDWORD lpCodes) PURE; - STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE7* lplpGDIDDSurface) PURE; - STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD lpdwFrequency) PURE; - STDMETHOD(GetScanLine)(THIS_ LPDWORD lpdwScanLine) PURE; - STDMETHOD(GetVerticalBlankStatus)(THIS_ BOOL* lpbIsInVB) PURE; - STDMETHOD(Initialize)(THIS_ GUID* lpGUID) PURE; - STDMETHOD(RestoreDisplayMode)(THIS) PURE; - STDMETHOD(SetCooperativeLevel)(THIS_ HWND hWnd, DWORD dwFlags) PURE; - STDMETHOD(SetDisplayMode)(THIS_ DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags) PURE; - STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD dwFlags, HANDLE hEvent) PURE; - - STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS2 lpDDCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) PURE; - - STDMETHOD(GetSurfaceFromDC)(THIS_ HDC , LPDIRECTDRAWSURFACE7* ) PURE; - STDMETHOD(RestoreAllSurfaces)(THIS) PURE; - STDMETHOD(TestCooperativeLevel)(THIS) PURE; - STDMETHOD(GetDeviceIdentifier)(THIS_ LPDDDEVICEIDENTIFIER2 , DWORD ) PURE; - - STDMETHOD(StartModeTest)(THIS_ LPSIZE , DWORD , DWORD ) PURE; - STDMETHOD(EvaluateMode)(THIS_ DWORD , DWORD * ) PURE; -}; - - /*** IUnknown methods ***/ -#define IDirectDraw7_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) -#define IDirectDraw7_AddRef(p) ICOM_CALL_(AddRef,p,(p)) -#define IDirectDraw7_Release(p) ICOM_CALL_(Release,p,(p)) - /*** IDirectDraw methods ***/ -#define IDirectDraw7_Compact(p) ICOM_CALL_(Compact,p,(p)) -#define IDirectDraw7_CreateClipper(p,a,b,c) ICOM_CALL_(CreateClipper,p,(p,a,b,c)) -#define IDirectDraw7_CreatePalette(p,a,b,c,d) ICOM_CALL_(CreatePalette,p,(p,a,b,c,d)) -#define IDirectDraw7_CreateSurface(p,a,b,c) ICOM_CALL_(CreateSurface,p,(p,a,b,c)) -#define IDirectDraw7_DuplicateSurface(p,a,b) ICOM_CALL_(DuplicateSurface,p,(p,a,b)) -#define IDirectDraw7_EnumDisplayModes(p,a,b,c,d) ICOM_CALL_(EnumDisplayModes,p,(p,a,b,c,d)) -#define IDirectDraw7_EnumSurfaces(p,a,b,c,d) ICOM_CALL_(EnumSurfaces,p,(p,a,b,c,d)) -#define IDirectDraw7_FlipToGDISurface(p) ICOM_CALL_(FlipToGDISurface,p,(p)) -#define IDirectDraw7_GetCaps(p,a,b) ICOM_CALL_(GetCaps,p,(p,a,b)) -#define IDirectDraw7_GetDisplayMode(p,a) ICOM_CALL_(GetDisplayMode,p,(p,a)) -#define IDirectDraw7_GetFourCCCodes(p,a,b) ICOM_CALL_(GetFourCCCodes,p,(p,a,b)) -#define IDirectDraw7_GetGDISurface(p,a) ICOM_CALL_(GetGDISurface,p,(p,a)) -#define IDirectDraw7_GetMonitorFrequency(p,a) ICOM_CALL_(GetMonitorFrequency,p,(p,a)) -#define IDirectDraw7_GetScanLine(p,a) ICOM_CALL_(GetScanLine,p,(p,a)) -#define IDirectDraw7_GetVerticalBlankStatus(p,a) ICOM_CALL_(GetVerticalBlankStatus,p,(p,a)) -#define IDirectDraw7_Initialize(p,a) ICOM_CALL_(Initialize,p,(p,a)) -#define IDirectDraw7_RestoreDisplayMode(p) ICOM_CALL_(RestoreDisplayMode,p,(p)) -#define IDirectDraw7_SetCooperativeLevel(p,a,b) ICOM_CALL_(SetCooperativeLevel,p,(p,a,b)) -#define IDirectDraw7_SetDisplayMode(p,a,b,c,d,e) ICOM_CALL_(SetDisplayMode,p,(p,a,b,c,d,e)) -#define IDirectDraw7_WaitForVerticalBlank(p,a,b) ICOM_CALL_(WaitForVerticalBlank,p,(p,a,b)) -/*** added in IDirectDraw2 ***/ -#define IDirectDraw7_GetAvailableVidMem(p,a,b,c) ICOM_CALL_(GetAvailableVidMem,p,(p,a,b,c)) -/*** added in IDirectDraw4 ***/ -#define IDirectDraw7_GetSurfaceFromDC(p,a,b) ICOM_CALL_(GetSurfaceFromDC,p,(p,a,b)) -#define IDirectDraw7_RestoreAllSurfaces(p) ICOM_CALL_(RestoreAllSurfaces,p,(p)) -#define IDirectDraw7_TestCooperativeLevel(p) ICOM_CALL_(TestCooperativeLevel,p,(p)) -#define IDirectDraw7_GetDeviceIdentifier(p,a,b) ICOM_CALL_(GetDeviceIdentifier,p,(p,a,b)) -/*** added in IDirectDraw 7 ***/ -#define IDirectDraw7_StartModeTest(p,a,b,c) ICOM_CALL_(StartModeTest,p,(p,a,b,c)) -#define IDirectDraw7_EvaluateMode(p,a,b) ICOM_CALL_(EvaluateMode,p,(p,a,b)) - - -/***************************************************************************** - * IDirectDrawSurface interface - */ -#undef INTERFACE -#define INTERFACE IDirectDrawSurface -DECLARE_INTERFACE_(IDirectDrawSurface,IUnknown) -{ - STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDSAttachedSurface) PURE; - STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT lpRect) PURE; - STDMETHOD(Blt)(THIS_ LPRECT lpDestRect, LPDIRECTDRAWSURFACE lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx) PURE; - STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags) PURE; - STDMETHOD(BltFast)(THIS_ DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans) PURE; - STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE lpDDSAttachedSurface) PURE; - STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE; - STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback) PURE; - STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride, DWORD dwFlags) PURE; - STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE* lplpDDAttachedSurface) PURE; - STDMETHOD(GetBltStatus)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(GetCaps)(THIS_ LPDDSCAPS lpDDSCaps) PURE; - STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER* lplpDDClipper) PURE; - STDMETHOD(GetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; - STDMETHOD(GetDC)(THIS_ HDC* lphDC) PURE; - STDMETHOD(GetFlipStatus)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(GetOverlayPosition)(THIS_ LPLONG lplX, LPLONG lplY) PURE; - STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE* lplpDDPalette) PURE; - STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE; - STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE; - STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) PURE; - STDMETHOD(IsLost)(THIS) PURE; - STDMETHOD(Lock)(THIS_ LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE; - STDMETHOD(ReleaseDC)(THIS_ HDC hDC) PURE; - STDMETHOD(Restore)(THIS) PURE; - STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER lpDDClipper) PURE; - STDMETHOD(SetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; - STDMETHOD(SetOverlayPosition)(THIS_ LONG lX, LONG lY) PURE; - STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE lpDDPalette) PURE; - STDMETHOD(Unlock)(THIS_ LPVOID lpSurfaceData) PURE; - STDMETHOD(UpdateOverlay)(THIS_ LPRECT lpSrcRect, LPDIRECTDRAWSURFACE lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx) PURE; - STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE lpDDSReference) PURE; -}; - - /*** IUnknown methods ***/ -#define IDirectDrawSurface_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) -#define IDirectDrawSurface_AddRef(p) ICOM_CALL_(AddRef,p,(p)) -#define IDirectDrawSurface_Release(p) ICOM_CALL_(Release,p,(p)) - /*** IDirectDrawSurface methods ***/ -#define IDirectDrawSurface_AddAttachedSurface(p,a) ICOM_CALL_(AddAttachedSurface,p,(p,a)) -#define IDirectDrawSurface_AddOverlayDirtyRect(p,a) ICOM_CALL_(AddOverlayDirtyRect,p,(p,a)) -#define IDirectDrawSurface_Blt(p,a,b,c,d,e) ICOM_CALL_(Blt,p,(p,a,b,c,d,e)) -#define IDirectDrawSurface_BltBatch(p,a,b,c) ICOM_CALL_(BltBatch,p,(p,a,b,c)) -#define IDirectDrawSurface_BltFast(p,a,b,c,d,e) ICOM_CALL_(BltFast,p,(p,a,b,c,d,e)) -#define IDirectDrawSurface_DeleteAttachedSurface(p,a,b) ICOM_CALL_(DeleteAttachedSurface,p,(p,a,b)) -#define IDirectDrawSurface_EnumAttachedSurfaces(p,a,b) ICOM_CALL_(EnumAttachedSurfaces,p,(p,a,b)) -#define IDirectDrawSurface_EnumOverlayZOrders(p,a,b,c) ICOM_CALL_(EnumOverlayZOrders,p,(p,a,b,c)) -#define IDirectDrawSurface_Flip(p,a,b) ICOM_CALL_(Flip,p,(p,a,b)) -#define IDirectDrawSurface_GetAttachedSurface(p,a,b) ICOM_CALL_(GetAttachedSurface,p,(p,a,b)) -#define IDirectDrawSurface_GetBltStatus(p,a) ICOM_CALL_(GetBltStatus,p,(p,a)) -#define IDirectDrawSurface_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a)) -#define IDirectDrawSurface_GetClipper(p,a) ICOM_CALL_(GetClipper,p,(p,a)) -#define IDirectDrawSurface_GetColorKey(p,a,b) ICOM_CALL_(GetColorKey,p,(p,a,b)) -#define IDirectDrawSurface_GetDC(p,a) ICOM_CALL_(GetDC,p,(p,a)) -#define IDirectDrawSurface_GetFlipStatus(p,a) ICOM_CALL_(GetFlipStatus,p,(p,a)) -#define IDirectDrawSurface_GetOverlayPosition(p,a,b) ICOM_CALL_(GetOverlayPosition,p,(p,a,b)) -#define IDirectDrawSurface_GetPalette(p,a) ICOM_CALL_(GetPalette,p,(p,a)) -#define IDirectDrawSurface_GetPixelFormat(p,a) ICOM_CALL_(GetPixelFormat,p,(p,a)) -#define IDirectDrawSurface_GetSurfaceDesc(p,a) ICOM_CALL_(GetSurfaceDesc,p,(p,a)) -#define IDirectDrawSurface_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b)) -#define IDirectDrawSurface_IsLost(p) ICOM_CALL_(IsLost,p,(p)) -#define IDirectDrawSurface_Lock(p,a,b,c,d) ICOM_CALL_(Lock,p,(p,a,b,c,d)) -#define IDirectDrawSurface_ReleaseDC(p,a) ICOM_CALL_(ReleaseDC,p,(p,a)) -#define IDirectDrawSurface_Restore(p) ICOM_CALL_(Restore,p,(p)) -#define IDirectDrawSurface_SetClipper(p,a) ICOM_CALL_(SetClipper,p,(p,a)) -#define IDirectDrawSurface_SetColorKey(p,a,b) ICOM_CALL_(SetColorKey,p,(p,a,b)) -#define IDirectDrawSurface_SetOverlayPosition(p,a,b) ICOM_CALL_(SetOverlayPosition,p,(p,a,b)) -#define IDirectDrawSurface_SetPalette(p,a) ICOM_CALL_(SetPalette,p,(p,a)) -#define IDirectDrawSurface_Unlock(p,a) ICOM_CALL_(Unlock,p,(p,a)) -#define IDirectDrawSurface_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL_(UpdateOverlay,p,(p,a,b,c,d,e)) -#define IDirectDrawSurface_UpdateOverlayDisplay(p,a) ICOM_CALL_(UpdateOverlayDisplay,p,(p,a)) -#define IDirectDrawSurface_UpdateOverlayZOrder(p,a,b) ICOM_CALL_(UpdateOverlayZOrder,p,(p,a,b)) - - -/***************************************************************************** - * IDirectDrawSurface2 interface - */ -/* Cannot inherit from IDirectDrawSurface because the LPDIRECTDRAWSURFACE parameters - * have been converted to LPDIRECTDRAWSURFACE2. - */ -#undef INTERFACE -#define INTERFACE IDirectDrawSurface2 -DECLARE_INTERFACE_(IDirectDrawSurface2,IUnknown) -{ - STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE2 lpDDSAttachedSurface) PURE; - STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT lpRect) PURE; - STDMETHOD(Blt)(THIS_ LPRECT lpDestRect, LPDIRECTDRAWSURFACE2 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx) PURE; - STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags) PURE; - STDMETHOD(BltFast)(THIS_ DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE2 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans) PURE; - STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE2 lpDDSAttachedSurface) PURE; - STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE; - STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback) PURE; - STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE2 lpDDSurfaceTargetOverride, DWORD dwFlags) PURE; - STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE2* lplpDDAttachedSurface) PURE; - STDMETHOD(GetBltStatus)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(GetCaps)(THIS_ LPDDSCAPS lpDDSCaps) PURE; - STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER* lplpDDClipper) PURE; - STDMETHOD(GetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; - STDMETHOD(GetDC)(THIS_ HDC* lphDC) PURE; - STDMETHOD(GetFlipStatus)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(GetOverlayPosition)(THIS_ LPLONG lplX, LPLONG lplY) PURE; - STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE* lplpDDPalette) PURE; - STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE; - STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE; - STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) PURE; - STDMETHOD(IsLost)(THIS) PURE; - STDMETHOD(Lock)(THIS_ LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE; - STDMETHOD(ReleaseDC)(THIS_ HDC hDC) PURE; - STDMETHOD(Restore)(THIS) PURE; - STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER lpDDClipper) PURE; - STDMETHOD(SetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; - STDMETHOD(SetOverlayPosition)(THIS_ LONG lX, LONG lY) PURE; - STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE lpDDPalette) PURE; - STDMETHOD(Unlock)(THIS_ LPVOID lpSurfaceData) PURE; - STDMETHOD(UpdateOverlay)(THIS_ LPRECT lpSrcRect, LPDIRECTDRAWSURFACE2 lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx) PURE; - STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE2 lpDDSReference) PURE; - /* added in v2 */ - STDMETHOD(GetDDInterface)(THIS_ LPVOID* lplpDD) PURE; - STDMETHOD(PageLock)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(PageUnlock)(THIS_ DWORD dwFlags) PURE; -}; - - /*** IUnknown methods ***/ -#define IDirectDrawSurface2_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) -#define IDirectDrawSurface2_AddRef(p) ICOM_CALL_(AddRef,p,(p)) -#define IDirectDrawSurface2_Release(p) ICOM_CALL_(Release,p,(p)) -/*** IDirectDrawSurface methods (almost) ***/ -#define IDirectDrawSurface2_AddAttachedSurface(p,a) ICOM_CALL_(AddAttachedSurface,p,(p,a)) -#define IDirectDrawSurface2_AddOverlayDirtyRect(p,a) ICOM_CALL_(AddOverlayDirtyRect,p,(p,a)) -#define IDirectDrawSurface2_Blt(p,a,b,c,d,e) ICOM_CALL_(Blt,p,(p,a,b,c,d,e)) -#define IDirectDrawSurface2_BltBatch(p,a,b,c) ICOM_CALL_(BltBatch,p,(p,a,b,c)) -#define IDirectDrawSurface2_BltFast(p,a,b,c,d,e) ICOM_CALL_(BltFast,p,(p,a,b,c,d,e)) -#define IDirectDrawSurface2_DeleteAttachedSurface(p,a,b) ICOM_CALL_(DeleteAttachedSurface,p,(p,a,b)) -#define IDirectDrawSurface2_EnumAttachedSurfaces(p,a,b) ICOM_CALL_(EnumAttachedSurfaces,p,(p,a,b)) -#define IDirectDrawSurface2_EnumOverlayZOrders(p,a,b,c) ICOM_CALL_(EnumOverlayZOrders,p,(p,a,b,c)) -#define IDirectDrawSurface2_Flip(p,a,b) ICOM_CALL_(Flip,p,(p,a,b)) -#define IDirectDrawSurface2_GetAttachedSurface(p,a,b) ICOM_CALL_(GetAttachedSurface,p,(p,a,b)) -#define IDirectDrawSurface2_GetBltStatus(p,a) ICOM_CALL_(GetBltStatus,p,(p,a)) -#define IDirectDrawSurface2_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a)) -#define IDirectDrawSurface2_GetClipper(p,a) ICOM_CALL_(GetClipper,p,(p,a)) -#define IDirectDrawSurface2_GetColorKey(p,a,b) ICOM_CALL_(GetColorKey,p,(p,a,b)) -#define IDirectDrawSurface2_GetDC(p,a) ICOM_CALL_(GetDC,p,(p,a)) -#define IDirectDrawSurface2_GetFlipStatus(p,a) ICOM_CALL_(GetFlipStatus,p,(p,a)) -#define IDirectDrawSurface2_GetOverlayPosition(p,a,b) ICOM_CALL_(GetOverlayPosition,p,(p,a,b)) -#define IDirectDrawSurface2_GetPalette(p,a) ICOM_CALL_(GetPalette,p,(p,a)) -#define IDirectDrawSurface2_GetPixelFormat(p,a) ICOM_CALL_(GetPixelFormat,p,(p,a)) -#define IDirectDrawSurface2_GetSurfaceDesc(p,a) ICOM_CALL_(GetSurfaceDesc,p,(p,a)) -#define IDirectDrawSurface2_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b)) -#define IDirectDrawSurface2_IsLost(p) ICOM_CALL_(IsLost,p,(p)) -#define IDirectDrawSurface2_Lock(p,a,b,c,d) ICOM_CALL_(Lock,p,(p,a,b,c,d)) -#define IDirectDrawSurface2_ReleaseDC(p,a) ICOM_CALL_(ReleaseDC,p,(p,a)) -#define IDirectDrawSurface2_Restore(p) ICOM_CALL_(Restore,p,(p)) -#define IDirectDrawSurface2_SetClipper(p,a) ICOM_CALL_(SetClipper,p,(p,a)) -#define IDirectDrawSurface2_SetColorKey(p,a,b) ICOM_CALL_(SetColorKey,p,(p,a,b)) -#define IDirectDrawSurface2_SetOverlayPosition(p,a,b) ICOM_CALL_(SetOverlayPosition,p,(p,a,b)) -#define IDirectDrawSurface2_SetPalette(p,a) ICOM_CALL_(SetPalette,p,(p,a)) -#define IDirectDrawSurface2_Unlock(p,a) ICOM_CALL_(Unlock,p,(p,a)) -#define IDirectDrawSurface2_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL_(UpdateOverlay,p,(p,a,b,c,d,e)) -#define IDirectDrawSurface2_UpdateOverlayDisplay(p,a) ICOM_CALL_(UpdateOverlayDisplay,p,(p,a)) -#define IDirectDrawSurface2_UpdateOverlayZOrder(p,a,b) ICOM_CALL_(UpdateOverlayZOrder,p,(p,a,b)) -/*** IDirectDrawSurface2 methods ***/ -#define IDirectDrawSurface2_GetDDInterface(p,a) ICOM_CALL_(GetDDInterface,p,(p,a)) -#define IDirectDrawSurface2_PageLock(p,a) ICOM_CALL_(PageLock,p,(p,a)) -#define IDirectDrawSurface2_PageUnlock(p,a) ICOM_CALL_(PageUnlock,p,(p,a)) - - -/***************************************************************************** - * IDirectDrawSurface3 interface - */ -/* Cannot inherit from IDirectDrawSurface2 because the LPDIRECTDRAWSURFACE2 parameters - * have been converted to LPDIRECTDRAWSURFACE3. - */ -#undef INTERFACE -#define INTERFACE IDirectDrawSurface3 -DECLARE_INTERFACE_(IDirectDrawSurface3,IUnknown) -{ - STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE3 lpDDSAttachedSurface) PURE; - STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT lpRect) PURE; - STDMETHOD(Blt)(THIS_ LPRECT lpDestRect, LPDIRECTDRAWSURFACE3 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx) PURE; - STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags) PURE; - STDMETHOD(BltFast)(THIS_ DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE3 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans) PURE; - STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE3 lpDDSAttachedSurface) PURE; - STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE; - STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback) PURE; - STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE3 lpDDSurfaceTargetOverride, DWORD dwFlags) PURE; - STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE3* lplpDDAttachedSurface) PURE; - STDMETHOD(GetBltStatus)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(GetCaps)(THIS_ LPDDSCAPS lpDDSCaps) PURE; - STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER* lplpDDClipper) PURE; - STDMETHOD(GetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; - STDMETHOD(GetDC)(THIS_ HDC* lphDC) PURE; - STDMETHOD(GetFlipStatus)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(GetOverlayPosition)(THIS_ LPLONG lplX, LPLONG lplY) PURE; - STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE* lplpDDPalette) PURE; - STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE; - STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE; - STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) PURE; - STDMETHOD(IsLost)(THIS) PURE; - STDMETHOD(Lock)(THIS_ LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE; - STDMETHOD(ReleaseDC)(THIS_ HDC hDC) PURE; - STDMETHOD(Restore)(THIS) PURE; - STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER lpDDClipper) PURE; - STDMETHOD(SetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; - STDMETHOD(SetOverlayPosition)(THIS_ LONG lX, LONG lY) PURE; - STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE lpDDPalette) PURE; - STDMETHOD(Unlock)(THIS_ LPVOID lpSurfaceData) PURE; - STDMETHOD(UpdateOverlay)(THIS_ LPRECT lpSrcRect, LPDIRECTDRAWSURFACE3 lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx) PURE; - STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE3 lpDDSReference) PURE; - /* added in v2 */ - STDMETHOD(GetDDInterface)(THIS_ LPVOID* lplpDD) PURE; - STDMETHOD(PageLock)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(PageUnlock)(THIS_ DWORD dwFlags) PURE; - /* added in v3 */ - STDMETHOD(SetSurfaceDesc)(THIS_ LPDDSURFACEDESC lpDDSD, DWORD dwFlags) PURE; -}; - - /*** IUnknown methods ***/ -#define IDirectDrawSurface3_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) -#define IDirectDrawSurface3_AddRef(p) ICOM_CALL_(AddRef,p,(p)) -#define IDirectDrawSurface3_Release(p) ICOM_CALL_(Release,p,(p)) -/*** IDirectDrawSurface methods (almost) ***/ -#define IDirectDrawSurface3_AddAttachedSurface(p,a) ICOM_CALL_(AddAttachedSurface,p,(p,a)) -#define IDirectDrawSurface3_AddOverlayDirtyRect(p,a) ICOM_CALL_(AddOverlayDirtyRect,p,(p,a)) -#define IDirectDrawSurface3_Blt(p,a,b,c,d,e) ICOM_CALL_(Blt,p,(p,a,b,c,d,e)) -#define IDirectDrawSurface3_BltBatch(p,a,b,c) ICOM_CALL_(BltBatch,p,(p,a,b,c)) -#define IDirectDrawSurface3_BltFast(p,a,b,c,d,e) ICOM_CALL_(BltFast,p,(p,a,b,c,d,e)) -#define IDirectDrawSurface3_DeleteAttachedSurface(p,a,b) ICOM_CALL_(DeleteAttachedSurface,p,(p,a,b)) -#define IDirectDrawSurface3_EnumAttachedSurfaces(p,a,b) ICOM_CALL_(EnumAttachedSurfaces,p,(p,a,b)) -#define IDirectDrawSurface3_EnumOverlayZOrders(p,a,b,c) ICOM_CALL_(EnumOverlayZOrders,p,(p,a,b,c)) -#define IDirectDrawSurface3_Flip(p,a,b) ICOM_CALL_(Flip,p,(p,a,b)) -#define IDirectDrawSurface3_GetAttachedSurface(p,a,b) ICOM_CALL_(GetAttachedSurface,p,(p,a,b)) -#define IDirectDrawSurface3_GetBltStatus(p,a) ICOM_CALL_(GetBltStatus,p,(p,a)) -#define IDirectDrawSurface3_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a)) -#define IDirectDrawSurface3_GetClipper(p,a) ICOM_CALL_(GetClipper,p,(p,a)) -#define IDirectDrawSurface3_GetColorKey(p,a,b) ICOM_CALL_(GetColorKey,p,(p,a,b)) -#define IDirectDrawSurface3_GetDC(p,a) ICOM_CALL_(GetDC,p,(p,a)) -#define IDirectDrawSurface3_GetFlipStatus(p,a) ICOM_CALL_(GetFlipStatus,p,(p,a)) -#define IDirectDrawSurface3_GetOverlayPosition(p,a,b) ICOM_CALL_(GetOverlayPosition,p,(p,a,b)) -#define IDirectDrawSurface3_GetPalette(p,a) ICOM_CALL_(GetPalette,p,(p,a)) -#define IDirectDrawSurface3_GetPixelFormat(p,a) ICOM_CALL_(GetPixelFormat,p,(p,a)) -#define IDirectDrawSurface3_GetSurfaceDesc(p,a) ICOM_CALL_(GetSurfaceDesc,p,(p,a)) -#define IDirectDrawSurface3_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b)) -#define IDirectDrawSurface3_IsLost(p) ICOM_CALL_(IsLost,p,(p)) -#define IDirectDrawSurface3_Lock(p,a,b,c,d) ICOM_CALL_(Lock,p,(p,a,b,c,d)) -#define IDirectDrawSurface3_ReleaseDC(p,a) ICOM_CALL_(ReleaseDC,p,(p,a)) -#define IDirectDrawSurface3_Restore(p) ICOM_CALL_(Restore,p,(p)) -#define IDirectDrawSurface3_SetClipper(p,a) ICOM_CALL_(SetClipper,p,(p,a)) -#define IDirectDrawSurface3_SetColorKey(p,a,b) ICOM_CALL_(SetColorKey,p,(p,a,b)) -#define IDirectDrawSurface3_SetOverlayPosition(p,a,b) ICOM_CALL_(SetOverlayPosition,p,(p,a,b)) -#define IDirectDrawSurface3_SetPalette(p,a) ICOM_CALL_(SetPalette,p,(p,a)) -#define IDirectDrawSurface3_Unlock(p,a) ICOM_CALL_(Unlock,p,(p,a)) -#define IDirectDrawSurface3_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL_(UpdateOverlay,p,(p,a,b,c,d,e)) -#define IDirectDrawSurface3_UpdateOverlayDisplay(p,a) ICOM_CALL_(UpdateOverlayDisplay,p,(p,a)) -#define IDirectDrawSurface3_UpdateOverlayZOrder(p,a,b) ICOM_CALL_(UpdateOverlayZOrder,p,(p,a,b)) -/*** IDirectDrawSurface2 methods ***/ -#define IDirectDrawSurface3_GetDDInterface(p,a) ICOM_CALL_(GetDDInterface,p,(p,a)) -#define IDirectDrawSurface3_PageLock(p,a) ICOM_CALL_(PageLock,p,(p,a)) -#define IDirectDrawSurface3_PageUnlock(p,a) ICOM_CALL_(PageUnlock,p,(p,a)) -/*** IDirectDrawSurface3 methods ***/ -#define IDirectDrawSurface3_SetSurfaceDesc(p,a,b) ICOM_CALL_(SetSurfaceDesc,p,(p,a,b)) - - -/***************************************************************************** - * IDirectDrawSurface4 interface - */ -/* Cannot inherit from IDirectDrawSurface2 because DDSCAPS changed to DDSCAPS2. - */ -#undef INTERFACE -#define INTERFACE IDirectDrawSurface4 -DECLARE_INTERFACE_(IDirectDrawSurface4,IUnknown) -{ - STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE4 lpDDSAttachedSurface) PURE; - STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT lpRect) PURE; - STDMETHOD(Blt)(THIS_ LPRECT lpDestRect, LPDIRECTDRAWSURFACE4 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx) PURE; - STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags) PURE; - STDMETHOD(BltFast)(THIS_ DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE4 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans) PURE; - STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE4 lpDDSAttachedSurface) PURE; - STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE; - STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback) PURE; - STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE4 lpDDSurfaceTargetOverride, DWORD dwFlags) PURE; - STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS2 lpDDSCaps, LPDIRECTDRAWSURFACE4* lplpDDAttachedSurface) PURE; - STDMETHOD(GetBltStatus)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(GetCaps)(THIS_ LPDDSCAPS2 lpDDSCaps) PURE; - STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER* lplpDDClipper) PURE; - STDMETHOD(GetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; - STDMETHOD(GetDC)(THIS_ HDC* lphDC) PURE; - STDMETHOD(GetFlipStatus)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(GetOverlayPosition)(THIS_ LPLONG lplX, LPLONG lplY) PURE; - STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE* lplpDDPalette) PURE; - STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE; - STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE; - STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) PURE; - STDMETHOD(IsLost)(THIS) PURE; - STDMETHOD(Lock)(THIS_ LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE; - STDMETHOD(ReleaseDC)(THIS_ HDC hDC) PURE; - STDMETHOD(Restore)(THIS) PURE; - STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER lpDDClipper) PURE; - STDMETHOD(SetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; - STDMETHOD(SetOverlayPosition)(THIS_ LONG lX, LONG lY) PURE; - STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE lpDDPalette) PURE; - STDMETHOD(Unlock)(THIS_ LPRECT lpSurfaceData) PURE; - STDMETHOD(UpdateOverlay)(THIS_ LPRECT lpSrcRect, LPDIRECTDRAWSURFACE4 lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx) PURE; - STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE4 lpDDSReference) PURE; - /* added in v2 */ - STDMETHOD(GetDDInterface)(THIS_ LPVOID* lplpDD) PURE; - STDMETHOD(PageLock)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(PageUnlock)(THIS_ DWORD dwFlags) PURE; - /* added in v3 */ - STDMETHOD(SetSurfaceDesc)(THIS_ LPDDSURFACEDESC lpDDSD, DWORD dwFlags) PURE; - /* added in v4 */ - STDMETHOD(SetPrivateData)(THIS_ REFGUID , LPVOID , DWORD , DWORD ) PURE; - STDMETHOD(GetPrivateData)(THIS_ REFGUID , LPVOID , LPDWORD ) PURE; - STDMETHOD(FreePrivateData)(THIS_ REFGUID ) PURE; - STDMETHOD(GetUniquenessValue)(THIS_ LPDWORD ) PURE; - STDMETHOD(ChangeUniquenessValue)(THIS) PURE; -}; - - /*** IUnknown methods ***/ -#define IDirectDrawSurface4_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) -#define IDirectDrawSurface4_AddRef(p) ICOM_CALL_(AddRef,p,(p)) -#define IDirectDrawSurface4_Release(p) ICOM_CALL_(Release,p,(p)) -/*** IDirectDrawSurface (almost) methods ***/ -#define IDirectDrawSurface4_AddAttachedSurface(p,a) ICOM_CALL_(AddAttachedSurface,p,(p,a)) -#define IDirectDrawSurface4_AddOverlayDirtyRect(p,a) ICOM_CALL_(AddOverlayDirtyRect,p,(p,a)) -#define IDirectDrawSurface4_Blt(p,a,b,c,d,e) ICOM_CALL_(Blt,p,(p,a,b,c,d,e)) -#define IDirectDrawSurface4_BltBatch(p,a,b,c) ICOM_CALL_(BltBatch,p,(p,a,b,c)) -#define IDirectDrawSurface4_BltFast(p,a,b,c,d,e) ICOM_CALL_(BltFast,p,(p,a,b,c,d,e)) -#define IDirectDrawSurface4_DeleteAttachedSurface(p,a,b) ICOM_CALL_(DeleteAttachedSurface,p,(p,a,b)) -#define IDirectDrawSurface4_EnumAttachedSurfaces(p,a,b) ICOM_CALL_(EnumAttachedSurfaces,p,(p,a,b)) -#define IDirectDrawSurface4_EnumOverlayZOrders(p,a,b,c) ICOM_CALL_(EnumOverlayZOrders,p,(p,a,b,c)) -#define IDirectDrawSurface4_Flip(p,a,b) ICOM_CALL_(Flip,p,(p,a,b)) -#define IDirectDrawSurface4_GetAttachedSurface(p,a,b) ICOM_CALL_(GetAttachedSurface,p,(p,a,b)) -#define IDirectDrawSurface4_GetBltStatus(p,a) ICOM_CALL_(GetBltStatus,p,(p,a)) -#define IDirectDrawSurface4_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a)) -#define IDirectDrawSurface4_GetClipper(p,a) ICOM_CALL_(GetClipper,p,(p,a)) -#define IDirectDrawSurface4_GetColorKey(p,a,b) ICOM_CALL_(GetColorKey,p,(p,a,b)) -#define IDirectDrawSurface4_GetDC(p,a) ICOM_CALL_(GetDC,p,(p,a)) -#define IDirectDrawSurface4_GetFlipStatus(p,a) ICOM_CALL_(GetFlipStatus,p,(p,a)) -#define IDirectDrawSurface4_GetOverlayPosition(p,a,b) ICOM_CALL_(GetOverlayPosition,p,(p,a,b)) -#define IDirectDrawSurface4_GetPalette(p,a) ICOM_CALL_(GetPalette,p,(p,a)) -#define IDirectDrawSurface4_GetPixelFormat(p,a) ICOM_CALL_(GetPixelFormat,p,(p,a)) -#define IDirectDrawSurface4_GetSurfaceDesc(p,a) ICOM_CALL_(GetSurfaceDesc,p,(p,a)) -#define IDirectDrawSurface4_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b)) -#define IDirectDrawSurface4_IsLost(p) ICOM_CALL_(IsLost,p,(p)) -#define IDirectDrawSurface4_Lock(p,a,b,c,d) ICOM_CALL_(Lock,p,(p,a,b,c,d)) -#define IDirectDrawSurface4_ReleaseDC(p,a) ICOM_CALL_(ReleaseDC,p,(p,a)) -#define IDirectDrawSurface4_Restore(p) ICOM_CALL_(Restore,p,(p)) -#define IDirectDrawSurface4_SetClipper(p,a) ICOM_CALL_(SetClipper,p,(p,a)) -#define IDirectDrawSurface4_SetColorKey(p,a,b) ICOM_CALL_(SetColorKey,p,(p,a,b)) -#define IDirectDrawSurface4_SetOverlayPosition(p,a,b) ICOM_CALL_(SetOverlayPosition,p,(p,a,b)) -#define IDirectDrawSurface4_SetPalette(p,a) ICOM_CALL_(SetPalette,p,(p,a)) -#define IDirectDrawSurface4_Unlock(p,a) ICOM_CALL_(Unlock,p,(p,a)) -#define IDirectDrawSurface4_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL_(UpdateOverlay,p,(p,a,b,c,d,e)) -#define IDirectDrawSurface4_UpdateOverlayDisplay(p,a) ICOM_CALL_(UpdateOverlayDisplay,p,(p,a)) -#define IDirectDrawSurface4_UpdateOverlayZOrder(p,a,b) ICOM_CALL_(UpdateOverlayZOrder,p,(p,a,b)) -/*** IDirectDrawSurface2 methods ***/ -#define IDirectDrawSurface4_GetDDInterface(p,a) ICOM_CALL_(GetDDInterface,p,(p,a)) -#define IDirectDrawSurface4_PageLock(p,a) ICOM_CALL_(PageLock,p,(p,a)) -#define IDirectDrawSurface4_PageUnlock(p,a) ICOM_CALL_(PageUnlock,p,(p,a)) -/*** IDirectDrawSurface3 methods ***/ -#define IDirectDrawSurface4_SetSurfaceDesc(p,a,b) ICOM_CALL_(SetSurfaceDesc,p,(p,a,b)) -/*** IDirectDrawSurface4 methods ***/ -#define IDirectDrawSurface4_SetPrivateData(p,a,b,c,d) ICOM_CALL_(SetPrivateData,p,(p,a,b,c,d)) -#define IDirectDrawSurface4_GetPrivateData(p,a,b,c) ICOM_CALL_(GetPrivateData,p,(p,a,b,c)) -#define IDirectDrawSurface4_FreePrivateData(p,a) ICOM_CALL_(FreePrivateData,p,(p,a)) -#define IDirectDrawSurface4_GetUniquenessValue(p,a) ICOM_CALL_(GetUniquenessValue,p,(p,a)) -#define IDirectDrawSurface4_ChangeUniquenessValue(p) ICOM_CALL_(ChangeUniquenessValue,p,(p)) - - -/***************************************************************************** - * IDirectDrawSurface7 interface - */ -#undef INTERFACE -#define INTERFACE IDirectDrawSurface7 -DECLARE_INTERFACE_(IDirectDrawSurface7,IUnknown) -{ - STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE7 lpDDSAttachedSurface) PURE; - STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT lpRect) PURE; - STDMETHOD(Blt)(THIS_ LPRECT lpDestRect, LPDIRECTDRAWSURFACE7 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx) PURE; - STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags) PURE; - STDMETHOD(BltFast)(THIS_ DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE7 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans) PURE; - STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE7 lpDDSAttachedSurface) PURE; - STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpEnumSurfacesCallback) PURE; - STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpfnCallback) PURE; - STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE7 lpDDSurfaceTargetOverride, DWORD dwFlags) PURE; - STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS2 lpDDSCaps, LPDIRECTDRAWSURFACE7* lplpDDAttachedSurface) PURE; - STDMETHOD(GetBltStatus)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(GetCaps)(THIS_ LPDDSCAPS2 lpDDSCaps) PURE; - STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER* lplpDDClipper) PURE; - STDMETHOD(GetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; - STDMETHOD(GetDC)(THIS_ HDC* lphDC) PURE; - STDMETHOD(GetFlipStatus)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(GetOverlayPosition)(THIS_ LPLONG lplX, LPLONG lplY) PURE; - STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE* lplpDDPalette) PURE; - STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE; - STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC2 lpDDSurfaceDesc) PURE; - STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC2 lpDDSurfaceDesc) PURE; - STDMETHOD(IsLost)(THIS) PURE; - STDMETHOD(Lock)(THIS_ LPRECT lpDestRect, LPDDSURFACEDESC2 lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE; - STDMETHOD(ReleaseDC)(THIS_ HDC hDC) PURE; - STDMETHOD(Restore)(THIS) PURE; - STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER lpDDClipper) PURE; - STDMETHOD(SetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; - STDMETHOD(SetOverlayPosition)(THIS_ LONG lX, LONG lY) PURE; - STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE lpDDPalette) PURE; - STDMETHOD(Unlock)(THIS_ LPRECT lpSurfaceData) PURE; - STDMETHOD(UpdateOverlay)(THIS_ LPRECT lpSrcRect, LPDIRECTDRAWSURFACE7 lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx) PURE; - STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE7 lpDDSReference) PURE; - /* added in v2 */ - STDMETHOD(GetDDInterface)(THIS_ LPVOID* lplpDD) PURE; - STDMETHOD(PageLock)(THIS_ DWORD dwFlags) PURE; - STDMETHOD(PageUnlock)(THIS_ DWORD dwFlags) PURE; - /* added in v3 */ - STDMETHOD(SetSurfaceDesc)(THIS_ LPDDSURFACEDESC2 lpDDSD, DWORD dwFlags) PURE; - /* added in v4 */ - STDMETHOD(SetPrivateData)(THIS_ REFGUID , LPVOID , DWORD , DWORD ) PURE; - STDMETHOD(GetPrivateData)(THIS_ REFGUID , LPVOID , LPDWORD ) PURE; - STDMETHOD(FreePrivateData)(THIS_ REFGUID ) PURE; - STDMETHOD(GetUniquenessValue)(THIS_ LPDWORD ) PURE; - STDMETHOD(ChangeUniquenessValue)(THIS) PURE; - /* added in v7 */ - STDMETHOD(SetPriority)(THIS_ DWORD prio) PURE; - STDMETHOD(GetPriority)(THIS_ LPDWORD prio) PURE; - STDMETHOD(SetLOD)(THIS_ DWORD lod) PURE; - STDMETHOD(GetLOD)(THIS_ LPDWORD lod) PURE; -}; - - /*** IUnknown methods ***/ -#define IDirectDrawSurface7_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) -#define IDirectDrawSurface7_AddRef(p) ICOM_CALL_(AddRef,p,(p)) -#define IDirectDrawSurface7_Release(p) ICOM_CALL_(Release,p,(p)) -/*** IDirectDrawSurface (almost) methods ***/ -#define IDirectDrawSurface7_AddAttachedSurface(p,a) ICOM_CALL_(AddAttachedSurface,p,(p,a)) -#define IDirectDrawSurface7_AddOverlayDirtyRect(p,a) ICOM_CALL_(AddOverlayDirtyRect,p,(p,a)) -#define IDirectDrawSurface7_Blt(p,a,b,c,d,e) ICOM_CALL_(Blt,p,(p,a,b,c,d,e)) -#define IDirectDrawSurface7_BltBatch(p,a,b,c) ICOM_CALL_(BltBatch,p,(p,a,b,c)) -#define IDirectDrawSurface7_BltFast(p,a,b,c,d,e) ICOM_CALL_(BltFast,p,(p,a,b,c,d,e)) -#define IDirectDrawSurface7_DeleteAttachedSurface(p,a,b) ICOM_CALL_(DeleteAttachedSurface,p,(p,a,b)) -#define IDirectDrawSurface7_EnumAttachedSurfaces(p,a,b) ICOM_CALL_(EnumAttachedSurfaces,p,(p,a,b)) -#define IDirectDrawSurface7_EnumOverlayZOrders(p,a,b,c) ICOM_CALL_(EnumOverlayZOrders,p,(p,a,b,c)) -#define IDirectDrawSurface7_Flip(p,a,b) ICOM_CALL_(Flip,p,(p,a,b)) -#define IDirectDrawSurface7_GetAttachedSurface(p,a,b) ICOM_CALL_(GetAttachedSurface,p,(p,a,b)) -#define IDirectDrawSurface7_GetBltStatus(p,a) ICOM_CALL_(GetBltStatus,p,(p,a)) -#define IDirectDrawSurface7_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a)) -#define IDirectDrawSurface7_GetClipper(p,a) ICOM_CALL_(GetClipper,p,(p,a)) -#define IDirectDrawSurface7_GetColorKey(p,a,b) ICOM_CALL_(GetColorKey,p,(p,a,b)) -#define IDirectDrawSurface7_GetDC(p,a) ICOM_CALL_(GetDC,p,(p,a)) -#define IDirectDrawSurface7_GetFlipStatus(p,a) ICOM_CALL_(GetFlipStatus,p,(p,a)) -#define IDirectDrawSurface7_GetOverlayPosition(p,a,b) ICOM_CALL_(GetOverlayPosition,p,(p,a,b)) -#define IDirectDrawSurface7_GetPalette(p,a) ICOM_CALL_(GetPalette,p,(p,a)) -#define IDirectDrawSurface7_GetPixelFormat(p,a) ICOM_CALL_(GetPixelFormat,p,(p,a)) -#define IDirectDrawSurface7_GetSurfaceDesc(p,a) ICOM_CALL_(GetSurfaceDesc,p,(p,a)) -#define IDirectDrawSurface7_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b)) -#define IDirectDrawSurface7_IsLost(p) ICOM_CALL_(IsLost,p,(p)) -#define IDirectDrawSurface7_Lock(p,a,b,c,d) ICOM_CALL_(Lock,p,(p,a,b,c,d)) -#define IDirectDrawSurface7_ReleaseDC(p,a) ICOM_CALL_(ReleaseDC,p,(p,a)) -#define IDirectDrawSurface7_Restore(p) ICOM_CALL_(Restore,p,(p)) -#define IDirectDrawSurface7_SetClipper(p,a) ICOM_CALL_(SetClipper,p,(p,a)) -#define IDirectDrawSurface7_SetColorKey(p,a,b) ICOM_CALL_(SetColorKey,p,(p,a,b)) -#define IDirectDrawSurface7_SetOverlayPosition(p,a,b) ICOM_CALL_(SetOverlayPosition,p,(p,a,b)) -#define IDirectDrawSurface7_SetPalette(p,a) ICOM_CALL_(SetPalette,p,(p,a)) -#define IDirectDrawSurface7_Unlock(p,a) ICOM_CALL_(Unlock,p,(p,a)) -#define IDirectDrawSurface7_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL_(UpdateOverlay,p,(p,a,b,c,d,e)) -#define IDirectDrawSurface7_UpdateOverlayDisplay(p,a) ICOM_CALL_(UpdateOverlayDisplay,p,(p,a)) -#define IDirectDrawSurface7_UpdateOverlayZOrder(p,a,b) ICOM_CALL_(UpdateOverlayZOrder,p,(p,a,b)) -/*** IDirectDrawSurface2 methods ***/ -#define IDirectDrawSurface7_GetDDInterface(p,a) ICOM_CALL_(GetDDInterface,p,(p,a)) -#define IDirectDrawSurface7_PageLock(p,a) ICOM_CALL_(PageLock,p,(p,a)) -#define IDirectDrawSurface7_PageUnlock(p,a) ICOM_CALL_(PageUnlock,p,(p,a)) -/*** IDirectDrawSurface3 methods ***/ -#define IDirectDrawSurface7_SetSurfaceDesc(p,a,b) ICOM_CALL_(SetSurfaceDesc,p,(p,a,b)) -/*** IDirectDrawSurface4 methods ***/ -#define IDirectDrawSurface7_SetPrivateData(p,a,b,c,d) ICOM_CALL_(SetPrivateData,p,(p,a,b,c,d)) -#define IDirectDrawSurface7_GetPrivateData(p,a,b,c) ICOM_CALL_(GetPrivateData,p,(p,a,b,c)) -#define IDirectDrawSurface7_FreePrivateData(p,a) ICOM_CALL_(FreePrivateData,p,(p,a)) -#define IDirectDrawSurface7_GetUniquenessValue(p,a) ICOM_CALL_(GetUniquenessValue,p,(p,a)) -#define IDirectDrawSurface7_ChangeUniquenessValue(p) ICOM_CALL_(ChangeUniquenessValue,p,(p)) -/*** IDirectDrawSurface7 methods ***/ -#define IDirectDrawSurface7_SetPriority(p,a) ICOM_CALL_(SetPriority,p,(p,a)) -#define IDirectDrawSurface7_GetPriority(p,a) ICOM_CALL_(GetPriority,p,(p,a)) -#define IDirectDrawSurface7_SetLOD(p,a) ICOM_CALL_(SetLOD,p,(p,a)) -#define IDirectDrawSurface7_GetLOD(p,a) ICOM_CALL_(GetLOD,p,(p,a)) - -/***************************************************************************** - * IDirectDrawColorControl interface - */ -#undef INTERFACE -#define INTERFACE IDirectDrawColorControl -DECLARE_INTERFACE_(IDirectDrawColorControl,IUnknown) -{ - STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - STDMETHOD(GetColorControls)(THIS_ LPDDCOLORCONTROL lpColorControl) PURE; - STDMETHOD(SetColorControls)(THIS_ LPDDCOLORCONTROL lpColorControl) PURE; -}; - - /*** IUnknown methods ***/ -#define IDirectDrawColorControl_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) -#define IDirectDrawColorControl_AddRef(p) ICOM_CALL_(AddRef,p,(p)) -#define IDirectDrawColorControl_Release(p) ICOM_CALL_(Release,p,(p)) - /*** IDirectDrawColorControl methods ***/ -#define IDirectDrawColorControl_GetColorControls(p,a) ICOM_CALL_(GetColorControls,p,(p,a)) -#define IDirectDrawColorControl_SetColorControls(p,a) ICOM_CALL_(SetColorControls,p,(p,a)) - -/***************************************************************************** - * IDirectDrawGammaControl interface - */ -#undef INTERFACE -#define INTERFACE IDirectDrawGammaControl -DECLARE_INTERFACE_(IDirectDrawGammaControl,IUnknown) -{ - STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - STDMETHOD(GetGammaRamp)(THIS_ DWORD dwFlags, LPDDGAMMARAMP lpGammaRamp) PURE; - STDMETHOD(SetGammaRamp)(THIS_ DWORD dwFlags, LPDDGAMMARAMP lpGammaRamp) PURE; -}; - - /*** IUnknown methods ***/ -#define IDirectDrawGammaControl_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) -#define IDirectDrawGammaControl_AddRef(p) ICOM_CALL_(AddRef,p,(p)) -#define IDirectDrawGammaControl_Release(p) ICOM_CALL_(Release,p,(p)) - /*** IDirectDrawGammaControl methods ***/ -#define IDirectDrawGammaControl_GetGammaRamp(p,a,b) ICOM_CALL_(GetGammaRamp,p,(p,a,b)) -#define IDirectDrawGammaControl_SetGammaRamp(p,a,b) ICOM_CALL_(SetGammaRamp,p,(p,a,b)) - - -HRESULT WINAPI DirectDrawCreate(LPGUID,LPDIRECTDRAW*,LPUNKNOWN); -HRESULT WINAPI DirectDrawCreateEx(LPGUID,LPVOID*,REFIID,LPUNKNOWN); -HRESULT WINAPI DirectDrawEnumerateA(LPDDENUMCALLBACKA,LPVOID); -HRESULT WINAPI DirectDrawEnumerateW(LPDDENUMCALLBACKW,LPVOID); -#define DirectDrawEnumerate WINELIB_NAME_AW(DirectDrawEnumerate) -HRESULT WINAPI DirectDrawCreateClipper(DWORD,LPDIRECTDRAWCLIPPER*,LPUNKNOWN); - - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* defined(__cplusplus) */ - -#endif /* __XWIN_DDRAW_H */ diff --git a/xorg-server/hw/xwin/makefile b/xorg-server/hw/xwin/makefile new file mode 100644 index 000000000..5b409759d --- /dev/null +++ b/xorg-server/hw/xwin/makefile @@ -0,0 +1,101 @@ +LIBRARY = libXWin + +SRCS_CLIPBOARD = \ + winclipboardinit.c \ + winclipboardtextconv.c \ + winclipboardthread.c \ + winclipboardunicode.c \ + winclipboardwndproc.c \ + winclipboardwrappers.c \ + winclipboardxevents.c + +DEFINES += XWIN_CLIPBOARD + +SRCS_MULTIWINDOW = \ + winmultiwindowshape.c \ + winmultiwindowwindow.c \ + winmultiwindowwm.c \ + winmultiwindowwndproc.c + +DEFINES += XWIN_MULTIWINDOW + +SRCS_RANDR = \ + winrandr.c +DEFINES += XWIN_RANDR RELOCATE_PROJECTROOT + +CSRCS = InitInput.c \ + InitOutput.c \ + winallpriv.c \ + winauth.c \ + winblock.c \ + wincmap.c \ + winconfig.c \ + wincreatewnd.c \ + wincursor.c \ + windialogs.c \ + winengine.c \ + winerror.c \ + winglobals.c \ + winkeybd.c \ + winkeyhook.c \ + winmisc.c \ + winmouse.c \ + winmsg.c \ + winmultiwindowclass.c \ + winmultiwindowicons.c \ + winprefs.c \ + winprocarg.c \ + winregistry.c \ + winscrinit.c \ + winshaddd.c \ + winshadddnl.c \ + winshadgdi.c \ + wintrayicon.c \ + winvalargs.c \ + winwakeup.c \ + winwindow.c \ + winprefslex.c \ + winprefsyacc.c \ + winwndproc.c $(SRCS_RANDR) $(SRCS_MULTIWINDOW) $(SRCS_CLIPBOARD) + +DEFINES += YY_NO_UNISTD_H + +# XWin.rc \ +# $(top_srcdir)/Xext/dpmsstubs.c \ +# $(top_srcdir)/Xi/stubs.c \ +# $(top_srcdir)/mi/miinitext.c \ +# $(top_srcdir)/fb/fbcmap_mi.c \ +# $(SRCS_CLIPBOARD) \ +# $(SRCS_GLX_WINDOWS) \ +# $(SRCS_MULTIWINDOW) \ +# $(SRCS_MULTIWINDOWEXTWM) \ +# $(SRCS_NATIVEGDI) \ +# $(SRCS_PRIMARYFB) \ +# $(SRCS_RANDR) \ +# $(SRCS_XV) + +INCLUDES += ..\..\miext\rootless + +SRCS_NATIVEGDI = \ + winclip.c \ + winfillsp.c \ + winfont.c \ + wingc.c \ + wingetsp.c \ + winnativegdi.c \ + winpixmap.c \ + winpolyline.c \ + winpushpxl.c \ + winrop.c \ + winsetsp.c +CSRCS += $(SRCS_NATIVEGDI) +DEFINES += XWIN_NATIVEGDI + +#.rc.o: + +# $(WINDRES) --use-temp-file -i $< --input-format=rc -o $@ -O coff -I $(top_builddir)/include -DPROJECT_NAME=\"$(VENDOR_NAME_SHORT)\" -DPROJECT_VERSION=\"$(PACKAGE_VERSION)\" -DBUILD_DATE=\"$(BUILD_DATE)\" + +DEFINES += HAVE_XWIN_CONFIG_H BUILD_DATE=0-0-0000 PTW32_STATIC_LIB + +#CSRCS=winkeybd.c + diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h index 3ab324931..62fcd83b8 100644 --- a/xorg-server/hw/xwin/win.h +++ b/xorg-server/hw/xwin/win.h @@ -103,6 +103,7 @@ #define WIN_E3B_TIMER_ID 1 #define WIN_POLLING_MOUSE_TIMER_ID 2 +#define MOUSE_POLLING_INTERVAL 50 #define WIN_E3B_OFF -1 #define WIN_FD_INVALID -1 @@ -142,6 +143,9 @@ #include <errno.h> #if defined(XWIN_MULTIWINDOWEXTWM) || defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) #define HANDLE void * +#ifdef _MSC_VER +typedef int pid_t; +#endif #include <pthread.h> #undef HANDLE #endif @@ -314,6 +318,7 @@ typedef Bool (*winReleasePrimarySurfaceProcPtr)(ScreenPtr); typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin); +typedef Bool (*winCreateScreenResourcesProc)(ScreenPtr); /* Typedef for DIX wrapper functions */ typedef int (*winDispatchProcPtr) (ClientPtr); @@ -564,6 +569,8 @@ typedef struct _winPrivScreenRec winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface; winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface; + winCreateScreenResourcesProc pwinCreateScreenResources; + #ifdef XWIN_MULTIWINDOW /* Window Procedures for MultiWindow mode */ winFinishCreateWindowsWindowProcPtr pwinFinishCreateWindowsWindow; @@ -590,6 +597,11 @@ typedef struct _winPrivScreenRec SetShapeProcPtr SetShape; #endif +#ifdef XWIN_NATIVEGDI + RealizeFontProcPtr RealizeFont; + UnrealizeFontProcPtr UnrealizeFont; +#endif + winCursorRec cursor; } winPrivScreenRec; @@ -1006,6 +1018,9 @@ winMouseButtonsHandle (ScreenPtr pScreen, int iEventType, int iButton, WPARAM wParam); +void +winEnqueueMotion(int x, int y); + #ifdef XWIN_NATIVEGDI /* * winnativegdi.c diff --git a/xorg-server/hw/xwin/winclipboard.h b/xorg-server/hw/xwin/winclipboard.h index 445c01b27..9603b92fe 100644 --- a/xorg-server/hw/xwin/winclipboard.h +++ b/xorg-server/hw/xwin/winclipboard.h @@ -34,15 +34,20 @@ #include <assert.h> #include <stdio.h> #include <stdlib.h> +#ifndef _MSC_VER #include <unistd.h> +#endif #ifdef __CYGWIN__ #include <sys/select.h> #else -#include "Xwinsock.h" +#include "X11/Xwinsock.h" #define HAS_WINSOCK #endif #include <fcntl.h> #include <setjmp.h> +#ifdef _MSC_VER +typedef int pid_t; +#endif #include <pthread.h> /* X headers */ @@ -60,8 +65,10 @@ #define ATOM DWORD #ifndef __CYGWIN__ +#ifndef sleep #define sleep(x) Sleep (1000 * (x)) #endif +#endif /* Windows headers */ #ifndef XFree86Server diff --git a/xorg-server/hw/xwin/winclipboardthread.c b/xorg-server/hw/xwin/winclipboardthread.c index 081abd5e7..0e654d267 100644 --- a/xorg-server/hw/xwin/winclipboardthread.c +++ b/xorg-server/hw/xwin/winclipboardthread.c @@ -1,5 +1,6 @@ /* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -20,12 +21,13 @@ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - *Except as contained in this notice, the name of Harold L Hunt II - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. + *Except as contained in this notice, the name of the copyright holder(s) + *and author(s) shall not be used in advertising or otherwise to promote + *the sale, use or other dealings in this Software without prior written + *authorization from the copyright holder(s) and author(s). * * Authors: Harold L Hunt II + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H @@ -38,6 +40,10 @@ #endif #include "X11/Xauth.h" +#ifdef _MSC_VER +#define snprintf _snprintf +#define max __max +#endif /* * Constants @@ -218,7 +224,7 @@ winClipboardProc (void *pvNotUsed) #ifdef HAS_DEVWINDOWS /* Open a file descriptor for the windows message queue */ - fdMessageQueue = open (WIN_MSG_QUEUE_FNAME, O_RDONLY); + fdMessageQueue = open (WIN_MSG_QUEUE_FNAME, _O_RDONLY); if (fdMessageQueue == -1) { ErrorF ("winClipboardProc - Failed opening %s\n", WIN_MSG_QUEUE_FNAME); @@ -231,15 +237,6 @@ winClipboardProc (void *pvNotUsed) iMaxDescriptor = iConnectionNumber + 1; #endif - /* Select event types to watch */ - if (XSelectInput (pDisplay, - DefaultRootWindow (pDisplay), - SubstructureNotifyMask | - StructureNotifyMask | - PropertyChangeMask) == BadWindow) - ErrorF ("winClipboardProc - XSelectInput generated BadWindow " - "on RootWindow\n\n"); - /* Create atoms */ atomClipboard = XInternAtom (pDisplay, "CLIPBOARD", False); atomClipboardManager = XInternAtom (pDisplay, "CLIPBOARD_MANAGER", False); @@ -258,6 +255,13 @@ winClipboardProc (void *pvNotUsed) pthread_exit (NULL); } + /* Select event types to watch */ + if (XSelectInput (pDisplay, + iWindow, + PropertyChangeMask) == BadWindow) + ErrorF ("winClipboardProc - XSelectInput generated BadWindow " + "on messaging window\n"); + /* Save the window in the screen privates */ g_iClipboardWindow = iWindow; @@ -273,7 +277,8 @@ winClipboardProc (void *pvNotUsed) /* PRIMARY */ iReturn = XSetSelectionOwner (pDisplay, XA_PRIMARY, iWindow, CurrentTime); - if (iReturn == BadAtom || iReturn == BadWindow) + if (iReturn == BadAtom || iReturn == BadWindow || + XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow) { ErrorF ("winClipboardProc - Could not set PRIMARY owner\n"); pthread_exit (NULL); @@ -282,7 +287,8 @@ winClipboardProc (void *pvNotUsed) /* CLIPBOARD */ iReturn = XSetSelectionOwner (pDisplay, atomClipboard, iWindow, CurrentTime); - if (iReturn == BadAtom || iReturn == BadWindow) + if (iReturn == BadAtom || iReturn == BadWindow || + XGetSelectionOwner (pDisplay, atomClipboard) != iWindow) { ErrorF ("winClipboardProc - Could not set CLIPBOARD owner\n"); pthread_exit (NULL); diff --git a/xorg-server/hw/xwin/winclipboardunicode.c b/xorg-server/hw/xwin/winclipboardunicode.c index ba86915a4..531f5703a 100644 --- a/xorg-server/hw/xwin/winclipboardunicode.c +++ b/xorg-server/hw/xwin/winclipboardunicode.c @@ -43,25 +43,43 @@ Bool winClipboardDetectUnicodeSupport (void) { Bool fReturn = FALSE; - OSVERSIONINFO osvi = {0}; + OSVERSIONINFOEX osvi = {0}; /* Get operating system version information */ osvi.dwOSVersionInfoSize = sizeof (osvi); - GetVersionEx (&osvi); + GetVersionEx ((LPOSVERSIONINFO)&osvi); /* Branch on platform ID */ switch (osvi.dwPlatformId) { case VER_PLATFORM_WIN32_NT: - /* Unicode supported on NT only */ - ErrorF ("DetectUnicodeSupport - Windows NT/2000/XP\n"); - fReturn = TRUE; + if (osvi.dwMajorVersion >= 6) + { + if (osvi.wProductType == VER_NT_WORKSTATION) + ErrorF ("OS: Windows Vista\n"); + else + ErrorF ("OS: Windows Server 2008\n"); + fReturn = TRUE; + } + else if (osvi.dwMajorVersion == 5) + { + if (osvi.dwMinorVersion == 2) + { + ErrorF ("OS: Windows 2003\n"); + fReturn = TRUE; + } + else if (osvi.dwMinorVersion == 1) + { + ErrorF ("OS: Windows XP\n"); + fReturn = TRUE; + } + else if (osvi.dwMinorVersion == 0) ErrorF ("OS: Windows 2000\n"); + } + else if (osvi.dwMajorVersion <= 4) ErrorF ("OS: Windows NT\n"); break; case VER_PLATFORM_WIN32_WINDOWS: - /* Unicode is not supported on non-NT */ - ErrorF ("DetectUnicodeSupport - Windows 95/98/Me\n"); - fReturn = FALSE; + ErrorF ("OS: Windows 95/98/Me\n"); break; } diff --git a/xorg-server/hw/xwin/winclipboardwndproc.c b/xorg-server/hw/xwin/winclipboardwndproc.c index 802a74035..a69edaeca 100644 --- a/xorg-server/hw/xwin/winclipboardwndproc.c +++ b/xorg-server/hw/xwin/winclipboardwndproc.c @@ -1,5 +1,6 @@ /* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -20,12 +21,13 @@ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - *Except as contained in this notice, the name of Harold L Hunt II - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. + *Except as contained in this notice, the name of the copyright holder(s) + *and author(s) shall not be used in advertising or otherwise to promote + *the sale, use or other dealings in this Software without prior written + *authorization from the copyright holder(s) and author(s). * * Authors: Harold L Hunt II + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H @@ -63,7 +65,7 @@ extern HWND g_hwndClipboard; * Local function prototypes */ -static Bool +static int winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay, Bool fUseUnicode, int iTimeoutSec); @@ -260,12 +262,15 @@ winClipboardWindowProc (HWND hwnd, UINT message, case WM_DRAWCLIPBOARD: { static Bool s_fProcessingDrawClipboard = FALSE; + static Atom atomClipboard; Display *pDisplay = g_pClipboardDisplay; Window iWindow = g_iClipboardWindow; int iReturn; winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Enter\n"); + if (atomClipboard == None) atomClipboard = XInternAtom (pDisplay, "CLIPBOARD", False); + /* * We've occasionally seen a loop in the clipboard chain. * Try and fix it on the first hint of recursion. @@ -353,17 +358,13 @@ winClipboardWindowProc (HWND hwnd, UINT message, /* Release CLIPBOARD selection if owned */ iReturn = XGetSelectionOwner (pDisplay, - XInternAtom (pDisplay, - "CLIPBOARD", - False)); + atomClipboard); if (iReturn == g_iClipboardWindow) { winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - " "CLIPBOARD selection is owned by us.\n"); XSetSelectionOwner (pDisplay, - XInternAtom (pDisplay, - "CLIPBOARD", - False), + atomClipboard, None, CurrentTime); } @@ -383,7 +384,8 @@ winClipboardWindowProc (HWND hwnd, UINT message, XA_PRIMARY, iWindow, CurrentTime); - if (iReturn == BadAtom || iReturn == BadWindow) + if (iReturn == BadAtom || iReturn == BadWindow || + XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow) { winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - " "Could not reassert ownership of PRIMARY\n"); @@ -396,12 +398,12 @@ winClipboardWindowProc (HWND hwnd, UINT message, /* Reassert ownership of the CLIPBOARD */ iReturn = XSetSelectionOwner (pDisplay, - XInternAtom (pDisplay, - "CLIPBOARD", - False), + atomClipboard, iWindow, CurrentTime); - if (iReturn == BadAtom || iReturn == BadWindow) + + if (iReturn == BadAtom || iReturn == BadWindow || + XGetSelectionOwner (pDisplay, atomClipboard) != iWindow) { winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - " "Could not reassert ownership of CLIPBOARD\n"); diff --git a/xorg-server/hw/xwin/winclipboardwrappers.c b/xorg-server/hw/xwin/winclipboardwrappers.c index 2cfe0ffce..5578182c1 100644 --- a/xorg-server/hw/xwin/winclipboardwrappers.c +++ b/xorg-server/hw/xwin/winclipboardwrappers.c @@ -1,5 +1,6 @@ /* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -20,12 +21,13 @@ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - *Except as contained in this notice, the name of Harold L Hunt II - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. + *Except as contained in this notice, the name of the copyright holder(s) + *and author(s) shall not be used in advertising or otherwise to promote + *the sale, use or other dealings in this Software without prior written + *authorization from the copyright holder(s) and author(s). * * Authors: Harold L Hunt II + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H @@ -40,6 +42,7 @@ * Constants */ +#define CLIP_NUM_CALLS 4 #define CLIP_NUM_SELECTIONS 2 #define CLIP_OWN_PRIMARY 0 #define CLIP_OWN_CLIPBOARD 1 @@ -85,6 +88,8 @@ winProcQueryTree (ClientPtr client) { int iReturn; + ErrorF ("winProcQueryTree - Hello\n"); + /* * This procedure is only used for initialization. * We can unwrap the original procedure at this point @@ -184,7 +189,7 @@ winProcEstablishConnection (ClientPtr client) static int s_iCallCount = 0; static unsigned long s_ulServerGeneration = 0; - ErrorF ("winProcEstablishConnection - Hello\n"); + if (s_iCallCount == 0 || s_iCallCount == CLIP_NUM_CALLS) ErrorF ("winProcEstablishConnection - Hello\n"); /* Do nothing if clipboard is not enabled */ if (!g_fClipboard) @@ -212,13 +217,15 @@ winProcEstablishConnection (ClientPtr client) /* Increment call count */ ++s_iCallCount; - /* Wait for second call when Xdmcp is enabled */ + /* Wait for CLIP_NUM_CALLS when Xdmcp is enabled */ if (g_fXdmcpEnabled && !g_fClipboardLaunched - && s_iCallCount < 4) + && s_iCallCount < CLIP_NUM_CALLS) { - ErrorF ("winProcEstablishConnection - Xdmcp enabled, waiting to " - "start clipboard client until fourth call.\n"); + if (s_iCallCount == 1) ErrorF ("winProcEstablishConnection - Xdmcp, waiting to " + "start clipboard client until %dth call", CLIP_NUM_CALLS); + if (s_iCallCount == CLIP_NUM_CALLS - 1) ErrorF (".\n"); + else ErrorF ("."); return (*winProcEstablishConnectionOrig) (client); } @@ -275,7 +282,7 @@ winProcEstablishConnection (ClientPtr client) * 8) Unfortunately, there is another problem. * 9) XDM walks the list of windows with XQueryTree, * killing any client it finds with a window. - * 10)Thus, when using XDMCP we wait until the second call + * 10)Thus, when using XDMCP we wait until CLIP_NUM_CALLS * to ProcEstablishCeonnection before we startup the clipboard * client. This should prevent XDM from finding the clipboard * client, since it has not yet created a window. diff --git a/xorg-server/hw/xwin/winclipboardxevents.c b/xorg-server/hw/xwin/winclipboardxevents.c index d4c617bec..09bdb7396 100644 --- a/xorg-server/hw/xwin/winclipboardxevents.c +++ b/xorg-server/hw/xwin/winclipboardxevents.c @@ -1,5 +1,6 @@ /* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -20,12 +21,13 @@ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - *Except as contained in this notice, the name of Harold L Hunt II - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. + *Except as contained in this notice, the name of the copyright holder(s) + *and author(s) shall not be used in advertising or otherwise to promote + *the sale, use or other dealings in this Software without prior written + *authorization from the copyright holder(s) and author(s). * * Authors: Harold L Hunt II + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H @@ -51,18 +53,25 @@ winClipboardFlushXEvents (HWND hwnd, Display *pDisplay, Bool fUseUnicode) { - Atom atomLocalProperty = XInternAtom (pDisplay, - WIN_LOCAL_PROPERTY, - False); - Atom atomUTF8String = XInternAtom (pDisplay, - "UTF8_STRING", - False); - Atom atomCompoundText = XInternAtom (pDisplay, - "COMPOUND_TEXT", - False); - Atom atomTargets = XInternAtom (pDisplay, - "TARGETS", - False); + static Atom atomLocalProperty, atomCompoundText; + static Atom atomUTF8String, atomTargets; + + if (atomLocalProperty == None) + atomLocalProperty = XInternAtom (pDisplay, + WIN_LOCAL_PROPERTY, + False); + if (atomUTF8String == None) + atomUTF8String = XInternAtom (pDisplay, + "UTF8_STRING", + False); + if (atomCompoundText == None) + atomCompoundText = XInternAtom (pDisplay, + "COMPOUND_TEXT", + False); + if (atomTargets == None) + atomTargets = XInternAtom (pDisplay, + "TARGETS", + False); /* Process all pending events */ while (XPending (pDisplay)) @@ -183,6 +192,7 @@ winClipboardFlushXEvents (HWND hwnd, } /* Check that clipboard format is available */ + XLockDisplay (pDisplay); if (fUseUnicode && !IsClipboardFormatAvailable (CF_UNICODETEXT)) { @@ -190,6 +200,7 @@ winClipboardFlushXEvents (HWND hwnd, "available from Win32 clipboard. Aborting.\n"); /* Abort */ + XUnlockDisplay (pDisplay); fAbort = TRUE; goto winClipboardFlushXEvents_SelectionRequest_Done; } @@ -200,6 +211,7 @@ winClipboardFlushXEvents (HWND hwnd, "available from Win32 clipboard. Aborting.\n"); /* Abort */ + XUnlockDisplay (pDisplay); fAbort = TRUE; goto winClipboardFlushXEvents_SelectionRequest_Done; } @@ -218,6 +230,7 @@ winClipboardFlushXEvents (HWND hwnd, GetLastError ()); /* Abort */ + XUnlockDisplay (pDisplay); fAbort = TRUE; goto winClipboardFlushXEvents_SelectionRequest_Done; } @@ -259,6 +272,7 @@ winClipboardFlushXEvents (HWND hwnd, GetLastError ()); /* Abort */ + XUnlockDisplay (pDisplay); fAbort = TRUE; goto winClipboardFlushXEvents_SelectionRequest_Done; } @@ -294,6 +308,7 @@ winClipboardFlushXEvents (HWND hwnd, /* Convert DOS string to UNIX string */ winClipboardDOStoUNIX (pszConvertData, strlen (pszConvertData)); + XUnlockDisplay (pDisplay); /* Setup our text list */ pszTextList[0] = pszConvertData; @@ -301,6 +316,7 @@ winClipboardFlushXEvents (HWND hwnd, /* Initialize the text property */ xtpText.value = NULL; + xtpText.nitems = 0; /* Create the text property from the text list */ if (fUseUnicode) @@ -361,10 +377,13 @@ winClipboardFlushXEvents (HWND hwnd, /* Release the clipboard data */ GlobalUnlock (hGlobal); pszGlobalData = NULL; + fCloseClipboard = FALSE; + CloseClipboard (); /* Clean up */ XFree (xtpText.value); xtpText.value = NULL; + xtpText.nitems = 0; /* Setup selection notify event */ eventSelection.type = SelectionNotify; @@ -395,7 +414,11 @@ winClipboardFlushXEvents (HWND hwnd, winClipboardFlushXEvents_SelectionRequest_Done: /* Free allocated resources */ if (xtpText.value) + { XFree (xtpText.value); + xtpText.value = NULL; + xtpText.nitems = 0; + } if (pszConvertData) free (pszConvertData); if (hGlobal && pszGlobalData) @@ -436,7 +459,10 @@ winClipboardFlushXEvents (HWND hwnd, /* Close clipboard if it was opened */ if (fCloseClipboard) + { + fCloseClipboard = FALSE; CloseClipboard (); + } break; @@ -618,11 +644,12 @@ winClipboardFlushXEvents (HWND hwnd, /* Conversion succeeded or some unconvertible characters */ if (ppszTextList != NULL) { + iReturnDataLen = 0; for (i = 0; i < iCount; i++) { iReturnDataLen += strlen(ppszTextList[i]); } - pszReturnData = malloc (iReturnDataLen + 1); + pszReturnData = (char *) malloc (iReturnDataLen + 1); pszReturnData[0] = '\0'; for (i = 0; i < iCount; i++) { @@ -633,7 +660,7 @@ winClipboardFlushXEvents (HWND hwnd, { ErrorF ("winClipboardFlushXEvents - SelectionNotify - " "X*TextPropertyToTextList list_return is NULL.\n"); - pszReturnData = malloc (1); + pszReturnData = (char *) malloc (1); pszReturnData[0] = '\0'; } } @@ -653,7 +680,7 @@ winClipboardFlushXEvents (HWND hwnd, ErrorF ("%d", iReturn); break; } - pszReturnData = malloc (1); + pszReturnData = (char *) malloc (1); pszReturnData[0] = '\0'; } @@ -663,9 +690,11 @@ winClipboardFlushXEvents (HWND hwnd, ppszTextList = NULL; XFree (xtpText.value); xtpText.value = NULL; + xtpText.nitems = 0; /* Convert the X clipboard string to DOS format */ - winClipboardUNIXtoDOS (&pszReturnData, strlen (pszReturnData)); + XLockDisplay (pDisplay); + winClipboardUNIXtoDOS ((unsigned char **)&pszReturnData, strlen (pszReturnData)); if (fUseUnicode) { @@ -711,6 +740,8 @@ winClipboardFlushXEvents (HWND hwnd, hGlobal = GlobalAlloc (GMEM_MOVEABLE, iConvertDataLen); } + free (pszReturnData); + /* Check that global memory was allocated */ if (!hGlobal) { @@ -770,11 +801,16 @@ winClipboardFlushXEvents (HWND hwnd, */ winClipboardFlushXEvents_SelectionNotify_Done: + XUnlockDisplay (pDisplay); /* Free allocated resources */ if (ppszTextList) XFreeStringList (ppszTextList); if (xtpText.value) + { XFree (xtpText.value); + xtpText.value = NULL; + xtpText.nitems = 0; + } if (pszConvertData) free (pszConvertData); if (pwszUnicodeStr) diff --git a/xorg-server/hw/xwin/wincreatewnd.c b/xorg-server/hw/xwin/wincreatewnd.c index 796a08593..85b6cf8a9 100644 --- a/xorg-server/hw/xwin/wincreatewnd.c +++ b/xorg-server/hw/xwin/wincreatewnd.c @@ -88,7 +88,9 @@ winCreateBoundingWindowFullScreen (ScreenPtr pScreen) snprintf (szTitle, sizeof (szTitle), WINDOW_TITLE_XDMCP, - g_pszQueryHost); + g_pszQueryHost, + display, + (int) pScreenInfo->dwScreen); else snprintf (szTitle, sizeof (szTitle), @@ -331,7 +333,9 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) snprintf (szTitle, sizeof (szTitle), WINDOW_TITLE_XDMCP, - g_pszQueryHost); + g_pszQueryHost, + display, + (int) pScreenInfo->dwScreen); else snprintf (szTitle, sizeof (szTitle), diff --git a/xorg-server/hw/xwin/wincursor.c b/xorg-server/hw/xwin/wincursor.c index 021b8b82c..0b8f7e7b2 100644 --- a/xorg-server/hw/xwin/wincursor.c +++ b/xorg-server/hw/xwin/wincursor.c @@ -99,8 +99,16 @@ winPointerWarpCursor (ScreenPtr pScreen, int x, int y) return; } - /* Only update the Windows cursor position if we are active */ - if (pScreenPriv->hwndScreen == GetForegroundWindow ()) + /* + Only update the Windows cursor position if root window is active, + or we are in a rootless mode + */ + if ((pScreenPriv->hwndScreen == GetForegroundWindow ()) + || pScreenPriv->pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOW + || pScreenPriv->pScreenInfo->fMultiWindow +#endif + ) { /* Get the client area coordinates */ GetClientRect (pScreenPriv->hwndScreen, &rcClient); @@ -601,9 +609,11 @@ winInitCursor (ScreenPtr pScreen) pPointPriv = (miPointerScreenPtr) dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); + if (pPointPriv) + { pScreenPriv->cursor.spriteFuncs = pPointPriv->spriteFuncs; pPointPriv->spriteFuncs = &winSpriteFuncsRec; - + } pScreenPriv->cursor.handle = NULL; pScreenPriv->cursor.visible = FALSE; diff --git a/xorg-server/hw/xwin/windialogs.c b/xorg-server/hw/xwin/windialogs.c index ab06b0d00..822941e83 100644 --- a/xorg-server/hw/xwin/windialogs.c +++ b/xorg-server/hw/xwin/windialogs.c @@ -54,6 +54,10 @@ extern Bool g_fClipboardStarted; #endif extern Bool g_fSoftwareCursor; +#if defined(XWIN_MULTIWINDOW) +extern HICON g_hIconX; +extern HICON g_hSmallIconX; +#endif /* * Local function prototypes @@ -112,8 +116,8 @@ winDrawURLWindow (LPARAM lParam) crText = RGB(0,0,128+64); SetTextColor (draw->hDC, crText); - /* Create underlined font 14 high, standard dialog font */ - font = CreateFont (-14, 0, 0, 0, FW_NORMAL, FALSE, TRUE, FALSE, + /* Create font 8 high, standard dialog font */ + font = CreateFont (-8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, 0, 0, 0, 0, 0, "MS Sans Serif"); if (!font) { @@ -181,34 +185,73 @@ winUnoverrideURLButton (HWND hwnd, int id) /* * Center a dialog window in the desktop window + * and set small and large icons to X icons. */ static void -winCenterDialog (HWND hwndDlg) +winInitDialog (HWND hwndDlg) { HWND hwndDesk; - RECT rc, rcDlg, rcDesk; - + RECT rc, rcDlg, rcDesk; + HICON hIcon, hIconSmall; + hwndDesk = GetParent (hwndDlg); if (!hwndDesk || IsIconic (hwndDesk)) hwndDesk = GetDesktopWindow (); - GetWindowRect (hwndDesk, &rcDesk); - GetWindowRect (hwndDlg, &rcDlg); - CopyRect (&rc, &rcDesk); - - OffsetRect (&rcDlg, -rcDlg.left, -rcDlg.top); - OffsetRect (&rc, -rc.left, -rc.top); - OffsetRect (&rc, -rcDlg.right, -rcDlg.bottom); - - SetWindowPos (hwndDlg, - HWND_TOP, - rcDesk.left + (rc.right / 2), - rcDesk.top + (rc.bottom / 2), - 0, 0, - SWP_NOSIZE | SWP_NOZORDER); -} + /* Remove minimize and maximize buttons */ + SetWindowLongPtr (hwndDlg, GWL_STYLE, + GetWindowLongPtr (hwndDlg, GWL_STYLE) + & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX)); + + /* Set Window not to show in the task bar */ + SetWindowLongPtr (hwndDlg, GWL_EXSTYLE, + GetWindowLongPtr (hwndDlg, GWL_EXSTYLE) & ~WS_EX_APPWINDOW ); + + /* Center dialog window in the screen. Not done for multi-monitor systems, where + * it is likely to end up split across the screens. In that case, it appears + * near the Tray icon. + */ + if (GetSystemMetrics(SM_CMONITORS)>1) { + /* Still need to refresh the frame change. */ + SetWindowPos (hwndDlg, HWND_TOP, 0,0,0,0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); + } else { + GetWindowRect (hwndDesk, &rcDesk); + GetWindowRect (hwndDlg, &rcDlg); + CopyRect (&rc, &rcDesk); + + OffsetRect (&rcDlg, -rcDlg.left, -rcDlg.top); + OffsetRect (&rc, -rc.left, -rc.top); + OffsetRect (&rc, -rcDlg.right, -rcDlg.bottom); + + SetWindowPos (hwndDlg, + HWND_TOPMOST, + rcDesk.left + (rc.right / 2), + rcDesk.top + (rc.bottom / 2), + 0, 0, + SWP_NOSIZE | SWP_FRAMECHANGED); + } +#ifdef XWIN_MULTIWINDOW + if (g_hIconX) hIcon=g_hIconX; + else +#endif + hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN)); + +#ifdef XWIN_MULTIWINDOW + if (g_hSmallIconX) hIconSmall=g_hSmallIconX; + else +#endif + hIconSmall = LoadImage (g_hInstance, + MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, + GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CYSMICON), + LR_SHARED); + + PostMessage (hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon); + PostMessage (hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall); +} /* * Display the Exit dialog box @@ -220,7 +263,7 @@ winDisplayExitDialog (winPrivScreenPtr pScreenPriv) int i; int liveClients = 0; - /* Count up running clinets (clients[0] is serverClient) */ + /* Count up running clients (clients[0] is serverClient) */ for (i = 1; i < currentMaxClients; i++) if (clients[i] != NullClient) liveClients++; @@ -271,15 +314,6 @@ winDisplayExitDialog (winPrivScreenPtr pScreenPriv) winExitDlgProc, (int) pScreenPriv); - /* Drop minimize and maximize buttons */ - SetWindowLong (g_hDlgExit, GWL_STYLE, - GetWindowLong (g_hDlgExit, GWL_STYLE) - & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX)); - SetWindowLong (g_hDlgExit, GWL_EXSTYLE, - GetWindowLong (g_hDlgExit, GWL_EXSTYLE) & ~WS_EX_APPWINDOW ); - SetWindowPos (g_hDlgExit, HWND_TOPMOST, 0, 0, 0, 0, - SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE); - /* Show the dialog box */ ShowWindow (g_hDlgExit, SW_SHOW); @@ -314,14 +348,7 @@ winExitDlgProc (HWND hDialog, UINT message, /* Store pointers to private structures for future use */ s_pScreenPriv = (winPrivScreenPtr) lParam; - winCenterDialog (hDialog); - - /* Set icon to standard app icon */ - PostMessage (hDialog, - WM_SETICON, - ICON_SMALL, - (LPARAM) LoadIcon (g_hInstance, - MAKEINTRESOURCE(IDI_XWIN))); + winInitDialog (hDialog); /* Format the connected clients string */ pszConnectedClients = Xprintf (CONNECTED_CLIENTS_FORMAT, @@ -413,17 +440,6 @@ winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv) pScreenPriv->hwndScreen, winChangeDepthDlgProc, (int) pScreenPriv); - - /* Drop minimize and maximize buttons */ - SetWindowLong (g_hDlgDepthChange, GWL_STYLE, - GetWindowLong (g_hDlgDepthChange, GWL_STYLE) - & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX)); - SetWindowLong (g_hDlgDepthChange, GWL_EXSTYLE, - GetWindowLong (g_hDlgDepthChange, GWL_EXSTYLE) - & ~WS_EX_APPWINDOW ); - SetWindowPos (g_hDlgDepthChange, 0, 0, 0, 0, 0, - SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOSIZE); - /* Show the dialog box */ ShowWindow (g_hDlgDepthChange, SW_SHOW); @@ -480,13 +496,7 @@ winChangeDepthDlgProc (HWND hwndDialog, UINT message, s_pScreenPriv->dwLastWindowsBitsPixel); #endif - winCenterDialog( hwndDialog ); - - /* Set icon to standard app icon */ - PostMessage (hwndDialog, - WM_SETICON, - ICON_SMALL, - (LPARAM) LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN))); + winInitDialog( hwndDialog ); return TRUE; @@ -572,15 +582,6 @@ winDisplayAboutDialog (winPrivScreenPtr pScreenPriv) winAboutDlgProc, (int) pScreenPriv); - /* Drop minimize and maximize buttons */ - SetWindowLong (g_hDlgAbout, GWL_STYLE, - GetWindowLong (g_hDlgAbout, GWL_STYLE) - & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX)); - SetWindowLong (g_hDlgAbout, GWL_EXSTYLE, - GetWindowLong (g_hDlgAbout, GWL_EXSTYLE) & ~WS_EX_APPWINDOW); - SetWindowPos (g_hDlgAbout, 0, 0, 0, 0, 0, - SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE); - /* Show the dialog box */ ShowWindow (g_hDlgAbout, SW_SHOW); @@ -622,13 +623,7 @@ winAboutDlgProc (HWND hwndDialog, UINT message, s_pScreenInfo = s_pScreenPriv->pScreenInfo; s_pScreen = s_pScreenInfo->pScreen; - winCenterDialog (hwndDialog); - - /* Set icon to standard app icon */ - PostMessage (hwndDialog, - WM_SETICON, - ICON_SMALL, - (LPARAM) LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN))); + winInitDialog (hwndDialog); /* Override the URL buttons */ winOverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG); @@ -706,7 +701,7 @@ winAboutDlgProc (HWND hwndDialog, UINT message, case ID_ABOUT_WEBSITE: { - const char * pszPath = "http://x.cygwin.com/"; + const char * pszPath = __VENDORDWEBSUPPORT__; int iReturn; iReturn = (int) ShellExecute (NULL, diff --git a/xorg-server/hw/xwin/winerror.c b/xorg-server/hw/xwin/winerror.c index 7d292134f..9c5c92ccf 100644 --- a/xorg-server/hw/xwin/winerror.c +++ b/xorg-server/hw/xwin/winerror.c @@ -33,17 +33,17 @@ #endif #ifdef XVENDORNAME #define VENDOR_STRING XVENDORNAME -#define VERSION_STRING XORG_RELEASE #define VENDOR_CONTACT BUILDERADDR #endif - +#include <../xfree86/common/xorgVersion.h> #include "win.h" /* References to external symbols */ extern char * g_pszCommandLine; extern char * g_pszLogFile; extern Bool g_fSilentFatalError; - +extern Bool g_fSilentDupError; +extern Bool g_fLogInited; #ifdef DDXOSVERRORF /* Prototype */ @@ -62,6 +62,24 @@ OsVendorVErrorF (const char *pszFormat, va_list va_args) pthread_mutex_lock (&s_pmPrinting); #endif + /* + If we want to silence it, + detect if we are going to abort due to duplication error + */ + if (g_fSilentDupError) + { + if ((strcmp(pszFormat, + "InitOutput - Duplicate invocation on display " + "number: %s. Exiting.\n") == 0) + || (strcmp(pszFormat, + "Server is already active for display %s\n%s %s\n%s\n") == 0) + || (strcmp(pszFormat, + "MakeAllCOTSServerListeners: server already running\n") == 0)) + { + g_fSilentFatalError = TRUE; + } + } + /* Print the error message to a log file, could be stderr */ LogVWrite (0, pszFormat, va_args); @@ -80,7 +98,6 @@ OsVendorVErrorF (const char *pszFormat, va_list va_args) * * Attempt to do last-ditch, safe, important cleanup here. */ -#ifdef DDXOSFATALERROR void OsVendorFatalError (void) { @@ -88,12 +105,17 @@ OsVendorFatalError (void) if (g_fSilentFatalError) return; + if (!g_fLogInited) { + g_fLogInited = TRUE; + g_pszLogFile = LogInit (g_pszLogFile, NULL); + } + LogClose (); + winMessageBoxF ( "A fatal error has occurred and " PROJECT_NAME " will now exit.\n" \ "Please open %s for more information.\n", MB_ICONERROR, (g_pszLogFile?g_pszLogFile:"the logfile")); } -#endif /* @@ -117,13 +139,15 @@ winMessageBoxF (const char *pszError, UINT uType, ...) #define MESSAGEBOXF \ "%s\n" \ "Vendor: %s\n" \ - "Release: %s\n" \ + "Release: %d.%d.%d.%d (%d)\n" \ "Contact: %s\n" \ "XWin was started with the following command-line:\n\n" \ "%s\n" pszMsgBox = Xprintf (MESSAGEBOXF, - pszErrorF, VENDOR_STRING, VERSION_STRING, VENDOR_CONTACT, + pszErrorF, VENDOR_STRING, + XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, BUILD_DATE, + VENDOR_CONTACT, g_pszCommandLine); if (!pszMsgBox) goto winMessageBoxF_Cleanup; diff --git a/xorg-server/hw/xwin/winglobals.c b/xorg-server/hw/xwin/winglobals.c index fddada39e..01604a8c4 100644 --- a/xorg-server/hw/xwin/winglobals.c +++ b/xorg-server/hw/xwin/winglobals.c @@ -1,5 +1,6 @@ /* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -26,6 +27,7 @@ *from Harold L Hunt II. * * Authors: Harold L Hunt II + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H @@ -58,10 +60,11 @@ HWND g_hDlgExit = NULL; HWND g_hDlgAbout = NULL; const char * g_pszQueryHost = NULL; Bool g_fXdmcpEnabled = FALSE; +Bool g_fAuthEnabled = FALSE; HICON g_hIconX = NULL; HICON g_hSmallIconX = NULL; #ifndef RELOCATE_PROJECTROOT -char * g_pszLogFile = "/tmp/XWin.log"; +char * g_pszLogFile = DEFAULT_LOGDIR "/XWin.%s.log"; #else char * g_pszLogFile = "XWin.log"; Bool g_fLogFileChanged = FALSE; diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c index d574f2053..1cd3e4cb3 100644 --- a/xorg-server/hw/xwin/winkeybd.c +++ b/xorg-server/hw/xwin/winkeybd.c @@ -49,10 +49,6 @@ static Bool g_winKeyState[NUM_KEYCODES]; -/* Stored to get internal mode key states. Must be read-only. */ -static unsigned short const *g_winInternalModeKeyStatesPtr = NULL; - - /* * Local prototypes */ @@ -84,6 +80,20 @@ winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode) int iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2]; int iParamScanCode = LOBYTE (HIWORD (lParam)); +/* WM_ key messages faked by Vista speech recognition (WSR) don't have a + * scan code. + * + * Vocola 3 (Rick Mohr's supplement to WSR) uses + * System.Windows.Forms.SendKeys.SendWait(), which appears always to give a + * scan code of 1 + */ + if (iParamScanCode <= 1) + { + iParamScanCode = MapVirtualKeyEx(wParam, + /*MAPVK_VK_TO_VSC*/0, + GetKeyboardLayout(0)); + } + /* Branch on special extended, special non-extended, or normal key */ if ((HIWORD (lParam) & KF_EXTENDED) && iKeyFixupEx) *piScanCode = iKeyFixupEx; @@ -209,7 +219,6 @@ winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt, static void winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl) { - g_winInternalModeKeyStatesPtr = &(pDevice->key->state); } @@ -293,21 +302,23 @@ winKeybdProc (DeviceIntPtr pDeviceInt, int iState) { winErrorFVerb (1, "winKeybdProc - Error initializing keyboard AutoRepeat (No XKB)\n"); } + + XkbSetExtension(pDeviceInt, ProcessKeyboardEvent); } #endif - - g_winInternalModeKeyStatesPtr = &(pDeviceInt->key->state); break; case DEVICE_ON: pDevice->on = TRUE; - g_winInternalModeKeyStatesPtr = &(pDeviceInt->key->state); + + // immediately copy the state of this keyboard device to the VCK + // (which otherwise happens lazily after the first keypress) + SwitchCoreKeyboard(pDeviceInt); break; case DEVICE_CLOSE: case DEVICE_OFF: pDevice->on = FALSE; - g_winInternalModeKeyStatesPtr = NULL; break; } @@ -369,7 +380,7 @@ winRestoreModeKeyStates () unsigned short internalKeyStates; /* X server is being initialized */ - if (!g_winInternalModeKeyStatesPtr) + if (!inputInfo.keyboard) return; /* Only process events if the rootwindow is mapped. The keyboard events @@ -382,7 +393,9 @@ winRestoreModeKeyStates () mieqProcessInputEvents (); /* Read the mode key states of our X server */ - internalKeyStates = *g_winInternalModeKeyStatesPtr; + /* (stored in the virtual core keyboard) */ + internalKeyStates = inputInfo.keyboard->key->state; + winDebug("winRestoreModeKeyStates: state %d\n", internalKeyStates); /* * NOTE: The C XOR operator, ^, will not work here because it is @@ -580,6 +593,7 @@ winKeybdReleaseKeys () void winSendKeyEvent (DWORD dwKey, Bool fDown) { + DeviceIntPtr pDev; xEvent xCurrentEvent; /* @@ -597,7 +611,16 @@ winSendKeyEvent (DWORD dwKey, Bool fDown) xCurrentEvent.u.keyButtonPointer.time = g_c32LastInputEventTime = GetTickCount (); xCurrentEvent.u.u.detail = dwKey + MIN_KEYCODE; - mieqEnqueue (&xCurrentEvent); + +#if CYGDEBUG + ErrorF("winSendKeyEvent: xCurrentEvent.u.u.type: %d, xCurrentEvent.u.u.detail: %d\n", + xCurrentEvent.u.u.type, xCurrentEvent.u.u.detail); +#endif + for (pDev = inputInfo.devices; pDev; pDev = pDev->next) + if ((pDev->coreEvents && pDev != inputInfo.keyboard) && pDev->key) + { + mieqEnqueue (pDev, &xCurrentEvent); + } } BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam) diff --git a/xorg-server/hw/xwin/winkeybd.h b/xorg-server/hw/xwin/winkeybd.h index 09eed1491..d5b115736 100644 --- a/xorg-server/hw/xwin/winkeybd.h +++ b/xorg-server/hw/xwin/winkeybd.h @@ -45,6 +45,11 @@ #define WIN_KEYMAP_COLS 3 +/* ASCII column, rows 33 through 40 are for Speech Recognition with + * num-lock asserted. + * Rows 160 through 165 correspond to software-generated codes, which + * may not be associated with the appropriate scan code/extended bit + */ const int g_iKeyMap [] = { /* count Windows VK, ASCII, ASCII when extended VK */ @@ -81,14 +86,14 @@ g_iKeyMap [] = { /* 30 */ 0, 0, 0, /* 31 */ 0, 0, 0, /* 32 */ 0, 0, 0, - /* 33 */ VK_PRIOR, 0, KEY_PgUp, - /* 34 */ VK_NEXT, 0, KEY_PgDown, - /* 35 */ VK_END, 0, KEY_End, - /* 36 */ VK_HOME, 0, KEY_Home, - /* 37 */ VK_LEFT, 0, KEY_Left, - /* 38 */ VK_UP, 0, KEY_Up, - /* 39 */ VK_RIGHT, 0, KEY_Right, - /* 40 */ VK_DOWN, 0, KEY_Down, + /* 33 */ VK_PRIOR, KEY_PgUp, KEY_PgUp, + /* 34 */ VK_NEXT, KEY_PgDown, KEY_PgDown, + /* 35 */ VK_END, KEY_End, KEY_End, + /* 36 */ VK_HOME, KEY_Home, KEY_Home, + /* 37 */ VK_LEFT, KEY_Left, KEY_Left, + /* 38 */ VK_UP, KEY_Up, KEY_Up, + /* 39 */ VK_RIGHT, KEY_Right, KEY_Right, + /* 40 */ VK_DOWN, KEY_Down, KEY_Down, /* 41 */ 0, 0, 0, /* 42 */ 0, 0, 0, /* 43 */ 0, 0, 0, @@ -208,12 +213,12 @@ g_iKeyMap [] = { /* 157 */ 0, 0, 0, /* 158 */ 0, 0, 0, /* 159 */ 0, 0, 0, - /* 160 */ 0, 0, 0, - /* 161 */ 0, 0, 0, - /* 162 */ 0, 0, 0, - /* 163 */ 0, 0, 0, - /* 164 */ 0, 0, 0, - /* 165 */ 0, 0, 0, + /* 160 */ VK_LSHIFT, KEY_ShiftL, KEY_ShiftL, + /* 161 */ VK_RSHIFT, KEY_ShiftR, KEY_ShiftR, + /* 162 */ VK_LCONTROL, KEY_LCtrl, KEY_LCtrl, + /* 163 */ VK_RCONTROL, KEY_RCtrl, KEY_RCtrl, + /* 164 */ VK_LMENU, KEY_Alt, KEY_Alt, + /* 165 */ VK_RMENU, KEY_AltLang, KEY_AltLang, /* 166 */ 0, 0, 0, /* 167 */ 0, 0, 0, /* 168 */ 0, 0, 0, diff --git a/xorg-server/hw/xwin/winlayouts.h b/xorg-server/hw/xwin/winlayouts.h index cc0752430..336839453 100644 --- a/xorg-server/hw/xwin/winlayouts.h +++ b/xorg-server/hw/xwin/winlayouts.h @@ -38,34 +38,50 @@ typedef struct char *layoutname; } WinKBLayoutRec, *WinKBLayoutPtr; +/* + This table is sorted by low byte of winlayout, then by next byte, etc. +*/ + WinKBLayoutRec winKBLayouts[] = { + { 0x404, -1, "pc105", "zh_TW", NULL, NULL, "Chinese (Taiwan)"}, { 0x405, -1, "pc105", "cz", NULL, NULL, "Czech"}, {0x10405, -1, "pc105", "cz_qwerty", NULL, NULL, "Czech (QWERTY)"}, { 0x406, -1, "pc105", "dk", NULL, NULL, "Danish"}, { 0x407, -1, "pc105", "de", NULL, NULL, "German (Germany)"}, {0x10407, -1, "pc105", "de", NULL, NULL, "German (Germany, IBM)"}, - { 0x807, -1, "pc105", "de_CH", NULL, NULL, "German (Switzerland)"}, + { 0x807, -1, "pc105", "ch", "de", NULL, "German (Switzerland)"}, { 0x409, -1, "pc105", "us", NULL, NULL, "English (USA)"}, {0x10409, -1, "pc105", "dvorak", NULL, NULL, "English (USA, Dvorak)"}, {0x20409, -1, "pc105", "us_intl", NULL, NULL, "English (USA, International)"}, { 0x809, -1, "pc105", "gb", NULL, NULL, "English (United Kingdom)"}, { 0x1809, -1, "pc105", "ie", NULL, NULL, "Irish"}, { 0x40a, -1, "pc105", "es", NULL, NULL, "Spanish (Spain, Traditional Sort)"}, + { 0x80a, -1, "pc105", "la", NULL, NULL, "Latin American"}, { 0x40b, -1, "pc105", "fi", NULL, NULL, "Finnish"}, { 0x40c, -1, "pc105", "fr", NULL, NULL, "French (Standard)"}, { 0x80c, -1, "pc105", "be", NULL, NULL, "French (Belgian)"}, - { 0xc0c, -1, "pc105", "ca_enhanced", NULL, NULL, "French (Canada)"}, - { 0x100c, -1, "pc105", "fr_CH", NULL, NULL, "French (Switzerland)"}, + {0x1080c, -1, "pc105", "be", NULL, NULL, "Belgian (Comma)"}, + { 0xc0c, -1, "pc105", "ca", "fr", NULL, "French (Canada)"}, + { 0x100c, -1, "pc105", "ch", "fr", NULL, "French (Switzerland)"}, { 0x40e, -1, "pc105", "hu", NULL, NULL, "Hungarian"}, + { 0x40f, -1, "pc105", "is", NULL, NULL, "Icelandic"}, { 0x410, -1, "pc105", "it", NULL, NULL, "Italian"}, + {0x10410, -1, "pc105", "it", NULL, NULL, "Italian (142)"}, + {0xa0000410,-1, "macbook79","it", "mac",NULL, "Italiano (Apple)"}, { 0x411, 7, "jp106", "jp", NULL, NULL, "Japanese"}, + { 0x413, -1, "pc105", "nl", NULL, NULL, "Dutch"}, { 0x813, -1, "pc105", "be", NULL, NULL, "Dutch (Belgian)"}, { 0x414, -1, "pc105", "no", NULL, NULL, "Norwegian"}, + { 0x415, -1, "pc105", "pl", NULL, NULL, "Polish (Programmers)"}, { 0x416, -1, "pc105", "br", NULL, NULL, "Portuguese (Brazil, ABNT)"}, {0x10416, -1, "abnt2", "br", NULL, NULL, "Portuguese (Brazil, ABNT2)"}, { 0x816, -1, "pc105", "pt", NULL, NULL, "Portuguese (Portugal)"}, + { 0x41a, -1, "pc105", "hr", NULL, NULL, "Croatian"}, { 0x41d, -1, "pc105", "se", NULL, NULL, "Swedish (Sweden)"}, + { 0x424, -1, "pc105", "si", NULL, NULL, "Slovenian"}, + { 0x425, -1, "pc105", "ee", NULL, NULL, "Estonian"}, + { 0x452, -1, "pc105", "gb", "intl", NULL, "United Kingdom (Extended)"}, { -1, -1, NULL, NULL, NULL, NULL, NULL} }; @@ -147,6 +163,7 @@ Support ID XKB Language Finnish (with Sami) X 0x040c fr French (Standard) X 0x080c be French (Belgian) + X 0x1080c be Belgian (Comma) . 0x0c0c French (Canadian) French (Canadian, Legacy) Canadian (Multilingual) diff --git a/xorg-server/hw/xwin/winmouse.c b/xorg-server/hw/xwin/winmouse.c index 1507dd34f..d25a66524 100644 --- a/xorg-server/hw/xwin/winmouse.c +++ b/xorg-server/hw/xwin/winmouse.c @@ -36,7 +36,7 @@ #endif #include "win.h" -#if defined(XFree86Server) && defined(XINPUT) +#ifdef XINPUT #include "inputstr.h" /* Peek the internal button mapping */ @@ -106,7 +106,7 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState) 2); free(map); -#if defined(XFree86Server) && defined(XINPUT) +#ifdef XINPUT g_winMouseButtonMap = pDeviceInt->button->map; #endif break; @@ -116,7 +116,7 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState) break; case DEVICE_CLOSE: -#if defined(XFree86Server) && defined(XINPUT) +#ifdef XINPUT g_winMouseButtonMap = NULL; #endif case DEVICE_OFF: @@ -221,11 +221,12 @@ winMouseWheel (ScreenPtr pScreen, int iDeltaZ) void winMouseButtonsSendEvent (int iEventType, int iButton) { + DeviceIntPtr pDev; xEvent xCurrentEvent; /* Load an xEvent and enqueue the event */ xCurrentEvent.u.u.type = iEventType; -#if defined(XFree86Server) && defined(XINPUT) +#ifdef XINPUT if (g_winMouseButtonMap) xCurrentEvent.u.u.detail = g_winMouseButtonMap[iButton]; else @@ -233,7 +234,16 @@ winMouseButtonsSendEvent (int iEventType, int iButton) xCurrentEvent.u.u.detail = iButton; xCurrentEvent.u.keyButtonPointer.time = g_c32LastInputEventTime = GetTickCount (); - mieqEnqueue (&xCurrentEvent); + +#if CYGDEBUG + ErrorF("winMouseButtonsSendEvent: xCurrentEvent.u.u.type: %d, xCurrentEvent.u.u.detail: %d\n", + xCurrentEvent.u.u.type, xCurrentEvent.u.u.detail); +#endif + for (pDev = inputInfo.devices; pDev; pDev = pDev->next) + if ((pDev->coreEvents && pDev != inputInfo.pointer) && pDev->button) + { + mieqEnqueue (pDev, &xCurrentEvent); + } } @@ -339,3 +349,25 @@ winMouseButtonsHandle (ScreenPtr pScreen, return 0; } + +/** + * Enqueue a motion event. + */ +void winEnqueueMotion(int x, int y) +{ + int i, nevents; + int valuators[2]; + + xEvent *events = (xEvent *)malloc(sizeof(xEvent) * GetMaximumEventsNum()); + + valuators[0] = x; + valuators[1] = y; + nevents = GetPointerEvents(events, inputInfo.pointer, MotionNotify, 0, + POINTER_ABSOLUTE, 0, 2, valuators); + + for (i = 0; i < nevents; i++) + mieqEnqueue(inputInfo.pointer, events + i); + + xfree(events); +} +// XXX: miPointerMove does exactly this, but is static :-( (and uses a static buffer) diff --git a/xorg-server/hw/xwin/winmultiwindowclass.c b/xorg-server/hw/xwin/winmultiwindowclass.c index 5b47c3976..fe81f2bd0 100644 --- a/xorg-server/hw/xwin/winmultiwindowclass.c +++ b/xorg-server/hw/xwin/winmultiwindowclass.c @@ -1,5 +1,6 @@ /* *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -26,6 +27,7 @@ *from the XFree86 Project. * * Authors: Earle F. Philhower, III + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H @@ -263,7 +265,7 @@ winMultiWindowGetTransientFor (WindowPtr pWin, WindowPtr *ppDaddy) if (prop->propertyName == XA_WM_TRANSIENT_FOR) { if (ppDaddy) - memcpy (*ppDaddy, prop->data, sizeof (WindowPtr)); + memcpy (ppDaddy, prop->data, sizeof (WindowPtr)); return 1; } else diff --git a/xorg-server/hw/xwin/winmultiwindowicons.c b/xorg-server/hw/xwin/winmultiwindowicons.c index 45ed093ec..0d9d87ed2 100644 --- a/xorg-server/hw/xwin/winmultiwindowicons.c +++ b/xorg-server/hw/xwin/winmultiwindowicons.c @@ -36,6 +36,9 @@ #include "winmultiwindowclass.h" #include "winprefs.h" +#include "propertyst.h" +#include "windowstr.h" + /* * External global variables @@ -50,9 +53,15 @@ extern HICON g_hSmallIconX; */ static void -winScaleXBitmapToWindows (int iconSize, int effBPP, - PixmapPtr pixmap, unsigned char *image); - +winScaleIconToWindows (int iconSize, + int effBPP, + unsigned char *iconData, + unsigned short width, + unsigned short height, + int xStride, + int effXBPP, + int effXDepth, + unsigned char *image); /* * Scale an X icon bitmap into a Windoze icon bitmap @@ -64,15 +73,9 @@ winScaleXBitmapToWindows (int iconSize, PixmapPtr pixmap, unsigned char *image) { - int row, column, effXBPP, effXDepth; - unsigned char *outPtr; - unsigned char *iconData = 0; - int stride, xStride; - float factX, factY; - int posX, posY; - unsigned char *ptr; - unsigned int zero; - unsigned int color; + int effXBPP, effXDepth; + int xStride; + unsigned char *iconData = 0; effXBPP = BitsPerPixel(pixmap->drawable.depth); effXDepth = pixmap->drawable.depth; @@ -83,12 +86,10 @@ winScaleXBitmapToWindows (int iconSize, if (pixmap->drawable.depth == 15) effXDepth = 16; - /* Need 32-bit aligned rows */ - stride = ((iconSize * effBPP + 31) & (~31)) / 8; xStride = PixmapBytePad (pixmap->drawable.width, pixmap->drawable.depth); - if (stride == 0 || xStride == 0) + if (xStride == 0) { - ErrorF ("winScaleXBitmapToWindows - stride or xStride is zero. " + ErrorF ("winScaleXBitmapToWindows - xStride is zero. " "Bailing.\n"); return; } @@ -107,9 +108,54 @@ winScaleXBitmapToWindows (int iconSize, pixmap->drawable.width, pixmap->drawable.height, ZPixmap, 0xffffffff, iconData); + winScaleIconToWindows(iconSize, effBPP, + iconData, + pixmap->drawable.width, pixmap->drawable.height, + xStride, effXBPP, effXDepth, + image); + + free (iconData); +} + +/* + * Scale a drawable into a Windoze icon bitmap + */ + +static void +winScaleIconToWindows (int iconSize, + int effBPP, + unsigned char *iconData, + unsigned short width, + unsigned short height, + int xStride, + int effXBPP, + int effXDepth, + unsigned char *image) +{ + int row, column; + unsigned char *outPtr; + int stride; + float factX, factY; + int posX, posY; + unsigned char *ptr; + unsigned int zero; + unsigned int color; + + winDebug("winScaleIconToWindows: scaling from %d x %d @ %d bpp (depth %d) to %d x %d @ %d bpp\n", + width, height, effXBPP, effXDepth, iconSize, iconSize, effBPP); + + /* Need 16-bit aligned rows for DDBitmaps */ + stride = ((iconSize * effBPP + 15) & (~15)) / 8; + if (stride == 0) + { + ErrorF ("winScaleXBitmapToWindows - stride is zero. " + "Bailing.\n"); + return; + } + /* Keep aspect ratio */ - factX = ((float)pixmap->drawable.width) / ((float)iconSize); - factY = ((float)pixmap->drawable.height) / ((float)iconSize); + factX = ((float)width) / ((float)iconSize); + factY = ((float)height) / ((float)iconSize); if (factX > factY) factY = factX; else @@ -132,8 +178,8 @@ winScaleXBitmapToWindows (int iconSize, ptr += posX / 8; /* Out of X icon bounds, leave space blank */ - if (posX >= pixmap->drawable.width - || posY >= pixmap->drawable.height) + if (posX >= width + || posY >= height) ptr = (unsigned char *) &zero; if ((*ptr) & (1 << (posX & 7))) @@ -178,8 +224,8 @@ winScaleXBitmapToWindows (int iconSize, ptr += posX * (effXBPP / 8); /* Out of X icon bounds, leave space blank */ - if (posX >= pixmap->drawable.width - || posY >= pixmap->drawable.height) + if (posX >= width + || posY >= height) ptr = (unsigned char *) &zero; color = (((*ptr) << 16) + ((*(ptr + 1)) << 8) @@ -190,7 +236,7 @@ winScaleXBitmapToWindows (int iconSize, *(outPtr++) = *(ptr++); // b *(outPtr++) = *(ptr++); // g *(outPtr++) = *(ptr++); // r - *(outPtr++) = 0; // resvd + *(outPtr++) = (effXDepth == 32) ? *(ptr++) : 0x0; // alpha break; case 24: *(outPtr++) = *(ptr++); @@ -221,8 +267,8 @@ winScaleXBitmapToWindows (int iconSize, ptr += posX * (effXBPP / 8); /* Out of X icon bounds, leave space blank */ - if (posX >= pixmap->drawable.width - || posY >= pixmap->drawable.height) + if (posX >= width + || posY >= height) ptr = (unsigned char *) &zero; color = ((*ptr) << 8) + (*(ptr + 1)); switch (effBPP) @@ -257,9 +303,50 @@ winScaleXBitmapToWindows (int iconSize, } /* end if effxbpp==16) */ } /* end for column */ } /* end for row */ - free (iconData); } +static pointer +GetWindowProp(WindowPtr pWin, Atom name, long int *size_return) +{ + struct _Window *pwin; + struct _Property *prop; + + if (!pWin || !name) { + winDebug("GetWindowProp - pWin or name was NULL\n"); + return 0; + } + pwin = (struct _Window*) pWin; + if (!pwin->optional) return NULL; + for (prop = (struct _Property *) pwin->optional->userProps; + prop; + prop=prop->next){ + if (prop->propertyName == name) { + *size_return=prop->size; + return prop->data; + } + } + return NULL; +} + +static void +winScaleNetWMIconToWindows (int iconSize, + int effBPP, + uint32_t *icondata, + unsigned char *image) +{ + int height, width; + uint32_t *pixels; + + width = icondata[0]; + height = icondata[1]; + pixels = &icondata[2]; + + winScaleIconToWindows(iconSize, effBPP, + (unsigned char *)pixels, + width, height, + width*4, 32, 32, + image); +} /* * Attempt to create a custom icon from the WM_HINTS bitmaps @@ -268,7 +355,7 @@ winScaleXBitmapToWindows (int iconSize, HICON winXIconToHICON (WindowPtr pWin, int iconSize) { - unsigned char *mask, *image, *imageMask; + unsigned char *mask, *image; unsigned char *dst, *src; PixmapPtr iconPtr; PixmapPtr maskPtr; @@ -276,14 +363,12 @@ winXIconToHICON (WindowPtr pWin, int iconSize) HDC hDC; ICONINFO ii; WinXWMHints hints; - HICON hIcon; + HICON hIcon = NULL; + Bool net_wm_icon_found = FALSE; - winMultiWindowGetWMHints (pWin, &hints); - if (!hints.icon_pixmap) return NULL; - - iconPtr = (PixmapPtr) LookupIDByType (hints.icon_pixmap, RT_PIXMAP); - - if (!iconPtr) return NULL; + static Atom _XA_NET_WM_ICON = 0; + uint32_t *icon, *icon_data; + long int size=0; hDC = GetDC (GetDesktopWindow ()); planes = GetDeviceCaps (hDC, PLANES); @@ -296,38 +381,99 @@ winXIconToHICON (WindowPtr pWin, int iconSize) else effBPP = bpp; - /* Need 32-bit aligned rows */ - stride = ((iconSize * effBPP + 31) & (~31)) / 8; + /* Need 16-bit aligned rows for DDBitmaps */ + stride = ((iconSize * effBPP + 15) & (~15)) / 8; /* Mask is 1-bit deep */ - maskStride = ((iconSize * 1 + 31) & (~31)) / 8; + maskStride = ((iconSize * 1 + 15) & (~15)) / 8; - image = (unsigned char * ) malloc (stride * iconSize); - imageMask = (unsigned char *) malloc (stride * iconSize); - mask = (unsigned char *) malloc (maskStride * iconSize); - - /* Default to a completely black mask */ - memset (mask, 0, maskStride * iconSize); + if (!_XA_NET_WM_ICON) _XA_NET_WM_ICON = MakeAtom("_NET_WM_ICON", 12, FALSE); - winScaleXBitmapToWindows (iconSize, effBPP, iconPtr, image); - maskPtr = (PixmapPtr) LookupIDByType (hints.icon_mask, RT_PIXMAP); + /* Always prefer _NET_WM_ICON icons */ + icon_data = GetWindowProp(pWin, _XA_NET_WM_ICON, &size); + if (icon_data) + { + uint32_t *best_icon = 0; + unsigned int best_size = 0; + + /* + For scaling to the required size, choose the smallest icon which is + bigger than or equal to the required size, failing that, the biggest + icon which is smaller than the required size + */ + for(icon = icon_data; + icon < &icon_data[size] && *icon; + icon = &icon[icon[0]*icon[1]+2]) + { + unsigned int candidateSize = (icon[0] + icon[1])/2; + winDebug("winXIconToHICON: pWin%x found %lu x %lu NetIcon\n",(int)pWin,icon[0],icon[1]); + + if (((best_size < iconSize) && ((candidateSize > best_size) || (candidateSize >= iconSize))) + || ((best_size > iconSize) && (candidateSize >= iconSize) && (candidateSize < best_size))) + { + best_icon = icon; + best_size = candidateSize; + } + } + + if (best_icon) + { + winDebug("winXIconToHICON: pWin%x selected %lu x %lu NetIcon for scaling to %u x %u\n", + (int)pWin, best_icon[0], best_icon[1], iconSize, iconSize ); + + image = malloc (stride * iconSize); + + /* Use a completely black mask, image has alpha */ + mask = calloc (maskStride, iconSize); + + winScaleNetWMIconToWindows(iconSize, effBPP, best_icon, image); + net_wm_icon_found = TRUE; + } + else + { + winDebug("winXIconToHICON: pWin %x no %d x %d NetIcon\n",(int)pWin,iconSize,iconSize); + } + } - if (maskPtr) + if (!net_wm_icon_found) { - winScaleXBitmapToWindows (iconSize, 1, maskPtr, mask); - - winScaleXBitmapToWindows (iconSize, effBPP, maskPtr, imageMask); - - /* Now we need to set all bits of the icon which are not masked */ - /* on to 0 because Color is really an XOR, not an OR function */ - dst = image; - src = imageMask; - - for (i = 0; i < (stride * iconSize); i++) - if ((*(src++))) - *(dst++) = 0; - else - dst++; + unsigned char *imageMask; + + winMultiWindowGetWMHints (pWin, &hints); + winDebug("winXIconToHICON: pWin 0x%x icon_pixmap hint %x\n", pWin, hints.icon_pixmap); + if (!hints.icon_pixmap) return NULL; + + iconPtr = (PixmapPtr) LookupIDByType (hints.icon_pixmap, RT_PIXMAP); + winDebug("winXIconToHICON: pWin 0x%x iconPtr 0x%x\n", pWin, iconPtr); + + if (!iconPtr) return NULL; + + image = malloc (stride * iconSize); + imageMask = malloc (stride * iconSize); + /* Default to a completely black mask */ + mask = calloc (maskStride, iconSize); + + winScaleXBitmapToWindows (iconSize, effBPP, iconPtr, image); + maskPtr = (PixmapPtr) LookupIDByType (hints.icon_mask, RT_PIXMAP); + + if (maskPtr) + { + winScaleXBitmapToWindows (iconSize, 1, maskPtr, mask); + + winScaleXBitmapToWindows (iconSize, effBPP, maskPtr, imageMask); + + /* Now we need to set all bits of the icon which are not masked */ + /* on to 0 because Color is really an XOR, not an OR function */ + dst = image; + src = imageMask; + + for (i = 0; i < (stride * iconSize); i++) + if ((*(src++))) + *(dst++) = 0; + else + dst++; + } + free (imageMask); } ii.fIcon = TRUE; @@ -350,15 +496,13 @@ winXIconToHICON (WindowPtr pWin, int iconSize) /* Free X mask and bitmap */ free (mask); free (image); - free (imageMask); return hIcon; } - /* - * Change the Windows window icon + * Change the Windows window icon */ #ifdef XWIN_MULTIWINDOW @@ -366,10 +510,14 @@ void winUpdateIcon (Window id) { WindowPtr pWin; - HICON hIcon, hiconOld; + HICON hIcon, hIconSmall, hiconOld; pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW); if (!pWin) return; +{ + winWindowPriv(pWin); + if (!pWinPriv->hWnd) return; + hIcon = (HICON)winOverrideIcon ((unsigned long)pWin); if (!hIcon) @@ -377,32 +525,30 @@ winUpdateIcon (Window id) if (hIcon) { - winWindowPriv(pWin); + hiconOld = (HICON) SetClassLong (pWinPriv->hWnd, + GCL_HICON, + (int) hIcon); - if (pWinPriv->hWnd) - { - hiconOld = (HICON) SetClassLong (pWinPriv->hWnd, - GCL_HICON, - (int) hIcon); - - /* Delete the icon if its not the default */ - winDestroyIcon(hiconOld); - } + /* Delete the icon if its not the default */ + if (hiconOld != g_hIconX) + winDestroyIcon(hiconOld); } - hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXSMICON)); - if (hIcon) - { - winWindowPriv(pWin); + hIconSmall = (HICON)winOverrideIcon ((unsigned long)pWin); + + if (!hIconSmall) + hIconSmall = winXIconToHICON (pWin, GetSystemMetrics(SM_CXSMICON)); + + if (hIconSmall) + { + hiconOld = (HICON) SetClassLong (pWinPriv->hWnd, + GCL_HICONSM, + (int) hIconSmall); + if (hiconOld != g_hSmallIconX) + winDestroyIcon (hiconOld); - if (pWinPriv->hWnd) - { - hiconOld = (HICON) SetClassLong (pWinPriv->hWnd, - GCL_HICONSM, - (int) hIcon); - winDestroyIcon (hiconOld); - } } + } } void winInitGlobalIcons (void) diff --git a/xorg-server/hw/xwin/winmultiwindowshape.c b/xorg-server/hw/xwin/winmultiwindowshape.c index 33deae337..46e392ec3 100644 --- a/xorg-server/hw/xwin/winmultiwindowshape.c +++ b/xorg-server/hw/xwin/winmultiwindowshape.c @@ -45,7 +45,6 @@ void winSetShapeMultiWindow (WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGMULTIWINDOW_DEBUG @@ -73,6 +72,9 @@ winUpdateRgnMultiWindow (WindowPtr pWin) { SetWindowRgn (winGetWindowPriv(pWin)->hWnd, winGetWindowPriv(pWin)->hRgn, TRUE); + + /* The system now owns the region specified by the region handle and delete it when it is no longer needed. */ + winGetWindowPriv(pWin)->hRgn = NULL; } @@ -209,3 +211,14 @@ winReshapeMultiWindow (WindowPtr pWin) return; } #endif + +void +winShapeRgnUpdateMultiwindow(HWND hwnd) +{ + WindowPtr pWin = GetProp (hwnd, WIN_WINDOW_PROP); + if (pWin) + { + winReshapeMultiWindow(pWin); + winUpdateRgnMultiWindow(pWin); + } +} diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c index 037c881b4..c3972013c 100644 --- a/xorg-server/hw/xwin/winmultiwindowwindow.c +++ b/xorg-server/hw/xwin/winmultiwindowwindow.c @@ -1,5 +1,6 @@ /* *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -28,6 +29,7 @@ * Authors: Kensuke Matsuzaki * Earle F. Philhower, III * Harold L Hunt II + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H @@ -63,13 +65,6 @@ static void winFindWindow (pointer value, XID id, pointer cdata); /* - * Constant defines - */ - -#define MOUSE_POLLING_INTERVAL 500 - - -/* * Macros */ @@ -486,6 +481,7 @@ winCreateWindowsWindow (WindowPtr pWin) int iWidth; int iHeight; HWND hWnd; + HWND hFore = NULL; WNDCLASSEX wc; winWindowPriv(pWin); HICON hIcon; @@ -496,6 +492,7 @@ winCreateWindowsWindow (WindowPtr pWin) static int s_iWindowID = 0; winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv; WinXSizeHints hints; + WindowPtr pDaddy; #if CYGMULTIWINDOW_DEBUG ErrorF ("winCreateWindowsWindow - pWin: %08x\n", pWin); @@ -504,20 +501,16 @@ winCreateWindowsWindow (WindowPtr pWin) iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN); iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN); - /* Default positions if none specified */ - if (!winMultiWindowGetWMNormalHints(pWin, &hints)) - hints.flags = 0; - if ( !(hints.flags & (USPosition|PPosition)) && - !winMultiWindowGetTransientFor (pWin, NULL) && - !pWin->overrideRedirect ) - { - iX = CW_USEDEFAULT; - iY = CW_USEDEFAULT; - } - iWidth = pWin->drawable.width; iHeight = pWin->drawable.height; + /* ensure window actually ends up somewhere visible */ + if (iX > GetSystemMetrics (SM_CXVIRTUALSCREEN)) + iX = CW_USEDEFAULT; + + if (iY > GetSystemMetrics (SM_CYVIRTUALSCREEN)) + iY = CW_USEDEFAULT; + winSelectIcons(pWin, &hIcon, &hIconSmall); /* Set standard class name prefix so we can identify window easily */ @@ -570,6 +563,28 @@ winCreateWindowsWindow (WindowPtr pWin) wc.lpszClassName = pszClass; RegisterClassEx (&wc); + if (!pWin->overrideRedirect) + { + if (winMultiWindowGetTransientFor (pWin, &pDaddy)) + { + if (pDaddy) + { + hFore = GetForegroundWindow(); + if (hFore && (pDaddy != (WindowPtr)GetProp(hFore, WIN_WID_PROP))) hFore = NULL; + } + } + else + { + /* Default positions if none specified */ + if (!winMultiWindowGetWMNormalHints(pWin, &hints)) hints.flags = 0; + if (!(hints.flags & (USPosition|PPosition))) + { + iX = CW_USEDEFAULT; + iY = CW_USEDEFAULT; + } + } + } + /* Create the window */ /* Make it OVERLAPPED in create call since WS_POPUP doesn't support */ /* CW_USEDEFAULT, change back to popup after creation */ @@ -581,7 +596,7 @@ winCreateWindowsWindow (WindowPtr pWin) iY, /* Vertical position */ iWidth, /* Right edge */ iHeight, /* Bottom edge */ - (HWND) NULL, /* No parent or owner window */ + hFore, /* Null or Parent window if transient*/ (HMENU) NULL, /* No menu */ GetModuleHandle (NULL), /* Instance handle */ pWin); /* ScreenPrivates */ diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c index 5401ecdee..e766c42dc 100644 --- a/xorg-server/hw/xwin/winmultiwindowwm.c +++ b/xorg-server/hw/xwin/winmultiwindowwm.c @@ -1,5 +1,6 @@ /* *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -26,6 +27,7 @@ *from the XFree86 Project. * * Authors: Kensuke Matsuzaki + * Colin Harrison */ /* X headers */ @@ -34,13 +36,18 @@ #endif #include <stdio.h> #include <stdlib.h> +#ifndef _MSC_VER #include <unistd.h> +#endif #ifdef __CYGWIN__ #include <sys/select.h> #endif #include <fcntl.h> #include <setjmp.h> #define HANDLE void * +#ifdef _MSC_VER +typedef int pid_t; +#endif #include <pthread.h> #undef HANDLE #include <X11/X.h> @@ -52,24 +59,22 @@ #include <X11/cursorfont.h> /* Windows headers */ -#ifdef __CYGWIN__ -/* Fixups to prevent collisions between Windows and X headers */ -#define ATOM DWORD - -#include <windows.h> -#else -#include <Xwindows.h> -#endif +#include <X11/Xwindows.h> /* Local headers */ #include "objbase.h" #include "ddraw.h" #include "winwindow.h" +#include "winprefs.h" +#include "window.h" +#include "windowstr.h" #ifdef XWIN_MULTIWINDOWEXTWM -#include "windowswmstr.h" +#include <X11/extensions/windowswmstr.h> #endif extern void winDebug(const char *format, ...); +extern void winReshapeMultiWindow(WindowPtr pWin); +extern void winUpdateRgnMultiWindow(WindowPtr pWin); #ifndef CYGDEBUG #define CYGDEBUG NO @@ -86,6 +91,7 @@ extern void winDebug(const char *format, ...); #endif #define WIN_JMP_OKAY 0 #define WIN_JMP_ERROR_IO 2 +#define AUTH_NAME "MIT-MAGIC-COOKIE-1" /* @@ -135,6 +141,10 @@ typedef struct _XMsgProcArgRec { extern char *display; extern void ErrorF (const char* /*f*/, ...); +#if defined(XCSECURITY) +extern unsigned int g_uiAuthDataLen; +extern char *g_pAuthData; +#endif /* @@ -151,7 +161,7 @@ static Bool InitQueue (WMMsgQueuePtr pQueue); static void -GetWindowName (Display * pDpy, Window iWin, char **ppName); +GetWindowName (Display * pDpy, Window iWin, wchar_t **ppName); static int SendXMessage (Display *pDisplay, Window iWin, Atom atmType, long nData); @@ -191,6 +201,11 @@ PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction); static Bool CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen); +static void +winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle); + +void +winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle); /* * Local globals @@ -403,10 +418,12 @@ InitQueue (WMMsgQueuePtr pQueue) */ static void -GetWindowName (Display *pDisplay, Window iWin, char **ppName) +GetWindowName (Display *pDisplay, Window iWin, wchar_t **ppName) { int nResult, nNum; char **ppList; + char *pszReturnData; + int iLen, i; XTextProperty xtpName; #if CYGMULTIWINDOW_DEBUG @@ -425,38 +442,26 @@ GetWindowName (Display *pDisplay, Window iWin, char **ppName) #endif return; } - - /* */ - if (xtpName.encoding == XA_STRING) - { - /* */ - if (xtpName.value) - { - int size = xtpName.nitems * (xtpName.format >> 3); - *ppName = malloc(size + 1); - strncpy(*ppName, xtpName.value, size); - (*ppName)[size] = 0; - XFree (xtpName.value); - } -#if CYGMULTIWINDOW_DEBUG - ErrorF ("GetWindowName - XA_STRING %s\n", *ppName); -#endif - } - else - { - if (XmbTextPropertyToTextList (pDisplay, &xtpName, &ppList, &nNum) >= Success && nNum > 0 && *ppList) - { - *ppName = strdup (*ppList); - XFreeStringList (ppList); - } - XFree (xtpName.value); - -#if CYGMULTIWINDOW_DEBUG - ErrorF ("GetWindowName - %s %s\n", - XGetAtomName (pDisplay, xtpName.encoding), *ppName); -#endif - } + if (Xutf8TextPropertyToTextList (pDisplay, &xtpName, &ppList, &nNum) >= Success && nNum > 0 && *ppList) + { + iLen = 0; + for (i = 0; i < nNum; i++) iLen += strlen(ppList[i]); + pszReturnData = (char *) malloc (iLen + 1); + pszReturnData[0] = '\0'; + for (i = 0; i < nNum; i++) strcat (pszReturnData, ppList[i]); + } + else + { + pszReturnData = (char *) malloc (1); + pszReturnData[0] = '\0'; + } + iLen = MultiByteToWideChar (CP_UTF8, 0, pszReturnData, -1, NULL, 0); + *ppName = (wchar_t*)malloc(sizeof(wchar_t)*(iLen + 1)); + MultiByteToWideChar (CP_UTF8, 0, pszReturnData, -1, *ppName, iLen); + XFree (xtpName.value); + if (ppList) XFreeStringList (ppList); + free (pszReturnData); #if CYGMULTIWINDOW_DEBUG ErrorF ("GetWindowName - Returning\n"); @@ -493,7 +498,7 @@ SendXMessage (Display *pDisplay, Window iWin, Atom atmType, long nData) static void UpdateName (WMInfoPtr pWMInfo, Window iWindow) { - char *pszName; + wchar_t *pszName; Atom atmType; int fmtRet; unsigned long items, remain; @@ -537,7 +542,7 @@ UpdateName (WMInfoPtr pWMInfo, Window iWindow) &attr); if (!attr.override_redirect) { - SetWindowText (hWnd, pszName); + SetWindowTextW (hWnd, pszName); winUpdateIcon (iWindow); } @@ -705,10 +710,25 @@ winMultiWindowWMProc (void *pArg) 1); UpdateName (pWMInfo, pNode->msg.iWindow); winUpdateIcon (pNode->msg.iWindow); -#if 0 - /* Handles the case where there are AOT windows above it in W32 */ - PreserveWin32Stack (pWMInfo, pNode->msg.iWindow, GW_HWNDPREV); + { + HWND zstyle = HWND_NOTOPMOST; + winApplyHints (pWMInfo->pDisplay, pNode->msg.iWindow, pNode->msg.hwndWindow, &zstyle); + winUpdateWindowPosition (pNode->msg.hwndWindow, TRUE, &zstyle); + } + break; + + case WM_WM_MAP2: +#if CYGMULTIWINDOW_DEBUG + ErrorF ("\tWM_WM_MAP2\n"); #endif + XChangeProperty (pWMInfo->pDisplay, + pNode->msg.iWindow, + pWMInfo->atmPrivMap, + XA_INTEGER,//pWMInfo->atmPrivMap, + 32, + PropModeReplace, + (unsigned char *) &(pNode->msg.hwndWindow), + 1); break; case WM_WM_UNMAP: @@ -803,6 +823,7 @@ winMultiWindowWMProc (void *pArg) #if CYGMULTIWINDOW_DEBUG ErrorF("-winMultiWindowWMProc ()\n"); #endif + return NULL; } @@ -1063,6 +1084,7 @@ winMultiWindowXMsgProc (void *pArg) XCloseDisplay (pProcArg->pDisplay); pthread_exit (NULL); + return NULL; } @@ -1226,6 +1248,14 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg) /* Print the display connection string */ ErrorF ("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay); + +#if defined(XCSECURITY) + /* Use our generated cookie for authentication */ + XSetAuthorization (AUTH_NAME, + strlen (AUTH_NAME), + g_pAuthData, + g_uiAuthDataLen); +#endif /* Open the X display */ do @@ -1265,11 +1295,10 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg) pWMInfo->atmWmDelete = XInternAtom (pWMInfo->pDisplay, "WM_DELETE_WINDOW", False); -#ifdef XWIN_MULTIWINDOWEXTWM + pWMInfo->atmPrivMap = XInternAtom (pWMInfo->pDisplay, - WINDOWSWM_NATIVE_HWND, + "_WINDOWSWM_NATIVE_HWND", False); -#endif if (1) { @@ -1364,7 +1393,9 @@ winMultiWindowXMsgProcErrorHandler (Display *pDisplay, XErrorEvent *pErr) pErr->error_code, pszErrorMsg, sizeof (pszErrorMsg)); +#if CYGMULTIWINDOW_DEBUG ErrorF ("winMultiWindowXMsgProcErrorHandler - ERROR: %s\n", pszErrorMsg); +#endif return 0; } @@ -1438,3 +1469,205 @@ winDeinitMultiWindowWM () ErrorF ("winDeinitMultiWindowWM - Noting shutdown in progress\n"); g_shutdown = TRUE; } + +/* Windows window styles */ +#define HINT_NOFRAME (1L<<0) +#define HINT_BORDER (1L<<1) +#define HINT_SIZEBOX (1L<<2) +#define HINT_CAPTION (1L<<3) +#define HINT_NOMAXIMIZE (1L<<4) +/* These two are used on their own */ +#define HINT_MAX (1L<<0) +#define HINT_MIN (1L<<1) + +static void +winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle) +{ + static Atom windowState, motif_wm_hints, windowType; + Atom type, *pAtom = NULL; + int format; + unsigned long hint = 0, maxmin = 0, rcStyle, nitems = 0 , left = 0; + WindowPtr pWin = GetProp (hWnd, WIN_WINDOW_PROP); + MwmHints *mwm_hint = NULL; + XSizeHints *normal_hint; + long supplied; + + if (!hWnd) return; + if (!IsWindow (hWnd)) return; + + if (windowState == None) windowState = XInternAtom(pDisplay, "_NET_WM_STATE", False); + if (motif_wm_hints == None) motif_wm_hints = XInternAtom(pDisplay, "_MOTIF_WM_HINTS", False); + if (windowType == None) windowType = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE", False); + + if (XGetWindowProperty(pDisplay, iWindow, windowState, 0L, + 1L, False, XA_ATOM, &type, &format, + &nitems, &left, (unsigned char **)&pAtom) == Success) + { + if (pAtom && nitems == 1) + { + static Atom hiddenState, fullscreenState, belowState, aboveState; + if (hiddenState == None) hiddenState = XInternAtom(pDisplay, "_NET_WM_STATE_HIDDEN", False); + if (fullscreenState == None) fullscreenState = XInternAtom(pDisplay, "_NET_WM_STATE_FULLSCREEN", False); + if (belowState == None) belowState = XInternAtom(pDisplay, "_NET_WM_STATE_BELOW", False); + if (aboveState == None) aboveState = XInternAtom(pDisplay, "_NET_WM_STATE_ABOVE", False); + if (*pAtom == hiddenState) maxmin |= HINT_MIN; + else if (*pAtom == fullscreenState) maxmin |= HINT_MAX; + if (*pAtom == belowState) *zstyle = HWND_BOTTOM; + else if (*pAtom == aboveState) *zstyle = HWND_TOPMOST; + } + if (pAtom) XFree(pAtom); + } + + nitems = left = 0; + if (XGetWindowProperty(pDisplay, iWindow, motif_wm_hints, 0L, + PropMwmHintsElements, False, motif_wm_hints, &type, &format, + &nitems, &left, (unsigned char **)&mwm_hint) == Success) + { + if (mwm_hint && nitems == PropMwmHintsElements && (mwm_hint->flags & MwmHintsDecorations)) + { + if (!mwm_hint->decorations) hint |= HINT_NOFRAME; + else if (!(mwm_hint->decorations & MwmDecorAll)) + { + if (mwm_hint->decorations & MwmDecorBorder) hint |= HINT_BORDER; + if (mwm_hint->decorations & MwmDecorHandle) hint |= HINT_SIZEBOX; + if (mwm_hint->decorations & MwmDecorTitle) hint |= HINT_CAPTION; + } + } + if (mwm_hint) XFree(mwm_hint); + } + + nitems = left = 0; + pAtom = NULL; + if (XGetWindowProperty(pDisplay, iWindow, windowType, 0L, + 1L, False, XA_ATOM, &type, &format, + &nitems, &left, (unsigned char **)&pAtom) == Success) + { + if (pAtom && nitems == 1) + { + static Atom dockWindow; + if (dockWindow == None) dockWindow = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE_DOCK", False); + if (*pAtom == dockWindow) + { + hint = (hint & ~HINT_NOFRAME) | HINT_SIZEBOX; /* Xming puts a sizebox on dock windows */ + *zstyle = HWND_TOPMOST; + } + } + if (pAtom) XFree(pAtom); + } + + normal_hint = XAllocSizeHints(); + if (normal_hint && (XGetWMNormalHints(pDisplay, iWindow, normal_hint, &supplied) == Success)) + { + if (normal_hint->flags & PMaxSize) + { + /* Not maximizable if a maximum size is specified */ + hint |= HINT_NOMAXIMIZE; + + if (normal_hint->flags & PMinSize) + { + /* + If both minimum size and maximum size are specified and are the same, + don't bother with a resizing frame + */ + if ((normal_hint->min_width == normal_hint->max_width) + && (normal_hint->min_height == normal_hint->max_height)) + hint = (hint & ~HINT_SIZEBOX); + } + } + } + XFree(normal_hint); + + /* Apply Styles, overriding hint settings from above */ + rcStyle = winOverrideStyle((unsigned long)pWin); + if (rcStyle & STYLE_TOPMOST) *zstyle = HWND_TOPMOST; + else if (rcStyle & STYLE_MAXIMIZE) maxmin = (hint & ~HINT_MIN) | HINT_MAX; + else if (rcStyle & STYLE_MINIMIZE) maxmin = (hint & ~HINT_MAX) | HINT_MIN; + else if (rcStyle & STYLE_BOTTOM) *zstyle = HWND_BOTTOM; + + if (maxmin & HINT_MAX) SendMessage(hWnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0); + else if (maxmin & HINT_MIN) SendMessage(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); + + if (rcStyle & STYLE_NOTITLE) + hint = (hint & ~HINT_NOFRAME & ~HINT_BORDER & ~HINT_CAPTION) | HINT_SIZEBOX; + else if (rcStyle & STYLE_OUTLINE) + hint = (hint & ~HINT_NOFRAME & ~HINT_SIZEBOX & ~HINT_CAPTION) | HINT_BORDER; + else if (rcStyle & STYLE_NOFRAME) + hint = (hint & ~HINT_BORDER & ~HINT_CAPTION & ~HINT_SIZEBOX) | HINT_NOFRAME; + + SetWindowLongPtr (hWnd, GWL_STYLE, GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION & ~WS_SIZEBOX); /* Just in case */ + if (!hint) /* All on */ + SetWindowLongPtr (hWnd, GWL_STYLE, GetWindowLongPtr(hWnd, GWL_STYLE) | WS_CAPTION | WS_SIZEBOX); + else if (hint & HINT_NOFRAME); /* All off, so do nothing */ + else SetWindowLongPtr (hWnd, GWL_STYLE, GetWindowLongPtr(hWnd, GWL_STYLE) | + ((hint & HINT_BORDER) ? WS_BORDER : 0) | + ((hint & HINT_SIZEBOX) ? WS_SIZEBOX : 0) | + ((hint & HINT_CAPTION) ? WS_CAPTION : 0)); + + if (hint & HINT_NOMAXIMIZE) + SetWindowLongPtr(hWnd, GWL_STYLE, GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_MAXIMIZEBOX); +} + +void +winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle) +{ + int iX, iY, iWidth, iHeight; + int iDx, iDy; + RECT rcNew; + WindowPtr pWin = GetProp (hWnd, WIN_WINDOW_PROP); + DrawablePtr pDraw = NULL; + + if (!pWin) return; + pDraw = &pWin->drawable; + if (!pDraw) return; + + /* Get the X and Y location of the X window */ + iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN); + iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN); + + /* Get the height and width of the X window */ + iWidth = pWin->drawable.width; + iHeight = pWin->drawable.height; + + /* Setup a rectangle with the X window position and size */ + SetRect (&rcNew, iX, iY, iX + iWidth, iY + iHeight); + +#if 0 + ErrorF ("winUpdateWindowPosition - (%d, %d)-(%d, %d)\n", + rcNew.left, rcNew.top, + rcNew.right, rcNew.bottom); +#endif + + AdjustWindowRectEx (&rcNew, GetWindowLongPtr (hWnd, GWL_STYLE), FALSE, WS_EX_APPWINDOW); + + /* Don't allow window decoration to disappear off to top-left as a result of this adjustment */ + if (rcNew.left < GetSystemMetrics(SM_XVIRTUALSCREEN)) + { + iDx = GetSystemMetrics(SM_XVIRTUALSCREEN) - rcNew.left; + rcNew.left += iDx; + rcNew.right += iDx; + } + + if (rcNew.top < GetSystemMetrics(SM_YVIRTUALSCREEN)) + { + iDy = GetSystemMetrics(SM_YVIRTUALSCREEN) - rcNew.top; + rcNew.top += iDy; + rcNew.bottom += iDy; + } + +#if 0 + ErrorF ("winUpdateWindowPosition - (%d, %d)-(%d, %d)\n", + rcNew.left, rcNew.top, + rcNew.right, rcNew.bottom); +#endif + + /* Position the Windows window */ + SetWindowPos (hWnd, *zstyle, rcNew.left, rcNew.top, + rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, + 0); + + if (reshape) + { + winReshapeMultiWindow(pWin); + winUpdateRgnMultiWindow(pWin); + } +} diff --git a/xorg-server/hw/xwin/winmultiwindowwndproc.c b/xorg-server/hw/xwin/winmultiwindowwndproc.c index 20ff9f7db..bfb74a092 100644 --- a/xorg-server/hw/xwin/winmultiwindowwndproc.c +++ b/xorg-server/hw/xwin/winmultiwindowwndproc.c @@ -1,5 +1,6 @@ /* *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -28,6 +29,7 @@ * Authors: Kensuke Matsuzaki * Earle F. Philhower, III * Harold L Hunt II + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H @@ -49,6 +51,8 @@ extern Bool g_fKeyboardHookLL; extern Bool g_fSoftwareCursor; extern Bool g_fButton[3]; +extern void winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle); + /* * Local globals @@ -61,7 +65,6 @@ static UINT_PTR g_uipMousePollingTimerID = 0; * Constant defines */ -#define MOUSE_POLLING_INTERVAL 500 #define WIN_MULTIWINDOW_SHAPE YES @@ -206,6 +209,7 @@ ValidateSizing (HWND hwnd, WindowPtr pWin, WinXSizeHints sizeHints; RECT *rect; int iWidth, iHeight; + unsigned long rcStyle; /* Invalid input checking */ if (pWin==NULL || lParam==0) @@ -227,19 +231,31 @@ ValidateSizing (HWND hwnd, WindowPtr pWin, iWidth = rect->right - rect->left; iHeight = rect->bottom - rect->top; - /* Now remove size of any borders */ - iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME); - iHeight -= (GetSystemMetrics(SM_CYCAPTION) - + 2 * GetSystemMetrics(SM_CYSIZEFRAME)); - + /* Now remove size of any borders and title bar */ + rcStyle = GetWindowLongPtr(hwnd, GWL_STYLE); + if (rcStyle & WS_CAPTION) + { + iHeight -= GetSystemMetrics(SM_CYCAPTION); + } + if (rcStyle & WS_SIZEBOX) + { + iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME); + iHeight -= 2 * GetSystemMetrics(SM_CYSIZEFRAME); + } /* Constrain the size to legal values */ ConstrainSize (sizeHints, &iWidth, &iHeight); - /* Add back the borders */ - iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME); - iHeight += (GetSystemMetrics(SM_CYCAPTION) - + 2 * GetSystemMetrics(SM_CYSIZEFRAME)); + /* Add back the size of borders and title bar */ + if (rcStyle & WS_CAPTION) + { + iHeight += GetSystemMetrics(SM_CYCAPTION); + } + if (rcStyle & WS_SIZEBOX) + { + iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME); + iHeight += 2 * GetSystemMetrics(SM_CYSIZEFRAME); + } /* Adjust size according to where we're dragging from */ switch(wParam) { @@ -276,16 +292,30 @@ static void winRaiseWindow(WindowPtr pWin) if (!winInDestroyWindowsWindow && !winInRaiseWindow) { BOOL oldstate = winInRaiseWindow; + XID vlist[1] = { 0 }; winInRaiseWindow = TRUE; /* Call configure window directly to make sure it gets processed * in time */ - XID vlist[1] = { 0 }; ConfigureWindow(pWin, CWStackMode, vlist, serverClient); winInRaiseWindow = oldstate; } } +static +void winStartMousePolling(winPrivScreenPtr s_pScreenPriv) +{ + /* + * Timer to poll mouse position. This is needed to make + * programs like xeyes follow the mouse properly when the + * mouse pointer is outside of any X window. + */ + if (g_uipMousePollingTimerID == 0) + g_uipMousePollingTimerID = SetTimer (s_pScreenPriv->hwndScreen, + WIN_POLLING_MOUSE_TIMER_ID, + MOUSE_POLLING_INTERVAL, + NULL); +} /* * winTopLevelWindowProc - Window procedure for all top-level Windows windows. @@ -377,7 +407,9 @@ winTopLevelWindowProc (HWND hwnd, UINT message, switch (message) { case WM_CREATE: - +{ + RECT rWindow; + HRGN hRgnWindow; /* */ SetProp (hwnd, WIN_WINDOW_PROP, @@ -396,13 +428,13 @@ winTopLevelWindowProc (HWND hwnd, UINT message, winReorderWindowsMultiWindow (); /* Fix a 'round title bar corner background should be transparent not black' problem when first painted */ - RECT rWindow; - HRGN hRgnWindow; GetWindowRect(hwnd, &rWindow); hRgnWindow = CreateRectRgnIndirect(&rWindow); SetWindowRgn (hwnd, hRgnWindow, TRUE); DeleteObject(hRgnWindow); + SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)XMING_SIGNATURE); +} return 0; case WM_INIT_SYS_MENU: @@ -535,9 +567,9 @@ winTopLevelWindowProc (HWND hwnd, UINT message, } /* Deliver absolute cursor position to X Server */ - miPointerAbsoluteCursor (ptMouse.x - s_pScreenInfo->dwXOffset, - ptMouse.y - s_pScreenInfo->dwYOffset, - g_c32LastInputEventTime = GetTickCount ()); + winEnqueueMotion(ptMouse.x - s_pScreenInfo->dwXOffset, + ptMouse.y - s_pScreenInfo->dwYOffset); + return 0; case WM_NCMOUSEMOVE: @@ -561,15 +593,8 @@ winTopLevelWindowProc (HWND hwnd, UINT message, ShowCursor (TRUE); } - /* - * Timer to poll mouse events. This is needed to make - * programs like xeyes follow the mouse properly. - */ - if (g_uipMousePollingTimerID == 0) - g_uipMousePollingTimerID = SetTimer (s_pScreenPriv->hwndScreen, - WIN_POLLING_MOUSE_TIMER_ID, - MOUSE_POLLING_INTERVAL, - NULL); + winStartMousePolling(s_pScreenPriv); + break; case WM_MOUSELEAVE: @@ -585,15 +610,8 @@ winTopLevelWindowProc (HWND hwnd, UINT message, ShowCursor (TRUE); } - /* - * Timer to poll mouse events. This is needed to make - * programs like xeyes follow the mouse properly. - */ - if (g_uipMousePollingTimerID == 0) - g_uipMousePollingTimerID = SetTimer (s_pScreenPriv->hwndScreen, - WIN_POLLING_MOUSE_TIMER_ID, - MOUSE_POLLING_INTERVAL, - NULL); + winStartMousePolling(s_pScreenPriv); + return 0; case WM_LBUTTONDBLCLK: @@ -601,12 +619,15 @@ winTopLevelWindowProc (HWND hwnd, UINT message, if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[0] = TRUE; + SetCapture(hwnd); return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam); - + case WM_LBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[0] = FALSE; + ReleaseCapture(); + winStartMousePolling(s_pScreenPriv); return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam); case WM_MBUTTONDBLCLK: @@ -614,47 +635,66 @@ winTopLevelWindowProc (HWND hwnd, UINT message, if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[1] = TRUE; + SetCapture(hwnd); return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam); - + case WM_MBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[1] = FALSE; + ReleaseCapture(); + winStartMousePolling(s_pScreenPriv); return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam); - + case WM_RBUTTONDBLCLK: case WM_RBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[2] = TRUE; + SetCapture(hwnd); return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam); - + case WM_RBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[2] = FALSE; + ReleaseCapture(); + winStartMousePolling(s_pScreenPriv); return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam); case WM_XBUTTONDBLCLK: case WM_XBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; + SetCapture(hwnd); return winMouseButtonsHandle (s_pScreen, ButtonPress, HIWORD(wParam) + 5, wParam); + case WM_XBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; + ReleaseCapture(); + winStartMousePolling(s_pScreenPriv); return winMouseButtonsHandle (s_pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam); case WM_MOUSEWHEEL: - - /* Pass the message to the root window */ - SendMessage (hwndScreen, message, wParam, lParam); - return 0; + if (SendMessage(hwnd, WM_NCHITTEST, 0, MAKELONG(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))) == HTCLIENT) + { + /* Pass the message to the root window */ + SendMessage (hwndScreen, message, wParam, lParam); + return 0; + } + else break; case WM_SETFOCUS: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; + { + /* Get the parent window for transient handling */ + HWND hParent = GetParent(hwnd); + if (hParent && IsIconic(hParent)) ShowWindow (hParent, SW_RESTORE); + } + winRestoreModeKeyStates (); /* Add the keyboard hook if possible */ @@ -668,6 +708,9 @@ winTopLevelWindowProc (HWND hwnd, UINT message, /* Remove our keyboard hook if it is installed */ winRemoveKeyboardHookLL (); + if (!wParam) + /* Revert the X focus as well, but only if the Windows focus is going to another thread */ + DeleteWindowFromAnyEvents(pWin, FALSE); return 0; case WM_SYSDEADCHAR: @@ -770,6 +813,10 @@ winTopLevelWindowProc (HWND hwnd, UINT message, if (!pWin || !pWin->overrideRedirect) /* for OOo menus */ winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg); } + /* Prevent the mouse wheel from stalling when another window is minimized */ + if (HIWORD(wParam) == 0 && LOWORD(wParam) == WA_ACTIVE && + (HWND)lParam != NULL && (HWND)lParam != (HWND)GetParent(hwnd)) + SetFocus(hwnd); return 0; case WM_ACTIVATEAPP: @@ -824,98 +871,57 @@ winTopLevelWindowProc (HWND hwnd, UINT message, if (!wParam) return 0; - /* Tell X to map the window */ - MapWindow (pWin, wClient(pWin)); - /* */ if (!pWin->overrideRedirect) { - DWORD dwExStyle; - DWORD dwStyle; - RECT rcNew; - int iDx, iDy; - /* Flag that this window needs to be made active when clicked */ SetProp (hwnd, WIN_NEEDMANAGE_PROP, (HANDLE) 1); - /* Get the standard and extended window style information */ - dwExStyle = GetWindowLongPtr (hwnd, GWL_EXSTYLE); - dwStyle = GetWindowLongPtr (hwnd, GWL_STYLE); - - /* */ - if (dwExStyle != WS_EX_APPWINDOW) + if (!(GetWindowLongPtr (hwnd, GWL_EXSTYLE) & WS_EX_APPWINDOW)) { - /* Setup a rectangle with the X window position and size */ - SetRect (&rcNew, - pDraw->x, - pDraw->y, - pDraw->x + pDraw->width, - pDraw->y + pDraw->height); - -#if 0 - ErrorF ("winTopLevelWindowProc - (%d, %d)-(%d, %d)\n", - rcNew.left, rcNew.top, - rcNew.right, rcNew.bottom); -#endif - - /* */ - AdjustWindowRectEx (&rcNew, - WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW, - FALSE, - WS_EX_APPWINDOW); - - /* Calculate position deltas */ - iDx = pDraw->x - rcNew.left; - iDy = pDraw->y - rcNew.top; - - /* Calculate new rectangle */ - rcNew.left += iDx; - rcNew.right += iDx; - rcNew.top += iDy; - rcNew.bottom += iDy; - -#if 0 - ErrorF ("winTopLevelWindowProc - (%d, %d)-(%d, %d)\n", - rcNew.left, rcNew.top, - rcNew.right, rcNew.bottom); -#endif + HWND zstyle = HWND_NOTOPMOST; /* Set the window extended style flags */ SetWindowLongPtr (hwnd, GWL_EXSTYLE, WS_EX_APPWINDOW); + /* Set the transient style flags */ + if (GetParent(hwnd)) SetWindowLongPtr (hwnd, GWL_STYLE, + WS_POPUP | WS_OVERLAPPED | WS_SYSMENU | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); /* Set the window standard style flags */ - SetWindowLongPtr (hwnd, GWL_STYLE, - WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW); - - /* Position the Windows window */ - SetWindowPos (hwnd, HWND_TOP, - rcNew.left, rcNew.top, - rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, - SWP_NOMOVE | SWP_FRAMECHANGED - | SWP_SHOWWINDOW | SWP_NOACTIVATE); + else SetWindowLongPtr (hwnd, GWL_STYLE, + (WS_POPUP | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS) + & ~WS_CAPTION & ~WS_SIZEBOX); - /* Bring the Windows window to the foreground */ + winUpdateWindowPosition (hwnd, FALSE, &zstyle); SetForegroundWindow (hwnd); } + wmMsg.msg = WM_WM_MAP; } else /* It is an overridden window so make it top of Z stack */ { + HWND forHwnd = GetForegroundWindow(); #if CYGWINDOWING_DEBUG ErrorF ("overridden window is shown\n"); #endif - SetWindowPos (hwnd, HWND_TOPMOST, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + if (forHwnd != NULL) + { + if (GetWindowLongPtr(forHwnd, GWLP_USERDATA) & (LONG_PTR)XMING_SIGNATURE) + { + if (GetWindowLongPtr(forHwnd, GWL_EXSTYLE) & WS_EX_TOPMOST) + SetWindowPos (hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + else + SetWindowPos (hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + } + } + wmMsg.msg = WM_WM_MAP2; } - /* Setup the Window Manager message */ - wmMsg.msg = WM_WM_MAP; - wmMsg.iWidth = pDraw->width; - wmMsg.iHeight = pDraw->height; - /* Tell our Window Manager thread to map the window */ if (fWMMsgInitialized) winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg); + winStartMousePolling(s_pScreenPriv); + return 0; case WM_SIZING: @@ -1009,8 +1015,20 @@ winTopLevelWindowProc (HWND hwnd, UINT message, #endif /* Adjust the X Window to the moved Windows window */ winAdjustXWindow (pWin, hwnd); + if (wParam == SIZE_MINIMIZED) winReorderWindowsMultiWindow(); return 0; /* end of WM_SIZE handler */ + case WM_STYLECHANGED: + /* when the style changes, adjust the window size so the client area remains the same */ + { + LONG x,y; + DrawablePtr pDraw = &pWin->drawable; + x = pDraw->x - wBorderWidth(pWin); + y = pDraw->y - wBorderWidth(pWin); + winPositionWindowMultiWindow(pWin, x, y); + } + return 0; + case WM_MOUSEACTIVATE: /* Check if this window needs to be made active when clicked */ diff --git a/xorg-server/hw/xwin/winpolyline.c b/xorg-server/hw/xwin/winpolyline.c index db9dd345b..bf98d73ec 100644 --- a/xorg-server/hw/xwin/winpolyline.c +++ b/xorg-server/hw/xwin/winpolyline.c @@ -45,7 +45,7 @@ winPolyLineNativeGDI (DrawablePtr pDrawable, { case LineSolid: if (pGC->lineWidth == 0) - return miZeroLine (pDrawable, pGC, mode, npt, ppt); + miZeroLine (pDrawable, pGC, mode, npt, ppt); else miWideLine (pDrawable, pGC, mode, npt, ppt); break; diff --git a/xorg-server/hw/xwin/winprefs.c b/xorg-server/hw/xwin/winprefs.c index 30e587d4a..c5fd7eb08 100644 --- a/xorg-server/hw/xwin/winprefs.c +++ b/xorg-server/hw/xwin/winprefs.c @@ -1,5 +1,6 @@ /* * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * Copyright (C) Colin Harrison 2005-2008 * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -26,6 +27,7 @@ * from the XFree86 Project. * * Authors: Earle F. Philhower, III + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H @@ -724,7 +726,7 @@ winIconIsOverride(unsigned hiconIn) /* - * Try and open ~/.XWinrc and /usr/X11R6/lib/X11/system.XWinrc + * Try and open ~/.XWinrc and system.XWinrc * Load it into prefs structure for use by other functions */ void @@ -764,7 +766,7 @@ LoadPreferences () #ifdef RELOCATE_PROJECTROOT snprintf(buffer, sizeof(buffer), "%s\\system.XWinrc", winGetBaseDir()); #else - strncpy(buffer, PROJECTROOT"/lib/X11/system.XWinrc", sizeof(buffer)); + strncpy(buffer, SYSCONFDIR"/X11/system.XWinrc", sizeof(buffer)); #endif buffer[sizeof(buffer)-1] = 0; prefFile = fopen (buffer, "r"); @@ -820,3 +822,49 @@ LoadPreferences () } /* for all menus */ } + + +/* + * Check for a match of the window class to one specified in the + * STYLES{} section in the prefs file, and return the style type + */ +unsigned long +winOverrideStyle (unsigned long longpWin) +{ + WindowPtr pWin = (WindowPtr) longpWin; + char *res_name, *res_class; + int i; + char *wmName; + + if (pWin==NULL) + return STYLE_NONE; + + /* If we can't find the class, we can't override from default! */ + if (!winMultiWindowGetClassHint (pWin, &res_name, &res_class)) + return STYLE_NONE; + + winMultiWindowGetWMName (pWin, &wmName); + + for (i=0; i<pref.styleItems; i++) { + if (!strcmp(pref.style[i].match, res_name) || + !strcmp(pref.style[i].match, res_class) || + (wmName && strstr(wmName, pref.style[i].match))) + { + free (res_name); + free (res_class); + if (wmName) + free (wmName); + + if (pref.style[i].type) + return pref.style[i].type; + } + } + + /* Didn't find the style, fail gracefully */ + free (res_name); + free (res_class); + if (wmName) + free (wmName); + + return STYLE_NONE; +} diff --git a/xorg-server/hw/xwin/winprefs.h b/xorg-server/hw/xwin/winprefs.h index d9e09deea..996b02ade 100644 --- a/xorg-server/hw/xwin/winprefs.h +++ b/xorg-server/hw/xwin/winprefs.h @@ -2,6 +2,7 @@ #define WINPREFS_H /* * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * Copyright (C) Colin Harrison 2005-2008 * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -28,6 +29,7 @@ * from the XFree86 Project. * * Authors: Earle F. Philhower, III + * Colin Harrison */ /* Need Bool */ @@ -57,6 +59,15 @@ typedef enum MENUCOMMANDTYPE CMD_RELOAD /* Reparse the .XWINRC file */ } MENUCOMMANDTYPE; +#define STYLE_NONE (0L) /* Dummy the first entry */ +#define STYLE_NOTITLE (1L) /* Force window style no titlebar */ +#define STYLE_OUTLINE (1L<<1) /* Force window style just thin-line border */ +#define STYLE_NOFRAME (1L<<2) /* Force window style no frame */ +#define STYLE_TOPMOST (1L<<3) /* Open a window always-on-top */ +#define STYLE_MAXIMIZE (1L<<4) /* Open a window maximized */ +#define STYLE_MINIMIZE (1L<<5) /* Open a window minimized */ +#define STYLE_BOTTOM (1L<<6) /* Open a window at the bottom of the Z order */ + /* Where to place a system menu */ typedef enum MENUPOSITION { @@ -97,6 +108,13 @@ typedef struct ICONITEM unsigned long hicon; /* LoadImage() result */ } ICONITEM; +/* To redefine styles for certain window types */ +typedef struct STYLEITEM +{ + char match[MENU_MAX+1]; /* What string to search for? */ + unsigned long type; /* What should it do? */ +} STYLEITEM; + typedef struct WINPREFS { /* Menu information */ @@ -122,6 +140,9 @@ typedef struct WINPREFS ICONITEM *icon; int iconItems; + STYLEITEM *style; + int styleItems; + /* Silent exit flag */ Bool fSilentExit; @@ -155,6 +176,9 @@ unsigned long winOverrideIcon (unsigned long longpWin); unsigned long +winOverrideStyle (unsigned long longpWin); + +unsigned long winTaskbarIcon(void); unsigned long diff --git a/xorg-server/hw/xwin/winprefslex.l b/xorg-server/hw/xwin/winprefslex.l index a4c1abc3d..ee2478bcc 100644 --- a/xorg-server/hw/xwin/winprefslex.l +++ b/xorg-server/hw/xwin/winprefslex.l @@ -1,6 +1,7 @@ %{ # -*- C -*- /* * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * Copyright (C) Colin Harrison 2005-2008 * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -27,6 +28,7 @@ * from the XFree86 Project. * * Authors: Earle F. Philhower, III + * Colin Harrison */ /* $XFree86: $ */ @@ -70,6 +72,14 @@ MENU { return MENU; } ICONDIRECTORY { return ICONDIRECTORY; } DEFAULTICON { return DEFAULTICON; } ICONS { return ICONS; } +STYLES { return STYLES; } +TOPMOST { return TOPMOST; } +MAXIMIZE { return MAXIMIZE; } +MINIMIZE { return MINIMIZE; } +BOTTOM { return BOTTOM; } +NOTITLE { return NOTITLE; } +OUTLINE { return OUTLINE; } +NOFRAME { return NOFRAME; } ROOTMENU { return ROOTMENU; } DEFAULTSYSMENU { return DEFAULTSYSMENU; } SYSMENU { return SYSMENU; } diff --git a/xorg-server/hw/xwin/winprefsyacc.c b/xorg-server/hw/xwin/winprefsyacc.c index abdc681b6..131379f48 100644 --- a/xorg-server/hw/xwin/winprefsyacc.c +++ b/xorg-server/hw/xwin/winprefsyacc.c @@ -62,6 +62,9 @@ /* Tokens. */ #ifndef YYTOKENTYPE +#ifdef DEBUG +#undef DEBUG +#endif # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ @@ -373,14 +376,14 @@ YYID (i) # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) + || defined __cplusplus) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) + || defined __cplusplus) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif diff --git a/xorg-server/hw/xwin/winprefsyacc.h b/xorg-server/hw/xwin/winprefsyacc.h index 60a879a4d..de075f50a 100644 --- a/xorg-server/hw/xwin/winprefsyacc.h +++ b/xorg-server/hw/xwin/winprefsyacc.h @@ -35,6 +35,10 @@ /* Tokens. */ #ifndef YYTOKENTYPE +#ifdef DEBUG +#undef DEBUG +#endif + # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ diff --git a/xorg-server/hw/xwin/winprefsyacc.y b/xorg-server/hw/xwin/winprefsyacc.y index 2a54ff28f..c917d04ff 100644 --- a/xorg-server/hw/xwin/winprefsyacc.y +++ b/xorg-server/hw/xwin/winprefsyacc.y @@ -1,6 +1,7 @@ %{ /* * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * Copyright (C) Colin Harrison 2005-2008 * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -27,6 +28,7 @@ * from the XFree86 Project. * * Authors: Earle F. Philhower, III + * Colin Harrison */ /* $XFree86: $ */ @@ -41,6 +43,10 @@ /* The following give better error messages in bison at the cost of a few KB */ #define YYERROR_VERBOSE 1 +/* YYLTYPE_IS_TRIVIAL and YYENABLE_NLS defined to suppress warnings */ +#define YYLTYPE_IS_TRIVIAL 1 +#define YYENABLE_NLS 0 + /* The global pref settings */ WINPREFS pref; @@ -64,6 +70,10 @@ static void OpenIcons(void); static void AddIconLine(char *matchstr, char *iconfile); static void CloseIcons(void); +static void OpenStyles(void); +static void AddStyleLine(char *matchstr, unsigned long style); +static void CloseStyles(void); + static void OpenSysMenu(void); static void AddSysMenuLine(char *matchstr, char *menuname, int pos); static void CloseSysMenu(void); @@ -78,14 +88,19 @@ extern int yylex(void); %union { char *sVal; + unsigned long uVal; int iVal; } -%token NEWLINE MENU LB RB ICONDIRECTORY DEFAULTICON ICONS DEFAULTSYSMENU +%token NEWLINE MENU LB RB ICONDIRECTORY DEFAULTICON ICONS STYLES +%token TOPMOST MAXIMIZE MINIMIZE BOTTOM NOTITLE OUTLINE NOFRAME DEFAULTSYSMENU %token SYSMENU ROOTMENU SEPARATOR ATSTART ATEND EXEC ALWAYSONTOP DEBUG %token RELOAD TRAYICON SILENTEXIT %token <sVal> STRING +%type <uVal> group1 +%type <uVal> group2 +%type <uVal> stylecombo %type <iVal> atspot %% @@ -107,6 +122,7 @@ command: defaulticon | icondirectory | menu | icons + | styles | sysmenu | rootmenu | defaultsysmenu @@ -154,6 +170,33 @@ iconlist: iconline icons: ICONS LB {OpenIcons();} newline_or_nada iconlist RB {CloseIcons();} ; +group1: TOPMOST { $$=STYLE_TOPMOST; } + | MAXIMIZE { $$=STYLE_MAXIMIZE; } + | MINIMIZE { $$=STYLE_MINIMIZE; } + | BOTTOM { $$=STYLE_BOTTOM; } + ; + +group2: NOTITLE { $$=STYLE_NOTITLE; } + | OUTLINE { $$=STYLE_OUTLINE; } + | NOFRAME { $$=STYLE_NOFRAME; } + ; + +stylecombo: group1 { $$=$1; } + | group2 { $$=$1; } + | group1 group2 { $$=$1+$2; } + | group2 group1 { $$=$1+$2; } + ; + +styleline: STRING stylecombo NEWLINE newline_or_nada { AddStyleLine($1, $2); free($1); } + ; + +stylelist: styleline + | styleline stylelist + ; + +styles: STYLES LB {OpenStyles();} newline_or_nada stylelist RB {CloseStyles();} + ; + atspot: { $$=AT_END; } | ATSTART { $$=AT_START; } | ATEND { $$=AT_END; } @@ -316,6 +359,39 @@ CloseIcons (void) } static void +OpenStyles (void) +{ + if (pref.style != NULL) { + ErrorF("LoadPreferences: Redefining window style\n"); + free(pref.style); + pref.style = NULL; + } + pref.styleItems = 0; +} + +static void +AddStyleLine (char *matchstr, unsigned long style) +{ + if (pref.style==NULL) + pref.style = (STYLEITEM*)malloc(sizeof(STYLEITEM)); + else + pref.style = (STYLEITEM*) + realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1)); + + strncpy(pref.style[pref.styleItems].match, matchstr, MENU_MAX); + pref.style[pref.styleItems].match[MENU_MAX] = 0; + + pref.style[pref.styleItems].type = style; + + pref.styleItems++; +} + +static void +CloseStyles (void) +{ +} + +static void OpenSysMenu (void) { if (pref.sysMenu != NULL) { diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c index 7139cbaab..9271da02b 100644 --- a/xorg-server/hw/xwin/winprocarg.c +++ b/xorg-server/hw/xwin/winprocarg.c @@ -1,6 +1,7 @@ /* Copyright 1993, 1998 The Open Group +Copyright (C) Colin Harrison 2005-2008 Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that @@ -31,9 +32,9 @@ from The Open Group. #endif #ifdef XVENDORNAME #define VENDOR_STRING XVENDORNAME -#define VERSION_STRING XORG_RELEASE #define VENDOR_CONTACT BUILDERADDR #endif +#include <../xfree86/common/xorgVersion.h> #include "win.h" #include "winconfig.h" #include "winprefs.h" @@ -57,6 +58,7 @@ extern char * g_pszLogFile; extern Bool g_fLogFileChanged; #endif extern Bool g_fXdmcpEnabled; +extern Bool g_fAuthEnabled; extern char * g_pszCommandLine; extern Bool g_fKeyboardHookLL; extern Bool g_fNoHelpMessageBox; @@ -1289,6 +1291,29 @@ ddxProcessArgument (int argc, char *argv[], int i) } /* + * Look for the '-auth' argument + */ + if (IS_OPTION ("-auth")) + { +#ifdef __MINGW32__ + HANDLE hFile; + char * pszFile; + CHECK_ARGS (1); + pszFile = argv[++i]; + hFile = CreateFile(pszFile,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); + if (hFile == INVALID_HANDLE_VALUE) + winMessageBoxF ("This authorization file for the -auth option could not be opened...\n" + "\"%s\"\n" + "You should use an \"Xauthority\" file in your HOME directory.\n" + "\nIgnoring and continuing.\n", + MB_ICONINFORMATION, + pszFile); +#endif + g_fAuthEnabled = TRUE; + return 0; /* Let DIX parse this again */ + } + + /* * Look for the '-indirect' or '-broadcast' arguments */ if (IS_OPTION ("-indirect") @@ -1459,13 +1484,13 @@ winLogCommandLine (int argc, char *argv[]) for (i = 0, iCurrLen = 0; i < argc; ++i) if (argv[i]) { - /* Add a character for lines that overflow */ + /* Adds two characters for lines that overflow */ if ((strlen (argv[i]) < CHARS_PER_LINE && iCurrLen + strlen (argv[i]) > CHARS_PER_LINE) || strlen (argv[i]) > CHARS_PER_LINE) { iCurrLen = 0; - ++iSize; + iSize += 2; } /* Add space for item and trailing space */ @@ -1525,8 +1550,8 @@ winLogVersionInfo (void) ErrorF ("Welcome to the XWin X Server\n"); ErrorF ("Vendor: %s\n", VENDOR_STRING); - ErrorF ("Release: %s\n\n", VERSION_STRING); - ErrorF ("Contact: %s\n\n", VENDOR_CONTACT); + ErrorF ("Release: %d.%d.%d.%d (%d)\n", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, BUILD_DATE); + ErrorF ("Contact: %s\n", VENDOR_CONTACT); } /* diff --git a/xorg-server/hw/xwin/winresource.h b/xorg-server/hw/xwin/winresource.h index 5aa884030..7085117e6 100644 --- a/xorg-server/hw/xwin/winresource.h +++ b/xorg-server/hw/xwin/winresource.h @@ -37,7 +37,6 @@ #define IDC_STATIC -1 #define IDI_XWIN 101 -#define IDI_XWIN_BOXED 102 #define IDM_TRAYICON_MENU 103 #define IDC_CLIENTS_CONNECTED 104 diff --git a/xorg-server/hw/xwin/winscrinit.c b/xorg-server/hw/xwin/winscrinit.c index 9dc4c3da5..5cc3925c7 100644 --- a/xorg-server/hw/xwin/winscrinit.c +++ b/xorg-server/hw/xwin/winscrinit.c @@ -37,7 +37,6 @@ #endif #include "win.h" #include "winmsg.h" -#include "safeAlpha.h" #ifdef XWIN_MULTIWINDOWEXTWM @@ -142,7 +141,7 @@ winScreenInit (int index, } /* Adjust the video mode for our engine type */ - if (!(*pScreenPriv->pwinAdjustVideoMode) (pScreen)) + if (pScreenPriv->pwinAdjustVideoMode && !(*pScreenPriv->pwinAdjustVideoMode) (pScreen)) { ErrorF ("winScreenInit - winAdjustVideoMode () failed\n"); return FALSE; @@ -176,7 +175,7 @@ winScreenInit (int index, } /* Create display window */ - if (!(*pScreenPriv->pwinCreateBoundingWindow) (pScreen)) + if (pScreenPriv->pwinCreateBoundingWindow && !(*pScreenPriv->pwinCreateBoundingWindow) (pScreen)) { ErrorF ("winScreenInit - pwinCreateBoundingWindow () " "failed\n"); @@ -227,7 +226,7 @@ winScreenInit (int index, pScreenInfo->dwBPP); /* Call the engine dependent screen initialization procedure */ - if (!((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv))) + if (pScreenPriv->pwinFinishScreenInit && !((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv))) { ErrorF ("winScreenInit - winFinishScreenInit () failed\n"); return FALSE; @@ -245,6 +244,25 @@ winScreenInit (int index, return TRUE; } +static Bool +winCreateScreenResources(ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + Bool result; + + result = pScreenPriv->pwinCreateScreenResources(pScreen); + + /* Now the screen bitmap has been wrapped in a pixmap, + add that to the Shadow framebuffer */ + if (!shadowAdd(pScreen, pScreen->devPrivate, + pScreenPriv->pwinShadowUpdate, NULL, 0, 0)) + { + ErrorF ("winCreateScreenResources - shadowAdd () failed\n"); + return FALSE; + } + + return result; +} /* See Porting Layer Definition - p. 20 */ Bool @@ -360,22 +378,6 @@ winFinishScreenInitFB (int index, pScreen->blockData = pScreen; pScreen->wakeupData = pScreen; -#ifdef XWIN_MULTIWINDOWEXTWM - /* - * Setup acceleration for multi-window external window manager mode. - * To be compatible with the Damage extension, this must be done - * before calling miDCInitialize, which calls DamageSetup. - */ - if (pScreenInfo->fMWExtWM) - { - if (!RootlessAccelInit (pScreen)) - { - ErrorF ("winFinishScreenInitFB - RootlessAccelInit () failed\n"); - return FALSE; - } - } -#endif - #ifdef RENDER /* Render extension initialization, calls miPictureInit */ if (!fbPictureInit (pScreen, NULL, 0)) @@ -428,15 +430,18 @@ winFinishScreenInitFB (int index, ) { #if CYGDEBUG - winDebug ("winFinishScreenInitFB - Calling shadowInit ()\n"); + winDebug ("winFinishScreenInitFB - Calling shadowSetup ()\n"); #endif - if (!shadowInit (pScreen, - pScreenPriv->pwinShadowUpdate, - NULL)) + if (!shadowSetup(pScreen)) { - ErrorF ("winFinishScreenInitFB - shadowInit () failed\n"); + ErrorF ("winFinishScreenInitFB - shadowSetup () failed\n"); return FALSE; } + + /* Wrap CreateScreenResources so we can add the screen pixmap + to the Shadow framebuffer after it's been created */ + pScreenPriv->pwinCreateScreenResources = pScreen->CreateScreenResources; + pScreen->CreateScreenResources = winCreateScreenResources; } #ifdef XWIN_MULTIWINDOWEXTWM diff --git a/xorg-server/hw/xwin/winshaddd.c b/xorg-server/hw/xwin/winshaddd.c index a2c1dc9b0..96acfcbc7 100644 --- a/xorg-server/hw/xwin/winshaddd.c +++ b/xorg-server/hw/xwin/winshaddd.c @@ -48,10 +48,12 @@ extern HWND g_hDlgExit; * FIXME: Headers are broken, DEFINE_GUID doesn't work correctly, * so we have to redefine it here. */ +#ifndef _MSC_VER #ifdef DEFINE_GUID #undef DEFINE_GUID #define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} #endif /* DEFINE_GUID */ +#endif /* @@ -361,7 +363,7 @@ winAllocateFBShadowDD (ScreenPtr pScreen) { ErrorF ("winAllocateFBShadowDD - Changing video mode\n"); - /* Change the video mode to the mode requested */ + /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */ ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2, pScreenInfo->dwWidth, pScreenInfo->dwHeight, @@ -373,7 +375,20 @@ winAllocateFBShadowDD (ScreenPtr pScreen) ErrorF ("winAllocateFBShadowDD - Could not set "\ "full screen display mode: %08x\n", (unsigned int) ddrval); - return FALSE; + ErrorF ("winAllocateFBShadowDD - Using default driver refresh rate\n"); + ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwBPP, + 0, + 0); + if (FAILED(ddrval)) + { + ErrorF ("winAllocateFBShadowDD - Could not set default refresh rate " + "full screen display mode: %08x\n", + (unsigned int) ddrval); + return FALSE; + } } } else @@ -508,7 +523,7 @@ winShadowUpdateDD (ScreenPtr pScreen, { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - RegionPtr damage = &pBuf->damage; + RegionPtr damage = shadowDamage(pBuf); HRESULT ddrval = DD_OK; RECT rcDest, rcSrc; POINT ptOrigin; @@ -534,7 +549,7 @@ winShadowUpdateDD (ScreenPtr pScreen, ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL); if (FAILED (ddrval)) { - ErrorF ("winShadowUpdateProcDD - Unlock failed\n"); + ErrorF ("winShadowUpdateDD - Unlock failed\n"); return; } @@ -626,19 +641,20 @@ winShadowUpdateDD (ScreenPtr pScreen, NULL); if (FAILED (ddrval)) { - ErrorF ("winShadowUpdateProcDD - Lock failed\n"); + ErrorF ("winShadowUpdateDD - Lock failed\n"); return; } /* Has our memory pointer changed? */ if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) { - ErrorF ("winShadowUpdateProcDD - Memory location of the shadow " + extern char *g_pszLogFile; + ErrorF ("winShadowUpdateDD - Memory location of the shadow " "surface has changed, trying to update the root window " "pixmap header to point to the new address. If you get " "this message and "PROJECT_NAME" freezes or crashes " "after this message then send a problem report and your " - "/tmp/XWin.log file to cygwin-xfree@cygwin.com\n"); + "%s file to " BUILDERADDR, g_pszLogFile); /* Location of shadow framebuffer has changed */ pScreenInfo->pfb = pScreenPriv->pddsdShadow->lpSurface; @@ -653,7 +669,7 @@ winShadowUpdateDD (ScreenPtr pScreen, pScreenInfo->dwBPP), pScreenInfo->pfb)) { - ErrorF ("winShadowUpdateProcDD - Bits changed, could not " + ErrorF ("winShadowUpdateDD - Bits changed, could not " "notify fb.\n"); return; } diff --git a/xorg-server/hw/xwin/winshadddnl.c b/xorg-server/hw/xwin/winshadddnl.c index 47cc382e9..e029154ed 100644 --- a/xorg-server/hw/xwin/winshadddnl.c +++ b/xorg-server/hw/xwin/winshadddnl.c @@ -48,10 +48,12 @@ extern HWND g_hDlgExit; * FIXME: Headers are broken, DEFINE_GUID doesn't work correctly, * so we have to redefine it here. */ +#ifndef _MSC_VER #ifdef DEFINE_GUID #undef DEFINE_GUID #define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} #endif /* DEFINE_GUID */ +#endif /* * FIXME: Headers are broken, IID_IDirectDraw4 has to be defined @@ -391,7 +393,7 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen) { winDebug ("winAllocateFBShadowDDNL - Changing video mode\n"); - /* Change the video mode to the mode requested */ + /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */ ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4, pScreenInfo->dwWidth, pScreenInfo->dwHeight, @@ -403,7 +405,20 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen) ErrorF ("winAllocateFBShadowDDNL - Could not set " "full screen display mode: %08x\n", (unsigned int) ddrval); - return FALSE; + ErrorF ("winAllocateFBShadowDDNL - Using default driver refresh rate\n"); + ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwBPP, + 0, + 0); + if (FAILED(ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL - Could not set default refresh rate " + "full screen display mode: %08x\n", + (unsigned int) ddrval); + return FALSE; + } } } else @@ -584,7 +599,7 @@ winShadowUpdateDDNL (ScreenPtr pScreen, { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - RegionPtr damage = &pBuf->damage; + RegionPtr damage = shadowDamage(pBuf); HRESULT ddrval = DD_OK; RECT rcDest, rcSrc; POINT ptOrigin; @@ -1310,7 +1325,7 @@ winStoreColorsShadowDDNL (ColormapPtr pColormap, + pdefs[0].pixel); if (FAILED (ddrval)) { - ErrorF ("winStoreColorsShadowDDNL - SetEntries () failed: %08x\n", ddrval); + ErrorF ("winStoreColorsShadowDDNL - SetEntries () failed: %08x\n", (int) ddrval); return FALSE; } diff --git a/xorg-server/hw/xwin/winshadgdi.c b/xorg-server/hw/xwin/winshadgdi.c index 04cc2f716..d38e4f76b 100644 --- a/xorg-server/hw/xwin/winshadgdi.c +++ b/xorg-server/hw/xwin/winshadgdi.c @@ -498,7 +498,7 @@ winShadowUpdateGDI (ScreenPtr pScreen, { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - RegionPtr damage = &pBuf->damage; + RegionPtr damage = shadowDamage(pBuf); DWORD dwBox = REGION_NUM_RECTS (damage); BoxPtr pBox = REGION_RECTS (damage); int x, y, w, h; diff --git a/xorg-server/hw/xwin/winwin32rootless.c b/xorg-server/hw/xwin/winwin32rootless.c index 6f4e2c97e..2c80c0885 100644 --- a/xorg-server/hw/xwin/winwin32rootless.c +++ b/xorg-server/hw/xwin/winwin32rootless.c @@ -38,7 +38,7 @@ #include "win.h" #include <winuser.h> #define _WINDOWSWM_SERVER_ -#include "windowswmstr.h" +#include <X11/extensions/windowswmstr.h> #include "dixevents.h" #include "winmultiwindowclass.h" #include "winprefs.h" @@ -48,9 +48,6 @@ /* * Constant defines */ - -#define MOUSE_POLLING_INTERVAL 500 - #define ULW_COLORKEY 0x00000001 #define ULW_ALPHA 0x00000002 #define ULW_OPAQUE 0x00000004 diff --git a/xorg-server/hw/xwin/winwin32rootlesswndproc.c b/xorg-server/hw/xwin/winwin32rootlesswndproc.c index 859aafd29..3d16ae5c9 100644 --- a/xorg-server/hw/xwin/winwin32rootlesswndproc.c +++ b/xorg-server/hw/xwin/winwin32rootlesswndproc.c @@ -35,7 +35,7 @@ #include "win.h" #include <winuser.h> #define _WINDOWSWM_SERVER_ -#include "windowswmstr.h" +#include <X11/extensions/windowswmstr.h> #include "dixevents.h" #include "propertyst.h" #include <X11/Xatom.h> @@ -48,7 +48,6 @@ * Constant defines */ -#define MOUSE_POLLING_INTERVAL 500 #define MOUSE_ACTIVATE_DEFAULT TRUE #define RAISE_ON_CLICK_DEFAULT FALSE @@ -567,9 +566,9 @@ winMWExtWMWindowProc (HWND hwnd, UINT message, } /* Deliver absolute cursor position to X Server */ - miPointerAbsoluteCursor (ptMouse.x - pScreenInfo->dwXOffset, - ptMouse.y - pScreenInfo->dwYOffset, - g_c32LastInputEventTime = GetTickCount ()); + winEnqueueMotion(ptMouse.x - pScreenInfo->dwXOffset, + ptMouse.y - pScreenInfo->dwYOffset); + return 0; case WM_NCMOUSEMOVE: diff --git a/xorg-server/hw/xwin/winwindow.c b/xorg-server/hw/xwin/winwindow.c index 1600996df..54afe9f7e 100644 --- a/xorg-server/hw/xwin/winwindow.c +++ b/xorg-server/hw/xwin/winwindow.c @@ -60,6 +60,7 @@ winReshapeRootless (WindowPtr pWin); Bool winCreateWindowNativeGDI (WindowPtr pWin) { + Bool fResult; ScreenPtr pScreen = pWin->drawable.pScreen; winWindowPriv(pWin); winScreenPriv(pScreen); @@ -352,7 +353,6 @@ winPositionWindowRootless (WindowPtr pWin, int x, int y) { Bool fResult = FALSE; ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); @@ -378,7 +378,6 @@ winChangeWindowAttributesRootless (WindowPtr pWin, unsigned long mask) { Bool fResult = FALSE; ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGDEBUG @@ -436,7 +435,6 @@ winMapWindowRootless (WindowPtr pWin) { Bool fResult = FALSE; ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGDEBUG @@ -462,7 +460,6 @@ void winSetShapeRootless (WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGDEBUG diff --git a/xorg-server/hw/xwin/winwindow.h b/xorg-server/hw/xwin/winwindow.h index 9c49d6482..71c5b015e 100644 --- a/xorg-server/hw/xwin/winwindow.h +++ b/xorg-server/hw/xwin/winwindow.h @@ -2,6 +2,7 @@ #define _WINWINDOW_H_ /* *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -28,6 +29,7 @@ *from the XFree86 Project. * * Authors: Kensuke Matsuzaki + * Colin Harrison */ #ifndef NO @@ -42,8 +44,8 @@ # define PROJECT_NAME "Cygwin/X" #endif #define WINDOW_CLASS "cygwin/x" -#define WINDOW_TITLE PROJECT_NAME " - %s:%d" -#define WINDOW_TITLE_XDMCP PROJECT_NAME " - %s" +#define WINDOW_TITLE PROJECT_NAME ":%s.%d" +#define WINDOW_TITLE_XDMCP "%s:%s.%d" #define WIN_SCR_PROP "cyg_screen_prop rl" #define WINDOW_CLASS_X "cygwin/x X rl" #define WINDOW_TITLE_X PROJECT_NAME " X" @@ -60,6 +62,8 @@ #define CYGWINDOWING_DEBUG NO #endif +#define XMING_SIGNATURE 0x12345678L + typedef struct _winPrivScreenRec *winPrivScreenPtr; @@ -111,9 +115,24 @@ typedef struct _winWMMessageRec{ #define WM_WM_NAME_EVENT (WM_USER + 9) #define WM_WM_HINTS_EVENT (WM_USER + 10) #define WM_WM_CHANGE_STATE (WM_USER + 11) +#define WM_WM_MAP2 (WM_USER + 12) #define WM_MANAGE (WM_USER + 100) #define WM_UNMANAGE (WM_USER + 102) +#define MwmHintsDecorations (1L << 1) + +#define MwmDecorAll (1l << 0) +#define MwmDecorBorder (1l << 1) +#define MwmDecorHandle (1l << 2) +#define MwmDecorTitle (1l << 3) + +/* This structure only contains 3 elements... the Motif 2.0 structure +contains 5... we only need the first 3... so that is all we will define */ +typedef struct MwmHints { + unsigned long flags, functions, decorations; +} MwmHints; +#define PropMwmHintsElements 3 + void winSendMessageToWM (void *pWMInfo, winWMMessagePtr msg); diff --git a/xorg-server/hw/xwin/winwindowswm.c b/xorg-server/hw/xwin/winwindowswm.c index e1994de84..6a0b81232 100644 --- a/xorg-server/hw/xwin/winwindowswm.c +++ b/xorg-server/hw/xwin/winwindowswm.c @@ -42,7 +42,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "servermd.h" #include "swaprep.h" #define _WINDOWSWM_SERVER_ -#include "windowswmstr.h" +#include <X11/extensions/windowswmstr.h> static int WMErrorBase; diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c index 29ea81fc1..c553634f9 100644 --- a/xorg-server/hw/xwin/winwndproc.c +++ b/xorg-server/hw/xwin/winwndproc.c @@ -762,11 +762,11 @@ winWindowProc (HWND hwnd, UINT message, g_fCursor = TRUE; ShowCursor (TRUE); } - + /* Deliver absolute cursor position to X Server */ - miPointerAbsoluteCursor (GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset, - GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset, - g_c32LastInputEventTime = GetTickCount ()); + winEnqueueMotion(GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset, + GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset); + return 0; case WM_NCMOUSEMOVE: @@ -927,10 +927,9 @@ winWindowProc (HWND hwnd, UINT message, /* Map from screen (-X, -Y) to root (0, 0) */ point.x -= GetSystemMetrics (SM_XVIRTUALSCREEN); point.y -= GetSystemMetrics (SM_YVIRTUALSCREEN); - + /* Deliver absolute cursor position to X Server */ - miPointerAbsoluteCursor (point.x, point.y, - g_c32LastInputEventTime = GetTickCount()); + winEnqueueMotion(point.x , point.y); /* Check if a button was released but we didn't see it */ GetCursorPos (&point); diff --git a/xorg-server/hw/xwin/xlaunch/config.h b/xorg-server/hw/xwin/xlaunch/config.h new file mode 100644 index 000000000..e2774e894 --- /dev/null +++ b/xorg-server/hw/xwin/xlaunch/config.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2005 Alexander Gottwald + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the sale, + * use or other dealings in this Software without prior written authorization. + * + * Authors: Alexander Gottwald, Colin Harrison + */ +#ifndef __CONFIG_H__ +#define __CONFIG_H__ +#define UNICODE +#define _UNICODE + +#define PROG_NUMBER 10 +#define HOST_NUMBER 10 +#define MAX_MESSAGE 256 +#define MAX_CAPTION 128 + +#include <windows.h> +#include <string> +#include <vector> +struct CConfig +{ + enum {MultiWindow, Fullscreen, Windowed, Nodecoration} window; + enum {NoClient, StartProgram, XDMCP} client; + enum {NoXClient, Local, PuTTY, OpenSSH} clientstart; + std::string display; + std::string protocol_path; + std::string program; + std::vector<std::string> progs; + bool compress; + bool local; + std::string protocol; + std::string host; + std::string user; + std::string password; + bool password_save; + bool password_start; + bool broadcast; + bool indirect; + std::string xdmcp_host; + std::vector<std::string> xhosts; + bool clipboard; + bool no_access_control; + std::string font_server; + std::string extra_params; + std::string extra_ssh; + CConfig() : window(MultiWindow), client(NoClient), clientstart(NoXClient), display(""), + protocol_path(""), program("xeyes"), progs(PROG_NUMBER), compress(false), host(""), user(""), + password(""), password_save(false), password_start(false), broadcast(false), + indirect(false), xdmcp_host(""), xhosts(HOST_NUMBER), clipboard(true), no_access_control(false), + font_server(), extra_params(), extra_ssh() {}; + void Load(const char * filename); + void Save(const char * filename); +}; + +#endif diff --git a/xorg-server/hw/xwin/xlaunch/main.cc b/xorg-server/hw/xwin/xlaunch/main.cc index 2247d3aaf..e4be475ee 100644 --- a/xorg-server/hw/xwin/xlaunch/main.cc +++ b/xorg-server/hw/xwin/xlaunch/main.cc @@ -34,6 +34,10 @@ #include <X11/Xlib.h> +#ifdef _MSC_VER +#define snprintf _snprintf +#endif + /// @brief Send WM_ENDSESSION to all program windows. /// This will shutdown the started xserver BOOL CALLBACK KillWindowsProc(HWND hwnd, LPARAM lParam) @@ -489,7 +493,7 @@ class CMyWizard : public CWizard return NULL; } - /// @brief Do the actual start of Xming and clients + /// @brief Do the actual start of VCXsrv and clients void StartUp() { std::string buffer; @@ -500,12 +504,12 @@ class CMyWizard : public CWizard std::string display = "localhost" + display_id + ":0"; #ifdef _DEBUG - // Debug only: Switch to Xming installation directory - SetCurrentDirectory("C:\\Programme\\Xming"); + // Debug only: Switch to VCXsrv installation directory + SetCurrentDirectory("C:\\Programme\\vcxsrv"); #endif - // Build Xming commandline - buffer = "Xming " + display_id + " "; + // Build Xsrv commandline + buffer = "vcxsrv " + display_id + " "; switch (config.window) { case CConfig::MultiWindow: @@ -577,7 +581,7 @@ class CMyWizard : public CWizard sic.cb = sizeof(sic); ZeroMemory( &pic, sizeof(pic) ); - // Start Xming process. + // Start VCXsrv process. #ifdef _DEBUG printf("%s\n", buffer.c_str()); #endif @@ -627,7 +631,7 @@ class CMyWizard : public CWizard #ifdef _DEBUG printf("killing process!\n"); #endif - // Check if Xming is still running + // Check if Xsrv is still running DWORD exitcode; GetExitCodeProcess(pi.hProcess, &exitcode); unsigned counter = 0; @@ -636,7 +640,7 @@ class CMyWizard : public CWizard if (++counter > 10) TerminateProcess(pi.hProcess, (DWORD)-1); else - // Shutdown Xming (the soft way!) + // Shutdown Xsrv (the soft way!) EnumThreadWindows(pi.dwThreadId, KillWindowsProc, 0); Sleep(500); GetExitCodeProcess(pi.hProcess, &exitcode); diff --git a/xorg-server/hw/xwin/xlaunch/makefile b/xorg-server/hw/xwin/xlaunch/makefile new file mode 100644 index 000000000..345357d92 --- /dev/null +++ b/xorg-server/hw/xwin/xlaunch/makefile @@ -0,0 +1,32 @@ +INCLUDELIBFILES = window\$(OBJDIR)\window.lib \
+ $(MHMAKECONF)\libx11\src\$(OBJDIR)\libx11.lib \
+ $(MHMAKECONF)\libxcb\src\$(OBJDIR)\libxcb.lib \
+ $(MHMAKECONF)\libxau\$(OBJDIR)\libxau.lib \
+ $(MHMAKECONF)\libx11\src\xlibi18n\$(OBJDIR)\libi18n.lib \
+ $(MHMAKECONF)\libx11\modules\lc\xlocale\$(OBJDIR)\libxlocale.lib \
+ $(MHMAKECONF)\libx11\modules\lc\utf8\$(OBJDIR)\libxlcUTF8Load.lib \
+ $(MHMAKECONF)\libx11\modules\lc\gen\$(OBJDIR)\liblcGenConvLoad.lib \
+ $(MHMAKECONF)\libx11\modules\lc\def\$(OBJDIR)\libxlcDef.lib \
+ $(MHMAKECONF)\libx11\src\xkb\$(OBJDIR)\libxkb.lib \
+ $(MHMAKECONF)\libx11\modules\im\ximcp\$(OBJDIR)\libximcp.lib \
+ $(MHMAKECONF)\libx11\modules\om\generic\$(OBJDIR)\libxomGeneric.lib
+
+CSRCS=config.cc main.cc
+
+WINAPP = xlaunch
+
+RESOURCES = resources.rc
+
+$(OBJDIR)\%.res : resources\%.rc
+ $(RC) $(RCFLAGS) $(RCDEFINES:%=-d "%") $(RCINCLUDES:%=-i "%") -Fo"$(relpath $@)" "$<"
+
+LIBDIRS=$(dir $(INCLUDELIBFILES))
+
+load_makefile $(LIBDIRS:%$(OBJDIR)\=%makefile MAKESERVER=$(MAKESERVER) DEBUG=$(DEBUG);)
+
+ifeq ($(DEBUG),1)
+LINKLIBS += $(MHMAKECONF)\pthreads\pthreadVC2d.lib
+else
+LINKLIBS += $(MHMAKECONF)\pthreads\pthreadVC2.lib
+endif
+
diff --git a/xorg-server/hw/xwin/xlaunch/window/makefile b/xorg-server/hw/xwin/xlaunch/window/makefile new file mode 100644 index 000000000..18a33e728 --- /dev/null +++ b/xorg-server/hw/xwin/xlaunch/window/makefile @@ -0,0 +1,4 @@ +CSRCS=dialog.cc util.cc window.cc wizard.cc
+
+LIBRARY = window
+
diff --git a/xorg-server/hw/xwin/xlaunch/window/util.h b/xorg-server/hw/xwin/xlaunch/window/util.h index cd21da657..2e8dab263 100644 --- a/xorg-server/hw/xwin/xlaunch/window/util.h +++ b/xorg-server/hw/xwin/xlaunch/window/util.h @@ -28,7 +28,7 @@ #include <windows.h> #include <stdexcept> - +#include <string> class win32_error : public std::runtime_error { diff --git a/xorg-server/hw/xwin/xlaunch/window/wizard.h b/xorg-server/hw/xwin/xlaunch/window/wizard.h index a2361c51c..c576cc093 100644 --- a/xorg-server/hw/xwin/xlaunch/window/wizard.h +++ b/xorg-server/hw/xwin/xlaunch/window/wizard.h @@ -29,7 +29,6 @@ #include "dialog.h"
#include <vector>
-#define _WIN32_IE 0x0500
#include <prsht.h>
class CWizard : public CBaseDialog
|