Assorted bug fixes and cleanup for lg3d-x11-dev-0.6.1.8

This commit is contained in:
Deron Johnson 2004-12-09 18:59:52 +00:00
parent cc390e4ed5
commit 6eaa11da2e
10 changed files with 674 additions and 197 deletions

View File

@ -69,6 +69,10 @@ in this Software without prior written authorization from The Open Group.
#include "modinit.h"
#ifdef LG3D
#include "lgeint.h"
#endif /* LG3D */
typedef struct _ShmDesc {
struct _ShmDesc *next;
int shmid;
@ -447,11 +451,22 @@ ProcShmAttach(client)
* do manual checking of access rights for the credentials
* of the client */
if (shm_access(client, &(buf.shm_perm), stuff->readOnly) == -1) {
shmdt(shmdesc->addr);
xfree(shmdesc);
return BadAccess;
#ifdef LG3D
/*
** Skip this access check when talking to the display server.
** TODO: POSSIBLE SECURITY HOLE: make sure that only the
** actual LG Display Server can ever set this.
*/
if (!lgeDisplayServerIsAlive) {
#endif /* LG3D */
if (shm_access(client, &(buf.shm_perm), stuff->readOnly) == -1) {
shmdt(shmdesc->addr);
xfree(shmdesc);
return BadAccess;
}
#ifdef LG3D
}
#endif /* LG3D */
shmdesc->shmid = stuff->shmid;
shmdesc->refcnt = 1;
@ -1229,6 +1244,9 @@ SProcShmCreatePixmap(client)
REQUEST(xShmCreatePixmapReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
#ifdef LG3D
swapl(&stuff->pid, n);
#endif /* LG3D */
swapl(&stuff->drawable, n);
swaps(&stuff->width, n);
swaps(&stuff->height, n);

View File

@ -127,6 +127,11 @@ int ProcQueryVersion (client)
rep.sequence_number = client->sequence;
rep.server_major_version = XEVIE_MAJOR_VERSION;
rep.server_minor_version = XEVIE_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequence_number, n);
swapl(&rep.server_major_version, n);
swapl(&rep.server_minor_version, n);
}
WriteToClient (client, sizeof (xXevieQueryVersionReply), (char *)&rep);
return client->noClientException;
}
@ -153,7 +158,11 @@ int ProcStart (client)
return BadAccess;
rep.type = X_Reply;
rep.length = 0;
rep.sequence_number = client->sequence;
if (client->swapped) {
swaps(&rep.sequence_number, n);
}
WriteToClient (client, sizeof (xXevieStartReply), (char *)&rep);
return client->noClientException;
}
@ -163,11 +172,16 @@ int ProcEnd (client)
register ClientPtr client;
{
xXevieEndReply rep;
register int n;
XevieEnd(xevieClientIndex);
rep.type = X_Reply;
rep.length = 0;
rep.sequence_number = client->sequence;
if (client->swapped) {
swaps(&rep.sequence_number, n);
}
WriteToClient (client, sizeof (xXevieEndReply), (char *)&rep);
return client->noClientException;
}
@ -181,10 +195,15 @@ int ProcSend (client)
xEvent *xE;
OsCommPtr oc;
static unsigned char lastDetail = 0, lastType = 0;
register int n;
xE = (xEvent *)&stuff->event;
rep.type = X_Reply;
rep.length = 0;
rep.sequence_number = client->sequence;
if (client->swapped) {
swaps(&rep.sequence_number, n);
}
WriteToClient (client, sizeof (xXevieSendReply), (char *)&rep);
switch(xE->u.u.type) {
@ -216,10 +235,15 @@ int ProcSelectInput (client)
{
REQUEST (xXevieSelectInputReq);
xXevieSelectInputReply rep;
register int n;
xevieMask = (long)stuff->event_mask;
rep.type = X_Reply;
rep.length = 0;
rep.sequence_number = client->sequence;
if (client->swapped) {
swaps(&rep.sequence_number, n);
}
WriteToClient (client, sizeof (xXevieSelectInputReply), (char *)&rep);
return client->noClientException;
}
@ -308,7 +332,7 @@ int SProcSelectInput (client)
REQUEST (xXevieSelectInputReq);
swaps (&stuff->length, n);
REQUEST_AT_LEAST_SIZE (xXevieSendReq);
REQUEST_AT_LEAST_SIZE (xXevieSelectInputReq);
swapl(&stuff->event_mask, n);
return ProcSelectInput (client);
}

View File

