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
c539e0ca
You need to sign in or sign up before continuing.
Commit
c539e0ca
authored
Jun 30, 2019
by
Ulrich Sibiller
Committed by
Mike Gabriel
Sep 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NXproperty.c: reformat GetWindowProperty to increase readability
parent
7fa6c880
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
23 deletions
+24
-23
NXproperty.c
nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
+24
-23
No files found.
nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
View file @
c539e0ca
...
@@ -549,14 +549,17 @@ ProcGetProperty(ClientPtr client)
...
@@ -549,14 +549,17 @@ ProcGetProperty(ClientPtr client)
#ifdef NXAGENT_CLIPBOARD
#ifdef NXAGENT_CLIPBOARD
/* GetWindowProperty clipboard use only */
/* GetWindowProperty clipboard use only */
/* FIXME: that's wrong, it is also called in Window.c and Events. */
/* FIXME: should be moved to a different file, is not derived from
dix */
int
int
GetWindowProperty
(
pWin
,
property
,
longOffset
,
longLength
,
delete
,
GetWindowProperty
(
pWin
,
property
,
longOffset
,
longLength
,
delete
,
type
,
actualType
,
format
,
nItems
,
bytesAfter
,
propData
)
type
,
actualType
,
format
,
nItems
,
bytesAfter
,
propData
)
WindowPtr
pWin
;
WindowPtr
pWin
;
Atom
property
;
Atom
property
;
long
longOffset
;
long
longOffset
;
long
longLength
;
long
longLength
;
Bool
delete
;
Bool
delete
;
Atom
type
;
Atom
type
;
Atom
*
actualType
;
Atom
*
actualType
;
int
*
format
;
int
*
format
;
...
@@ -569,24 +572,24 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
...
@@ -569,24 +572,24 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
if
(
!
pWin
)
if
(
!
pWin
)
{
{
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"%s: invalid window
\n
"
,
__func__
);
fprintf
(
stderr
,
"%s: invalid window
\n
"
,
__func__
);
#endif
#endif
return
BadWindow
;
return
BadWindow
;
}
}
if
(
!
ValidAtom
(
property
))
if
(
!
ValidAtom
(
property
))
{
{
#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
);
}
}
...
@@ -604,14 +607,14 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
...
@@ -604,14 +607,14 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
if
(
!
pProp
)
if
(
!
pProp
)
{
{
#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
property information, but not the data. */
property information, but not the data. */
if
(((
type
!=
pProp
->
type
)
&&
if
(((
type
!=
pProp
->
type
)
&&
(
type
!=
AnyPropertyType
))
(
type
!=
AnyPropertyType
))
...
@@ -624,20 +627,20 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
...
@@ -624,20 +627,20 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
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 */
n
=
(
pProp
->
format
/
8
)
*
pProp
->
size
;
/* size (bytes) of prop */
ind
=
longOffset
<<
2
;
ind
=
longOffset
<<
2
;
/* 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. */
if
(
n
<
ind
)
if
(
n
<
ind
)
{
{
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"%s: negative property len
\n
"
,
__func__
);
fprintf
(
stderr
,
"%s: negative property len
\n
"
,
__func__
);
#endif
#endif
return
BadValue
;
return
BadValue
;
}
}
...
@@ -650,9 +653,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
...
@@ -650,9 +653,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
if
(
delete
&&
(
*
bytesAfter
==
0
))
if
(
delete
&&
(
*
bytesAfter
==
0
))
{
/* send the event */
{
/* send the event */
xEvent
event
;
xEvent
event
=
{
0
};
memset
(
&
event
,
0
,
sizeof
(
xEvent
));
event
.
u
.
u
.
type
=
PropertyNotify
;
event
.
u
.
u
.
type
=
PropertyNotify
;
event
.
u
.
property
.
window
=
pWin
->
drawable
.
id
;
event
.
u
.
property
.
window
=
pWin
->
drawable
.
id
;
event
.
u
.
property
.
state
=
PropertyDelete
;
event
.
u
.
property
.
state
=
PropertyDelete
;
...
@@ -663,7 +664,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
...
@@ -663,7 +664,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
if
(
len
)
if
(
len
)
{
{
*
propData
=
(
unsigned
char
*
)(
pProp
->
data
)
+
ind
;
*
propData
=
(
unsigned
char
*
)(
pProp
->
data
)
+
ind
;
}
}
if
(
delete
&&
(
*
bytesAfter
==
0
))
if
(
delete
&&
(
*
bytesAfter
==
0
))
...
...
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