redone ddraw.h to be able to mix it with w32api style COM header files.

obj_base.h is not needed anymore. Using <objbase.h> instead.
Use Xwindows.h instead of windows.h
do not include win_ms.h
remove extra definition of sleep()
Set HOME to Documents and Settings/username if not set
Use Xming basedir instead of ProjectRoot for system.XWinrc
Fix callback functions to use wBOOL instead of BOOL
Fix compiler warnings. Added debug output.
Fix warning about undefined macro max
This commit is contained in:
Alexander Gottwald 2004-12-05 21:24:48 +00:00
parent bf0a760331
commit 9bd1328c49
14 changed files with 932 additions and 834 deletions

View File

@ -1,3 +1,43 @@
2004-12-05 Alexander Gottwald <ago at freedesktop dot org>
* ddraw.h:
redone ddraw.h to be able to mix it with w32api style COM header
files.
* winmultiwindowwm.c:
* obj_base.h:
* ddraw.h:
obj_base.h is not needed anymore. Using <objbase.h> instead.
* winms.h:
Use Xwindows.h instead of windows.h
* winresource.h:
do not include win_ms.h
* win.h:
remove extra definition of sleep()
* InitOutput.c:
Set HOME to Documents and Settings/username if not set
* winprefs.c:
Use Xming basedir instead of ProjectRoot for system.XWinrc
* windialogs.c:
* winshadgdi.c:
* winprefs.c:
Fix callback functions to use wBOOL instead of BOOL
* winmultiwindowwindow.c:
* winwin32rootless.c:
* winwin32rootlesswindow.c:
* winerror.c:
Fix compiler warnings. Added debug output.
* winconfig.c:
Fix warning about undefined macro max
2004-12-03 Alexander Gottwald <ago at freedesktop dot org>
* windialogs.c:
@ -314,4 +354,4 @@
to prevent our window appearing twice in the clipboard chain. Also
detect loops when they occur and try to behave in a reasonable way.
# vim:ts=8:noexpandtab
# vim:ts=8:noexpandtab:encoding=utf8

View File

@ -41,6 +41,9 @@ from The Open Group.
#if defined(XKB) && defined(WIN32)
#include "XKBsrv.h"
#endif
#ifdef RELOCATE_PROJECTROOT
#include <shlobj.h>
#endif
/*
@ -622,6 +625,14 @@ winFixupPaths (void)
buffer[sizeof(buffer)-1] = 0;
putenv(buffer);
}
if (getenv("HOME") == NULL)
{
char buffer[MAX_PATH + 5];
strncpy(buffer, "HOME=", 5);
if(SHGetFolderPath(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, 0,
buffer + 5) == 0)
putenv(buffer);
}
if (!g_fLogFileChanged) {
static char buffer[MAX_PATH];
DWORD size = GetTempPath(sizeof(buffer), buffer);

File diff suppressed because it is too large Load Diff

View File

@ -140,10 +140,6 @@
#include <sys/stat.h>
#include <stdio.h>
#ifndef __CYGWIN__
#define sleep(x) Sleep(1000 * (x))
#endif
#include <errno.h>
#if defined(XWIN_MULTIWINDOWEXTWM) || defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
#include <pthread.h>

View File

@ -56,15 +56,15 @@ extern Bool g_fSoftwareCursor;
* Local function prototypes
*/
static BOOL CALLBACK
static wBOOL CALLBACK
winExitDlgProc (HWND hDialog, UINT message,
WPARAM wParam, LPARAM lParam);
static BOOL CALLBACK
static wBOOL CALLBACK
winChangeDepthDlgProc (HWND hDialog, UINT message,
WPARAM wParam, LPARAM lParam);
static BOOL CALLBACK
static wBOOL CALLBACK
winAboutDlgProc (HWND hDialog, UINT message,
WPARAM wParam, LPARAM lParam);
@ -295,7 +295,7 @@ winDisplayExitDialog (winPrivScreenPtr pScreenPriv)
* Exit dialog window procedure
*/
static BOOL CALLBACK
static wBOOL CALLBACK
winExitDlgProc (HWND hDialog, UINT message,
WPARAM wParam, LPARAM lParam)
{
@ -439,7 +439,7 @@ winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv)
* disruptive screen depth changes.
*/
static BOOL CALLBACK
static wBOOL CALLBACK
winChangeDepthDlgProc (HWND hwndDialog, UINT message,
WPARAM wParam, LPARAM lParam)
{
@ -594,7 +594,7 @@ winDisplayAboutDialog (winPrivScreenPtr pScreenPriv)
* Process messages for the about dialog.
*/
static BOOL CALLBACK
static wBOOL CALLBACK
winAboutDlgProc (HWND hwndDialog, UINT message,
WPARAM wParam, LPARAM lParam)
{

View File

@ -93,7 +93,6 @@ OsVendorFatalError (void)
void
winMessageBoxF (const char *pszError, UINT uType, ...)
{
int i;
char * pszErrorF = NULL;
char * pszMsgBox = NULL;
va_list args;

View File

@ -30,33 +30,17 @@
* Authors: Harold L Hunt II
*/
#undef MINSHORT
#undef MAXSHORT
#undef CARD8
#undef INT32
#undef ATOM
#define NONAMELESSUNION
#define DIRECTDRAW_VERSION 0x0300
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef XFree86Server
#define XFree86Server
#endif
#include <windows.h>
#include <Xwindows.h>
#include <windowsx.h>
#include "obj_base.h"
#include "ddraw.h"
/*
* Undefine unneeded Windows symbols that conflict
* with X symbols
*/
#undef CreateWindow
#undef FreeResource
#endif /* _WINMS_H_ */

View File

@ -91,7 +91,7 @@ winCreateWindowMultiWindow (WindowPtr pWin)
winWindowPriv(pWin);
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winCreateWindowMultiWindow - pWin: %08x\n", pWin);
ErrorF ("winCreateWindowMultiWindow - pWin: %p\n", pWin);
#endif
/* Call any wrapped CreateWindow function */
@ -119,7 +119,7 @@ winDestroyWindowMultiWindow (WindowPtr pWin)
winWindowPriv(pWin);
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winDestroyWindowMultiWindow - pWin: %08x\n", pWin);
ErrorF ("winDestroyWindowMultiWindow - pWin: %p\n", pWin);
#endif
/* Call any wrapped DestroyWindow function */
@ -161,7 +161,7 @@ winPositionWindowMultiWindow (WindowPtr pWin, int x, int y)
DWORD dwStyle;
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winPositionWindowMultiWindow - pWin: %08x\n", pWin);
ErrorF ("winPositionWindowMultiWindow - pWin: %p\n", pWin);
#endif
/* Call any wrapped PositionWindow function */
@ -952,12 +952,28 @@ winAdjustXWindow (WindowPtr pWin, HWND hwnd)
x = pDraw->x + GetSystemMetrics (SM_XVIRTUALSCREEN);
y = pDraw->y + GetSystemMetrics (SM_YVIRTUALSCREEN);
SetRect (&rcDraw, x, y, x + pDraw->width, y + pDraw->height);
#ifdef CYGMULTIWINDOW_DEBUG
winDebug("\tDrawable extend {%d, %d, %d, %d}, {%d, %d}\n",
rcDraw.left, rcDraw.top, rcDraw.right, rcDraw.bottom,
rcDraw.right - rcDraw.left, rcDraw.bottom - rcDraw.top);
#endif
dwExStyle = GetWindowLongPtr (hwnd, GWL_EXSTYLE);
dwStyle = GetWindowLongPtr (hwnd, GWL_STYLE);
#ifdef CYGMULTIWINDOW_DEBUG
winDebug("\tWindowStyle: %08x %08x\n", dwStyle, dwExStyle);
#endif
AdjustWindowRectEx (&rcDraw, dwStyle, FALSE, dwExStyle);
/* The source of adjust */
GetWindowRect (hwnd, &rcWin);
#ifdef CYGMULTIWINDOW_DEBUG
winDebug("\tWindow extend {%d, %d, %d, %d}, {%d, %d}\n",
rcWin.left, rcWin.top, rcWin.right, rcWin.bottom,
rcWin.right - rcWin.left, rcWin.bottom - rcWin.top);
winDebug("\tDraw extend {%d, %d, %d, %d}, {%d, %d}\n",
rcDraw.left, rcDraw.top, rcDraw.right, rcDraw.bottom,
rcDraw.right - rcDraw.left, rcDraw.bottom - rcDraw.top);
#endif
if (EqualRect (&rcDraw, &rcWin)) {
/* Bail if no adjust is needed */

View File

@ -58,7 +58,7 @@
#endif
/* Local headers */
#include "obj_base.h"
#include "objbase.h"
#include "ddraw.h"
#include "winwindow.h"
#include "windowswmstr.h"

View File

@ -36,9 +36,7 @@
#endif
#include "win.h"
/* Fixups to prevent collisions between Windows and X headers */
#define ATOM DWORD
#include <windows.h>
#include <Xwindows.h>
#include <shellapi.h>
#include "winprefs.h"
@ -52,6 +50,8 @@
extern DWORD g_dwCurrentThreadID;
#endif
extern const char *winGetBaseDir(void);
/* From winmultiwindowflex.l, the real parser */
extern void parse_file (FILE *fp);
@ -171,7 +171,7 @@ MakeMenu (char *name,
* Callback routine that is executed once per window class.
* Removes or creates custom window settings depending on LPARAM
*/
static BOOL CALLBACK
static wBOOL CALLBACK
ReloadEnumWindowsProc (HWND hwnd, LPARAM lParam)
{
HICON hicon;
@ -734,10 +734,16 @@ LoadPreferences ()
/* No home file found, check system default */
if (!prefFile)
{
prefFile = fopen (PROJECTROOT"/lib/X11/system.XWinrc", "r");
char buffer[MAX_PATH];
#ifdef RELOCATE_PROJECTROOT
snprintf(buffer, sizeof(buffer), "%s\\system.XWinrc", winGetBaseDir());
#else
strncpy(buffer, PROJECTROOT"/lib/X11/system.XWinrc", sizeof(buffer));
#endif
buffer[sizeof(buffer)-1] = 0;
prefFile = fopen (buffer, "r");
if (prefFile)
ErrorF ("winPrefsLoadPreferences: %s\n",
PROJECTROOT"/lib/X11/system.XWinrc");
ErrorF ("winPrefsLoadPreferences: %s\n", buffer);
}
/* If we could open it, then read the settings and close it */

View File

@ -30,8 +30,6 @@
* Authors: Harold L Hunt II
*/
#include "winms.h"
/*
* Local defines

View File

@ -46,10 +46,10 @@ extern HWND g_hDlgExit;
*/
#ifdef XWIN_MULTIWINDOW
static BOOL CALLBACK
static wBOOL CALLBACK
winRedrawAllProcShadowGDI (HWND hwnd, LPARAM lParam);
static BOOL CALLBACK
static wBOOL CALLBACK
winRedrawDamagedWindowShadowGDI (HWND hwnd, LPARAM lParam);
#endif
@ -293,7 +293,7 @@ winQueryRGBBitsAndMasks (ScreenPtr pScreen)
* Redraw all ---?
*/
static BOOL CALLBACK
static wBOOL CALLBACK
winRedrawAllProcShadowGDI (HWND hwnd, LPARAM lParam)
{
if (hwnd == (HWND)lParam)
@ -303,7 +303,7 @@ winRedrawAllProcShadowGDI (HWND hwnd, LPARAM lParam)
return TRUE;
}
static BOOL CALLBACK
static wBOOL CALLBACK
winRedrawDamagedWindowShadowGDI (HWND hwnd, LPARAM lParam)
{
BoxPtr pDamage = (BoxPtr)lParam;

View File

@ -53,7 +53,6 @@
#define ULW_OPAQUE 0x00000004
#define AC_SRC_ALPHA 0x01
/*
* Local function
*/
@ -455,16 +454,29 @@ winMWExtWMMoveFrame (RootlessFrameID wid, ScreenPtr pScreen, int iNewX, int iNew
/* Store the origin, height, and width in a rectangle structure */
SetRect (&rcNew, iX, iY, iX + iWidth, iY + iHeight);
#ifdef CYGMULTIWINDOW_DEBUG
winDebug("\tWindow {%d, %d, %d, %d}, {%d, %d}\n",
rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
#endif
/*
* Calculate the required size of the Windows window rectangle,
* given the size of the Windows window client area.
*/
AdjustWindowRectEx (&rcNew, dwStyle, FALSE, dwExStyle);
#ifdef CYGMULTIWINDOW_DEBUG
winDebug("\tAdjusted {%d, %d, %d, %d}, {%d, %d}\n",
rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
#endif
g_fNoConfigureWindow = TRUE;
SetWindowPos (pRLWinPriv->hWnd, NULL, rcNew.left, rcNew.top, 0, 0,
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
g_fNoConfigureWindow = FALSE;
#if CYGMULTIWINDOW_DEBUG
winDebug ("winMWExtWMMoveFrame (%08x) done\n", (int) pRLWinPriv);
#endif
}
void
@ -646,7 +658,7 @@ winMWExtWMReshapeFrame (RootlessFrameID wid, RegionPtr pShape)
#endif
hRgn = winMWExtWMCreateRgnFromRegion (pShape);
/* Create region for non-client area */
GetWindowRect (pRLWinPriv->hWnd, &rcWindow);
GetClientRect (pRLWinPriv->hWnd, &rcClient);
@ -708,7 +720,7 @@ winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow)
winDebug ("\tpScreenPriv %08X\n", (int) pScreenPriv);
winDebug ("\tpScreenInfo %08X\n", (int) pScreenInfo);
winDebug ("\t(%d, %d)\n", (int)pRLWinPriv->pFrame->width,
(int) -pRLWinPriv->pFrame->height);
(int) pRLWinPriv->pFrame->height);
#endif
if (pRLWinPriv->hdcScreen == NULL)
{
@ -796,10 +808,11 @@ winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow)
if (dibsection.dsBmih.biHeight < 0)
{
/* FIXME: Figure out why biHeight is sometimes negative */
ErrorF ("winMWExtWMStartDrawing - WEIRDNESS - biHeight "
"still negative: %d\n"
"winAllocateFBShadowGDI - WEIRDNESS - Flipping biHeight sign\n",
(int) dibsection.dsBmih.biHeight);
ErrorF ("winMWExtWMStartDrawing - WEIRDNESS - "
"biHeight still negative: %d\n",
(int) dibsection.dsBmih.biHeight);
ErrorF ("winMWExtWMStartDrawing - WEIRDNESS - "
"Flipping biHeight sign\n");
dibsection.dsBmih.biHeight = -dibsection.dsBmih.biHeight;
}
@ -829,8 +842,8 @@ winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow)
{
ErrorF ("winMWExtWMStartDrawing - Already window was destroyed \n");
}
#if CYGMULTIWINDOW_DEBUG && FALSE
winDebug ("winMWExtWMStartDrawing - done (0x08%x) 0x%08x %d\n",
#if CYGMULTIWINDOW_DEBUG
winDebug ("winMWExtWMStartDrawing - done (0x%08x) 0x%08x %d\n",
(int) pRLWinPriv,
(unsigned int)pRLWinPriv->pfb, (unsigned int)pRLWinPriv->dwWidthBytes);
#endif

View File

@ -106,10 +106,10 @@ winMWExtWMReorderWindows (ScreenPtr pScreen)
void
winMWExtWMMoveXWindow (WindowPtr pWin, int x, int y)
{
XID *vlist = malloc(sizeof(long)*2);
CARD32 *vlist = malloc(sizeof(CARD32)*2);
(CARD32*)vlist[0] = x;
(CARD32*)vlist[1] = y;
vlist[0] = x;
vlist[1] = y;
ConfigureWindow (pWin, CWX | CWY, vlist, wClient(pWin));
free(vlist);
}
@ -122,10 +122,10 @@ winMWExtWMMoveXWindow (WindowPtr pWin, int x, int y)
void
winMWExtWMResizeXWindow (WindowPtr pWin, int w, int h)
{
XID *vlist = malloc(sizeof(long)*2);
CARD32 *vlist = malloc(sizeof(CARD32)*2);
(CARD32*)vlist[0] = w;
(CARD32*)vlist[1] = h;
vlist[0] = w;
vlist[1] = h;
ConfigureWindow (pWin, CWWidth | CWHeight, vlist, wClient(pWin));
free(vlist);
}
@ -138,12 +138,12 @@ winMWExtWMResizeXWindow (WindowPtr pWin, int w, int h)
void
winMWExtWMMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h)
{
XID *vlist = malloc(sizeof(long)*4);
CARD32 *vlist = malloc(sizeof(long)*4);
(CARD32*)vlist[0] = x;
(CARD32*)vlist[1] = y;
(CARD32*)vlist[2] = w;
(CARD32*)vlist[3] = h;
vlist[0] = x;
vlist[1] = y;
vlist[2] = w;
vlist[3] = h;
ConfigureWindow (pWin, CWX | CWY | CWWidth | CWHeight, vlist, wClient(pWin));
free(vlist);
@ -272,12 +272,22 @@ winMWExtWMUpdateWindowDecoration (win32RootlessWindowPtr pRLWinPriv,
pRLWinPriv->pFrame->x + pRLWinPriv->pFrame->width,
pRLWinPriv->pFrame->y + pRLWinPriv->pFrame->height);
#ifdef CYGMULTIWINDOW_DEBUG
winDebug("\tWindow extend {%d, %d, %d, %d}, {%d, %d}\n",
rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
#endif
/* */
AdjustWindowRectEx (&rcNew,
WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW,
FALSE,
WS_EX_APPWINDOW);
#ifdef CYGMULTIWINDOW_DEBUG
winDebug("\tAdjusted {%d, %d, %d, %d}, {%d, %d}\n",
rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
#endif
/* Calculate position deltas */
iDx = pRLWinPriv->pFrame->x - rcNew.left;
iDy = pRLWinPriv->pFrame->y - rcNew.top;
@ -295,11 +305,22 @@ winMWExtWMUpdateWindowDecoration (win32RootlessWindowPtr pRLWinPriv,
SetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE,
WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW);
#ifdef CYGMULTIWINDOW_DEBUG
winDebug("\tWindowStyle: %08x %08x\n",
WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW,
WS_EX_APPWINDOW);
#endif
/* Position the Windows window */
#ifdef CYGMULTIWINDOW_DEBUG
winDebug("\tMoved {%d, %d, %d, %d}, {%d, %d}\n",
rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
#endif
SetWindowPos (pRLWinPriv->hWnd, NULL,
rcNew.left, rcNew.top,
rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
showCmd);
wmMsg.hwndWindow = pRLWinPriv->hWnd;
wmMsg.iWindow = (Window)pRLWinPriv->pFrame->win->drawable.id;