Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
cb3e44a1
Commit
cb3e44a1
authored
Aug 05, 2019
by
Ulrich Sibiller
Committed by
Mike Gabriel
Sep 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clipboard.c: Refactor nxagentCollectPropertyEvent
parent
9006e19a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
83 deletions
+77
-83
Clipboard.c
nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+77
-83
No files found.
nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
View file @
cb3e44a1
...
@@ -930,6 +930,13 @@ void nxagentTransferSelection(int resource)
...
@@ -930,6 +930,13 @@ void nxagentTransferSelection(int resource)
}
}
}
}
/*
Called from Events.c/nxagentHandlePropertyNotify
This event is generated after XChangeProperty(), XDeleteProperty() or
XGetWindowProperty(delete=True)
*/
void
nxagentCollectPropertyEvent
(
int
resource
)
void
nxagentCollectPropertyEvent
(
int
resource
)
{
{
Atom
atomReturnType
;
Atom
atomReturnType
;
...
@@ -940,9 +947,8 @@ void nxagentCollectPropertyEvent(int resource)
...
@@ -940,9 +947,8 @@ void nxagentCollectPropertyEvent(int resource)
int
result
;
int
result
;
/*
/*
* We have received the notification so
* We have received the notification so we can safely retrieve data
* we can safely retrieve data from the
* from the client structure.
* client structure.
*/
*/
result
=
NXGetCollectedProperty
(
nxagentDisplay
,
result
=
NXGetCollectedProperty
(
nxagentDisplay
,
...
@@ -958,117 +964,105 @@ void nxagentCollectPropertyEvent(int resource)
...
@@ -958,117 +964,105 @@ void nxagentCollectPropertyEvent(int resource)
if
(
result
==
0
)
if
(
result
==
0
)
{
{
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"%s: Failed to get reply data for client [%d].
\n
"
,
__func__
,
fprintf
(
stderr
,
"%s: Failed to get reply data.
\n
"
,
__func__
);
CLINDEX
(
lastClientClientPtr
));
#endif
#endif
endTransfer
(
SELECTION_FAULT
);
endTransfer
(
SELECTION_FAULT
);
SAFE_XFree
(
pszReturnData
);
return
;
}
}
else
if
(
resultFormat
!=
8
&&
resultFormat
!=
16
&&
resultFormat
!=
32
)
if
(
resultFormat
!=
8
&&
resultFormat
!=
16
&&
resultFormat
!=
32
)
{
{
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"%s: WARNING! Invalid property
value
.
\n
"
,
__func__
);
fprintf
(
stderr
,
"%s: WARNING! Invalid property
format
.
\n
"
,
__func__
);
#endif
#endif
endTransfer
(
SELECTION_FAULT
);
endTransfer
(
SELECTION_FAULT
);
SAFE_XFree
(
pszReturnData
);
return
;
}
}
else
switch
(
lastClientStage
)
{
{
case
SelectionStageWaitSize
:
switch
(
lastClientStage
)
{
{
PrintClientSelectionStage
();
case
SelectionStageWaitSize
:
#ifdef DEBUG
fprintf
(
stderr
,
"%s: Got size notify event for client [%d].
\n
"
,
__func__
,
CLINDEX
(
lastClientClientPtr
));
#endif
if
(
ulReturnBytesLeft
==
0
)
{
{
PrintClientSelectionStage
();
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"%s:
Aborting selection notify procedure
for client [%d].
\n
"
,
__func__
,
fprintf
(
stderr
,
"%s:
Got size notify event
for client [%d].
\n
"
,
__func__
,
CLINDEX
(
lastClientClientPtr
));
CLINDEX
(
lastClientClientPtr
));
#endif
#endif
endTransfer
(
SELECTION_FAULT
);
if
(
ulReturnBytesLeft
==
0
)
{
SAFE_XFree
(
pszReturnData
);
#ifdef DEBUG
return
;
fprintf
(
stderr
,
"%s: Aborting selection notify procedure.
\n
"
,
__func__
);
}
#endif
#ifdef DEBUG
fprintf
(
stderr
,
"%s: Got property size from remote server.
\n
"
,
__func__
);
#endif
/*
* Request the selection data now.
*/
lastClientPropertySize
=
ulReturnBytesLeft
;
SetClientSelectionStage
(
QueryData
);
nxagentTransferSelection
(
resource
);
endTransfer
(
SELECTION_FAULT
);
}
else
{
#ifdef DEBUG
fprintf
(
stderr
,
"%s: Got property size from remote server.
\n
"
,
__func__
);
#endif
break
;
/*
}
* Request the selection data now.
case
SelectionStageWaitData
:
*/
{
lastClientPropertySize
=
ulReturnBytesLeft
;
PrintClientSelectionStage
();
SetClientSelectionStage
(
QueryData
);
#ifdef DEBUG
fprintf
(
stderr
,
"%s: Got data notify event for client [%d].
\n
"
,
__func__
,
CLINDEX
(
lastClientClientPtr
));
#endif
if
(
ulReturnBytesLeft
!=
0
)
nxagentTransferSelection
(
resource
);
}
break
;
}
case
SelectionStageWaitData
:
{
{
PrintClientSelectionStage
();
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"%s:
Aborting selection notify procedure
for client [%d].
\n
"
,
__func__
,
fprintf
(
stderr
,
"%s:
Got data notify event
for client [%d].
\n
"
,
__func__
,
CLINDEX
(
lastClientClientPtr
));
CLINDEX
(
lastClientClientPtr
));
#endif
#endif
endTransfer
(
SELECTION_FAULT
);
if
(
ulReturnBytesLeft
!=
0
)
{
SAFE_XFree
(
pszReturnData
);
#ifdef DEBUG
return
;
fprintf
(
stderr
,
"%s: Aborting selection notify procedure.
\n
"
,
__func__
);
}
#endif
#ifdef DEBUG
fprintf
(
stderr
,
"%s: Got property content from remote server.
\n
"
,
__func__
);
#endif
ChangeWindowProperty
(
lastClientWindowPtr
,
lastClientProperty
,
lastClientTarget
,
resultFormat
,
PropModeReplace
,
ulReturnItems
,
pszReturnData
,
1
);
#ifdef DEBUG
endTransfer
(
SELECTION_FAULT
);
fprintf
(
stderr
,
"%s: Selection property [%s] changed to [%s]
\n
"
,
__func__
,
}
validateString
(
NameForAtom
(
lastClientProperty
)),
pszReturnData
);
else
#endif
{
#ifdef DEBUG
fprintf
(
stderr
,
"%s: Got property content from remote server.
\n
"
,
__func__
);
#endif
endTransfer
(
SELECTION_SUCCESS
);
ChangeWindowProperty
(
lastClientWindowPtr
,
lastClientProperty
,
lastClientTarget
,
resultFormat
,
PropModeReplace
,
ulReturnItems
,
pszReturnData
,
1
);
break
;
#ifdef DEBUG
}
fprintf
(
stderr
,
"%s: Selection property [%d][%s] changed to [
\"
%*.*s
\"
...]
\n
"
,
__func__
,
default:
lastClientProperty
,
validateString
(
NameForAtom
(
lastClientProperty
)),
{
(
int
)(
min
(
20
,
ulReturnItems
*
resultFormat
/
8
)),
#ifdef DEBUG
(
int
)(
min
(
20
,
ulReturnItems
*
resultFormat
/
8
)),
fprintf
(
stderr
,
"%s: WARNING! Inconsistent state [%s] for client [%d].
\n
"
,
__func__
,
pszReturnData
);
GetClientSelectionStageString
(
lastClientStage
),
CLINDEX
(
lastClientClientPtr
));
#endif
#endif
break
;
endTransfer
(
SELECTION_SUCCESS
);
}
break
;
}
default:
{
#ifdef DEBUG
fprintf
(
stderr
,
"%s: WARNING! Inconsistent state [%s] for client [%d].
\n
"
,
__func__
,
GetClientSelectionStageString
(
lastClientStage
),
CLINDEX
(
lastClientClientPtr
));
#endif
break
;
}
}
}
}
}
SAFE_XFree
(
pszReturnData
);
SAFE_XFree
(
pszReturnData
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment