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
067031a3
Commit
067031a3
authored
Feb 15, 2020
by
Ulrich Sibiller
Committed by
Mike Gabriel
May 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nxagent: use Xorg's callback mechanism for init/free of client privates
parent
78352049
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
28 deletions
+83
-28
dispatch.c
nx-X11/programs/Xserver/dix/dispatch.c
+0
-4
Client.c
nx-X11/programs/Xserver/hw/nxagent/Client.c
+75
-1
Client.h
nx-X11/programs/Xserver/hw/nxagent/Client.h
+1
-1
Init.c
nx-X11/programs/Xserver/hw/nxagent/Init.c
+6
-0
NXdispatch.c
nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
+1
-22
No files found.
nx-X11/programs/Xserver/dix/dispatch.c
View file @
067031a3
...
@@ -3642,11 +3642,7 @@ void InitClient(ClientPtr client, int i, void * ospriv)
...
@@ -3642,11 +3642,7 @@ void InitClient(ClientPtr client, int i, void * ospriv)
}
}
int
int
#ifdef NXAGENT_SERVER
xorg_InitClientPrivates
(
ClientPtr
client
)
#else
InitClientPrivates
(
ClientPtr
client
)
InitClientPrivates
(
ClientPtr
client
)
#endif
{
{
register
char
*
ptr
;
register
char
*
ptr
;
DevUnion
*
ppriv
;
DevUnion
*
ppriv
;
...
...
nx-X11/programs/Xserver/hw/nxagent/Client.c
View file @
067031a3
...
@@ -68,6 +68,10 @@
...
@@ -68,6 +68,10 @@
#undef TEST
#undef TEST
#undef DEBUG
#undef DEBUG
void
nxagentClientStateCallback
(
CallbackListPtr
*
callbacks
,
void
*
data
,
void
*
args
);
static
void
initClientPrivates
(
ClientPtr
client
);
static
void
freeClientPrivates
(
ClientPtr
client
);
/*
/*
* Returns the last signal delivered to the process.
* Returns the last signal delivered to the process.
*/
*/
...
@@ -106,8 +110,78 @@ int nxagentClientPrivateIndex;
...
@@ -106,8 +110,78 @@ int nxagentClientPrivateIndex;
int
nxagentShadowCounter
=
0
;
int
nxagentShadowCounter
=
0
;
void
nxagentInitClientPrivates
(
ClientPtr
client
)
/*
* called whenever the client state changes. See dixstruct.h for a
* list of known states.
*/
#ifdef DEBUG
const
char
*
getClientStateString
(
int
state
)
{
switch
(
state
)
{
case
ClientStateInitial
:
{
return
"Initial"
;
break
;
};
case
ClientStateAuthenticating
:
{
return
"Authenticating"
;
break
;
};
case
ClientStateRunning
:
{
return
"Running"
;
break
;
};
case
ClientStateRetained
:
{
return
"Retained"
;
break
;
};
case
ClientStateGone
:
{
return
"Gone"
;
break
;
};
case
ClientStateCheckingSecurity
:
{
return
"CheckingSecurity"
;
break
;
};
case
ClientStateCheckedSecurity
:
{
return
"CheckedSecurity"
;
break
;
};
default:
{
return
"UNKNOWN"
;
break
;
};
}
}
#endif
void
nxagentClientStateCallback
(
CallbackListPtr
*
callbacks
,
void
*
data
,
void
*
args
)
{
ClientPtr
client
=
((
NewClientInfoRec
*
)
args
)
->
client
;
#ifdef DEBUG
fprintf
(
stderr
,
"%s: client [%d] clientState [%s]
\n
"
,
__func__
,
client
->
index
,
getClientStateString
(
client
->
clientState
));
#endif
switch
(
client
->
clientState
)
{
case
ClientStateInitial
:
{
initClientPrivates
(
client
);
break
;
}
case
ClientStateGone
:
{
freeClientPrivates
(
client
);
break
;
}
default:
{
break
;
}
}
}
static
void
initClientPrivates
(
ClientPtr
client
)
{
{
#ifdef DEBUG
fprintf
(
stderr
,
"%s: called
\n
"
,
__func__
);
#endif
if
(
nxagentClientPriv
(
client
))
{
nxagentClientPriv
(
client
)
->
clientState
=
0
;
#ifdef COUNT_CLIENT_BYTES
nxagentClientPriv
(
client
)
->
clientBytes
=
0
;
#endif
nxagentClientPriv
(
client
)
->
clientHint
=
UNKNOWN
;
}
}
static
void
freeClientPrivates
(
ClientPtr
client
)
{
#ifdef DEBUG
fprintf
(
stderr
,
"%s: called
\n
"
,
__func__
);
#endif
if
(
nxagentClientPriv
(
client
))
if
(
nxagentClientPriv
(
client
))
{
{
nxagentClientPriv
(
client
)
->
clientState
=
0
;
nxagentClientPriv
(
client
)
->
clientState
=
0
;
...
...
nx-X11/programs/Xserver/hw/nxagent/Client.h
View file @
067031a3
...
@@ -57,7 +57,7 @@ extern int nxagentClientPrivateIndex;
...
@@ -57,7 +57,7 @@ extern int nxagentClientPrivateIndex;
#define nxagentClientPriv(pClient) \
#define nxagentClientPriv(pClient) \
((PrivClientRec *)((pClient)->devPrivates[nxagentClientPrivateIndex].ptr))
((PrivClientRec *)((pClient)->devPrivates[nxagentClientPrivateIndex].ptr))
void
nxagentInitClientPrivates
(
ClientPtr
);
extern
void
nxagentClientStateCallback
(
CallbackListPtr
*
callbacks
,
void
*
data
,
void
*
args
);
#undef COUNT_CLIENT_BYTES
#undef COUNT_CLIENT_BYTES
...
...
nx-X11/programs/Xserver/hw/nxagent/Init.c
View file @
067031a3
...
@@ -54,6 +54,7 @@ is" without express or implied warranty.
...
@@ -54,6 +54,7 @@ is" without express or implied warranty.
#include "mi.h"
#include "mi.h"
#include <X11/fonts/fontstruct.h>
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
#include "dixfontstr.h"
#include "dixstruct.h"
#include "Agent.h"
#include "Agent.h"
#include "Display.h"
#include "Display.h"
...
@@ -74,6 +75,7 @@ is" without express or implied warranty.
...
@@ -74,6 +75,7 @@ is" without express or implied warranty.
#include "Error.h"
#include "Error.h"
#include "Keystroke.h"
#include "Keystroke.h"
#include "Atoms.h"
#include "Atoms.h"
#include "Client.h"
#include <nx/NX.h>
#include <nx/NX.h>
#include "compext/Compext.h"
#include "compext/Compext.h"
...
@@ -386,9 +388,13 @@ FIXME: These variables, if not removed at all because have probably
...
@@ -386,9 +388,13 @@ FIXME: These variables, if not removed at all because have probably
nxagentInitKeystrokes
(
False
);
nxagentInitKeystrokes
(
False
);
#ifdef NXAGENT_CLIPBOARD
#ifdef NXAGENT_CLIPBOARD
/* FIXME: we need to call DeleteCallback at shutdown, but where? */
AddCallback
(
&
SelectionCallback
,
nxagentSetSelectionCallback
,
NULL
);
AddCallback
(
&
SelectionCallback
,
nxagentSetSelectionCallback
,
NULL
);
#endif
#endif
/* FIXME: we need to call DeleteCallback at shutdown, but where? */
AddCallback
(
&
ClientStateCallback
,
nxagentClientStateCallback
,
NULL
);
nxagentInitAtoms
();
nxagentInitAtoms
();
}
}
...
...
nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
View file @
067031a3
...
@@ -1009,29 +1009,8 @@ CloseDownClient(register ClientPtr client)
...
@@ -1009,29 +1009,8 @@ CloseDownClient(register ClientPtr client)
*/
*/
nxagentCheckIfShadowAgent
(
client
);
nxagentCheckIfShadowAgent
(
client
);
#endif
xorg_CloseDownClient
(
client
);
}
/* FIXME: Instead of having a own function use the provided Callback
mechanism */
int
InitClientPrivates
(
ClientPtr
client
)
{
int
ret
=
xorg_InitClientPrivates
(
client
);
#ifdef NXAGENT_SERVER
if
(
ret
==
1
)
{
/*
* Initialize the private members.
*/
nxagentInitClientPrivates
(
client
);
}
#endif
#endif
return
ret
;
xorg_CloseDownClient
(
client
)
;
}
}
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