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