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
4ab18725
Commit
4ab18725
authored
Oct 21, 2017
by
Ulrich Sibiller
Committed by
Mihai Moldovan
Feb 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Xext: lift screensaver extension to XORG-7_1 state
parent
cbdae3b7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
167 additions
and
9 deletions
+167
-9
saver.h
nx-X11/include/extensions/saver.h
+1
-3
saverproto.h
nx-X11/include/extensions/saverproto.h
+10
-3
saver.c
nx-X11/programs/Xserver/Xext/saver.c
+147
-2
Imakefile
nx-X11/programs/Xserver/dix/Imakefile
+1
-1
globals.c
nx-X11/programs/Xserver/dix/globals.c
+4
-0
globals.h
nx-X11/programs/Xserver/include/globals.h
+4
-0
No files found.
nx-X11/include/extensions/saver.h
View file @
4ab18725
/*
* $XConsortium: saver.h,v 1.5 94/04/17 20:59:33 rws Exp $
*
Copyright (c) 1992 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
...
...
@@ -37,7 +35,7 @@ in this Software without prior written authorization from the X Consortium.
#define ScreenSaverCycleMask 0x00000002
#define ScreenSaverMajorVersion 1
#define ScreenSaverMinorVersion
0
#define ScreenSaverMinorVersion
1
#define ScreenSaverOff 0
#define ScreenSaverOn 1
...
...
nx-X11/include/extensions/saverproto.h
View file @
4ab18725
/*
* $XConsortium: saverproto.h,v 1.5 94/04/17 20:59:33 keith Exp $
*
Copyright (c) 1992 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
...
...
@@ -26,7 +24,6 @@ in this Software without prior written authorization from the X Consortium.
*
* Author: Keith Packard, MIT X Consortium
*/
/* $XFree86$ */
#ifndef _SAVERPROTO_H_
#define _SAVERPROTO_H_
...
...
@@ -136,6 +133,16 @@ typedef struct _ScreenSaverUnsetAttributes {
}
xScreenSaverUnsetAttributesReq
;
#define sz_xScreenSaverUnsetAttributesReq 8
#define X_ScreenSaverSuspend 5
typedef
struct
_ScreenSaverSuspend
{
CARD8
reqType
;
CARD8
saverReqType
;
CARD16
length
B16
;
Bool
suspend
B32
;
}
xScreenSaverSuspendReq
;
#define sz_xScreenSaverSuspendReq 8
typedef
struct
_ScreenSaverNotify
{
CARD8
type
;
/* always eventBase + ScreenSaverNotify */
BYTE
state
;
/* off, on, cycle */
...
...
nx-X11/programs/Xserver/Xext/saver.c
View file @
4ab18725
...
...
@@ -51,7 +51,10 @@ in this Software without prior written authorization from the X Consortium.
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
#ifdef DPMSExtension
#define DPMS_SERVER
#include <nx-X11/extensions/dpms.h>
#endif
#include <stdio.h>
...
...
@@ -68,12 +71,14 @@ static DISPATCH_PROC(ProcScreenSaverQueryVersion);
static
DISPATCH_PROC
(
ProcScreenSaverSelectInput
);
static
DISPATCH_PROC
(
ProcScreenSaverSetAttributes
);
static
DISPATCH_PROC
(
ProcScreenSaverUnsetAttributes
);
static
DISPATCH_PROC
(
ProcScreenSaverSuspend
);
static
DISPATCH_PROC
(
SProcScreenSaverDispatch
);
static
DISPATCH_PROC
(
SProcScreenSaverQueryInfo
);
static
DISPATCH_PROC
(
SProcScreenSaverQueryVersion
);
static
DISPATCH_PROC
(
SProcScreenSaverSelectInput
);
static
DISPATCH_PROC
(
SProcScreenSaverSetAttributes
);
static
DISPATCH_PROC
(
SProcScreenSaverUnsetAttributes
);
static
DISPATCH_PROC
(
SProcScreenSaverSuspend
);
static
Bool
ScreenSaverHandle
(
ScreenPtr
/* pScreen */
,
...
...
@@ -110,6 +115,32 @@ static void ScreenSaverResetProc (
ExtensionEntry
*
/* extEntry */
);
static
RESTYPE
SuspendType
;
/* resource type for suspension records */
typedef
struct
_ScreenSaverSuspension
*
ScreenSaverSuspensionPtr
;
/* List of clients that are suspending the screensaver. */
static
ScreenSaverSuspensionPtr
suspendingClients
=
NULL
;
/*
* clientResource is a resource ID that's added when the record is
* allocated, so the record is freed and the screensaver resumed when
* the client disconnects. count is the number of times the client has
* requested the screensaver be suspended.
*/
typedef
struct
_ScreenSaverSuspension
{
ScreenSaverSuspensionPtr
next
;
ClientPtr
pClient
;
XID
clientResource
;
int
count
;
}
ScreenSaverSuspensionRec
;
static
int
ScreenSaverFreeSuspend
(
pointer
/*value */
,
XID
/* id */
);
/*
* each screen has a list of clients requesting
* ScreenSaverNotify events. Each client has a resource
...
...
@@ -227,13 +258,15 @@ ScreenSaverExtensionInit(void)
AttrType
=
CreateNewResourceType
(
ScreenSaverFreeAttr
);
EventType
=
CreateNewResourceType
(
ScreenSaverFreeEvents
);
SuspendType
=
CreateNewResourceType
(
ScreenSaverFreeSuspend
);
ScreenPrivateIndex
=
AllocateScreenPrivateIndex
();
for
(
i
=
0
;
i
<
screenInfo
.
numScreens
;
i
++
)
{
pScreen
=
screenInfo
.
screens
[
i
];
SetScreenPrivate
(
pScreen
,
NULL
);
}
if
(
AttrType
&&
EventType
&&
ScreenPrivateIndex
!=
-
1
&&
if
(
AttrType
&&
EventType
&&
S
uspendType
&&
S
creenPrivateIndex
!=
-
1
&&
(
extEntry
=
AddExtension
(
ScreenSaverName
,
ScreenSaverNumberEvents
,
0
,
ProcScreenSaverDispatch
,
SProcScreenSaverDispatch
,
ScreenSaverResetProc
,
StandardMinorOpcode
)))
...
...
@@ -427,6 +460,45 @@ ScreenSaverFreeAttr (value, id)
return
TRUE
;
}
static
int
ScreenSaverFreeSuspend
(
pointer
value
,
XID
id
)
{
ScreenSaverSuspensionPtr
data
=
(
ScreenSaverSuspensionPtr
)
value
;
ScreenSaverSuspensionPtr
*
prev
,
this
;
/* Unlink and free the suspension record for the client */
for
(
prev
=
&
suspendingClients
;
(
this
=
*
prev
);
prev
=
&
this
->
next
)
{
if
(
this
==
data
)
{
*
prev
=
this
->
next
;
free
(
this
);
break
;
}
}
/* Reenable the screensaver if this was the last client suspending it. */
if
(
screenSaverSuspended
&&
suspendingClients
==
NULL
)
{
screenSaverSuspended
=
FALSE
;
/* The screensaver could be active, since suspending it (by design)
doesn't prevent it from being forceably activated */
#ifdef DPMSExtension
if
(
screenIsSaved
!=
SCREEN_SAVER_ON
&&
DPMSPowerLevel
==
DPMSModeOn
)
#else
if
(
screenIsSaved
!=
SCREEN_SAVER_ON
)
#endif
{
UpdateCurrentTimeIf
();
lastDeviceEventTime
=
currentTime
;
SetScreenSaverTimer
();
}
}
return
Success
;
}
static
void
SendScreenSaverNotify
(
pScreen
,
state
,
forced
)
ScreenPtr
pScreen
;
...
...
@@ -1286,12 +1358,73 @@ ProcScreenSaverUnsetAttributes (ClientPtr client)
return
ScreenSaverUnsetAttributes
(
client
);
}
static
int
ProcScreenSaverSuspend
(
ClientPtr
client
)
{
ScreenSaverSuspensionPtr
*
prev
,
this
;
REQUEST
(
xScreenSaverSuspendReq
);
REQUEST_SIZE_MATCH
(
xScreenSaverSuspendReq
);
/* Check if this client is suspending the screensaver */
for
(
prev
=
&
suspendingClients
;
(
this
=
*
prev
);
prev
=
&
this
->
next
)
if
(
this
->
pClient
==
client
)
break
;
if
(
this
)
{
if
(
stuff
->
suspend
==
TRUE
)
this
->
count
++
;
else
if
(
--
this
->
count
==
0
)
FreeResource
(
this
->
clientResource
,
RT_NONE
);
return
Success
;
}
/* If we get to this point, this client isn't suspending the screensaver */
if
(
stuff
->
suspend
==
FALSE
)
return
Success
;
/*
* Allocate a suspension record for the client, and stop the screensaver
* if it isn't already suspended by another client. We attach a resource ID
* to the record, so the screensaver will be reenabled and the record freed
* if the client disconnects without reenabling it first.
*/
this
=
(
ScreenSaverSuspensionPtr
)
malloc
(
sizeof
(
ScreenSaverSuspensionRec
));
if
(
!
this
)
return
BadAlloc
;
memset
(
this
,
0
,
sizeof
(
ScreenSaverSuspensionRec
));
this
->
next
=
NULL
;
this
->
pClient
=
client
;
this
->
count
=
1
;
this
->
clientResource
=
FakeClientID
(
client
->
index
);
if
(
!
AddResource
(
this
->
clientResource
,
SuspendType
,
(
pointer
)
this
))
{
free
(
this
);
return
BadAlloc
;
}
*
prev
=
this
;
if
(
!
screenSaverSuspended
)
{
screenSaverSuspended
=
TRUE
;
FreeScreenSaverTimer
();
}
return
(
client
->
noClientException
);
}
static
DISPATCH_PROC
((
*
NormalVector
[]))
=
{
ProcScreenSaverQueryVersion
,
ProcScreenSaverQueryInfo
,
ProcScreenSaverSelectInput
,
ProcScreenSaverSetAttributes
,
ProcScreenSaverUnsetAttributes
,
ProcScreenSaverSuspend
,
};
#define NUM_REQUESTS ((sizeof NormalVector) / (sizeof NormalVector[0]))
...
...
@@ -1375,12 +1508,24 @@ SProcScreenSaverUnsetAttributes (client)
return
ProcScreenSaverUnsetAttributes
(
client
);
}
static
int
SProcScreenSaverSuspend
(
ClientPtr
client
)
{
REQUEST
(
xScreenSaverSuspendReq
);
swaps
(
&
stuff
->
length
);
REQUEST_SIZE_MATCH
(
xScreenSaverSuspendReq
);
swapl
(
&
stuff
->
suspend
);
return
ProcScreenSaverSuspend
(
client
);
}
static
DISPATCH_PROC
((
*
SwappedVector
[]))
=
{
SProcScreenSaverQueryVersion
,
SProcScreenSaverQueryInfo
,
SProcScreenSaverSelectInput
,
SProcScreenSaverSetAttributes
,
SProcScreenSaverUnsetAttributes
,
SProcScreenSaverSuspend
,
};
static
int
...
...
nx-X11/programs/Xserver/dix/Imakefile
View file @
4ab18725
...
...
@@ -132,7 +132,7 @@ NormalLibraryTarget(dix,$(OBJS))
LintLibraryTarget(dix,$(SRCS) $(XPSRC))
NormalLintTarget($(SRCS) $(XPSRC))
SpecialCObjectRule(globals,$(ICONFIGFILES),$(SITE_DEFINES))
SpecialCObjectRule(globals,$(ICONFIGFILES),$(SITE_DEFINES)
$(EXT_DEFINES)
)
SpecialCObjectRule(main,$(ICONFIGFILES),$(VENDOR_DEFINES))
SpecialCObjectRule(pixmap,$(ICONFIGFILES),$(_NOOP_))
SpecialCObjectRule(privates,$(ICONFIGFILES),$(_NOOP_))
...
...
nx-X11/programs/Xserver/dix/globals.c
View file @
4ab18725
...
...
@@ -127,6 +127,10 @@ int defaultScreenSaverAllowExposures = DEFAULT_SCREEN_SAVER_EXPOSURES;
int
logoScreenSaver
=
DEFAULT_LOGO_SCREEN_SAVER
;
#endif
#ifdef SCREENSAVER
Bool
screenSaverSuspended
=
FALSE
;
#endif
char
*
defaultFontPath
=
COMPILEDDEFAULTFONTPATH
;
char
*
defaultTextFont
=
COMPILEDDEFAULTFONT
;
char
*
defaultCursorFont
=
COMPILEDCURSORFONT
;
...
...
nx-X11/programs/Xserver/include/globals.h
View file @
4ab18725
...
...
@@ -11,6 +11,10 @@ extern CARD32 defaultScreenSaverInterval;
extern
CARD32
ScreenSaverTime
;
extern
CARD32
ScreenSaverInterval
;
#ifdef SCREENSAVER
extern
Bool
screenSaverSuspended
;
#endif
extern
char
*
defaultFontPath
;
extern
int
monitorResolution
;
extern
Bool
loadableFonts
;
...
...
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