aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-02-03 14:46:20 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-02-03 14:46:20 +0100
commit770f468cd56cdd4c82bf4973a3505a3e8e4f01b4 (patch)
treeecdf41f1034fd1a851265d903be367875846fb1e
parente5746df802eff5c50e46ef5ee96b3f0e34a00003 (diff)
parentcbd9875e5ca3169d5aaa995e73ec1f67f29ca743 (diff)
downloadnx-libs-770f468cd56cdd4c82bf4973a3505a3e8e4f01b4.tar.gz
nx-libs-770f468cd56cdd4c82bf4973a3505a3e8e4f01b4.tar.bz2
nx-libs-770f468cd56cdd4c82bf4973a3505a3e8e4f01b4.zip
Merge branch 'uli42-pr/windowfixes' into 3.6.x
Attributes GH PR #994: https://github.com/ArcticaProject/nx-libs/pull/994
-rw-r--r--nx-X11/programs/Xserver/dix/property.c6
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Events.c2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXproperty.c153
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Window.c27
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Windows.h2
5 files changed, 74 insertions, 116 deletions
diff --git a/nx-X11/programs/Xserver/dix/property.c b/nx-X11/programs/Xserver/dix/property.c
index f0bfe1e65..37af8d592 100644
--- a/nx-X11/programs/Xserver/dix/property.c
+++ b/nx-X11/programs/Xserver/dix/property.c
@@ -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
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c
index 8e2313eac..a342cdee1 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Events.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c
@@ -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;
}
/*
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
index 97665d22e..8461f4a30 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
@@ -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)
- return client->noClientException;
- }
+ 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;
-
- 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
+ int sizeInBytes = format>>3;
+ int totalSize = len * sizeInBytes;
+ int copySize = nxagentOption(CopyBufferSize);
-#ifdef NXAGENT_SERVER
- /* prevent clients from deleting the NX_AGENT_VERSION property */
+ if (copySize != COPY_UNLIMITED && property == clientCutProperty)
{
- Atom prop = MakeAtom("NX_AGENT_VERSION", strlen("NX_AGENT_VERSION"), True);
- if (stuff->property == prop)
- return client->noClientException;
+ if (totalSize > copySize)
+ {
+ totalSize = copySize;
+ totalSize = totalSize - (totalSize % sizeInBytes);
+ len = totalSize / sizeInBytes;
+ }
}
-#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);
}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c
index d95f8f3ed..5f12fd48a 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Window.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c
@@ -80,8 +80,6 @@ int nxagentWindowPrivateIndex;
*/
int nxagentVisibility = VisibilityUnobscured;
-unsigned long nxagentVisibilityTimeout = 0;
-Bool nxagentVisibilityStop = False;
ConfiguredWindowStruct *nxagentConfiguredWindowList;
StaticResizedWindowStruct *nxagentStaticResizedWindowList;
@@ -3089,10 +3087,15 @@ 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)
- {
+ if (data64)
+ {
for (int i = 0; i < 4; i++)
{
*(data64 + i) = *(data + i);
@@ -3106,18 +3109,18 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
}
XSizeHints *props = (XSizeHints *) data64;
- #else
- XSizeHints *props = (XSizeHints *) data;
- #endif /* _XSERVER64 */
-
hints = *props;
- }
- else
- {
+ }
+ else
+ {
#ifdef WARNING
fprintf(stderr, "%s: Failed to alloc memory for XSizeHints\n", __func__);
#endif
- }
+ }
+ #else
+ XSizeHints *props = (XSizeHints *) data;
+ hints = *props;
+ #endif /* _XSERVER64 */
}
else
{
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Windows.h b/nx-X11/programs/Xserver/hw/nxagent/Windows.h
index 8666ebec9..df27d4e53 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Windows.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Windows.h
@@ -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