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
a894fa8b
Commit
a894fa8b
authored
Dec 17, 2019
by
Ulrich Sibiller
Committed by
Mike Gabriel
Jan 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NXproperty.c: simplify ChangeWindowProperty
parent
11d9b74b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
110 deletions
+11
-110
property.c
nx-X11/programs/Xserver/dix/property.c
+7
-1
NXproperty.c
nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
+4
-109
No files found.
nx-X11/programs/Xserver/dix/property.c
View file @
a894fa8b
...
@@ -253,11 +253,18 @@ ProcChangeProperty(ClientPtr client)
...
@@ -253,11 +253,18 @@ ProcChangeProperty(ClientPtr client)
else
else
return
client
->
noClientException
;
return
client
->
noClientException
;
}
}
#endif
/* NXAGENT_SERVER */
int
int
#ifdef NXAGENT_SERVER
Xorg_ChangeWindowProperty
(
WindowPtr
pWin
,
Atom
property
,
Atom
type
,
int
format
,
int
mode
,
unsigned
long
len
,
void
*
value
,
Bool
sendevent
)
#else
ChangeWindowProperty
(
WindowPtr
pWin
,
Atom
property
,
Atom
type
,
int
format
,
ChangeWindowProperty
(
WindowPtr
pWin
,
Atom
property
,
Atom
type
,
int
format
,
int
mode
,
unsigned
long
len
,
void
*
value
,
int
mode
,
unsigned
long
len
,
void
*
value
,
Bool
sendevent
)
Bool
sendevent
)
#endif
{
{
PropertyPtr
pProp
;
PropertyPtr
pProp
;
int
sizeInBytes
;
int
sizeInBytes
;
...
@@ -367,7 +374,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
...
@@ -367,7 +374,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
}
}
return
(
Success
);
return
(
Success
);
}
}
#endif
/* NXAGENT_SERVER */
int
int
DeleteProperty
(
WindowPtr
pWin
,
Atom
propName
)
DeleteProperty
(
WindowPtr
pWin
,
Atom
propName
)
...
...
nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
View file @
a894fa8b
...
@@ -215,16 +215,9 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
...
@@ -215,16 +215,9 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
int
mode
,
unsigned
long
len
,
void
*
value
,
int
mode
,
unsigned
long
len
,
void
*
value
,
Bool
sendevent
)
Bool
sendevent
)
{
{
PropertyPtr
pProp
;
int
sizeInBytes
=
format
>>
3
;
int
sizeInBytes
;
int
totalSize
=
len
*
sizeInBytes
;
int
totalSize
;
int
copySize
=
nxagentOption
(
CopyBufferSize
);
void
*
data
;
int
copySize
;
sizeInBytes
=
format
>>
3
;
totalSize
=
len
*
sizeInBytes
;
copySize
=
nxagentOption
(
CopyBufferSize
);
if
(
copySize
!=
COPY_UNLIMITED
&&
property
==
clientCutProperty
)
if
(
copySize
!=
COPY_UNLIMITED
&&
property
==
clientCutProperty
)
{
{
...
@@ -236,105 +229,7 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
...
@@ -236,105 +229,7 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
}
}
}
}
/* first see if property already exists */
return
Xorg_ChangeWindowProperty
(
pWin
,
property
,
type
,
format
,
mode
,
len
,
value
,
sendevent
);
pProp
=
wUserProps
(
pWin
);
while
(
pProp
)
{
if
(
pProp
->
propertyName
==
property
)
break
;
pProp
=
pProp
->
next
;
}
if
(
!
pProp
)
/* just add to list */
{
if
(
!
pWin
->
optional
&&
!
MakeWindowOptional
(
pWin
))
return
(
BadAlloc
);
pProp
=
(
PropertyPtr
)
malloc
(
sizeof
(
PropertyRec
));
if
(
!
pProp
)
return
(
BadAlloc
);
data
=
(
void
*
)
malloc
(
totalSize
);
if
(
!
data
&&
len
)
{
free
(
pProp
);
return
(
BadAlloc
);
}
pProp
->
propertyName
=
property
;
pProp
->
type
=
type
;
pProp
->
format
=
format
;
pProp
->
data
=
data
;
if
(
len
)
memmove
((
char
*
)
data
,
(
char
*
)
value
,
totalSize
);
pProp
->
size
=
len
;
pProp
->
next
=
pWin
->
optional
->
userProps
;
pWin
->
optional
->
userProps
=
pProp
;
}
else
{
/* To append or prepend to a property the request format and type
must match those of the already defined property. The
existing format and type are irrelevant when using the mode
"PropModeReplace" since they will be written over. */
if
((
format
!=
pProp
->
format
)
&&
(
mode
!=
PropModeReplace
))
return
(
BadMatch
);
if
((
pProp
->
type
!=
type
)
&&
(
mode
!=
PropModeReplace
))
return
(
BadMatch
);
if
(
mode
==
PropModeReplace
)
{
if
(
totalSize
!=
pProp
->
size
*
(
pProp
->
format
>>
3
))
{
data
=
(
void
*
)
realloc
(
pProp
->
data
,
totalSize
);
if
(
!
data
&&
len
)
return
(
BadAlloc
);
pProp
->
data
=
data
;
}
if
(
len
)
memmove
((
char
*
)
pProp
->
data
,
(
char
*
)
value
,
totalSize
);
pProp
->
size
=
len
;
pProp
->
type
=
type
;
pProp
->
format
=
format
;
}
else
if
(
len
==
0
)
{
/* do nothing */
}
else
if
(
mode
==
PropModeAppend
)
{
data
=
(
void
*
)
realloc
(
pProp
->
data
,
sizeInBytes
*
(
len
+
pProp
->
size
));
if
(
!
data
)
return
(
BadAlloc
);
pProp
->
data
=
data
;
memmove
(
&
((
char
*
)
data
)[
pProp
->
size
*
sizeInBytes
],
(
char
*
)
value
,
totalSize
);
pProp
->
size
+=
len
;
}
else
if
(
mode
==
PropModePrepend
)
{
data
=
(
void
*
)
malloc
(
sizeInBytes
*
(
len
+
pProp
->
size
));
if
(
!
data
)
return
(
BadAlloc
);
memmove
(
&
((
char
*
)
data
)[
totalSize
],
(
char
*
)
pProp
->
data
,
(
int
)(
pProp
->
size
*
sizeInBytes
));
memmove
((
char
*
)
data
,
(
char
*
)
value
,
totalSize
);
free
(
pProp
->
data
);
pProp
->
data
=
data
;
pProp
->
size
+=
len
;
}
}
if
(
sendevent
)
{
xEvent
event
;
memset
(
&
event
,
0
,
sizeof
(
xEvent
));
event
.
u
.
u
.
type
=
PropertyNotify
;
event
.
u
.
property
.
window
=
pWin
->
drawable
.
id
;
event
.
u
.
property
.
state
=
PropertyNewValue
;
event
.
u
.
property
.
atom
=
pProp
->
propertyName
;
event
.
u
.
property
.
time
=
currentTime
.
milliseconds
;
DeliverEvents
(
pWin
,
&
event
,
1
,
(
WindowPtr
)
NULL
);
}
return
(
Success
);
}
}
/*****************
/*****************
...
...
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