@ -507,7 +507,7 @@ compAllocPixmap (WindowPtr pWin)
cw->damageRegistered = TRUE;
}
#ifdef LG3D
#ifdef xLG3D
/*
** Applications which use shaped windows (e.g. xeyes) don't
** always clear the entire backing pixmap. We should clear the

View File

@ -67,6 +67,10 @@ lgeTryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
Mask filter, GrabPtr grab);
#endif /* LG3D */
/*
int numevent = 0;
*/
static void
DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
{
@ -76,6 +80,17 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
xDamageNotifyEvent ev;
int i;
#ifdef LG3D
/*
** Force damage events to go to the damage grabbing client rather
** than the client who created the damage record.
*/
if (lgeDisplayServerIsAlive && lgeGrabDamageEventsClient != NULL) {
pClient = lgeGrabDamageEventsClient;
}
#endif /* LG3D */
UpdateCurrentTimeIf ();
ev.type = DamageEventBase + XDamageNotify;
ev.level = pDamageExt->level;
@ -98,10 +113,14 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
ev.area.y = pBoxes[i].y1;
ev.area.width = pBoxes[i].x2 - pBoxes[i].x1;
ev.area.height = pBoxes[i].y2 - pBoxes[i].y1;
/*
ErrorF("Construct DamageNotify event %d: xywh = %d, %d, %d, %d\n",
++numevent, ev.area.x, ev.area.y, ev.area.width, ev.area.height);
*/
if (!pClient->clientGone) {
#ifdef LG3D
if (lgeDisplayServerIsAlive) {
if (lgeTryClientEvents (NULL, (xEvent *) &ev, 1, 0, 0, NULL) == 0) {
if (lgeTryClientEvents (pClient, (xEvent *) &ev, 1, 0, 0, NULL) == 0) {
ErrorF("DamageExtNotify: warning: call to lgeTryWriteEventsToClients failed.\n");
ErrorF("Couldn't deliver DamageNotify event.\n");
}
@ -120,10 +139,14 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
ev.area.y = 0;
ev.area.width = pDrawable->width;
ev.area.height = pDrawable->height;
/*
ErrorF("Construct DamageNotify event %d: xywh = %d, %d, %d, %d\n",
++numevent, ev.area.x, ev.area.y, ev.area.width, ev.area.height);
*/
if (!pClient->clientGone) {
#ifdef LG3D
if (lgeDisplayServerIsAlive) {
if (lgeTryClientEvents (NULL, (xEvent *) &ev, 1, 0, 0, NULL) == 0) {
if (lgeTryClientEvents (pClient, (xEvent *) &ev, 1, 0, 0, NULL) == 0) {
ErrorF("DamageExtNotify: warning: call to lgeTryWriteEventsToClients failed.\n");
ErrorF("Couldn't deliver DamageNotify event.\n");
}

View File

@ -1,4 +1,4 @@
/* $XdotOrg: xc/programs/Xserver/dix/dispatch.c,v 1.4 2004/07/29 18:43:58 stukreit Exp $ */
/* $XdotOrg: xc/programs/Xserver/dix/dispatch.c,v 1.5 2004/07/31 01:48:27 anholt Exp $ */
/* $Xorg: dispatch.c,v 1.5 2001/02/09 02:04:40 xorgcvs Exp $ */
/************************************************************
@ -78,6 +78,138 @@ Equipment Corporation.
/* $XFree86: xc/programs/Xserver/dix/dispatch.c,v 3.32 2003/11/10 18:21:45 tsi Exp $ */
#if defined(LG3D) && defined(DISPATCH_DEBUG)
int printprocs = 0;
int proc_num = 0;
typedef char *ProcNameString;
static ProcNameString procNames[] = {
"",
"CreateWindow",
"ChangeWindowAttributes",
"GetWindowAttributes",
"DestroyWindow",
"DestroySubwindows",
"ChangeSaveSet",
"ReparentWindow",
"MapWindow",
"MapSubwindows",
"UnmapWindow",
"UnmapSubwindows",
"ConfigureWindow",
"CirculateWindow",
"GetGeometry",
"QueryTree",
"InternAtom",
"GetAtomName",
"ChangeProperty",
"DeleteProperty",
"GetProperty",
"ListProperties",
"SetSelectionOwner",
"GetSelectionOwner",
"ConvertSelection",
"SendEvent",
"GrabPointer",
"UngrabPointer",
"GrabButton",
"UngrabButton",
"ChangeActivePointerGrab",
"GrabKeyboard",
"UngrabKeyboard",
"GrabKey",
"UngrabKey",
"AllowEvents",
"GrabServer",
"UngrabServer",
"QueryPointer",
"GetMotionEvents",
"TranslateCoords",
"WarpPointer",
"SetInputFocus",
"GetInputFocus",
"QueryKeymap",
"OpenFont",
"CloseFont",
"QueryFont",
"QueryTextExtents",
"ListFonts",
"ListFontsWithInfo",
"SetFontPath",
"GetFontPath",
"CreatePixmap",
"FreePixmap",
"CreateGC",
"ChangeGC",
"CopyGC",
"SetDashes",
"SetClipRectangles",
"FreeGC",
"ClearArea",
"CopyArea",
"CopyPlane",
"PolyPoint",
"PolyLine",
"PolySegment",
"PolyRectangle",
"PolyArc",
"FillPoly",
"PolyFillRectangle",
"PolyFillArc",
"PutImage",
"GetImage",
"PolyText8",
"PolyText16",
"ImageText8",
"ImageText16",
"CreateColormap",
"FreeColormap",
"CopyColormapAndFree",
"InstallColormap",
"UninstallColormap",
"ListInstalledColormaps",
"AllocColor",
"AllocNamedColor",
"AllocColorCells",
"AllocColorPlanes",
"FreeColors",
"StoreColors",
"StoreNamedColor",
"QueryColors",
"LookupColor",
"CreateCursor",
"CreateGlyphCursor",
"FreeCursor",
"RecolorCursor",
"QueryBestSize",
"QueryExtension",
"ListExtensions",
"ChangeKeyboardMapping",
"GetKeyboardMapping",
"ChangeKeyboardControl",
"GetKeyboardControl",
"Bell",
"ChangePointerControl",
"GetPointerControl",
"SetScreenSaver",
"GetScreenSaver",
"ChangeHosts",
"ListHosts",
"SetAccessControl",
"SetCloseDownMode",
"KillClient",
"RotateProperties",
"ForceScreenSaver",
"SetPointerMapping",
"GetPointerMapping",
"SetModifierMapping",
"GetModifierMapping"
};
#define NUM_PROC_NAMES (sizeof(procNames)/sizeof(char*))
#endif /* LG3D && DISPATCH_DEBUG */
#ifdef PANORAMIX_DEBUG
#include <stdio.h>
int ProcInitialConnection();
@ -449,6 +581,20 @@ Dispatch(void)
client->requestLog[client->requestLogIndex] = MAJOROP;
client->requestLogIndex++;
#endif
#if defined(LG3D) && defined(DISPATCH_DEBUG)
if (printprocs) {
char *procName;
if (MAJOROP >= NUM_PROC_NAMES) {
procName = "Unknown";
} else {
procName = procNames[MAJOROP];
}
ErrorF("dispatcher: %d, client = %d, op = %d (%s)\n", ++proc_num, client->index, MAJOROP, procName);
}
#endif /* LG3D && DISPATCH_DEBUG */
if (result > (maxBigRequestSize << 2))
result = BadLength;
else

View File

@ -1,4 +1,4 @@
/* $XdotOrg: xc/programs/Xserver/dix/events.c,v 1.6 2004/08/09 02:08:35 kem Exp $ */
/* $XdotOrg: xc/programs/Xserver/dix/events.c,v 1.6.4.1 2004/09/16 23:37:22 deronj Exp $ */
/* $XFree86: xc/programs/Xserver/dix/events.c,v 3.51 2004/01/12 17:04:52 tsi Exp $ */
/************************************************************
@ -151,11 +151,21 @@ xEvent *xeviexE;
#include "dispatch.h"
#ifdef LG3D
/* Enable one or the other, but not both */
#undef LG3D_EVENT_TEST_LATENCY
#undef LG3D_EVENT_TEST_THROUGHPUT
#include "damagewire.h"
#include "../Xext/lgeint.h"
extern int lgeTryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
Mask filter, GrabPtr grab);
extern WindowPtr XYToSubWindow (WindowPtr pWin, int x, int y,
int *xWinRel, int *yWinRel);
extern Bool PointInBorderSize(WindowPtr pWin, int x, int y);
#endif /* LG3D */
#define EXTENSION_EVENT_BASE 64
@ -331,33 +341,6 @@ static CARD8 criticalEvents[32] =
0x7c /* key and button events */
};
#ifdef LG3D
#define LG3D_DECLARE_WINDOW() \
WindowPtr pEventWin = NULL
#define LG3D_GET_WINDOW(e) \
if ((e) != NULL) { \
pEventWin = (WindowPtr) LookupIDByType((e)->u.keyButtonPointer.event, RT_WINDOW); \
}
/*
** In LG Event Mode the sprite hotspot is calculated by taking the
** event window local coordinates and converting them to screen
** absolute.
**
*/
#define LG3D_CALC_SPRITE_HOTXY(e) \
sprite.hot.x = (e)->u.keyButtonPointer.rootX; \
sprite.hot.y = (e)->u.keyButtonPointer.rootY;
extern WindowPtr XYToSubWindow (WindowPtr pWin, int x, int y,
int *xWinRel, int *yWinRel);
extern Bool PointInBorderSize(WindowPtr pWin, int x, int y);
#endif /* LG3D */
#ifdef PANORAMIX
static void ConfineToShape(RegionPtr shape, int *px, int *py);
@ -498,19 +481,8 @@ XineramaCheckVirtualMotion(
if (qe)
{
sprite.hot.pScreen = qe->pScreen; /* should always be Screen 0 */
#ifdef LG3D
if (lgeDisplayServerIsAlive) {
LG3D_DECLARE_WINDOW();
LG3D_GET_WINDOW(qe->event);
LG3D_CALC_SPRITE_HOTXY(qe->event);
} else {
sprite.hot.x = qe->event->u.keyButtonPointer.rootX;
sprite.hot.y = qe->event->u.keyButtonPointer.rootY;
}
#else
sprite.hot.x = qe->event->u.keyButtonPointer.rootX;
sprite.hot.y = qe->event->u.keyButtonPointer.rootY;
#endif /* LG3D */
pWin = inputInfo.pointer->grab ? inputInfo.pointer->grab->confineTo :
NullWindow;
}
@ -678,22 +650,18 @@ XineramaConfineCursorToWindow(WindowPtr pWin, Bool generateEvents)
static void
XineramaChangeToCursor(CursorPtr cursor)
{
#ifdef LG3D
if (plgeDisplayServerForceThisCursor != NULL) {
(*sprite.hotPhys.pScreen->DisplayCursor) (sprite.hotPhys.pScreen,
plgeDisplayServerForceThisCursor);
return;
}
#endif /* LG3D */
#ifndef LG3D
if (cursor != sprite.current)
{
#endif /* ! LG3D */
if ((sprite.current->bits->xhot != cursor->bits->xhot) ||
(sprite.current->bits->yhot != cursor->bits->yhot))
XineramaCheckPhysLimits(cursor, FALSE);
(*sprite.screen->DisplayCursor)(sprite.screen, cursor);
sprite.current = cursor;
#ifndef LG3D
}
#endif /* ! LG3D */
}
@ -921,16 +889,10 @@ ChangeToCursor(CursorPtr cursor)
}
#endif
#ifdef LG3D
if (plgeDisplayServerForceThisCursor != NULL) {
(*sprite.hotPhys.pScreen->DisplayCursor) (sprite.hotPhys.pScreen,
plgeDisplayServerForceThisCursor);
return;
}
#endif /* LG3D */
#ifndef LG3D
if (cursor != sprite.current)
{
#endif /* ! LG3D */
if ((sprite.current->bits->xhot != cursor->bits->xhot) ||
(sprite.current->bits->yhot != cursor->bits->yhot))
CheckPhysLimits(cursor, FALSE, sprite.confined,
@ -938,7 +900,9 @@ ChangeToCursor(CursorPtr cursor)
(*sprite.hotPhys.pScreen->DisplayCursor) (sprite.hotPhys.pScreen,
cursor);
sprite.current = cursor;
#ifndef LG3D
}
#endif /* ! LG3D */
}
/* returns true if b is a descendent of a */
@ -973,6 +937,7 @@ PostNewCursor(void)
}
else
win = sprite.win;
for (; win; win = win->parent)
if (win->optional && win->optional->cursor != NullCursor)
{
@ -1139,8 +1104,7 @@ lgeTryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
destination = lgeDSCaresAboutEvent (pEvents, &win);
if (client == NULL /* For XDamageNotify */ ||
(destination != SEND_TO_NORMAL_CLIENT && win == lgeGrabAllWindowEvents.window)) {
if (destination != SEND_TO_NORMAL_CLIENT && win == lgeGrabAllWindowEvents.window) {
/*
** Send events to grabbing client client. Use a null grab pointer
** in order to sure that the event isn't eaten by any grabs; we want
@ -1653,6 +1617,7 @@ ProcAllowEvents(client)
REQUEST_SIZE_MATCH(xAllowEventsReq);
time = ClientTimeToServerTime(stuff->time);
switch (stuff->mode)
{
case ReplayPointer:
@ -1981,6 +1946,131 @@ MaybeDeliverEventsToClient(pWin, pEvents, count, filter, dontClient)
return 2;
}
#ifdef LG3D
/* Returns True if the event occurred above a 3D object rather than a native window */
#define EVENT_IS_3D(e) \
((e)->u.keyButtonPointer.event == lgeDisplayServerPRW)
/*
TODO: it's not clear whether this routine deals with grabs properly.
Must handle the following cases:
2D event grabbed and forced to go to 2D win
2D event grabbed and forced to go to 3D win
3D event grabbed and forced to go to 2D win
3D event grabbed and forced to go to 3D win
*/
static void
lgeFixUpEventFromWindow(
xEvent *xE,
WindowPtr pWin,
Window child,
Bool calcChild)
{
Window eventWindowOld;
/*
ErrorF("Enter FixUpEventFromWindow, event type = %d\n", xE->u.u.type);
if (EVENT_IS_3D(xE)) {
ErrorF("Event is 3D\n");
} else {
ErrorF("Event is 2D\n");
}
ErrorF("old event window = %d\n", XE_KBPTR.event);
ErrorF("old child window = %d\n", XE_KBPTR.child);
ErrorF("old eventxy = %d, %d\n", XE_KBPTR.eventX, XE_KBPTR.eventY);
*/
/* TODO: This is merely an optimization; it is no longer functionally necessary */
if (EVENT_IS_3D(xE)) {
calcChild = False;
}
if (calcChild)
{
/*ErrorF("Calculating child\n");*/
WindowPtr w=spriteTrace[spriteTraceGood-1];
/* If the search ends up past the root should the child field be
set to none or should the value in the argument be passed
through. It probably doesn't matter since everyone calls
this function with child == None anyway. */
while (w)
{
/* If the source window is same as event window, child should be
none. Don't bother going all all the way back to the root. */
if (w == pWin)
{
child = None;
break;
}
if (w->parent == pWin)
{
child = w->drawable.id;
break;
}
w = w->parent;
}
}
XE_KBPTR.root = ROOT->drawable.id;
/* Set event field (only for non-3D events) */
if (!EVENT_IS_3D(xE)) {
eventWindowOld = XE_KBPTR.event;
XE_KBPTR.event = pWin->drawable.id;
/*ErrorF("new event window = %d\n", XE_KBPTR.event);*/
}
if (sprite.hot.pScreen != pWin->drawable.pScreen)
{
XE_KBPTR.sameScreen = xFalse;
XE_KBPTR.child = None;
XE_KBPTR.eventX = 0;
XE_KBPTR.eventY = 0;
return;
}
XE_KBPTR.sameScreen = xTrue;
/* Set various fields (only for non-3D events) */
if (!EVENT_IS_3D(xE)) {
XE_KBPTR.child = child;
/*ErrorF("new child window = %d\n", XE_KBPTR.child);*/
/*
** The only events needing fixup at this point are mouse events
** where the event window has been changed.
*/
if ((xE->u.u.type == ButtonPress ||
xE->u.u.type == ButtonRelease ||
xE->u.u.type == MotionNotify) &&
eventWindowOld != XE_KBPTR.event) {
/* TODO: it would be good to avoid a resource lookup here. Some sort of
caching might optimize this */
WindowPtr pOuterWin = (WindowPtr) LookupIDByType(eventWindowOld, RT_WINDOW);
if (pOuterWin == NULL) {
ErrorF("Error: FixupEventFromWindow: outer window %d, not found. No XY fix up occuring.\n",
eventWindowOld);
} else {
/*
** Make the event coords relative to the destination window
** instead of relative to the outer window.
*/
XE_KBPTR.eventX -= pWin->drawable.x - pOuterWin->drawable.x;
XE_KBPTR.eventY -= pWin->drawable.y - pOuterWin->drawable.y;
/*ErrorF("new eventxy = %d, %d", XE_KBPTR.eventX, XE_KBPTR.eventY);*/
}
}
}
}
#endif /* LG3D */
static void
FixUpEventFromWindow(
xEvent *xE,
@ -1989,8 +2079,10 @@ FixUpEventFromWindow(
Bool calcChild)
{
#ifdef LG3D
Bool isMouseEvent = FALSE;
Window mouseEventWinPrev = 0;
if (lgeDisplayServerIsAlive) {
lgeFixUpEventFromWindow(xE, pWin, child, calcChild);
return;
}
#endif /* LG3D */
if (calcChild)
@ -2021,93 +2113,15 @@ FixUpEventFromWindow(
}
}
XE_KBPTR.root = ROOT->drawable.id;
#ifdef LG3D
if (xE->u.u.type == ButtonPress ||
xE->u.u.type == ButtonRelease ||
xE->u.u.type == MotionNotify) {
isMouseEvent = TRUE;
mouseEventWinPrev = XE_KBPTR.event;
}
if (lgeDisplayServerIsAlive &&
XE_KBPTR.event == lgeDisplayServerPRW) {
/*
** Event is going to the PRW.
** Button and motion events already have the event
** window field set.
*/
if (!isMouseEvent) {
XE_KBPTR.event = pWin->drawable.id;
}
} else {
/*
** Non-LG event mode or the event is going to an
** X application window. Need to set the event window
** field to the destination window.
*/
XE_KBPTR.event = pWin->drawable.id;
}
#else
XE_KBPTR.event = pWin->drawable.id;
#endif /* LG3D */
if (sprite.hot.pScreen == pWin->drawable.pScreen)
{
XE_KBPTR.sameScreen = xTrue;
XE_KBPTR.child = child;
#ifdef LG3D
if (lgeDisplayServerIsAlive) {
if (XE_KBPTR.event == lgeDisplayServerPRW) {
/*
** Event is going to the PRW.
** Button and motion events already have the event
** XY fields set.
*/
if (!isMouseEvent) {
XE_KBPTR.eventX = XE_KBPTR.rootX;
XE_KBPTR.eventY = XE_KBPTR.rootY;
}
} else {
/*
** Event is going to an X application
** window. Need to set the window relative event XY for
** ALL event types.
**
** TODO: I don't think this code deals very well with grab cases,
*/
if (!isMouseEvent || mouseEventWinPrev == pWin->drawable.id) {
/*
** A non-button/motion event (e.g. keypress or enter/leave)
** or the event occurred in a top-level window.
** Do nothing. The event coords are already correct.
*/
} else {
/* TODO: it would be good to avoid a resource lookup here */
WindowPtr pOuterWin = (WindowPtr) LookupIDByType(mouseEventWinPrev, RT_WINDOW);
if (pOuterWin == NULL) {
ErrorF("Error: FixupEventFromWindow: outer window %d, not found. No XY fix up occuring.\n", mouseEventWinPrev);
} else {
/*
** Make the event coords relative to the destination window
** instead of relative to the outer window.
*/
XE_KBPTR.eventX -= pWin->drawable.x - pOuterWin->drawable.x;
XE_KBPTR.eventY -= pWin->drawable.y - pOuterWin->drawable.y;
}
}
}
} else {
/* Non-LG event mode */
XE_KBPTR.eventX = XE_KBPTR.rootX - pWin->drawable.x;
XE_KBPTR.eventY = XE_KBPTR.rootY - pWin->drawable.y;
}
#else
XE_KBPTR.eventX =
XE_KBPTR.rootX - pWin->drawable.x;
XE_KBPTR.eventY =
XE_KBPTR.rootY - pWin->drawable.y;
#endif /* LG3D */
}
else
{
@ -2320,12 +2334,6 @@ static Bool
CheckMotion(xEvent *xE)
{
WindowPtr prevSpriteWin = sprite.win;
#ifdef LG3D
LG3D_DECLARE_WINDOW();
if (lgeDisplayServerIsAlive) {
LG3D_GET_WINDOW(xE);
}
#endif /* LG3D */
#ifdef PANORAMIX
if(!noPanoramiXExtension)
@ -2339,17 +2347,8 @@ CheckMotion(xEvent *xE)
sprite.hot.pScreen = sprite.hotPhys.pScreen;
ROOT = WindowTable[sprite.hot.pScreen->myNum];
}
#ifdef LG3D
if (lgeDisplayServerIsAlive) {
LG3D_CALC_SPRITE_HOTXY(xE);
} else {
sprite.hot.x = XE_KBPTR.rootX;
sprite.hot.y = XE_KBPTR.rootY;
}
#else
sprite.hot.x = XE_KBPTR.rootX;
sprite.hot.y = XE_KBPTR.rootY;
#endif /* LG3D */
if (sprite.hot.x < sprite.physLimits.x1)
sprite.hot.x = sprite.physLimits.x1;
else if (sprite.hot.x >= sprite.physLimits.x2)
@ -2375,34 +2374,38 @@ CheckMotion(xEvent *xE)
}
#ifdef LG3D
if (pEventWin == NULL) {
sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y);
virtualSprite.hot.x = sprite.hot.x - sprite.win->drawable.x;
virtualSprite.hot.y = sprite.hot.y - sprite.win->drawable.y;
} else {
WindowPtr pSpriteWin;
if (lgeDisplayServerIsAlive) {
/*
** This is needed to decouple the virtual sprite position from
** the physical sprite position.
*/
if (pEventWin->drawable.id == lgeDisplayServerPRW) {
pSpriteWin = pEventWin;
if (xE == NULL) {
/* WindowsRestructured case */
/* TODO: this may change */
sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y);
virtualSprite.hot.x = sprite.hot.x - sprite.win->drawable.x;
virtualSprite.hot.y = sprite.hot.y - sprite.win->drawable.y;
} else if (XE_KBPTR.event == lgeDisplayServerPRW) {
/* 3D Event */
sprite.win = pLgeDisplayServerPRWWin;
virtualSprite.hot.x = sprite.hot.x;
virtualSprite.hot.y = sprite.hot.y;
} else {
pSpriteWin = XYToSubWindow(pEventWin,
xE->u.keyButtonPointer.eventX,
xE->u.keyButtonPointer.eventY,
&virtualSprite.hot.x,
&virtualSprite.hot.y);
/* Normal X Event */
WindowPtr pEventWin = (WindowPtr) LookupIDByType(XE_KBPTR.event, RT_WINDOW);
if (pEventWin == NULL) {
/* This might happen if the window has been destroyed */
sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y);
virtualSprite.hot.x = sprite.hot.x - sprite.win->drawable.x;
virtualSprite.hot.y = sprite.hot.y - sprite.win->drawable.y;
return TRUE;
}
sprite.win = XYToSubWindow(pEventWin,
XE_KBPTR.eventX, XE_KBPTR.eventY,
&virtualSprite.hot.x, &virtualSprite.hot.y);
}
virtualSprite.win = sprite.win;
sprite.win = pSpriteWin;
} else {
sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y);
}
virtualSprite.win = sprite.win;
#else
sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y);
#endif /* LG3D */
@ -2432,6 +2435,33 @@ void
WindowsRestructured()
{
(void) CheckMotion((xEvent *)NULL);
#ifdef xLG3D
/*
**
** Bug: this code doesn't currently work. It messes up the sprite window.
** Test case: freecell: click New button. Cursor jumps to upper left hand
** corner because the button ends up getting sent to the DS!
*/
/*
** In addition, we need to send a synthetic motion event with the
** last physical sprite position to the Display Server so that it
** will notice that something has changed and recompute the current
** pointer window.
**
** Note: we cannot just skip the above call to CheckMotion and
** send this synthetic event alone. We must call CheckMotion(NULL)
** in order to the current sprite window to a valid window. Otherwise
** when the synthetic event comes back to us the prevSpriteWindow
** may still point to an invalid window and this will crash the server!
*/
xEvent xE;
xE.u.u.type = MotionNotify;
xE.u.keyButtonPointer.event = lgeDisplayServerPRW;
xE.u.keyButtonPointer.rootX = sprite.hot.x;
xE.u.keyButtonPointer.rootY = sprite.hot.y;
xE.u.keyButtonPointer.time = GetTimeInMillis();
(*inputInfo.pointer->public.processInputProc)(&xE, inputInfo.pointer, 1);
#endif /* LG3D */
}
#ifdef PANORAMIX
@ -2971,6 +3001,7 @@ DeliverFocusedEvent(keybd, xE, window, count)
if (DeliverDeviceEvents(window, xE, NullGrab, focus, keybd, count))
return;
}
/* just deliver it to the focus window */
FixUpEventFromWindow(xE, focus, None, FALSE);
if (xE->u.u.type & EXTENSION_EVENT_BASE)
@ -3107,7 +3138,16 @@ ProcessKeyboardEvent (xE, keybd, count)
{
xeviekb = keybd;
if(!rootWin) {
#ifdef LG3D
/* TEMP Workaround */
WindowPtr pWin;
if (lgeDisplayServerIsAlive) {
xeviewin = pLgeDisplayServerPRWWin;
}
pWin = xeviewin->parent;
#else
WindowPtr pWin = xeviewin->parent;
#endif /* LG3D */
while(pWin) {
if(!pWin->parent) {
rootWin = pWin->drawable.id;
@ -3263,6 +3303,22 @@ FixKeyState (xE, keybd)
}
#endif
#if defined(LG3D_EVENT_TEST_LATENCY) || defined(LG3D_EVENT_TEST_THROUGHPUT)
#include <sys/time.h>
static int lg3dEventTestActive = 0;
static struct timeval lg3dEventTestStartTV;
#endif /* LG3D_EVENT_TEST_LATENCY || LG3D_EVENT_TEST_THROUGHPUT */
#ifdef LG3D_EVENT_TEST_LATENCY
#include "statbuf.h"
static StatBuf *lg3dEventTestSb = NULL;
#endif /* LG3D_EVENT_TEST_LATENCY */
#ifdef LG3D_EVENT_TEST_THROUGHPUT
static int lg3dEventTestReceived = 0;
static int lg3dEventTestCount = 10000;
#endif /* LG3D_EVENT_TEST_THROUGHPUT */
void
#ifdef XKB
CoreProcessPointerEvent (xE, mouse, count)
@ -3286,12 +3342,110 @@ ProcessPointerEvent (xE, mouse, count)
xevieEventSent = 0;
else {
xeviemouse = mouse;
#ifdef LG3D_EVENT_TEST_LATENCY
/* For latency timing: send */
if (xE->u.u.type == ButtonPress) {
ErrorF("Start Test\n");
if (lg3dEventTestSb == NULL) {
lg3dEventTestSb = statBufCreate();
if (lg3dEventTestSb == NULL) {
FatalError("LG3D Event Test: cannot create integer statistics buffer\n");
}
}
lg3dEventTestActive = 1;
gettimeofday(&lg3dEventTestStartTV, 0);
/*ErrorF("Start: sec = %d, usec = %d\n", lg3dEventTestStartTV.tv_sec,
lg3dEventTestStartTV.tv_usec);*/
}
if (lg3dEventTestActive) {
struct timeval tv;
int deltaSecs;
gettimeofday(&tv, 0);
deltaSecs = tv.tv_sec - lg3dEventTestStartTV.tv_sec;
/*ErrorF("Send: deltaSecs = %d, usec = %d\n", deltaSecs, tv.tv_usec);*/
xE->u.keyButtonPointer.time = deltaSecs;
xE->u.keyButtonPointer.child = tv.tv_usec;
}
#endif /* LG3D_EVENT_TEST_LATENCY */
#ifdef LG3D_EVENT_TEST_THROUGHPUT
/* For throughput timing */
if (xE->u.u.type == ButtonPress) {
int i;
ErrorF("Start Test\n");
lg3dEventTestActive = 1;
lg3dEventTestReceived = 0;
gettimeofday(&lg3dEventTestStartTV, 0);
for (i = 1; i <= lg3dEventTestCount; i++) {
/*ErrorF("Sending event %d\n", i);*/
WriteToClient(clients[xevieClientIndex], sizeof(xEvent), (char *)xE);
}
} else
#endif /* LG3D_EVENT_TEST_THROUGHPUT */
WriteToClient(clients[xevieClientIndex], sizeof(xEvent), (char *)xE);
return;
}
}
#endif
#ifdef LG3D_EVENT_TEST_LATENCY
/* For latency timing: receive */
if (lg3dEventTestActive) {
struct timeval tv;
int deltaSecs, deltaUsecs;
float msecs;
gettimeofday(&tv, 0);
/*ErrorF("Receive: sec = %d, usec = %d\n", tv.tv_sec, tv.tv_usec);*/
tv.tv_sec -= lg3dEventTestStartTV.tv_sec;
/*
ErrorF("Receive: deltaSecs = %d, usec = %d\n", tv.tv_sec, tv.tv_usec);
ErrorF("Receive: ev->time = %d, ev->child = %d\n",
xE->u.keyButtonPointer.time, xE->u.keyButtonPointer.child);
*/
deltaSecs = tv.tv_sec - xE->u.keyButtonPointer.time;
deltaUsecs = tv.tv_usec - xE->u.keyButtonPointer.child;
/*
ErrorF("Interval: deltaSecs = %d, deltaUsec = %d\n",
deltaSecs, deltaUsecs);
*/
msecs = 1000.0f * deltaSecs + deltaUsecs / 1000.0f;
/*ErrorF("Interval: msecs = %f\n", msecs);*/
statBufAdd(lg3dEventTestSb, msecs);
/* Discard event to avoid the additional computational load of
further processing */
return;
}
#endif /* LG3D_EVENT_TEST_LATENCY */
#ifdef LG3D_EVENT_TEST_THROUGHPUT
if (lg3dEventTestActive) {
lg3dEventTestReceived++;
/*ErrorF("Received event %d\n", lg3dEventTestReceived);*/
if (lg3dEventTestReceived == lg3dEventTestCount) {
struct timeval stopTV;
gettimeofday(&stopTV, 0);
int deltaSecs = stopTV.tv_sec - lg3dEventTestStartTV.tv_sec;
int deltaUsecs = stopTV.tv_usec - lg3dEventTestStartTV.tv_usec;
float msecs = deltaSecs * 1000.0f + deltaUsecs / 1000.0f;
float msecsPerEvent = msecs / (float)lg3dEventTestCount;
ErrorF("LG3D Event Test: %d events in %f ms (%f ms/event)\n",
lg3dEventTestCount, msecs, msecsPerEvent);
lg3dEventTestActive = 0;
}
}
#endif /* LG3D_EVENT_TEST_THROUGHPUT */
if (!syncEvents.playingEvents)
NoticeTime(xE)
XE_KBPTR.state = (butc->state | (
@ -4971,11 +5125,17 @@ ProcRecolorCursor(client)
return (Success);
}
/*#define DEBUG*/
#if defined(LG3D) && defined (DEBUG)
int print_events_all = 0;
int print_events_to_ds = 0;
int print_events_to_wm = 0;
int print_events_to_app = 0;
int damageEventsOnly = 0;
int numDamageEvents = 0;
/* TODO: for damage event debug only */
#include "damageproto.h"
#endif /* LG3D && DEBUG */
void
@ -5039,7 +5199,9 @@ WriteEventsToClient(pClient, count, events)
}
#if defined(LG3D) && defined (DEBUG)
if (print_events_all ||
/* TODO: these indices are now out of date; update them */
(print_events_to_ds && pClient->index == 4) ||
(print_events_to_wm && pClient->index == 5) ||
(print_events_to_app && pClient->index == 6)) {
@ -5047,10 +5209,18 @@ WriteEventsToClient(pClient, count, events)
for(i = 0; i < count; i++) {
ev = &events[i];
ErrorF("Send event %d to client %d, xy = %d, %d, event win = %d\n",
ev->u.u.type, pClient->index,
ev->u.keyButtonPointer.eventX, ev->u.keyButtonPointer.eventY,
ev->u.keyButtonPointer.event);
if (ev->u.u.type == 118) {
xDamageNotifyEvent *damev = (xDamageNotifyEvent *) ev;
ErrorF("Send damage event %d, to client %d, xywh = %d, %d, %d, %d\n",
++numDamageEvents, pClient->index,
damev->area.x, damev->area.y,
damev->area.width, damev->area.height);
} else if (!damageEventsOnly) {
ErrorF("Send event %d to client %d, xy = %d, %d, event win = %d\n",
ev->u.u.type, pClient->index,
ev->u.keyButtonPointer.eventX, ev->u.keyButtonPointer.eventY,
ev->u.keyButtonPointer.event);
}
}
}
#endif /* LG3D && DEBUG */

View File

@ -112,8 +112,7 @@
#include "xf86_OSproc.h" /* sigio stuff */
#ifdef LG3D
# include "../../../dix/ds.h"
# include "../../../Xext/lgeint.h"
#include "../../../Xext/lgeint.h"
#endif /* LG3D */
/******************************************************************************
@ -699,7 +698,9 @@ xf86eqEnqueue (xEvent *e)
#ifdef XINPUT
int count;
#ifndef LG3D
xf86AssertBlockedSIGIO ("xf86eqEnqueue");
#endif /* !LG3D */
switch (e->u.u.type) {
case KeyPress:
case KeyRelease:
@ -735,9 +736,18 @@ xf86eqEnqueue (xEvent *e)
#endif
#ifdef LG3D
/* If Display Server is not yet alive, do nothing to the event */
if (lgeDisplayServerIsAlive) {
dsProcessEvent(e);
if (lgeDisplayServerIsAlive &&
!lgeDisplayServerClient->clientGone &&
!lgeEventComesFromDS) {
/*
ErrorF("Send event XS->DS, type = %d xy = %d, %d\n",
e->u.u.type, e->u.keyButtonPointer.rootX,
e->u.keyButtonPointer.rootY);
*/
WriteToClient(lgeDisplayServerClient, sizeof(xEvent), (char *)e);
return;
}
#endif /* LG3D */
@ -1382,6 +1392,7 @@ xf86PostKeyboardEvent(DeviceIntPtr device,
#ifdef XFreeXDGA
/* if(!DGAStealKeyEvent(xf86EventQueue.pEnqueueScreen->myNum, xE)) */
#endif
ENQUEUE(xE);
}

View File

@ -55,6 +55,17 @@ SOFTWARE.
#include "pixmapstr.h"
#include "mivalidate.h"
#ifdef LG3D
#include "../Xext/lgeint.h"
extern void lg3dMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pNextSib,
VTKind kind);
extern void lg3dSlideAndSizeWindow (WindowPtr pWin, int x, int y,
unsigned int w, unsigned int h, WindowPtr pSib);
#endif /* LG3D */
void
miClearToBackground(pWin, x, y, w, h, generateExposures)
WindowPtr pWin;
@ -503,6 +514,18 @@ miMoveWindow(pWin, x, y, pNextSib, kind)
#endif
WindowPtr pLayerWin;
#ifdef LG3D
/*
** TODO: I tried to do this with wrappers but it didn't work.
** Is there a better way to override this function other than
** just directly modifying it?
*/
if (lgeDisplayServerIsAlive) {
lg3dMoveWindow(pWin, x, y, pNextSib, kind);
return;
}
#endif /* LG3D */
/* if this is a root window, can't be moved */
if (!(pParent = pWin->parent))
return ;
@ -637,6 +660,18 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
#endif
WindowPtr pLayerWin;
#ifdef LG3D
/*
** TODO: I tried to do this with wrappers but it didn't work.
** Is there a better way to override this function other than
** just directly modifying it?
*/
if (lgeDisplayServerIsAlive) {
lg3dSlideAndSizeWindow(pWin, x, y, w, h, pSib);
return;
}
#endif /* LG3D */
/* if this is a root window, can't be resized */
if (!(pParent = pWin->parent))
return ;

View File

@ -659,14 +659,26 @@ miInitializeCompositeWrapper(ScreenPtr pScreen)
cwInitializeRender(pScreen);
#endif
#ifdef LG3D
if (lgeDisplayServerIsAlive) {
SCREEN_EPILOGUE(pScreen, MoveWindow, lg3dMoveWindow);
SCREEN_EPILOGUE(pScreen, ResizeWindow, lg3dSlideAndSizeWindow);
}
#endif /* LG3D */
}
#ifdef LG3D
/*
** This is called when the LG Display Server first notifies
** the X server that it is alive. Note that we cannot initialize
** these screen functions earlier than this because the composite
** wrapper is initialized when the X server starts up and at that
** time it is not known whether the LG Display Server will be
** running.
*/
void
miInitializeCompositeWrapperForLG(ScreenPtr pScreen)
{
SCREEN_EPILOGUE(pScreen, MoveWindow, lg3dMoveWindow);
SCREEN_EPILOGUE(pScreen, ResizeWindow, lg3dSlideAndSizeWindow);
}
#endif /* LG3D */
static Bool
cwCloseScreen (int i, ScreenPtr pScreen)
{

View File

@ -32,6 +32,9 @@
#include "servermd.h"
#include "inputstr.h"
#include "windowstr.h"
#ifdef LG3D
#include "../Xext/lgeint.h"
#endif /* LG3D */
static RESTYPE CursorClientType;
static RESTYPE CursorWindowType;
@ -87,7 +90,39 @@ CursorDisplayCursor (ScreenPtr pScreen,
Bool ret;
Unwrap (cs, pScreen, DisplayCursor);
#ifdef LG3D
if (lgeDisplayServerIsAlive) {
ret = (*pScreen->DisplayCursor) (pScreen, pInvisibleCursor);
} else
#endif
ret = (*pScreen->DisplayCursor) (pScreen, pCursor);
#ifdef LG3D
{
CursorEventPtr e;
CursorCurrent = pCursor;
/* Always send events, except when cursor is null */
if (pCursor != NULL) {
for (e = cursorEvents; e; e = e->next)
{
if (e->eventMask & XFixesDisplayCursorNotifyMask)
{
xXFixesCursorNotifyEvent ev;
ev.type = XFixesEventBase + XFixesCursorNotify;
ev.subtype = XFixesDisplayCursorNotify;
ev.sequenceNumber = e->pClient->sequence;
ev.window = e->pWindow->drawable.id;
ev.cursorSerial = pCursor->serialNumber;
ev.timestamp = currentTime.milliseconds;
ev.name = pCursor->name;
WriteEventsToClient (e->pClient, 1, (xEvent *) &ev);
}
}
}
}
#else
if (pCursor != CursorCurrent)
{
CursorEventPtr e;
@ -109,6 +144,8 @@ CursorDisplayCursor (ScreenPtr pScreen,
}
}
}
#endif /* LG3D */
Wrap (cs, pScreen, DisplayCursor, CursorDisplayCursor);
return ret;
}
@ -303,6 +340,7 @@ ProcXFixesGetCursorImage (ClientPtr client)
int x, y;
REQUEST_SIZE_MATCH(xXFixesGetCursorImageReq);
pCursor = CursorCurrent;
if (!pCursor)
return BadCursor;