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
f2dc8121
Project 'ximper/mkimage-profiles' was moved to 'ximperlinux/mkimage-profiles'. Please update any links and bookmarks that may still have the old path.
Unverified
Commit
f2dc8121
authored
May 07, 2020
by
Mike Gabriel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'uli42-pr/refactor_timeout' into 3.6.x
Attributes GH PR #899:
https://github.com/ArcticaProject/nx-libs/pull/899
parents
82fc54e5
fde52a9b
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
151 additions
and
389 deletions
+151
-389
dispatch.c
nx-X11/programs/Xserver/dix/dispatch.c
+0
-5
window.c
nx-X11/programs/Xserver/dix/window.c
+0
-2
Args.c
nx-X11/programs/Xserver/hw/nxagent/Args.c
+0
-2
Init.c
nx-X11/programs/Xserver/hw/nxagent/Init.c
+94
-0
Init.h
nx-X11/programs/Xserver/hw/nxagent/Init.h
+4
-0
NXdispatch.c
nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
+6
-155
NXwindow.c
nx-X11/programs/Xserver/hw/nxagent/NXwindow.c
+0
-123
Reconnect.c
nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
+3
-0
Screen.c
nx-X11/programs/Xserver/hw/nxagent/Screen.c
+44
-100
Screen.h
nx-X11/programs/Xserver/hw/nxagent/Screen.h
+0
-2
No files found.
nx-X11/programs/Xserver/dix/dispatch.c
View file @
f2dc8121
...
...
@@ -3167,8 +3167,6 @@ ProcQueryBestSize (register ClientPtr client)
return
(
client
->
noClientException
);
}
#ifndef NXAGENT_SERVER
int
ProcSetScreenSaver
(
register
ClientPtr
client
)
{
...
...
@@ -3224,7 +3222,6 @@ ProcSetScreenSaver (register ClientPtr client)
SetScreenSaverTimer
();
return
(
client
->
noClientException
);
}
#endif
/* NXAGENT_SERVER */
int
ProcGetScreenSaver
(
register
ClientPtr
client
)
...
...
@@ -3425,7 +3422,6 @@ ProcChangeCloseDownMode(register ClientPtr client)
}
}
#ifndef NXAGENT_SERVER
int
ProcForceScreenSaver
(
register
ClientPtr
client
)
{
REQUEST
(
xForceScreenSaverReq
);
...
...
@@ -3441,7 +3437,6 @@ int ProcForceScreenSaver(register ClientPtr client)
SaveScreens
(
SCREEN_SAVER_FORCER
,
(
int
)
stuff
->
mode
);
return
client
->
noClientException
;
}
#endif
/* NXAGENT_SERVER */
int
ProcNoOperation
(
register
ClientPtr
client
)
{
...
...
nx-X11/programs/Xserver/dix/window.c
View file @
f2dc8121
...
...
@@ -3334,7 +3334,6 @@ static void DrawLogo(
);
#endif
#ifndef NXAGENT_SERVER
void
SaveScreens
(
int
on
,
int
mode
)
{
...
...
@@ -3445,7 +3444,6 @@ SaveScreens(int on, int mode)
if
(
mode
==
ScreenSaverReset
)
SetScreenSaverTimer
();
}
#endif
/* NXAGENT_SERVER */
static
Bool
TileScreenSaver
(
int
i
,
int
kind
)
...
...
nx-X11/programs/Xserver/hw/nxagent/Args.c
View file @
f2dc8121
...
...
@@ -2081,8 +2081,6 @@ FIXME: In rootless mode the backing-store support is not functional yet.
{
fprintf
(
stderr
,
"Info: Using auto-disconnect timeout of %d seconds.
\n
"
,
nxagentOption
(
Timeout
));
nxagentAutoDisconnectTimeout
=
nxagentOption
(
Timeout
)
*
MILLI_PER_SECOND
;
}
#ifdef WATCH
...
...
nx-X11/programs/Xserver/hw/nxagent/Init.c
View file @
f2dc8121
...
...
@@ -40,11 +40,13 @@ is" without express or implied warranty.
#include <sys/types.h>
#include <unistd.h>
#include <stdarg.h>
#include <signal.h>
#include "X.h"
#include "Xproto.h"
#include "screenint.h"
#include "input.h"
#include "inputstr.h"
#include "misc.h"
#include "scrnintstr.h"
#include "windowstr.h"
...
...
@@ -137,6 +139,8 @@ extern void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data,
void
*
args
);
#endif
OsTimerPtr
nxagentTimeoutTimer
=
NULL
;
extern
const
char
*
nxagentProgName
;
void
ddxInitGlobals
(
void
)
...
...
@@ -476,6 +480,96 @@ void ddxBeforeReset(void)
{
}
CARD32
nxagentTimeoutCallback
(
OsTimerPtr
timer
,
CARD32
now
,
void
*
arg
)
{
CARD32
idle
=
now
-
lastDeviceEventTime
.
milliseconds
;
#ifdef TEST
fprintf
(
stderr
,
"%s: called, idle [%d] timeout [%d]
\n
"
,
__func__
,
idle
,
nxagentOption
(
Timeout
)
*
MILLI_PER_SECOND
);
#endif
/* Set the time to exactly match the remaining time until timeout */
if
(
idle
<
nxagentOption
(
Timeout
)
*
MILLI_PER_SECOND
)
{
return
nxagentOption
(
Timeout
)
*
MILLI_PER_SECOND
-
idle
;
}
/*
* The lastDeviceEventTime is updated every time a device event is
* received, and it is used by WaitForSomething() to know when the
* SaveScreens() function should be called. This solution doesn't
* take care of a pointer button not being released, so we have to
* handle this case by ourselves.
*/
/*
FIXME: Do we need to check the key grab if the
autorepeat feature is disabled?
*/
if
(
inputInfo
.
pointer
->
button
->
buttonsDown
>
0
)
{
#ifdef TEST
fprintf
(
stderr
,
"%s: Prolonging timeout - there is a pointer button down.
\n
"
,
__func__
);
#endif
/* wait 10s more */
return
10
*
MILLI_PER_SECOND
;
}
if
(
nxagentSessionState
==
SESSION_UP
)
{
if
(
nxagentClients
==
0
)
{
fprintf
(
stderr
,
"Info: Auto-terminating session with no client running.
\n
"
);
raise
(
SIGTERM
);
}
else
if
(
nxagentOption
(
Persistent
)
==
0
)
{
fprintf
(
stderr
,
"Info: Auto-terminating session with persistence not allowed.
\n
"
);
raise
(
SIGTERM
);
}
else
{
fprintf
(
stderr
,
"Info: Auto-suspending session with %d clients running.
\n
"
,
nxagentClients
);
raise
(
SIGHUP
);
}
}
/*
* we do not need the timer anymore, so do not set a new time. The
* signals above will either terminate or suspend the session. At
* resume we will re-init the timer.
*/
return
0
;
}
void
nxagentSetTimeoutTimer
(
unsigned
int
millis
)
{
if
(
nxagentOption
(
Timeout
)
>
0
)
{
if
(
millis
==
0
)
{
millis
=
nxagentOption
(
Timeout
)
*
MILLI_PER_SECOND
;
}
#ifdef TEST
fprintf
(
stderr
,
"%s: Setting auto-disconnect timeout to [%dms]
\n
"
,
__func__
,
millis
);
#endif
nxagentTimeoutTimer
=
TimerSet
(
nxagentTimeoutTimer
,
0
,
millis
,
nxagentTimeoutCallback
,
NULL
);
}
}
void
nxagentFreeTimeoutTimer
(
void
)
{
#ifdef TEST
fprintf
(
stderr
,
"%s: freeing timeout timer
\n
"
,
__func__
);
#endif
TimerFree
(
nxagentTimeoutTimer
);
nxagentTimeoutTimer
=
NULL
;
}
void
OsVendorInit
(
void
)
{
return
;
...
...
nx-X11/programs/Xserver/hw/nxagent/Init.h
View file @
f2dc8121
...
...
@@ -52,4 +52,8 @@ extern ServerGrabInfoRec nxagentGrabServerInfo;
void
nxagentNotifyConnection
(
int
fd
,
int
ready
,
void
*
data
);
CARD32
nxagentTimeoutCallback
(
OsTimerPtr
timer
,
CARD32
now
,
void
*
arg
);
void
nxagentSetTimeoutTimer
(
unsigned
int
millis
);
void
nxagentFreeTimeoutTimer
(
void
);
#endif
/* __Init_H__ */
nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
View file @
f2dc8121
...
...
@@ -125,6 +125,7 @@ Equipment Corporation.
#include <nx/Shadow.h>
#include "Handlers.h"
#include "Keyboard.h"
#include "Init.h"
const
int
nxagentMaxFontNames
=
10000
;
...
...
@@ -139,12 +140,6 @@ void nxagentWaitDisplay(void);
void
nxagentListRemoteFonts
(
const
char
*
,
int
);
/*
* Timeouts based on screen saver time.
*/
int
nxagentAutoDisconnectTimeout
=
0
;
#include "Xatom.h"
/*
...
...
@@ -312,6 +307,9 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
if
(
!
(
dispatchException
&
DE_TERMINATE
))
dispatchException
=
0
;
/* Init TimeoutTimer if requested */
nxagentSetTimeoutTimer
(
0
);
#endif
/* NXAGENT_SERVER */
while
(
!
dispatchException
)
...
...
@@ -547,6 +545,8 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
#endif
#ifdef NXAGENT_SERVER
nxagentFreeTimeoutTimer
();
/* FIXME: maybe move the code up to the KillAllClients() call to ddxBeforeReset? */
if
((
dispatchException
&
DE_RESET
)
&&
(
serverGeneration
>
nxagentMaxAllowedResets
))
...
...
@@ -978,155 +978,6 @@ ProcFreePixmap(register ClientPtr client)
}
}
int
ProcSetScreenSaver
(
register
ClientPtr
client
)
{
int
blankingOption
,
exposureOption
;
REQUEST
(
xSetScreenSaverReq
);
REQUEST_SIZE_MATCH
(
xSetScreenSaverReq
);
blankingOption
=
stuff
->
preferBlank
;
if
((
blankingOption
!=
DontPreferBlanking
)
&&
(
blankingOption
!=
PreferBlanking
)
&&
(
blankingOption
!=
DefaultBlanking
))
{
client
->
errorValue
=
blankingOption
;
return
BadValue
;
}
exposureOption
=
stuff
->
allowExpose
;
if
((
exposureOption
!=
DontAllowExposures
)
&&
(
exposureOption
!=
AllowExposures
)
&&
(
exposureOption
!=
DefaultExposures
))
{
client
->
errorValue
=
exposureOption
;
return
BadValue
;
}
if
(
stuff
->
timeout
<
-
1
)
{
client
->
errorValue
=
stuff
->
timeout
;
return
BadValue
;
}
if
(
stuff
->
interval
<
-
1
)
{
client
->
errorValue
=
stuff
->
interval
;
return
BadValue
;
}
#ifdef NXAGENT_SERVER
/*
* The NX agent uses the screen saver procedure
* to monitor the user activities and launch its
* handlers (like timeout feature), so we can't
* always allow the clients to change our values.
*/
#ifdef TEST
fprintf
(
stderr
,
"ProcSetScreenSaver: Called with timeout [%d] interval [%d] Blanking [%d] Exposure [%d].
\n
"
,
stuff
->
timeout
,
stuff
->
interval
,
blankingOption
,
exposureOption
);
#endif
if
(
nxagentOption
(
Timeout
)
==
0
)
{
#endif
if
(
blankingOption
==
DefaultBlanking
)
{
ScreenSaverBlanking
=
defaultScreenSaverBlanking
;
}
else
{
ScreenSaverBlanking
=
blankingOption
;
}
if
(
exposureOption
==
DefaultExposures
)
{
ScreenSaverAllowExposures
=
defaultScreenSaverAllowExposures
;
}
else
{
ScreenSaverAllowExposures
=
exposureOption
;
}
if
(
stuff
->
timeout
>=
0
)
{
ScreenSaverTime
=
stuff
->
timeout
*
MILLI_PER_SECOND
;
}
else
{
ScreenSaverTime
=
defaultScreenSaverTime
;
}
if
(
stuff
->
interval
>=
0
)
{
ScreenSaverInterval
=
stuff
->
interval
*
MILLI_PER_SECOND
;
}
else
{
ScreenSaverInterval
=
defaultScreenSaverInterval
;
}
SetScreenSaverTimer
();
#ifdef NXAGENT_SERVER
}
#ifdef TEST
else
{
fprintf
(
stderr
,
"ProcSetScreenSaver: Keeping auto-disconnect timeout set to [%d] seconds.
\n
"
,
nxagentOption
(
Timeout
));
}
#endif
#endif
return
(
client
->
noClientException
);
}
int
ProcForceScreenSaver
(
register
ClientPtr
client
)
{
REQUEST
(
xForceScreenSaverReq
);
REQUEST_SIZE_MATCH
(
xForceScreenSaverReq
);
if
((
stuff
->
mode
!=
ScreenSaverReset
)
&&
(
stuff
->
mode
!=
ScreenSaverActive
))
{
client
->
errorValue
=
stuff
->
mode
;
return
BadValue
;
}
#ifdef NXAGENT_SERVER
/*
* The NX agent uses the screen saver procedure
* to monitor the user activities and launch its
* handlers (like timeout feature), so we can't
* always allow the clients to force the screen
* saver handler execution.
*/
if
(
nxagentOption
(
Timeout
)
==
0
)
{
#endif
SaveScreens
(
SCREEN_SAVER_FORCER
,
(
int
)
stuff
->
mode
);
#ifdef NXAGENT_SERVER
}
#ifdef TEST
else
{
fprintf
(
stderr
,
"ProcForceScreenSaver: Ignoring the client request with mode [%d].
\n
"
,
stuff
->
mode
);
}
#endif
#endif
return
client
->
noClientException
;
}
/**********************
* CloseDownClient
*
...
...
nx-X11/programs/Xserver/hw/nxagent/NXwindow.c
View file @
f2dc8121
...
...
@@ -783,126 +783,3 @@ MapWindow(register WindowPtr pWin, ClientPtr client)
return
(
Success
);
}
void
SaveScreens
(
int
on
,
int
mode
)
{
int
i
;
int
what
;
int
type
;
if
(
on
==
SCREEN_SAVER_FORCER
)
{
if
(
mode
==
ScreenSaverReset
)
what
=
SCREEN_SAVER_OFF
;
else
what
=
SCREEN_SAVER_ON
;
type
=
what
;
}
else
{
what
=
on
;
type
=
what
;
if
(
what
==
screenIsSaved
)
type
=
SCREEN_SAVER_CYCLE
;
}
for
(
i
=
0
;
i
<
screenInfo
.
numScreens
;
i
++
)
{
if
(
on
==
SCREEN_SAVER_FORCER
)
(
*
screenInfo
.
screens
[
i
]
->
SaveScreen
)
(
screenInfo
.
screens
[
i
],
on
);
if
(
savedScreenInfo
[
i
].
ExternalScreenSaver
)
{
#ifdef NXAGENT_SERVER
if
(
nxagentOption
(
Timeout
)
!=
0
)
{
#ifdef TEST
fprintf
(
stderr
,
"SaveScreens: An external screen-saver handler is installed. "
"Ignoring it to let the auto-disconnect feature work.
\n
"
);
#endif
}
else
#endif
{
if
((
*
savedScreenInfo
[
i
].
ExternalScreenSaver
)
(
screenInfo
.
screens
[
i
],
type
,
on
==
SCREEN_SAVER_FORCER
))
continue
;
}
}
if
(
type
==
screenIsSaved
)
continue
;
switch
(
type
)
{
case
SCREEN_SAVER_OFF
:
if
(
savedScreenInfo
[
i
].
blanked
==
SCREEN_IS_BLANKED
)
{
(
*
screenInfo
.
screens
[
i
]
->
SaveScreen
)
(
screenInfo
.
screens
[
i
],
what
);
}
else
if
(
HasSaverWindow
(
i
))
{
savedScreenInfo
[
i
].
pWindow
=
NullWindow
;
FreeResource
(
savedScreenInfo
[
i
].
wid
,
RT_NONE
);
}
break
;
case
SCREEN_SAVER_CYCLE
:
if
(
savedScreenInfo
[
i
].
blanked
==
SCREEN_IS_TILED
)
{
WindowPtr
pWin
=
savedScreenInfo
[
i
].
pWindow
;
/* make it look like screen saver is off, so that
* NotClippedByChildren will compute a clip list
* for the root window, so miPaintWindow works
*/
screenIsSaved
=
SCREEN_SAVER_OFF
;
#ifndef NOLOGOHACK
if
(
logoScreenSaver
)
(
*
pWin
->
drawable
.
pScreen
->
ClearToBackground
)(
pWin
,
0
,
0
,
0
,
0
,
FALSE
);
#endif
(
*
pWin
->
drawable
.
pScreen
->
MoveWindow
)(
pWin
,
(
short
)(
-
(
rand
()
%
RANDOM_WIDTH
)),
(
short
)(
-
(
rand
()
%
RANDOM_WIDTH
)),
pWin
->
nextSib
,
VTMove
);
#ifndef NOLOGOHACK
if
(
logoScreenSaver
)
DrawLogo
(
pWin
);
#endif
screenIsSaved
=
SCREEN_SAVER_ON
;
}
/*
* Call the DDX saver in case it wants to do something
* at cycle time
*/
else
if
(
savedScreenInfo
[
i
].
blanked
==
SCREEN_IS_BLANKED
)
{
(
*
screenInfo
.
screens
[
i
]
->
SaveScreen
)
(
screenInfo
.
screens
[
i
],
type
);
}
break
;
case
SCREEN_SAVER_ON
:
if
(
ScreenSaverBlanking
!=
DontPreferBlanking
)
{
if
((
*
screenInfo
.
screens
[
i
]
->
SaveScreen
)
(
screenInfo
.
screens
[
i
],
what
))
{
savedScreenInfo
[
i
].
blanked
=
SCREEN_IS_BLANKED
;
continue
;
}
if
((
ScreenSaverAllowExposures
!=
DontAllowExposures
)
&&
TileScreenSaver
(
i
,
SCREEN_IS_BLACK
))
{
savedScreenInfo
[
i
].
blanked
=
SCREEN_IS_BLACK
;
continue
;
}
}
if
((
ScreenSaverAllowExposures
!=
DontAllowExposures
)
&&
TileScreenSaver
(
i
,
SCREEN_IS_TILED
))
{
savedScreenInfo
[
i
].
blanked
=
SCREEN_IS_TILED
;
}
else
savedScreenInfo
[
i
].
blanked
=
SCREEN_ISNT_SAVED
;
break
;
}
}
screenIsSaved
=
what
;
if
(
mode
==
ScreenSaverReset
)
SetScreenSaverTimer
();
}
nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
View file @
f2dc8121
...
...
@@ -54,6 +54,7 @@
#include "Error.h"
#include "Keystroke.h"
#include "Utils.h"
#include "Init.h"
#ifdef XKB
#include "XKBsrv.h"
...
...
@@ -361,6 +362,8 @@ void nxagentDisconnectSession(void)
DECODE_SESSION_STATE
(
nxagentSessionState
));
#endif
nxagentFreeTimeoutTimer
();
/*
* Force an I/O error on the display
* and wait until the NX transport
...
...
nx-X11/programs/Xserver/hw/nxagent/Screen.c
View file @
f2dc8121
...
...
@@ -37,12 +37,6 @@ is" without express or implied warranty.
*/
/*
* Used by the auto-disconnect feature.
*/
#include <signal.h>
#include "scrnintstr.h"
#include "dix.h"
#include "dixstruct.h"
...
...
@@ -517,19 +511,6 @@ void nxagentSetScreenSaverTime(void)
(
long
unsigned
int
)
ScreenSaverTime
,
(
long
unsigned
int
)
ScreenSaverInterval
);
#endif
/*
* More than one timeout could be used here,
* to make use of screen-saver handler not
* only for the timeout feature. In a case
* like this, the lower timeout have to be
* used as ScreenSaverTime.
*/
if
(
nxagentAutoDisconnectTimeout
>
0
)
{
ScreenSaverTime
=
nxagentAutoDisconnectTimeout
;
}
ScreenSaverInterval
=
ScreenSaverTime
;
#ifdef TEST
...
...
@@ -538,37 +519,47 @@ void nxagentSetScreenSaverTime(void)
#endif
}
/*
* This is the called when the "hardware" should take care of the
* blanking.
*
* "what" can be one if these:
* SCREEN_SAVER_ON Turns on the screen saver; disables video
* SCREEN_SAVER_OFF Turns off the screen saver; enables video
* SCREEN_SAVER_FORCER Updates time of last screen saver mode change
* SCREEN_SAVER_CYCLE Cycle to new pattern
*
* Returns True if the 'what' action was successful and False otherwise.
*
* Returning False the SaveScreens() function (which calls this one)
* tries to build a screen-saver creating a new window. In some cases
* we do not want this so we return True. If we want the dix to take
* care fo blanking we return False.
*/
static
Bool
nxagentSaveScreen
(
ScreenPtr
pScreen
,
int
what
)
{
#ifdef TEST
fprintf
(
stderr
,
"nxagentSaveScreen: Called for screen at [%p] with parameter [%d].
\n
"
,
(
void
*
)
pScreen
,
what
);
fprintf
(
stderr
,
"nxagentSaveScreen: SCREEN_SAVER_ON is [%d] SCREEN_SAVER_OFF is [%d] "
"SCREEN_SAVER_FORCER is [%d] SCREEN_SAVER_CYCLE is [%d].
\n
"
,
SCREEN_SAVER_ON
,
SCREEN_SAVER_OFF
,
SCREEN_SAVER_FORCER
,
SCREEN_SAVER_CYCLE
);
fprintf
(
stderr
,
"%s: Called for screen at [%p] with parameter [%s]. ScreenSaverTime [%d]
\n
"
,
__func__
,
(
void
*
)
pScreen
,
what
==
SCREEN_SAVER_ON
?
"SCREEN_SAVER_ON"
:
what
==
SCREEN_SAVER_OFF
?
"SCREEN_SAVER_OFF"
:
what
==
SCREEN_SAVER_FORCER
?
"SCREEN_SAVER_FORCER"
:
what
==
SCREEN_SAVER_CYCLE
?
"SCREEN_SAVER_CYCLE"
:
"UNKNOWN"
,
ScreenSaverTime
);
#endif
/*
* We need only to reset the timeouts
* in this case.
*/
if
(
what
==
SCREEN_SAVER_OFF
)
{
nxagentAutoDisconnectTimeout
=
nxagentOption
(
Timeout
)
*
MILLI_PER_SECOND
;
return
1
;
return
False
;
}
/*
* The lastDeviceEventTime is updated every time
* a device event is received, and it is used by
* WaitForSomething() to know when the SaveScreens()
* function should be called. This solution doesn't
* take care of a pointer button not released, so
* we have to handle this case by ourselves.
* The lastDeviceEventTime is updated every time a device event is
* received, and it is used by WaitForSomething() to know when the
* SaveScreens() function should be called. This solution doesn't
* take care of a pointer button not released, so we have to handle
* this case by ourselves.
*/
/*
...
...
@@ -578,71 +569,19 @@ FIXME: Do we need to check the key grab if the
if
(
inputInfo
.
pointer
->
button
->
buttonsDown
>
0
)
{
#ifdef TEST
fprintf
(
stderr
,
"
nxagentSaveScreen: Ignoring timeout, there is a pointer button down.
\n
"
);
fprintf
(
stderr
,
"
%s: Ignoring timeout, there is a pointer button down.
\n
"
,
__func__
);
#endif
/*
* Returning 0 the SaveScreens() function
* (which calls this one) tries to build
* a screen-saver creating a new window.
* We don't want this, so we return 1 in
* any case.
* Returning False the SaveScreens() function (which calls this one)
* tries to build a screen-saver creating a new window. We don't
* want this, so we return True here.
*/
return
1
;
return
True
;
}
/*
* Handling the auto-disconnect feature.
* If there is any client attached and the persisten-
* ce is allowed then leave the session running, else
* terminate it. It should use something less brutal,
* though raising a signal should ensure that the code
* follows the usual execution path.
*/
if
(
nxagentOption
(
Timeout
)
>
0
)
{
#ifdef TEST
fprintf
(
stderr
,
"nxagentSaveScreen: Auto-disconnect timeout was [%d].
\n
"
,
nxagentAutoDisconnectTimeout
);
#endif
nxagentAutoDisconnectTimeout
-=
ScreenSaverTime
;
#ifdef TEST
fprintf
(
stderr
,
"nxagentSaveScreen: Auto-disconnect timeout is [%d].
\n
"
,
nxagentAutoDisconnectTimeout
);
#endif
if
(
nxagentSessionState
==
SESSION_UP
&&
nxagentAutoDisconnectTimeout
<=
0
)
{
nxagentAutoDisconnectTimeout
=
nxagentOption
(
Timeout
)
*
MILLI_PER_SECOND
;
if
(
nxagentClients
==
0
)
{
fprintf
(
stderr
,
"Info: Terminating session with no client running.
\n
"
);
raise
(
SIGTERM
);
}
else
if
(
nxagentOption
(
Persistent
)
==
0
)
{
fprintf
(
stderr
,
"Info: Terminating session with persistence not allowed.
\n
"
);
raise
(
SIGTERM
);
}
else
{
fprintf
(
stderr
,
"Info: Suspending session with %d clients running.
\n
"
,
nxagentClients
);
raise
(
SIGHUP
);
}
}
}
return
1
;
return
False
;
}
Bool
nxagentCreateScreenResources
(
ScreenPtr
pScreen
)
...
...
@@ -3490,14 +3429,19 @@ Bool nxagentReconnectScreen(void *p0)
XSelectInput
(
nxagentDisplay
,
nxagentDefaultWindows
[
0
],
mask
);
/*
* Turn off the screen-saver and reset the
* time to the next auto-disconnection.
* Turn off the screen-saver
*/
SaveScreens
(
SCREEN_SAVER_OFF
,
ScreenSaverActive
);
/*
* reset the time to the next auto-disconnection.
*/
lastDeviceEventTime
.
milliseconds
=
GetTimeInMillis
();
nxagentSetTimeoutTimer
(
0
);
return
True
;
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Screen.h
View file @
f2dc8121
...
...
@@ -57,8 +57,6 @@ extern XlibAtom nxagentReadyAtom;
extern
int
nxagentClients
;
extern
int
nxagentAutoDisconnectTimeout
;
extern
ScreenPtr
nxagentDefaultScreen
;
extern
Pixmap
nxagentPixmapLogo
;
...
...
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