aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/dix')
-rw-r--r--xorg-server/dix/Xserver-dtrace.h75
-rw-r--r--xorg-server/dix/colormap.c4
-rw-r--r--xorg-server/dix/devices.c4
-rw-r--r--xorg-server/dix/dispatch.c51
-rw-r--r--xorg-server/dix/dixfonts.c8
-rw-r--r--xorg-server/dix/events.c10
-rw-r--r--xorg-server/dix/getevents.c10
-rw-r--r--xorg-server/dix/main.c46
-rw-r--r--xorg-server/dix/makefile40
-rw-r--r--xorg-server/dix/ptrveloc.c9
-rw-r--r--xorg-server/dix/registry.c1
-rw-r--r--xorg-server/dix/resource.c61
12 files changed, 278 insertions, 41 deletions
diff --git a/xorg-server/dix/Xserver-dtrace.h b/xorg-server/dix/Xserver-dtrace.h
new file mode 100644
index 000000000..0ced498af
--- /dev/null
+++ b/xorg-server/dix/Xserver-dtrace.h
@@ -0,0 +1,75 @@
+/* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+
+/*
+ * Generated by dtrace(1M), and then modified for backwards compatibility
+ * with older versions of dtrace. Used if dtrace -h fails.
+ * (Since _ENABLED support was added after dtrace -h, this assumes if
+ * dtrace -h fails, _ENABLED will too.)
+ */
+
+#ifndef _XSERVER_DTRACE_H
+#define _XSERVER_DTRACE_H
+
+#include <unistd.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define XSERVER_CLIENT_AUTH(arg0, arg1, arg2, arg3) \
+ winDebug4("XSERVER_CLIENT_AUTH: %d %s %d %d\n",arg0, arg1, arg2, arg3)
+#define XSERVER_CLIENT_CONNECT(arg0, arg1) \
+ winDebug4("XSERVER_CLIENT_CONNECT: %d %d\n",arg0, arg1)
+#define XSERVER_CLIENT_DISCONNECT(arg0) \
+ winDebug4("XSERVER_CLIENT_DISCONNECT: %d %d\n",arg0)
+#define XSERVER_REQUEST_DONE(arg0, arg1, arg2, arg3, arg4) \
+ winDebug4("XSERVER_REQUEST_DONE: %s %d %d %d %d\n",arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_REQUEST_START(arg0, arg1, arg2, arg3, arg4) \
+ winDebug4("XSERVER_REQUEST_START: %s %d %d %d ->%p\n",arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_RESOURCE_ALLOC(arg0, arg1, arg2, arg3) \
+ winDebug4("XSERVER_RESOURCE_ALLOC: 0x%x 0x%x ->%p %s\n",arg0, arg1, arg2, arg3)
+#define XSERVER_RESOURCE_FREE(arg0, arg1, arg2, arg3) \
+ winDebug4("XSERVER_RESOURCE_FREE: 0x%x 0x%x ->%p %s\n",arg0, arg1, arg2, arg3)
+#define XSERVER_SEND_EVENT(arg0, arg1, arg2) \
+ winDebug4("XSERVER_SEND_EVENT: 0x%x 0x%x ->%p\n",arg0, arg1, arg2)
+
+#define XSERVER_CLIENT_AUTH_ENABLED() (1)
+#define XSERVER_CLIENT_CONNECT_ENABLED() (1)
+#define XSERVER_CLIENT_DISCONNECT_ENABLED() (1)
+#define XSERVER_REQUEST_DONE_ENABLED() (1)
+#define XSERVER_REQUEST_START_ENABLED() (1)
+#define XSERVER_RESOURCE_ALLOC_ENABLED() (1)
+#define XSERVER_RESOURCE_FREE_ENABLED() (1)
+#define XSERVER_SEND_EVENT_ENABLED() (1)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _XSERVER_DTRACE_H */
diff --git a/xorg-server/dix/colormap.c b/xorg-server/dix/colormap.c
index 12197acde..e22c35cb8 100644
--- a/xorg-server/dix/colormap.c
+++ b/xorg-server/dix/colormap.c
@@ -66,6 +66,10 @@ SOFTWARE.
#include "privates.h"
#include "xace.h"
+#ifdef _MSC_VER
+#define UpdateColors thisUpdateColors
+#endif
+
static Pixel FindBestPixel(
EntryPtr /*pentFirst*/,
int /*size*/,
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c
index f419a98fd..e65e5598e 100644
--- a/xorg-server/dix/devices.c
+++ b/xorg-server/dix/devices.c
@@ -920,6 +920,10 @@ CloseDownDevices(void)
{
if (!IsMaster(dev) && dev->u.master)
dev->u.master = NULL;
+ /* Initialise the sprite and paired members of all devices
+ to avoid crashes in CloseDevice later */
+ dev->spriteInfo->sprite=NULL;
+ dev->spriteInfo->paired=NULL;
}
CloseDeviceList(&inputInfo.devices);
diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c
index 181fafa77..b0b6f5b51 100644
--- a/xorg-server/dix/dispatch.c
+++ b/xorg-server/dix/dispatch.c
@@ -104,6 +104,10 @@ Equipment Corporation.
#include <version-config.h>
#endif
+#ifdef CreateWindow
+#undef CreateWindow
+#endif
+
#ifdef PANORAMIX_DEBUG
#include <stdio.h>
int ProcInitialConnection();
@@ -396,6 +400,9 @@ Dispatch(void)
start_tick = SmartScheduleTime;
while (!isItTimeToYield)
{
+#ifdef XSERVER_DTRACE
+ CARD8 StartMajorOp;
+#endif
if (*icheck[0] != *icheck[1])
ProcessInputEvents();
@@ -420,7 +427,8 @@ Dispatch(void)
client->sequence++;
#ifdef XSERVER_DTRACE
- XSERVER_REQUEST_START(LookupMajorName(MAJOROP), MAJOROP,
+ StartMajorOp=MAJOROP;
+ XSERVER_REQUEST_START(LookupMajorName(StartMajorOp), StartMajorOp,
((xReq *)client->requestBuffer)->length,
client->index, client->requestBuffer);
#endif
@@ -433,8 +441,28 @@ Dispatch(void)
XaceHookAuditEnd(client, result);
}
#ifdef XSERVER_DTRACE
- XSERVER_REQUEST_DONE(LookupMajorName(MAJOROP), MAJOROP,
- client->sequence, client->index, result);
+ if (result!=Success)
+ {
+ char Message[255];
+ sprintf(Message,"ERROR: %s (0x%x)",LookupMajorName(StartMajorOp),client->errorValue);
+ XSERVER_REQUEST_DONE(Message, MAJOROP,
+ client->sequence, client->index, result);
+ }
+ else
+ {
+ if (StartMajorOp!=MAJOROP)
+ {
+ char Message[255];
+ sprintf(Message,"Changed request: %s -> %s",LookupMajorName(StartMajorOp),LookupMajorName(MAJOROP));
+ XSERVER_REQUEST_DONE(Message, MAJOROP,
+ client->sequence, client->index, result);
+ }
+ else
+ {
+ XSERVER_REQUEST_DONE(LookupMajorName(MAJOROP), MAJOROP,
+ client->sequence, client->index, result);
+ }
+ }
#endif
if (client->noClientException != Success)
@@ -956,6 +984,13 @@ ProcGetGeometry(ClientPtr client)
return Success;
}
+#ifdef WIN32
+/* Do not return the clipboard window in ProcQueryTree, cause this may cause
+ the clipboard client being closed when connecting through xdmcp.
+*/
+extern int g_iClipboardWindow;
+
+#endif
int
ProcQueryTree(ClientPtr client)
@@ -980,7 +1015,10 @@ ProcQueryTree(ClientPtr client)
reply.parent = (Window)None;
pHead = RealChildHead(pWin);
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
- numChildren++;
+#ifdef WIN32
+ if (pChild->drawable.id!=g_iClipboardWindow)
+#endif
+ numChildren++;
if (numChildren)
{
int curChild = 0;
@@ -989,7 +1027,10 @@ ProcQueryTree(ClientPtr client)
if (!childIDs)
return BadAlloc;
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
- childIDs[curChild++] = pChild->drawable.id;
+#ifdef WIN32
+ if (pChild->drawable.id!=g_iClipboardWindow)
+#endif
+ childIDs[curChild++] = pChild->drawable.id;
}
reply.nChildren = numChildren;
diff --git a/xorg-server/dix/dixfonts.c b/xorg-server/dix/dixfonts.c
index 239431e2a..467be355f 100644
--- a/xorg-server/dix/dixfonts.c
+++ b/xorg-server/dix/dixfonts.c
@@ -130,6 +130,7 @@ SetDefaultFont(char *defaultfontname)
int err;
FontPtr pf;
XID fid;
+ static FontPtr last_pf;
fid = FakeClientID(0);
err = OpenFont(serverClient, fid, FontLoadAll | FontOpenSync,
@@ -138,9 +139,10 @@ SetDefaultFont(char *defaultfontname)
return FALSE;
err = dixLookupResourceByType((pointer *)&pf, fid, RT_FONT, serverClient,
DixReadAccess);
- if (err != Success)
+ if (err == Success) last_pf = pf;
+ if (last_pf == (FontPtr) NULL)
return FALSE;
- defaultFont = pf;
+ defaultFont = last_pf;
return TRUE;
}
@@ -1166,7 +1168,7 @@ badAlloc:
#define TextEltHeader 2
#define FontShiftSize 5
-static ChangeGCVal clearGC[] = { { .ptr = NullPixmap } };
+static ChangeGCVal clearGC[] = { NullPixmap };
#define clearGCmask (GCClipMask)
int
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index d68eeee62..d156cf3ed 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -747,7 +747,10 @@ CheckPhysLimits(
{
#ifdef PANORAMIX
if (!noPanoramiXExtension)
- XineramaSetCursorPosition (pDev, new.x, new.y, generateEvents);
+ {
+ if (pScreen && ((new.x != pSprite->hotPhys.x) || (new.y != pSprite->hotPhys.y)))
+ XineramaSetCursorPosition (pDev, new.x, new.y, generateEvents);
+ }
else
#endif
{
@@ -2732,6 +2735,9 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
CHECKEVENT(ev);
+ if (!pSprite)
+ return FALSE;
+
prevSpriteWin = pSprite->win;
if (ev && !syncEvents.playingEvents)
@@ -3138,7 +3144,7 @@ NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y)
}
} else
#endif
- if (newScreen != pSprite->hotPhys.pScreen)
+ if (newScreen != pSprite->hotPhys.pScreen && WindowTable[newScreen->myNum])
ConfineCursorToWindow(pDev, WindowTable[newScreen->myNum],
TRUE, FALSE);
}
diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c
index 7a24b801e..7d560f103 100644
--- a/xorg-server/dix/getevents.c
+++ b/xorg-server/dix/getevents.c
@@ -62,6 +62,16 @@
#include "extnsionst.h"
#include "listdev.h" /* for sizing up DeviceClassesChangedEvent */
+#ifdef _MSC_VER
+#include <math.h>
+
+float roundf(float f)
+{
+ return ((f<0.0f) ? ceil(f-.5) : floor (f+.5));
+}
+#define lroundf(val) ((int)roundf(val))
+#endif
+
/* Number of motion history events to store. */
#define MOTION_HISTORY_SIZE 256
diff --git a/xorg-server/dix/main.c b/xorg-server/dix/main.c
index 259093236..a4080d39f 100644
--- a/xorg-server/dix/main.c
+++ b/xorg-server/dix/main.c
@@ -116,6 +116,10 @@ Equipment Corporation.
#include "dpmsproc.h"
#endif
+#ifdef _DEBUG
+#include <crtdbg.h>
+#endif
+
extern void Dispatch(void);
extern void InitProcVectors(void);
@@ -136,9 +140,49 @@ int main(int argc, char *argv[], char *envp[])
{
int i;
HWEventQueueType alwaysCheckForInput[2];
-
+ #ifdef _DEBUG
+ //int TmpFlag=_CrtSetDbgFlag( _CRTDBG_REPORT_FLAG);
+
+ //TmpFlag|=_CRTDBG_ALLOC_MEM_DF;
+ //TmpFlag|=_CRTDBG_DELAY_FREE_MEM_DF;
+ //TmpFlag|=_CRTDBG_CHECK_ALWAYS_DF;
+ //TmpFlag|=_CRTDBG_CHECK_CRT_DF;
+ //TmpFlag|=_CRTDBG_LEAK_CHECK_DF;
+
+ //_CrtSetDbgFlag(TmpFlag);
+ #endif
+
+ ptw32_processInitialize();
display = "0";
+ #ifdef WIN32
+
+ if (InitWSA()<0)
+ {
+ printf("Error initialising WSA\n");
+ return -1;
+ }
+ /* In Win32 we have different threads call Xlib functions (depending
+ on the commandline options given).
+ XInitThreads has to be called before
+ any xlib function is called (aoccording to the man page) */
+ XInitThreads();
+ /* change the current directory to the directory where the vcxsrv.exe executable is installed.
+ This is needed because the font directories are relative to the current directory.
+ */
+ {
+ char ModuleFilename[MAX_PATH];
+ char *pSlash;
+ GetModuleFileName(NULL,ModuleFilename,sizeof(ModuleFilename));
+ pSlash=strrchr(ModuleFilename,'\\');
+ if (pSlash)
+ {
+ *pSlash='\0';
+ chdir(ModuleFilename);
+ }
+ }
+ #endif
+
InitRegions();
pixman_disable_out_of_bounds_workaround();
diff --git a/xorg-server/dix/makefile b/xorg-server/dix/makefile
new file mode 100644
index 000000000..01e98d638
--- /dev/null
+++ b/xorg-server/dix/makefile
@@ -0,0 +1,40 @@
+ifeq ($(DEBUG),1)
+DEFINES += FONTDEBUG XSERVER_DTRACE
+endif
+
+LIBRARY=libdix
+
+CSRCS=\
+ atom.c \
+ colormap.c \
+ cursor.c \
+ deprecated.c \
+ devices.c \
+ dispatch.c \
+ dixfonts.c \
+ dixutils.c \
+ enterleave.c \
+ events.c \
+ eventconvert.c \
+ extension.c \
+ ffs.c \
+ gc.c \
+ getevents.c \
+ globals.c \
+ glyphcurs.c \
+ grabs.c \
+ initatoms.c \
+ inpututils.c \
+ main.c \
+ pixmap.c \
+ privates.c \
+ property.c \
+ ptrveloc.c \
+ registry.c \
+ resource.c \
+ selection.c \
+ swaprep.c \
+ swapreq.c \
+ tables.c \
+ window.c
+
diff --git a/xorg-server/dix/ptrveloc.c b/xorg-server/dix/ptrveloc.c
index 37dd0548c..7310952c9 100644
--- a/xorg-server/dix/ptrveloc.c
+++ b/xorg-server/dix/ptrveloc.c
@@ -26,6 +26,10 @@
#include <dix-config.h>
#endif
+#ifdef _MSC_VER
+#define _USE_MATH_DEFINES
+#endif
+
#include <math.h>
#include <ptrveloc.h>
#include <exevents.h>
@@ -59,6 +63,11 @@
*
****************************************************************************/
+#ifdef _MSC_VER
+#define inline __inline
+#define lrintf(val) ((int)val)
+#endif
+
/* fwds */
int
SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
diff --git a/xorg-server/dix/registry.c b/xorg-server/dix/registry.c
index 9a83ff74e..7221359b8 100644
--- a/xorg-server/dix/registry.c
+++ b/xorg-server/dix/registry.c
@@ -25,6 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include "resource.h"
diff --git a/xorg-server/dix/resource.c b/xorg-server/dix/resource.c
index 1d33c9aad..5364dcc3b 100644
--- a/xorg-server/dix/resource.c
+++ b/xorg-server/dix/resource.c
@@ -189,46 +189,47 @@ struct ResourceType {
};
static struct ResourceType *resourceTypes;
+
static const struct ResourceType predefTypes[] = {
- [RT_NONE & (RC_LASTPREDEF - 1)] = {
- .deleteFunc = (DeleteType)NoopDDA,
- .errorValue = BadValue,
+ /* [RT_NONE & (RC_LASTPREDEF - 1)] = */ {
+ /*.deleteFunc = */(DeleteType)NoopDDA,
+ /*.errorValue = */BadValue,
},
- [RT_WINDOW & (RC_LASTPREDEF - 1)] = {
- .deleteFunc = DeleteWindow,
- .errorValue = BadWindow,
+ /* [RT_WINDOW & (RC_LASTPREDEF - 1)] = */ {
+ /*.deleteFunc = */DeleteWindow,
+ /*.errorValue = */BadWindow,
},
- [RT_PIXMAP & (RC_LASTPREDEF - 1)] = {
- .deleteFunc = dixDestroyPixmap,
- .errorValue = BadPixmap,
+ /* [RT_PIXMAP & (RC_LASTPREDEF - 1)] = */ {
+ /*.deleteFunc = */dixDestroyPixmap,
+ /*.errorValue = */BadPixmap,
},
- [RT_GC & (RC_LASTPREDEF - 1)] = {
- .deleteFunc = FreeGC,
- .errorValue = BadGC,
+ /* [RT_GC & (RC_LASTPREDEF - 1)] = */ {
+ /*.deleteFunc = */FreeGC,
+ /*.errorValue = */BadGC,
},
- [RT_FONT & (RC_LASTPREDEF - 1)] = {
- .deleteFunc = CloseFont,
- .errorValue = BadFont,
+ /* [RT_FONT & (RC_LASTPREDEF - 1)] = */ {
+ /*.deleteFunc = */CloseFont,
+ /*.errorValue = */BadFont,
},
- [RT_CURSOR & (RC_LASTPREDEF - 1)] = {
- .deleteFunc = FreeCursor,
- .errorValue = BadCursor,
+ /* [RT_CURSOR & (RC_LASTPREDEF - 1)] = */ {
+ /*.deleteFunc = */FreeCursor,
+ /*.errorValue = */BadCursor,
},
- [RT_COLORMAP & (RC_LASTPREDEF - 1)] = {
- .deleteFunc = FreeColormap,
- .errorValue = BadColor,
+ /* [RT_COLORMAP & (RC_LASTPREDEF - 1)] = */ {
+ /*.deleteFunc = */FreeColormap,
+ /*.errorValue = */BadColor,
},
- [RT_CMAPENTRY & (RC_LASTPREDEF - 1)] = {
- .deleteFunc = FreeClientPixels,
- .errorValue = BadColor,
+ /* [RT_CMAPENTRY & (RC_LASTPREDEF - 1)] = */ {
+ /*.deleteFunc = */FreeClientPixels,
+ /*.errorValue = */BadColor,
},
- [RT_OTHERCLIENT & (RC_LASTPREDEF - 1)] = {
- .deleteFunc = OtherClientGone,
- .errorValue = BadValue,
+ /* [RT_OTHERCLIENT & (RC_LASTPREDEF - 1)] = */ {
+ /*.deleteFunc = */OtherClientGone,
+ /*.errorValue = */BadValue,
},
- [RT_PASSIVEGRAB & (RC_LASTPREDEF - 1)] = {
- .deleteFunc = DeletePassiveGrab,
- .errorValue = BadValue,
+ /* [RT_PASSIVEGRAB & (RC_LASTPREDEF - 1)] = */ {
+ /*.deleteFunc = */DeletePassiveGrab,
+ /*.errorValue = */BadValue,
},
};