Commit 6eaa11da authored by Deron Johnson's avatar Deron Johnson
Browse files

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

parent cc390e4e
......@@ -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);
......
......@@ -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);
}
......
......@@ -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
......
......@@ -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");
}
......
/* $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
......
This diff is collapsed.
......@@ -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);
}
......
......@@ -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 ;
......
......@@ -659,13 +659,25 @@ miInitializeCompositeWrapper(ScreenPtr pScreen)
cwInitializeRender(pScreen);
#endif
}
#ifdef LG3D
if (lgeDisplayServerIsAlive) {
SCREEN_EPILOGUE(pScreen, MoveWindow, lg3dMoveWindow);
SCREEN_EPILOGUE(pScreen, ResizeWindow, lg3dSlideAndSizeWindow);
}
#endif /* 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)
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment