Unverified Commit 770f468c authored by Mike Gabriel's avatar Mike Gabriel

Merge branch 'uli42-pr/windowfixes' into 3.6.x

parents e5746df8 cbd9875e
......@@ -661,9 +661,12 @@ ProcListProperties(ClientPtr client)
return(client->noClientException);
}
#ifndef NXAGENT_SERVER
int
#ifdef NXAGENT_SERVER
xorg_ProcDeleteProperty(register ClientPtr client)
#else
ProcDeleteProperty(register ClientPtr client)
#endif
{
WindowPtr pWin;
REQUEST(xDeletePropertyReq);
......@@ -699,4 +702,3 @@ ProcDeleteProperty(register ClientPtr client)
else
return(result);
}
#endif
......@@ -2067,8 +2067,6 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
if (nxagentOption(Fullscreen))
{
nxagentVisibility = VisibilityUnobscured;
nxagentVisibilityStop = False;
nxagentVisibilityTimeout = GetTimeInMillis() + 2000;
}
/*
......
......@@ -180,11 +180,8 @@ ProcChangeProperty(ClientPtr client)
#ifdef NXAGENT_SERVER
/* prevent clients from changing the NX_AGENT_VERSION property */
{
Atom prop = MakeAtom("NX_AGENT_VERSION", strlen("NX_AGENT_VERSION"), True);
if (stuff->property == prop)
if (stuff->property == MakeAtom("NX_AGENT_VERSION", strlen("NX_AGENT_VERSION"), True))
return client->noClientException;
}
#endif
err = ChangeWindowProperty(pWin, stuff->property, stuff->type, (int)format,
......@@ -211,28 +208,6 @@ ProcChangeProperty(ClientPtr client)
}
}
int
ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
int mode, unsigned long len, void * value,
Bool sendevent)
{
int sizeInBytes = format>>3;
int totalSize = len * sizeInBytes;
int copySize = nxagentOption(CopyBufferSize);
if (copySize != COPY_UNLIMITED && property == clientCutProperty)
{
if (totalSize > copySize)
{
totalSize = copySize;
totalSize = totalSize - (totalSize % sizeInBytes);
len = totalSize / sizeInBytes;
}
}
return xorg_ChangeWindowProperty(pWin, property, type, format, mode, len, value, sendevent);
}
/*****************
* GetProperty
* If type Any is specified, returns the property from the specified
......@@ -446,29 +421,35 @@ ProcGetProperty(ClientPtr client)
return(client->noClientException);
}
#ifdef NXAGENT_CLIPBOARD
/* GetWindowProperty clipboard use only */
/* FIXME: that's wrong, it is also called in Window.c and Events.c */
/* FIXME: should be moved to a different file, is not derived from
dix */
int
GetWindowProperty(pWin, property, longOffset, longLength, delete,
type, actualType, format, nItems, bytesAfter, propData )
WindowPtr pWin;
Atom property;
long longOffset;
long longLength;
Bool delete;
Atom type;
Atom *actualType;
int *format;
unsigned long *nItems;
unsigned long *bytesAfter;
unsigned char **propData;
ProcDeleteProperty(register ClientPtr client)
{
PropertyPtr pProp, prevProp;
unsigned long n, len, ind;
REQUEST(xDeletePropertyReq);
REQUEST_SIZE_MATCH(xDeletePropertyReq);
/* prevent clients from deleting the NX_AGENT_VERSION property */
if (stuff->property == MakeAtom("NX_AGENT_VERSION", strlen("NX_AGENT_VERSION"), True))
return client->noClientException;
return xorg_ProcDeleteProperty(client);
}
/* ---------------------------------------------------------------------- */
/*
* GetWindowProperty is the internal implementation of the
* XGetWindowProperty() Xlib call. It is called from
* Clipboard.c, Window.c and Events.c
*
* FIXME: should be moved to a different file, is not derived from
* dix
*/
int
GetWindowProperty(WindowPtr pWin, Atom property, long longOffset,
long longLength, Bool delete, Atom type,
Atom *actualType, int *format, unsigned
long *nItems, unsigned long *bytesAfter,
unsigned char **propData)
{
if (!pWin)
{
#ifdef DEBUG
......@@ -482,18 +463,19 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
#ifdef DEBUG
fprintf(stderr, "%s: invalid atom [%d]\n", __func__, property);
#endif
return(BadAtom);
return BadAtom;
}
if ((type != AnyPropertyType) && !ValidAtom(type))
{
#ifdef DEBUG
fprintf(stderr, "%s: invalid type [%d]\n", __func__, type);
#endif
return(BadAtom);
return BadAtom;
}
pProp = wUserProps (pWin);
prevProp = (PropertyPtr)NULL;
PropertyPtr pProp = wUserProps (pWin);
PropertyPtr prevProp = (PropertyPtr)NULL;
while (pProp)
{
......@@ -508,7 +490,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
#ifdef DEBUG
fprintf(stderr, "%s: property not found [%d]\n", __func__, property);
#endif
return (BadAtom);
return BadAtom;
}
/* If the request type and actual type don't match. Return the
......@@ -522,14 +504,14 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
*format = pProp->format;
*nItems = 0;
*actualType = pProp->type;
return(Success);
return Success;
}
/*
* Return type, format, value to client
*/
n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */
ind = longOffset << 2;
unsigned long n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */
unsigned long ind = longOffset << 2; /* byte offset */
/* If longOffset is invalid such that it causes "len" to
be negative, it's a value error. */
......@@ -542,7 +524,8 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
return BadValue;
}
len = min(n - ind, 4 * longLength);
/* minimum of prop size and requested size */
unsigned long len = min(n - ind, 4 * longLength);
*bytesAfter = n - (ind + len);
*format = pProp->format;
......@@ -566,7 +549,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
}
if (delete && (*bytesAfter == 0))
{ /* delete the Property */
{ /* delete the property */
if (prevProp == (PropertyPtr)NULL) /* takes care of head */
{
if (!(pWin->optional->userProps = pProp->next))
......@@ -577,53 +560,27 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
free(pProp->data);
free(pProp);
}
return(Success);
return Success;
}
#endif
int
ProcDeleteProperty(register ClientPtr client)
ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
int mode, unsigned long len, void * value,
Bool sendevent)
{
WindowPtr pWin;
REQUEST(xDeletePropertyReq);
int result;
int sizeInBytes = format>>3;
int totalSize = len * sizeInBytes;
int copySize = nxagentOption(CopyBufferSize);
REQUEST_SIZE_MATCH(xDeletePropertyReq);
UpdateCurrentTime();
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
DixWriteAccess);
if (!pWin)
return(BadWindow);
if (!ValidAtom(stuff->property))
if (copySize != COPY_UNLIMITED && property == clientCutProperty)
{
client->errorValue = stuff->property;
return (BadAtom);
}
#ifdef XCSECURITY
switch(SecurityCheckPropertyAccess(client, pWin, stuff->property,
DixDestroyAccess))
if (totalSize > copySize)
{
case SecurityErrorOperation:
client->errorValue = stuff->property;
return BadAtom;;
case SecurityIgnoreOperation:
return Success;
totalSize = copySize;
totalSize = totalSize - (totalSize % sizeInBytes);
len = totalSize / sizeInBytes;
}
#endif
#ifdef NXAGENT_SERVER
/* prevent clients from deleting the NX_AGENT_VERSION property */
{
Atom prop = MakeAtom("NX_AGENT_VERSION", strlen("NX_AGENT_VERSION"), True);
if (stuff->property == prop)
return client->noClientException;
}
#endif
result = DeleteProperty(pWin, stuff->property);
if (client->noClientException != Success)
return(client->noClientException);
else
return(result);
return xorg_ChangeWindowProperty(pWin, property, type, format, mode, len, value, sendevent);
}
......@@ -80,8 +80,6 @@ int nxagentWindowPrivateIndex;
*/
int nxagentVisibility = VisibilityUnobscured;
unsigned long nxagentVisibilityTimeout = 0;
Bool nxagentVisibilityStop = False;
ConfiguredWindowStruct *nxagentConfiguredWindowList;
StaticResizedWindowStruct *nxagentStaticResizedWindowList;
......@@ -3089,6 +3087,11 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
#endif
/* FIXME: use XAllocSizeHints() */
/* FIXME: all this copying is only done because the first
element of the XSizeHints struct is a long which is of
different size on 32bit vs. 64bit platforms. We should
rewrite this to better readable and probably more robust
code */
#ifdef _XSERVER64
data64 = (unsigned char *) malloc(sizeof(XSizeHints) + 4);
if (data64)
......@@ -3106,10 +3109,6 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
}
XSizeHints *props = (XSizeHints *) data64;
#else
XSizeHints *props = (XSizeHints *) data;
#endif /* _XSERVER64 */
hints = *props;
}
else
......@@ -3118,6 +3117,10 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
fprintf(stderr, "%s: Failed to alloc memory for XSizeHints\n", __func__);
#endif
}
#else
XSizeHints *props = (XSizeHints *) data;
hints = *props;
#endif /* _XSERVER64 */
}
else
{
......
......@@ -256,8 +256,6 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask);
*/
extern int nxagentVisibility;
extern unsigned long nxagentVisibilityTimeout;
extern Bool nxagentVisibilityStop;
/*
* Return the pointer to the window given the remote id. It tries to
......
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