aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2020-10-02 22:59:12 +0200
committerUlrich Sibiller <uli42@gmx.de>2021-06-08 21:16:37 +0200
commit18c91fd94c8bba7de44110e9db9daf41ee6f916d (patch)
tree744910d396b55fe81be8a4a0703e9d43a5de9667
parent972a92cab16a99d86a5b66b03967229799f1216d (diff)
downloadnx-libs-18c91fd94c8bba7de44110e9db9daf41ee6f916d.tar.gz
nx-libs-18c91fd94c8bba7de44110e9db9daf41ee6f916d.tar.bz2
nx-libs-18c91fd94c8bba7de44110e9db9daf41ee6f916d.zip
Clipboard.c: improve error message
if we get an unexpected property print that as an error. Before we saw "unexpected stage" in that case which does not really help in debugging...
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Clipboard.c57
1 files changed, 37 insertions, 20 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index bb8ca5843..f704e4702 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -1330,8 +1330,8 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X)
}
#ifdef DEBUG
+ XSelectionEvent * e = (XSelectionEvent *)X;
{
- XSelectionEvent * e = (XSelectionEvent *)X;
char * s = XGetAtomName(nxagentDisplay, e->property);
char * t = XGetAtomName(nxagentDisplay, e->target);
fprintf(stderr, "%s: SelectionNotify event from real X server, property "\
@@ -1355,29 +1355,46 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X)
* the real X server). We now need to transfer it to the original
* requestor, which is stored in the lastClient* variables.
*/
- if (lastClientStage == SelectionStageNone &&
- X->xselection.property == serverTransToAgentProperty)
+
+ #ifdef DEBUG
+ fprintf(stderr, "%s: event selection is [%s]\n", __func__, XGetAtomName(nxagentDisplay, e->selection));
+ nxagentDumpClipboardStat();
+ #endif
+ if (lastClientStage == SelectionStageNone)
{
- #ifdef DEBUG
- fprintf(stderr, "%s: Starting selection transferral for client %s.\n", __func__,
- nxagentClientInfoString(lastClientClientPtr));
- #endif
+ if (X->xselection.property == serverTransToAgentProperty)
+ {
+ #ifdef DEBUG
+ fprintf(stderr, "%s: Starting selection transferral for client %s.\n", __func__,
+ nxagentClientInfoString(lastClientClientPtr));
+ #endif
- /*
- * The state machine is able to work in two phases. In the first
- * phase we get the size of property data, in the second we get
- * the actual data. We save a round-trip by requesting a prede-
- * termined amount of data in a single GetProperty and by discar-
- * ding the remaining part. This is not the optimal solution (we
- * could get the remaining part if it doesn't fit in a single
- * reply) but, at least with text, it should work in most situa-
- * tions.
- */
+ /*
+ * The state machine is able to work in two phases. In the first
+ * phase we get the size of property data, in the second we get
+ * the actual data. We save a round-trip by requesting a prede-
+ * termined amount of data in a single GetProperty and by discar-
+ * ding the remaining part. This is not the optimal solution (we
+ * could get the remaining part if it doesn't fit in a single
+ * reply) but, at least with text, it should work in most situa-
+ * tions.
+ */
- setClientSelectionStage(SelectionStageQueryData);
- lastClientPropertySize = 262144;
+ setClientSelectionStage(SelectionStageQueryData);
+ lastClientPropertySize = 262144;
- transferSelection(lastClientClientPtr -> index);
+ transferSelection(lastClientClientPtr -> index);
+ }
+ else
+ {
+ #ifdef DEBUG
+ char *s = XGetAtomName(nxagentDisplay, X->xselection.property);
+ fprintf(stderr, "%s: Unexpected property [%ld][%s] - reporting conversion failure.\n",
+ __func__, X->xselection.property, s);
+ SAFE_XFree(s);
+ #endif
+ endTransfer(SELECTION_FAULT);
+ }
}
else
{