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
a4346133
Commit
a4346133
authored
Apr 26, 2016
by
Mike Gabriel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hw/nxagent/NXproperty.c: Shrink file, drop duplicate code that can identically…
hw/nxagent/NXproperty.c: Shrink file, drop duplicate code that can identically be found in dix/property.c.
parent
c6f86b3b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
326 deletions
+8
-326
Imakefile
nx-X11/programs/Xserver/dix/Imakefile
+2
-2
property.c
nx-X11/programs/Xserver/dix/property.c
+5
-0
NXproperty.c
nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
+1
-324
No files found.
nx-X11/programs/Xserver/dix/Imakefile
View file @
a4346133
...
...
@@ -18,6 +18,7 @@ NXAGENT_SKIP_SRCS = \
events.c \
extension.c \
glyphcurs.c \
property.c \
resource.c \
window.c \
$(NULL)
...
...
@@ -25,6 +26,7 @@ NXAGENT_SKIP_OBJS = \
events.o \
extension.o \
glyphcurs.o \
property.o \
resource.o \
window.o \
$(NULL)
...
...
@@ -42,7 +44,6 @@ SRCS = \
globals.c \
grabs.c \
main.c \
property.c \
region.c \
swaprep.c \
swapreq.c \
...
...
@@ -66,7 +67,6 @@ OBJS = \
globals.o \
grabs.o \
main.o \
property.o \
region.o \
swaprep.o \
swapreq.o \
...
...
nx-X11/programs/Xserver/dix/property.c
View file @
a4346133
...
...
@@ -188,6 +188,7 @@ found:
return
Success
;
}
#ifndef NXAGENT_SERVER
int
ProcChangeProperty
(
ClientPtr
client
)
{
...
...
@@ -368,6 +369,7 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
}
return
(
Success
);
}
#endif
/* NXAGENT_SERVER */
int
DeleteProperty
(
WindowPtr
pWin
,
Atom
propName
)
...
...
@@ -446,6 +448,8 @@ NullPropertyReply(
return
(
client
->
noClientException
);
}
#ifndef NXAGENT_SERVER
/*****************
* GetProperty
* If type Any is specified, returns the property from the specified
...
...
@@ -600,6 +604,7 @@ ProcGetProperty(ClientPtr client)
}
return
(
client
->
noClientException
);
}
#endif
/* NXAGENT_SERVER */
int
ProcListProperties
(
ClientPtr
client
)
...
...
nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
View file @
a4346133
...
...
@@ -64,42 +64,13 @@ SOFTWARE.
******************************************************************/
/* $Xorg: property.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <nx-X11/X.h>
#define NEED_REPLIES
#define NEED_EVENTS
#include <nx-X11/Xproto.h>
#include "windowstr.h"
#include "propertyst.h"
#include "dixstruct.h"
#include "../../dix/dispatch.h"
#include "swaprep.h"
#ifdef XCSECURITY
#define _SECURITY_SERVER
#include <nx-X11/extensions/security.h>
#endif
#ifdef LBX
#include "lbxserve.h"
#include "lbxtags.h"
#endif
#include "../../dix/property.c"
#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 */
int fWriteToClient(ClientPtr client, int len, char *buf)
{
return WriteToClient(client, len, buf);
}
#endif
#endif
extern
Atom
clientCutProperty
;
#ifdef NXAGENT_SERVER
...
...
@@ -111,129 +82,6 @@ typedef struct
nxagentWMStateRec
;
#endif
/*****************************************************************
* Property Stuff
*
* ChangeProperty, DeleteProperty, GetProperties,
* ListProperties
*
* Properties below to windows. A allocate slots each time
* a property is added. No fancy searching done.
*
*****************************************************************/
#ifdef notdef
static
void
PrintPropertys
(
WindowPtr
pWin
)
{
PropertyPtr
pProp
;
register
int
j
;
pProp
=
pWin
->
userProps
;
while
(
pProp
)
{
ErrorF
(
"%x %x
\n
"
,
pProp
->
propertyName
,
pProp
->
type
);
ErrorF
(
"property format: %d
\n
"
,
pProp
->
format
);
ErrorF
(
"property data:
\n
"
);
for
(
j
=
0
;
j
<
(
pProp
->
format
/
8
)
*
pProp
->
size
;
j
++
)
ErrorF
(
"%c
\n
"
,
pProp
->
data
[
j
]);
pProp
=
pProp
->
next
;
}
}
#endif
int
ProcRotateProperties
(
ClientPtr
client
)
{
int
i
,
j
,
delta
;
REQUEST
(
xRotatePropertiesReq
);
WindowPtr
pWin
;
register
Atom
*
atoms
;
PropertyPtr
*
props
;
/* array of pointer */
PropertyPtr
pProp
;
xEvent
event
;
REQUEST_FIXED_SIZE
(
xRotatePropertiesReq
,
stuff
->
nAtoms
<<
2
);
UpdateCurrentTime
();
pWin
=
(
WindowPtr
)
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityWriteAccess
);
if
(
!
pWin
)
return
(
BadWindow
);
if
(
!
stuff
->
nAtoms
)
return
(
Success
);
atoms
=
(
Atom
*
)
&
stuff
[
1
];
props
=
(
PropertyPtr
*
)
ALLOCATE_LOCAL
(
stuff
->
nAtoms
*
sizeof
(
PropertyPtr
));
if
(
!
props
)
return
(
BadAlloc
);
for
(
i
=
0
;
i
<
stuff
->
nAtoms
;
i
++
)
{
#ifdef XCSECURITY
char
action
=
SecurityCheckPropertyAccess
(
client
,
pWin
,
atoms
[
i
],
SecurityReadAccess
|
SecurityWriteAccess
);
#endif
if
(
!
ValidAtom
(
atoms
[
i
])
#ifdef XCSECURITY
||
(
SecurityErrorOperation
==
action
)
#endif
)
{
DEALLOCATE_LOCAL
(
props
);
client
->
errorValue
=
atoms
[
i
];
return
BadAtom
;
}
#ifdef XCSECURITY
if
(
SecurityIgnoreOperation
==
action
)
{
DEALLOCATE_LOCAL
(
props
);
return
Success
;
}
#endif
for
(
j
=
i
+
1
;
j
<
stuff
->
nAtoms
;
j
++
)
if
(
atoms
[
j
]
==
atoms
[
i
])
{
DEALLOCATE_LOCAL
(
props
);
return
BadMatch
;
}
pProp
=
wUserProps
(
pWin
);
while
(
pProp
)
{
if
(
pProp
->
propertyName
==
atoms
[
i
])
goto
found
;
pProp
=
pProp
->
next
;
}
DEALLOCATE_LOCAL
(
props
);
return
BadMatch
;
found:
props
[
i
]
=
pProp
;
}
delta
=
stuff
->
nPositions
;
/* If the rotation is a complete 360 degrees, then moving the properties
around and generating PropertyNotify events should be skipped. */
if
(
(
stuff
->
nAtoms
!=
0
)
&&
(
abs
(
delta
)
%
stuff
->
nAtoms
)
!=
0
)
{
while
(
delta
<
0
)
/* faster if abs value is small */
delta
+=
stuff
->
nAtoms
;
for
(
i
=
0
;
i
<
stuff
->
nAtoms
;
i
++
)
{
/* Generate a PropertyNotify event for each property whose value
is changed in the order in which they appear in the request. */
event
.
u
.
u
.
type
=
PropertyNotify
;
event
.
u
.
property
.
window
=
pWin
->
drawable
.
id
;
event
.
u
.
property
.
state
=
PropertyNewValue
;
event
.
u
.
property
.
atom
=
props
[
i
]
->
propertyName
;
event
.
u
.
property
.
time
=
currentTime
.
milliseconds
;
DeliverEvents
(
pWin
,
&
event
,
1
,
(
WindowPtr
)
NULL
);
props
[
i
]
->
propertyName
=
atoms
[(
i
+
delta
)
%
stuff
->
nAtoms
];
}
}
DEALLOCATE_LOCAL
(
props
);
return
Success
;
}
int
ProcChangeProperty
(
ClientPtr
client
)
{
...
...
@@ -476,91 +324,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
#endif
}
int
DeleteProperty
(
WindowPtr
pWin
,
Atom
propName
)
{
PropertyPtr
pProp
,
prevProp
;
xEvent
event
;
if
(
!
(
pProp
=
wUserProps
(
pWin
)))
return
(
Success
);
prevProp
=
(
PropertyPtr
)
NULL
;
while
(
pProp
)
{
if
(
pProp
->
propertyName
==
propName
)
break
;
prevProp
=
pProp
;
pProp
=
pProp
->
next
;
}
if
(
pProp
)
{
if
(
prevProp
==
(
PropertyPtr
)
NULL
)
/* takes care of head */
{
if
(
!
(
pWin
->
optional
->
userProps
=
pProp
->
next
))
CheckWindowOptionalNeed
(
pWin
);
}
else
{
prevProp
->
next
=
pProp
->
next
;
}
#ifdef LBX
if
(
pProp
->
tag_id
)
TagDeleteTag
(
pProp
->
tag_id
);
#endif
event
.
u
.
u
.
type
=
PropertyNotify
;
event
.
u
.
property
.
window
=
pWin
->
drawable
.
id
;
event
.
u
.
property
.
state
=
PropertyDelete
;
event
.
u
.
property
.
atom
=
pProp
->
propertyName
;
event
.
u
.
property
.
time
=
currentTime
.
milliseconds
;
DeliverEvents
(
pWin
,
&
event
,
1
,
(
WindowPtr
)
NULL
);
xfree
(
pProp
->
data
);
xfree
(
pProp
);
}
return
(
Success
);
}
void
DeleteAllWindowProperties
(
WindowPtr
pWin
)
{
PropertyPtr
pProp
,
pNextProp
;
xEvent
event
;
pProp
=
wUserProps
(
pWin
);
while
(
pProp
)
{
#ifdef LBX
if
(
pProp
->
tag_id
)
TagDeleteTag
(
pProp
->
tag_id
);
#endif
event
.
u
.
u
.
type
=
PropertyNotify
;
event
.
u
.
property
.
window
=
pWin
->
drawable
.
id
;
event
.
u
.
property
.
state
=
PropertyDelete
;
event
.
u
.
property
.
atom
=
pProp
->
propertyName
;
event
.
u
.
property
.
time
=
currentTime
.
milliseconds
;
DeliverEvents
(
pWin
,
&
event
,
1
,
(
WindowPtr
)
NULL
);
pNextProp
=
pProp
->
next
;
xfree
(
pProp
->
data
);
xfree
(
pProp
);
pProp
=
pNextProp
;
}
}
static
int
NullPropertyReply
(
ClientPtr
client
,
ATOM
propertyType
,
int
format
,
xGetPropertyReply
*
reply
)
{
reply
->
nItems
=
0
;
reply
->
length
=
0
;
reply
->
bytesAfter
=
0
;
reply
->
propertyType
=
propertyType
;
reply
->
format
=
format
;
WriteReplyToClient
(
client
,
sizeof
(
xGenericReply
),
reply
);
return
(
client
->
noClientException
);
}
/*****************
* GetProperty
* If type Any is specified, returns the property from the specified
...
...
@@ -905,89 +668,3 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
return
(
Success
);
}
#endif
int
ProcListProperties
(
ClientPtr
client
)
{
Atom
*
pAtoms
=
NULL
,
*
temppAtoms
;
xListPropertiesReply
xlpr
;
int
numProps
=
0
;
WindowPtr
pWin
;
PropertyPtr
pProp
;
REQUEST
(
xResourceReq
);
REQUEST_SIZE_MATCH
(
xResourceReq
);
pWin
=
(
WindowPtr
)
SecurityLookupWindow
(
stuff
->
id
,
client
,
SecurityReadAccess
);
if
(
!
pWin
)
return
(
BadWindow
);
pProp
=
wUserProps
(
pWin
);
while
(
pProp
)
{
pProp
=
pProp
->
next
;
numProps
++
;
}
if
(
numProps
)
if
(
!
(
pAtoms
=
(
Atom
*
)
ALLOCATE_LOCAL
(
numProps
*
sizeof
(
Atom
))))
return
(
BadAlloc
);
xlpr
.
type
=
X_Reply
;
xlpr
.
nProperties
=
numProps
;
xlpr
.
length
=
(
numProps
*
sizeof
(
Atom
))
>>
2
;
xlpr
.
sequenceNumber
=
client
->
sequence
;
pProp
=
wUserProps
(
pWin
);
temppAtoms
=
pAtoms
;
while
(
pProp
)
{
*
temppAtoms
++
=
pProp
->
propertyName
;
pProp
=
pProp
->
next
;
}
WriteReplyToClient
(
client
,
sizeof
(
xGenericReply
),
&
xlpr
);
if
(
numProps
)
{
client
->
pSwapReplyFunc
=
(
ReplySwapPtr
)
Swap32Write
;
WriteSwappedDataToClient
(
client
,
numProps
*
sizeof
(
Atom
),
pAtoms
);
DEALLOCATE_LOCAL
(
pAtoms
);
}
return
(
client
->
noClientException
);
}
int
ProcDeleteProperty
(
register
ClientPtr
client
)
{
WindowPtr
pWin
;
REQUEST
(
xDeletePropertyReq
);
int
result
;
REQUEST_SIZE_MATCH
(
xDeletePropertyReq
);
UpdateCurrentTime
();
pWin
=
(
WindowPtr
)
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityWriteAccess
);
if
(
!
pWin
)
return
(
BadWindow
);
if
(
!
ValidAtom
(
stuff
->
property
))
{
client
->
errorValue
=
stuff
->
property
;
return
(
BadAtom
);
}
#ifdef XCSECURITY
switch
(
SecurityCheckPropertyAccess
(
client
,
pWin
,
stuff
->
property
,
SecurityDestroyAccess
))
{
case
SecurityErrorOperation
:
client
->
errorValue
=
stuff
->
property
;
return
BadAtom
;;
case
SecurityIgnoreOperation
:
return
Success
;
}
#endif
result
=
DeleteProperty
(
pWin
,
stuff
->
property
);
if
(
client
->
noClientException
!=
Success
)
return
(
client
->
noClientException
);
else
return
(
result
);
}
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