aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/X
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2011-10-10 17:58:31 +0200
committerReinhard Tartler <siretart@tauware.de>2011-10-10 17:58:31 +0200
commit3e7c6697ac2631a215691c8d23a32a790db33b85 (patch)
treee45f2e0b0b03b3f1f8c7c7512d0a8219f68a7cb6 /nx-X11/programs/Xserver/hw/nxagent/X
parent9e3371021541dbb7d8428b419c2e77156b166f1a (diff)
downloadnx-libs-3e7c6697ac2631a215691c8d23a32a790db33b85.tar.gz
nx-libs-3e7c6697ac2631a215691c8d23a32a790db33b85.tar.bz2
nx-libs-3e7c6697ac2631a215691c8d23a32a790db33b85.zip
Imported nxagent-3.1.0-6.tar.gznxagent/3.1.0-6
Summary: Imported nxagent-3.1.0-6.tar.gz Keywords: Imported nxagent-3.1.0-6.tar.gz into Git repository
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/X')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/X/NXproperty.c84
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/X/NXproperty.c.NX.original84
2 files changed, 168 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/X/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/X/NXproperty.c
index 3d08a3228..f58163488 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/X/NXproperty.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/X/NXproperty.c
@@ -89,6 +89,7 @@ SOFTWARE.
#include "Options.h"
#include "Rootless.h"
#include "Client.h"
+#include "Windows.h"
#if defined(LBX) || defined(LBX_COMPAT)
#if 0 /* no header in X11 environment, not used in X11 environment */
@@ -99,6 +100,17 @@ int fWriteToClient(ClientPtr client, int len, char *buf)
#endif
#endif
+extern Atom clientCutProperty;
+
+#ifdef NXAGENT_SERVER
+typedef struct
+{
+ CARD32 state;
+ Window icon;
+}
+nxagentWMStateRec;
+#endif
+
/*****************************************************************
* Property Stuff
*
@@ -343,10 +355,23 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
int sizeInBytes;
int totalSize;
pointer data;
+ int copySize;
sizeInBytes = format>>3;
totalSize = len * sizeInBytes;
+ copySize = nxagentOption(CopyBufferSize);
+
+ if (copySize != COPY_UNLIMITED && property == clientCutProperty)
+ {
+ if (totalSize > copySize)
+ {
+ totalSize = copySize;
+ totalSize = totalSize - (totalSize % sizeInBytes);
+ len = totalSize / sizeInBytes;
+ }
+ }
+
/* first see if property already exists */
pProp = wUserProps (pWin);
@@ -545,6 +570,11 @@ NullPropertyReply(
int
ProcGetProperty(ClientPtr client)
{
+ #ifdef NXAGENT_SERVER
+ nxagentWMStateRec wmState;
+ nxagentWMStateRec *wmsP = &wmState;
+ #endif
+
PropertyPtr pProp, prevProp;
unsigned long n, len, ind;
WindowPtr pWin;
@@ -552,6 +582,7 @@ ProcGetProperty(ClientPtr client)
REQUEST(xGetPropertyReq);
REQUEST_SIZE_MATCH(xGetPropertyReq);
+
if (stuff->delete)
UpdateCurrentTime();
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
@@ -587,6 +618,59 @@ ProcGetProperty(ClientPtr client)
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
+
+ #ifdef NXAGENT_SERVER
+
+ /*
+ * Creating a reply for WM_STATE property if it doesn't exist.
+ * This is intended to allow drag & drop work in JAva 1.6 when
+ * the agent is connected to NXWin in multiwindow mode.
+ */
+
+ if (nxagentOption(Rootless) &&
+ nxagentWindowTopLevel(pWin) &&
+ (!pProp) &&
+ strcmp(NameForAtom(stuff->property), "WM_STATE") == 0)
+ {
+ wmState.state = 1;
+ wmState.icon = None;
+
+ if (ChangeWindowProperty(pWin, stuff->property, stuff->property, 32, 0, 2, &wmState, 1) == Success)
+ {
+ nxagentExportProperty(pWin, stuff->property, stuff->property, 32, 0, 2, &wmState);
+ }
+
+ n = 8;
+ ind = stuff->longOffset << 2;
+
+ if (n < ind)
+ {
+ client->errorValue = stuff->longOffset;
+ return BadValue;
+ }
+
+ len = min(n - ind, 4 * stuff->longLength);
+
+ reply.bytesAfter = n - (ind + len);
+ reply.length = (len + 3) >> 2;
+
+ reply.format = 32;
+ reply.nItems = len / 4;
+ reply.propertyType = stuff->property;
+
+ WriteReplyToClient(client, sizeof(xGenericReply), &reply);
+
+ if (len)
+ {
+ client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
+
+ WriteSwappedDataToClient(client, len, (char *)wmsP + ind);
+ }
+
+ return(client->noClientException);
+ }
+ #endif
+
if (!pProp)
return NullPropertyReply(client, None, 0, &reply);
diff --git a/nx-X11/programs/Xserver/hw/nxagent/X/NXproperty.c.NX.original b/nx-X11/programs/Xserver/hw/nxagent/X/NXproperty.c.NX.original
index 3d08a3228..f58163488 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/X/NXproperty.c.NX.original
+++ b/nx-X11/programs/Xserver/hw/nxagent/X/NXproperty.c.NX.original
@@ -89,6 +89,7 @@ SOFTWARE.
#include "Options.h"
#include "Rootless.h"
#include "Client.h"
+#include "Windows.h"
#if defined(LBX) || defined(LBX_COMPAT)
#if 0 /* no header in X11 environment, not used in X11 environment */
@@ -99,6 +100,17 @@ int fWriteToClient(ClientPtr client, int len, char *buf)
#endif
#endif
+extern Atom clientCutProperty;
+
+#ifdef NXAGENT_SERVER
+typedef struct
+{
+ CARD32 state;
+ Window icon;
+}
+nxagentWMStateRec;
+#endif
+
/*****************************************************************
* Property Stuff
*
@@ -343,10 +355,23 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
int sizeInBytes;
int totalSize;
pointer data;
+ int copySize;
sizeInBytes = format>>3;
totalSize = len * sizeInBytes;
+ copySize = nxagentOption(CopyBufferSize);
+
+ if (copySize != COPY_UNLIMITED && property == clientCutProperty)
+ {
+ if (totalSize > copySize)
+ {
+ totalSize = copySize;
+ totalSize = totalSize - (totalSize % sizeInBytes);
+ len = totalSize / sizeInBytes;
+ }
+ }
+
/* first see if property already exists */
pProp = wUserProps (pWin);
@@ -545,6 +570,11 @@ NullPropertyReply(
int
ProcGetProperty(ClientPtr client)
{
+ #ifdef NXAGENT_SERVER
+ nxagentWMStateRec wmState;
+ nxagentWMStateRec *wmsP = &wmState;
+ #endif
+
PropertyPtr pProp, prevProp;
unsigned long n, len, ind;
WindowPtr pWin;
@@ -552,6 +582,7 @@ ProcGetProperty(ClientPtr client)
REQUEST(xGetPropertyReq);
REQUEST_SIZE_MATCH(xGetPropertyReq);
+
if (stuff->delete)
UpdateCurrentTime();
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
@@ -587,6 +618,59 @@ ProcGetProperty(ClientPtr client)
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
+
+ #ifdef NXAGENT_SERVER
+
+ /*
+ * Creating a reply for WM_STATE property if it doesn't exist.
+ * This is intended to allow drag & drop work in JAva 1.6 when
+ * the agent is connected to NXWin in multiwindow mode.
+ */
+
+ if (nxagentOption(Rootless) &&
+ nxagentWindowTopLevel(pWin) &&
+ (!pProp) &&
+ strcmp(NameForAtom(stuff->property), "WM_STATE") == 0)
+ {
+ wmState.state = 1;
+ wmState.icon = None;
+
+ if (ChangeWindowProperty(pWin, stuff->property, stuff->property, 32, 0, 2, &wmState, 1) == Success)
+ {
+ nxagentExportProperty(pWin, stuff->property, stuff->property, 32, 0, 2, &wmState);
+ }
+
+ n = 8;
+ ind = stuff->longOffset << 2;
+
+ if (n < ind)
+ {
+ client->errorValue = stuff->longOffset;
+ return BadValue;
+ }
+
+ len = min(n - ind, 4 * stuff->longLength);
+
+ reply.bytesAfter = n - (ind + len);
+ reply.length = (len + 3) >> 2;
+
+ reply.format = 32;
+ reply.nItems = len / 4;
+ reply.propertyType = stuff->property;
+
+ WriteReplyToClient(client, sizeof(xGenericReply), &reply);
+
+ if (len)
+ {
+ client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
+
+ WriteSwappedDataToClient(client, len, (char *)wmsP + ind);
+ }
+
+ return(client->noClientException);
+ }
+ #endif
+
if (!pProp)
return NullPropertyReply(client, None, 0, &reply);