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
e440ea76
Commit
e440ea76
authored
Jun 07, 2016
by
Mike Gabriel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
randr extension: Convert to Xorg coding style.
The reformatting has been achieved by applying x-indent.sh to all .c and .h files in Xserver/randr/.
parent
7f7c96c7
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
3511 additions
and
3699 deletions
+3511
-3699
panoramiXproto.h
nx-X11/programs/Xserver/randr/panoramiXproto.h
+107
-99
randr.c
nx-X11/programs/Xserver/randr/randr.c
+197
-207
randr.h
nx-X11/programs/Xserver/randr/randr.h
+9
-9
randrproto.h
nx-X11/programs/Xserver/randr/randrproto.h
+401
-358
randrstr.h
nx-X11/programs/Xserver/randr/randrstr.h
+269
-316
registry.h
nx-X11/programs/Xserver/randr/registry.h
+4
-4
rrcrtc.c
nx-X11/programs/Xserver/randr/rrcrtc.c
+482
-541
rrdispatch.c
nx-X11/programs/Xserver/randr/rrdispatch.c
+130
-137
rrinfo.c
nx-X11/programs/Xserver/randr/rrinfo.c
+135
-154
rrmode.c
nx-X11/programs/Xserver/randr/rrmode.c
+214
-215
rroutput.c
nx-X11/programs/Xserver/randr/rroutput.c
+226
-263
rrpointer.c
nx-X11/programs/Xserver/randr/rrpointer.c
+69
-73
rrproperty.c
nx-X11/programs/Xserver/randr/rrproperty.c
+405
-428
rrscreen.c
nx-X11/programs/Xserver/randr/rrscreen.c
+607
-665
rrsdispatch.c
nx-X11/programs/Xserver/randr/rrsdispatch.c
+93
-73
rrxinerama.c
nx-X11/programs/Xserver/randr/rrxinerama.c
+163
-157
No files found.
nx-X11/programs/Xserver/randr/panoramiXproto.h
View file @
e440ea76
...
@@ -41,152 +41,160 @@ Equipment Corporation.
...
@@ -41,152 +41,160 @@ Equipment Corporation.
#define X_XineramaQueryScreens 5
#define X_XineramaQueryScreens 5
typedef
struct
_PanoramiXQueryVersion
{
typedef
struct
_PanoramiXQueryVersion
{
CARD8
reqType
;
/* always PanoramiXReqCode */
CARD8
reqType
;
/* always PanoramiXReqCode */
CARD8
panoramiXReqType
;
/* always X_PanoramiXQueryVersion */
CARD8
panoramiXReqType
;
/* always X_PanoramiXQueryVersion */
CARD16
length
B16
;
CARD16
length
B16
;
CARD8
clientMajor
;
CARD8
clientMajor
;
CARD8
clientMinor
;
CARD8
clientMinor
;
CARD16
unused
B16
;
CARD16
unused
B16
;
}
xPanoramiXQueryVersionReq
;
}
xPanoramiXQueryVersionReq
;
#define sz_xPanoramiXQueryVersionReq 8
#define sz_xPanoramiXQueryVersionReq 8
typedef
struct
{
typedef
struct
{
CARD8
type
;
/* must be X_Reply */
CARD8
type
;
/* must be X_Reply */
CARD8
pad1
;
/* unused
*/
CARD8
pad1
;
/* unused
*/
CARD16
sequenceNumber
B16
;
/* last sequence number */
CARD16
sequenceNumber
B16
;
/* last sequence number */
CARD32
length
B32
;
/* 0 */
CARD32
length
B32
;
/* 0 */
CARD16
majorVersion
B16
;
CARD16
majorVersion
B16
;
CARD16
minorVersion
B16
;
CARD16
minorVersion
B16
;
CARD32
pad2
B32
;
/* unused */
CARD32
pad2
B32
;
/* unused */
CARD32
pad3
B32
;
/* unused */
CARD32
pad3
B32
;
/* unused */
CARD32
pad4
B32
;
/* unused */
CARD32
pad4
B32
;
/* unused */
CARD32
pad5
B32
;
/* unused */
CARD32
pad5
B32
;
/* unused */
CARD32
pad6
B32
;
/* unused */
CARD32
pad6
B32
;
/* unused */
}
xPanoramiXQueryVersionReply
;
}
xPanoramiXQueryVersionReply
;
#define sz_xPanoramiXQueryVersionReply 32
#define sz_xPanoramiXQueryVersionReply 32
typedef
struct
_PanoramiXGetState
{
typedef
struct
_PanoramiXGetState
{
CARD8
reqType
;
/* always PanoramiXReqCode */
CARD8
reqType
;
/* always PanoramiXReqCode */
CARD8
panoramiXReqType
;
/* always X_PanoramiXGetState */
CARD8
panoramiXReqType
;
/* always X_PanoramiXGetState */
CARD16
length
B16
;
CARD16
length
B16
;
CARD32
window
B32
;
CARD32
window
B32
;
}
xPanoramiXGetStateReq
;
}
xPanoramiXGetStateReq
;
#define sz_xPanoramiXGetStateReq 8
#define sz_xPanoramiXGetStateReq 8
typedef
struct
{
typedef
struct
{
BYTE
type
;
BYTE
type
;
BYTE
state
;
BYTE
state
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
CARD32
window
B32
;
CARD32
window
B32
;
CARD32
pad1
B32
;
/* unused */
CARD32
pad1
B32
;
/* unused */
CARD32
pad2
B32
;
/* unused */
CARD32
pad2
B32
;
/* unused */
CARD32
pad3
B32
;
/* unused */
CARD32
pad3
B32
;
/* unused */
CARD32
pad4
B32
;
/* unused */
CARD32
pad4
B32
;
/* unused */
CARD32
pad5
B32
;
/* unused */
CARD32
pad5
B32
;
/* unused */
}
xPanoramiXGetStateReply
;
}
xPanoramiXGetStateReply
;
#define sz_panoramiXGetStateReply 32
#define sz_panoramiXGetStateReply 32
typedef
struct
_PanoramiXGetScreenCount
{
typedef
struct
_PanoramiXGetScreenCount
{
CARD8
reqType
;
/* always PanoramiXReqCode */
CARD8
reqType
;
/* always PanoramiXReqCode */
CARD8
panoramiXReqType
;
/* always X_PanoramiXGetScreenCount */
CARD8
panoramiXReqType
;
/* always X_PanoramiXGetScreenCount */
CARD16
length
B16
;
CARD16
length
B16
;
CARD32
window
B32
;
CARD32
window
B32
;
}
xPanoramiXGetScreenCountReq
;
}
xPanoramiXGetScreenCountReq
;
#define sz_xPanoramiXGetScreenCountReq 8
#define sz_xPanoramiXGetScreenCountReq 8
typedef
struct
{
typedef
struct
{
BYTE
type
;
BYTE
type
;
BYTE
ScreenCount
;
BYTE
ScreenCount
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
CARD32
window
B32
;
CARD32
window
B32
;
CARD32
pad1
B32
;
/* unused */
CARD32
pad1
B32
;
/* unused */
CARD32
pad2
B32
;
/* unused */
CARD32
pad2
B32
;
/* unused */
CARD32
pad3
B32
;
/* unused */
CARD32
pad3
B32
;
/* unused */
CARD32
pad4
B32
;
/* unused */
CARD32
pad4
B32
;
/* unused */
CARD32
pad5
B32
;
/* unused */
CARD32
pad5
B32
;
/* unused */
}
xPanoramiXGetScreenCountReply
;
}
xPanoramiXGetScreenCountReply
;
#define sz_panoramiXGetScreenCountReply 32
#define sz_panoramiXGetScreenCountReply 32
typedef
struct
_PanoramiXGetScreenSize
{
typedef
struct
_PanoramiXGetScreenSize
{
CARD8
reqType
;
/* always PanoramiXReqCode */
CARD8
reqType
;
/* always PanoramiXReqCode */
CARD8
panoramiXReqType
;
/* always X_PanoramiXGetState */
CARD8
panoramiXReqType
;
/* always X_PanoramiXGetState */
CARD16
length
B16
;
CARD16
length
B16
;
CARD32
window
B32
;
CARD32
window
B32
;
CARD32
screen
B32
;
CARD32
screen
B32
;
}
xPanoramiXGetScreenSizeReq
;
}
xPanoramiXGetScreenSizeReq
;
#define sz_xPanoramiXGetScreenSizeReq 12
#define sz_xPanoramiXGetScreenSizeReq 12
typedef
struct
{
typedef
struct
{
BYTE
type
;
BYTE
type
;
CARD8
pad1
;
CARD8
pad1
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
CARD32
width
B32
;
CARD32
width
B32
;
CARD32
height
B32
;
CARD32
height
B32
;
CARD32
window
B32
;
CARD32
window
B32
;
CARD32
screen
B32
;
CARD32
screen
B32
;
CARD32
pad2
B32
;
/* unused */
CARD32
pad2
B32
;
/* unused */
CARD32
pad3
B32
;
/* unused */
CARD32
pad3
B32
;
/* unused */
}
xPanoramiXGetScreenSizeReply
;
}
xPanoramiXGetScreenSizeReply
;
#define sz_panoramiXGetScreenSizeReply 32
#define sz_panoramiXGetScreenSizeReply 32
/************ Alternate protocol ******************/
/************ Alternate protocol ******************/
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
panoramiXReqType
;
CARD8
panoramiXReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
}
xXineramaIsActiveReq
;
}
xXineramaIsActiveReq
;
#define sz_xXineramaIsActiveReq 4
#define sz_xXineramaIsActiveReq 4
typedef
struct
{
typedef
struct
{
BYTE
type
;
BYTE
type
;
CARD8
pad1
;
CARD8
pad1
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
CARD32
state
B32
;
CARD32
state
B32
;
CARD32
pad2
B32
;
CARD32
pad2
B32
;
CARD32
pad3
B32
;
CARD32
pad3
B32
;
CARD32
pad4
B32
;
CARD32
pad4
B32
;
CARD32
pad5
B32
;
CARD32
pad5
B32
;
CARD32
pad6
B32
;
CARD32
pad6
B32
;
}
xXineramaIsActiveReply
;
}
xXineramaIsActiveReply
;
#define sz_XineramaIsActiveReply 32
#define sz_XineramaIsActiveReply 32
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
panoramiXReqType
;
CARD8
panoramiXReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
}
xXineramaQueryScreensReq
;
}
xXineramaQueryScreensReq
;
#define sz_xXineramaQueryScreensReq 4
#define sz_xXineramaQueryScreensReq 4
typedef
struct
{
typedef
struct
{
BYTE
type
;
BYTE
type
;
CARD8
pad1
;
CARD8
pad1
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
CARD32
number
B32
;
CARD32
number
B32
;
CARD32
pad2
B32
;
CARD32
pad2
B32
;
CARD32
pad3
B32
;
CARD32
pad3
B32
;
CARD32
pad4
B32
;
CARD32
pad4
B32
;
CARD32
pad5
B32
;
CARD32
pad5
B32
;
CARD32
pad6
B32
;
CARD32
pad6
B32
;
}
xXineramaQueryScreensReply
;
}
xXineramaQueryScreensReply
;
#define sz_XineramaQueryScreensReply 32
#define sz_XineramaQueryScreensReply 32
typedef
struct
{
typedef
struct
{
INT16
x_org
B16
;
INT16
x_org
B16
;
INT16
y_org
B16
;
INT16
y_org
B16
;
CARD16
width
B16
;
CARD16
width
B16
;
CARD16
height
B16
;
CARD16
height
B16
;
}
xXineramaScreenInfo
;
}
xXineramaScreenInfo
;
#define sz_XineramaScreenInfo 8
#define sz_XineramaScreenInfo 8
#endif
#endif
nx-X11/programs/Xserver/randr/randr.c
View file @
e440ea76
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
#endif
#endif
#define RR_VALIDATE
#define RR_VALIDATE
static
int
RRNScreens
;
static
int
RRNScreens
;
#define wrap(priv,real,mem,func) {\
#define wrap(priv,real,mem,func) {\
priv->mem = real->mem; \
priv->mem = real->mem; \
...
@@ -67,74 +67,72 @@ static int RRNScreens;
...
@@ -67,74 +67,72 @@ static int RRNScreens;
real->mem = priv->mem; \
real->mem = priv->mem; \
}
}
static
int
ProcRRDispatch
(
ClientPtr
pClient
);
static
int
ProcRRDispatch
(
ClientPtr
pClient
);
static
int
SProcRRDispatch
(
ClientPtr
pClient
);
static
int
SProcRRDispatch
(
ClientPtr
pClient
);
int
RREventBase
;
int
RREventBase
;
int
RRErrorBase
;
int
RRErrorBase
;
RESTYPE
RRClientType
,
RREventType
;
/* resource types for event masks */
RESTYPE
RRClientType
,
RREventType
;
/* resource types for event masks */
#ifndef NXAGENT_SERVER
#ifndef NXAGENT_SERVER
DevPrivateKey
RRClientPrivateKey
=
&
RRClientPrivateKey
;
DevPrivateKey
RRClientPrivateKey
=
&
RRClientPrivateKey
;
DevPrivateKey
rrPrivKey
=
&
rrPrivKey
;
DevPrivateKey
rrPrivKey
=
&
rrPrivKey
;
#else
#else
int
RRClientPrivateIndex
;
int
RRClientPrivateIndex
;
int
rrPrivIndex
=
-
1
;
int
rrPrivIndex
=
-
1
;
#endif
#endif
static
void
static
void
RRClientCallback
(
CallbackListPtr
*
list
,
RRClientCallback
(
CallbackListPtr
*
list
,
void
*
closure
,
void
*
data
)
void
*
closure
,
void
*
data
)
{
{
NewClientInfoRec
*
clientinfo
=
(
NewClientInfoRec
*
)
data
;
NewClientInfoRec
*
clientinfo
=
(
NewClientInfoRec
*
)
data
;
ClientPtr
pClient
=
clientinfo
->
client
;
ClientPtr
pClient
=
clientinfo
->
client
;
rrClientPriv
(
pClient
);
rrClientPriv
(
pClient
);
RRTimesPtr
pTimes
=
(
RRTimesPtr
)
(
pRRClient
+
1
);
RRTimesPtr
pTimes
=
(
RRTimesPtr
)
(
pRRClient
+
1
);
int
i
;
int
i
;
pRRClient
->
major_version
=
0
;
pRRClient
->
major_version
=
0
;
pRRClient
->
minor_version
=
0
;
pRRClient
->
minor_version
=
0
;
for
(
i
=
0
;
i
<
screenInfo
.
numScreens
;
i
++
)
for
(
i
=
0
;
i
<
screenInfo
.
numScreens
;
i
++
)
{
{
ScreenPtr
pScreen
=
screenInfo
.
screens
[
i
];
ScreenPtr
pScreen
=
screenInfo
.
screens
[
i
];
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
if
(
pScrPriv
)
if
(
pScrPriv
)
{
{
pTimes
[
i
].
setTime
=
pScrPriv
->
lastSetTime
;
pTimes
[
i
].
setTime
=
pScrPriv
->
lastSetTime
;
pTimes
[
i
].
configTime
=
pScrPriv
->
lastConfigTime
;
pTimes
[
i
].
configTime
=
pScrPriv
->
lastConfigTime
;
}
}
}
}
}
}
static
void
static
void
RRResetProc
(
ExtensionEntry
*
extEntry
)
RRResetProc
(
ExtensionEntry
*
extEntry
)
{
{
}
}
static
Bool
static
Bool
RRCloseScreen
(
int
i
,
ScreenPtr
pScreen
)
RRCloseScreen
(
int
i
,
ScreenPtr
pScreen
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
int
j
;
int
j
;
unwrap
(
pScrPriv
,
pScreen
,
CloseScreen
);
unwrap
(
pScrPriv
,
pScreen
,
CloseScreen
);
for
(
j
=
pScrPriv
->
numCrtcs
-
1
;
j
>=
0
;
j
--
)
for
(
j
=
pScrPriv
->
numCrtcs
-
1
;
j
>=
0
;
j
--
)
RRCrtcDestroy
(
pScrPriv
->
crtcs
[
j
]);
RRCrtcDestroy
(
pScrPriv
->
crtcs
[
j
]);
for
(
j
=
pScrPriv
->
numOutputs
-
1
;
j
>=
0
;
j
--
)
for
(
j
=
pScrPriv
->
numOutputs
-
1
;
j
>=
0
;
j
--
)
RROutputDestroy
(
pScrPriv
->
outputs
[
j
]);
RROutputDestroy
(
pScrPriv
->
outputs
[
j
]);
xfree
(
pScrPriv
->
crtcs
);
xfree
(
pScrPriv
->
crtcs
);
xfree
(
pScrPriv
->
outputs
);
xfree
(
pScrPriv
->
outputs
);
xfree
(
pScrPriv
);
xfree
(
pScrPriv
);
RRNScreens
-=
1
;
/* ok, one fewer screen with RandR running */
RRNScreens
-=
1
;
/* ok, one fewer screen with RandR running */
return
(
*
pScreen
->
CloseScreen
)
(
i
,
pScreen
);
return
(
*
pScreen
->
CloseScreen
)
(
i
,
pScreen
);
}
}
static
void
static
void
SRRScreenChangeNotifyEvent
(
xRRScreenChangeNotifyEvent
*
from
,
SRRScreenChangeNotifyEvent
(
xRRScreenChangeNotifyEvent
*
from
,
xRRScreenChangeNotifyEvent
*
to
)
xRRScreenChangeNotifyEvent
*
to
)
{
{
to
->
type
=
from
->
type
;
to
->
type
=
from
->
type
;
to
->
rotation
=
from
->
rotation
;
to
->
rotation
=
from
->
rotation
;
...
@@ -152,8 +150,8 @@ SRRScreenChangeNotifyEvent(xRRScreenChangeNotifyEvent *from,
...
@@ -152,8 +150,8 @@ SRRScreenChangeNotifyEvent(xRRScreenChangeNotifyEvent *from,
}
}
static
void
static
void
SRRCrtcChangeNotifyEvent
(
xRRCrtcChangeNotifyEvent
*
from
,
SRRCrtcChangeNotifyEvent
(
xRRCrtcChangeNotifyEvent
*
from
,
xRRCrtcChangeNotifyEvent
*
to
)
xRRCrtcChangeNotifyEvent
*
to
)
{
{
to
->
type
=
from
->
type
;
to
->
type
=
from
->
type
;
to
->
subCode
=
from
->
subCode
;
to
->
subCode
=
from
->
subCode
;
...
@@ -171,8 +169,8 @@ SRRCrtcChangeNotifyEvent(xRRCrtcChangeNotifyEvent *from,
...
@@ -171,8 +169,8 @@ SRRCrtcChangeNotifyEvent(xRRCrtcChangeNotifyEvent *from,
}
}
static
void
static
void
SRROutputChangeNotifyEvent
(
xRROutputChangeNotifyEvent
*
from
,
SRROutputChangeNotifyEvent
(
xRROutputChangeNotifyEvent
*
from
,
xRROutputChangeNotifyEvent
*
to
)
xRROutputChangeNotifyEvent
*
to
)
{
{
to
->
type
=
from
->
type
;
to
->
type
=
from
->
type
;
to
->
subCode
=
from
->
subCode
;
to
->
subCode
=
from
->
subCode
;
...
@@ -187,8 +185,8 @@ SRROutputChangeNotifyEvent(xRROutputChangeNotifyEvent *from,
...
@@ -187,8 +185,8 @@ SRROutputChangeNotifyEvent(xRROutputChangeNotifyEvent *from,
}
}
static
void
static
void
SRROutputPropertyNotifyEvent
(
xRROutputPropertyNotifyEvent
*
from
,
SRROutputPropertyNotifyEvent
(
xRROutputPropertyNotifyEvent
*
from
,
xRROutputPropertyNotifyEvent
*
to
)
xRROutputPropertyNotifyEvent
*
to
)
{
{
to
->
type
=
from
->
type
;
to
->
type
=
from
->
type
;
to
->
subCode
=
from
->
subCode
;
to
->
subCode
=
from
->
subCode
;
...
@@ -200,58 +198,58 @@ SRROutputPropertyNotifyEvent(xRROutputPropertyNotifyEvent *from,
...
@@ -200,58 +198,58 @@ SRROutputPropertyNotifyEvent(xRROutputPropertyNotifyEvent *from,
}
}
static
void
static
void
SRRNotifyEvent
(
xEvent
*
from
,
SRRNotifyEvent
(
xEvent
*
from
,
xEvent
*
to
)
xEvent
*
to
)
{
{
switch
(
from
->
u
.
u
.
detail
)
{
switch
(
from
->
u
.
u
.
detail
)
{
case
RRNotify_CrtcChange
:
case
RRNotify_CrtcChange
:
SRRCrtcChangeNotifyEvent
((
xRRCrtcChangeNotifyEvent
*
)
from
,
SRRCrtcChangeNotifyEvent
((
xRRCrtcChangeNotifyEvent
*
)
from
,
(
xRRCrtcChangeNotifyEvent
*
)
to
);
(
xRRCrtcChangeNotifyEvent
*
)
to
);
break
;
break
;
case
RRNotify_OutputChange
:
case
RRNotify_OutputChange
:
SRROutputChangeNotifyEvent
((
xRROutputChangeNotifyEvent
*
)
from
,
SRROutputChangeNotifyEvent
((
xRROutputChangeNotifyEvent
*
)
from
,
(
xRROutputChangeNotifyEvent
*
)
to
);
(
xRROutputChangeNotifyEvent
*
)
to
);
break
;
break
;
case
RRNotify_OutputProperty
:
case
RRNotify_OutputProperty
:
SRROutputPropertyNotifyEvent
((
xRROutputPropertyNotifyEvent
*
)
from
,
SRROutputPropertyNotifyEvent
((
xRROutputPropertyNotifyEvent
*
)
from
,
(
xRROutputPropertyNotifyEvent
*
)
to
);
(
xRROutputPropertyNotifyEvent
*
)
to
);
break
;
break
;
default:
default:
break
;
break
;
}
}
}
}
static
int
RRGeneration
;
static
int
RRGeneration
;
Bool
RRInit
(
void
)
Bool
RRInit
(
void
)
{
{
if
(
RRGeneration
!=
serverGeneration
)
if
(
RRGeneration
!=
serverGeneration
)
{
{
#ifdef NXAGENT_SERVER
#ifdef NXAGENT_SERVER
if
((
rrPrivIndex
=
AllocateScreenPrivateIndex
())
<
0
)
if
((
rrPrivIndex
=
AllocateScreenPrivateIndex
())
<
0
)
return
FALSE
;
return
FALSE
;
#endif
#endif
if
(
!
RRModeInit
())
if
(
!
RRModeInit
())
return
FALSE
;
return
FALSE
;
if
(
!
RRCrtcInit
())
if
(
!
RRCrtcInit
())
return
FALSE
;
return
FALSE
;
if
(
!
RROutputInit
())
if
(
!
RROutputInit
())
return
FALSE
;
return
FALSE
;
RRGeneration
=
serverGeneration
;
RRGeneration
=
serverGeneration
;
}
}
return
TRUE
;
return
TRUE
;
}
}
Bool
RRScreenInit
(
ScreenPtr
pScreen
)
Bool
RRScreenInit
(
ScreenPtr
pScreen
)
{
{
rrScrPrivPtr
pScrPriv
;
rrScrPrivPtr
pScrPriv
;
if
(
!
RRInit
())
if
(
!
RRInit
())
return
FALSE
;
return
FALSE
;
pScrPriv
=
(
rrScrPrivPtr
)
xcalloc
(
1
,
sizeof
(
rrScrPrivRec
));
pScrPriv
=
(
rrScrPrivPtr
)
xcalloc
(
1
,
sizeof
(
rrScrPrivRec
));
if
(
!
pScrPriv
)
if
(
!
pScrPriv
)
return
FALSE
;
return
FALSE
;
SetRRScreen
(
pScreen
,
pScrPriv
);
SetRRScreen
(
pScreen
,
pScrPriv
);
...
@@ -291,145 +289,141 @@ Bool RRScreenInit(ScreenPtr pScreen)
...
@@ -291,145 +289,141 @@ Bool RRScreenInit(ScreenPtr pScreen)
pScrPriv
->
lastSetTime
=
currentTime
;
pScrPriv
->
lastSetTime
=
currentTime
;
pScrPriv
->
lastConfigTime
=
currentTime
;
pScrPriv
->
lastConfigTime
=
currentTime
;
wrap
(
pScrPriv
,
pScreen
,
CloseScreen
,
RRCloseScreen
);
wrap
(
pScrPriv
,
pScreen
,
CloseScreen
,
RRCloseScreen
);
pScrPriv
->
numOutputs
=
0
;
pScrPriv
->
numOutputs
=
0
;
pScrPriv
->
outputs
=
NULL
;
pScrPriv
->
outputs
=
NULL
;
pScrPriv
->
numCrtcs
=
0
;
pScrPriv
->
numCrtcs
=
0
;
pScrPriv
->
crtcs
=
NULL
;
pScrPriv
->
crtcs
=
NULL
;
RRNScreens
+=
1
;
/* keep count of screens that implement randr */
RRNScreens
+=
1
;
/* keep count of screens that implement randr */
return
TRUE
;
return
TRUE
;
}
}
/*ARGSUSED*/
/*ARGSUSED*/
static
int
static
int
RRFreeClient
(
void
*
data
,
XID
id
)
RRFreeClient
(
void
*
data
,
XID
id
)
{
{
RREventPtr
pRREvent
;
RREventPtr
pRREvent
;
WindowPtr
pWin
;
WindowPtr
pWin
;
RREventPtr
*
pHead
,
pCur
,
pPrev
;
RREventPtr
*
pHead
,
pCur
,
pPrev
;
pRREvent
=
(
RREventPtr
)
data
;
pRREvent
=
(
RREventPtr
)
data
;
pWin
=
pRREvent
->
window
;
pWin
=
pRREvent
->
window
;
pHead
=
(
RREventPtr
*
)
LookupIDByType
(
pWin
->
drawable
.
id
,
RREventType
);
pHead
=
(
RREventPtr
*
)
LookupIDByType
(
pWin
->
drawable
.
id
,
RREventType
);
if
(
pHead
)
{
if
(
pHead
)
{
pPrev
=
0
;
pPrev
=
0
;
for
(
pCur
=
*
pHead
;
pCur
&&
pCur
!=
pRREvent
;
pCur
=
pCur
->
next
)
for
(
pCur
=
*
pHead
;
pCur
&&
pCur
!=
pRREvent
;
pCur
=
pCur
->
next
)
pPrev
=
pCur
;
pPrev
=
pCur
;
if
(
pCur
)
if
(
pCur
)
{
{
if
(
pPrev
)
if
(
pPrev
)
pPrev
->
next
=
pRREvent
->
next
;
pPrev
->
next
=
pRREvent
->
next
;
else
else
*
pHead
=
pRREvent
->
next
;
*
pHead
=
pRREvent
->
next
;
}
}
}
}
xfree
((
void
*
)
pRREvent
);
xfree
((
void
*
)
pRREvent
);
return
1
;
return
1
;
}
}
/*ARGSUSED*/
/*ARGSUSED*/
static
int
static
int
RRFreeEvents
(
void
*
data
,
XID
id
)
RRFreeEvents
(
void
*
data
,
XID
id
)
{
{
RREventPtr
*
pHead
,
pCur
,
pNext
;
RREventPtr
*
pHead
,
pCur
,
pNext
;
pHead
=
(
RREventPtr
*
)
data
;
pHead
=
(
RREventPtr
*
)
data
;
for
(
pCur
=
*
pHead
;
pCur
;
pCur
=
pNext
)
{
for
(
pCur
=
*
pHead
;
pCur
;
pCur
=
pNext
)
{
pNext
=
pCur
->
next
;
pNext
=
pCur
->
next
;
FreeResource
(
pCur
->
clientResource
,
RRClientType
);
FreeResource
(
pCur
->
clientResource
,
RRClientType
);
xfree
((
void
*
)
pCur
);
xfree
((
void
*
)
pCur
);
}
}
xfree
((
void
*
)
pHead
);
xfree
((
void
*
)
pHead
);
return
1
;
return
1
;
}
}
void
void
RRExtensionInit
(
void
)
RRExtensionInit
(
void
)
{
{
ExtensionEntry
*
extEntry
;
ExtensionEntry
*
extEntry
;
if
(
RRNScreens
==
0
)
return
;
if
(
RRNScreens
==
0
)
return
;
#ifndef NXAGENT_SERVER
#ifndef NXAGENT_SERVER
if
(
!
dixRequestPrivate
(
RRClientPrivateKey
,
if
(
!
dixRequestPrivate
(
RRClientPrivateKey
,
sizeof
(
RRClientRec
)
+
sizeof
(
RRClientRec
)
+
screenInfo
.
numScreens
*
sizeof
(
RRTimesRec
)))
screenInfo
.
numScreens
*
sizeof
(
RRTimesRec
)))
return
;
return
;
#else
#else
RRClientPrivateIndex
=
AllocateClientPrivateIndex
();
RRClientPrivateIndex
=
AllocateClientPrivateIndex
();
if
(
!
AllocateClientPrivate
(
RRClientPrivateIndex
,
if
(
!
AllocateClientPrivate
(
RRClientPrivateIndex
,
sizeof
(
RRClientRec
)
+
sizeof
(
RRClientRec
)
+
screenInfo
.
numScreens
*
sizeof
(
RRTimesRec
)))
screenInfo
.
numScreens
*
sizeof
(
RRTimesRec
)))
return
;
return
;
#endif
#endif
if
(
!
AddCallback
(
&
ClientStateCallback
,
RRClientCallback
,
0
))
if
(
!
AddCallback
(
&
ClientStateCallback
,
RRClientCallback
,
0
))
return
;
return
;
RRClientType
=
CreateNewResourceType
(
RRFreeClient
);
RRClientType
=
CreateNewResourceType
(
RRFreeClient
);
if
(
!
RRClientType
)
if
(
!
RRClientType
)
return
;
return
;
RREventType
=
CreateNewResourceType
(
RRFreeEvents
);
RREventType
=
CreateNewResourceType
(
RRFreeEvents
);
if
(
!
RREventType
)
if
(
!
RREventType
)
return
;
return
;
extEntry
=
AddExtension
(
RANDR_NAME
,
RRNumberEvents
,
RRNumberErrors
,
extEntry
=
AddExtension
(
RANDR_NAME
,
RRNumberEvents
,
RRNumberErrors
,
ProcRRDispatch
,
SProcRRDispatch
,
ProcRRDispatch
,
SProcRRDispatch
,
RRResetProc
,
StandardMinorOpcode
);
RRResetProc
,
StandardMinorOpcode
);
if
(
!
extEntry
)
if
(
!
extEntry
)
return
;
return
;
RRErrorBase
=
extEntry
->
errorBase
;
RRErrorBase
=
extEntry
->
errorBase
;
RREventBase
=
extEntry
->
eventBase
;
RREventBase
=
extEntry
->
eventBase
;
EventSwapVector
[
RREventBase
+
RRScreenChangeNotify
]
=
(
EventSwapPtr
)
EventSwapVector
[
RREventBase
+
RRScreenChangeNotify
]
=
(
EventSwapPtr
)
SRRScreenChangeNotifyEvent
;
SRRScreenChangeNotifyEvent
;
EventSwapVector
[
RREventBase
+
RRNotify
]
=
(
EventSwapPtr
)
EventSwapVector
[
RREventBase
+
RRNotify
]
=
(
EventSwapPtr
)
SRRNotifyEvent
;
SRRNotifyEvent
;
#ifdef PANORAMIX
#ifdef PANORAMIX
RRXineramaExtensionInit
();
RRXineramaExtensionInit
();
#endif
#endif
}
}
static
int
static
int
TellChanged
(
WindowPtr
pWin
,
void
*
value
)
TellChanged
(
WindowPtr
pWin
,
void
*
value
)
{
{
RREventPtr
*
pHead
,
pRREvent
;
RREventPtr
*
pHead
,
pRREvent
;
ClientPtr
client
;
ClientPtr
client
;
ScreenPtr
pScreen
=
pWin
->
drawable
.
pScreen
;
ScreenPtr
pScreen
=
pWin
->
drawable
.
pScreen
;
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
int
i
;
int
i
;
pHead
=
(
RREventPtr
*
)
LookupIDByType
(
pWin
->
drawable
.
id
,
RREventType
);
pHead
=
(
RREventPtr
*
)
LookupIDByType
(
pWin
->
drawable
.
id
,
RREventType
);
if
(
!
pHead
)
if
(
!
pHead
)
return
WT_WALKCHILDREN
;
return
WT_WALKCHILDREN
;
for
(
pRREvent
=
*
pHead
;
pRREvent
;
pRREvent
=
pRREvent
->
next
)
for
(
pRREvent
=
*
pHead
;
pRREvent
;
pRREvent
=
pRREvent
->
next
)
{
{
client
=
pRREvent
->
client
;
client
=
pRREvent
->
client
;
if
(
client
==
serverClient
||
client
->
clientGone
)
if
(
client
==
serverClient
||
client
->
clientGone
)
continue
;
continue
;
if
(
pRREvent
->
mask
&
RRScreenChangeNotifyMask
)
if
(
pRREvent
->
mask
&
RRScreenChangeNotifyMask
)
RRDeliverScreenEvent
(
client
,
pWin
,
pScreen
);
RRDeliverScreenEvent
(
client
,
pWin
,
pScreen
);
if
(
pRREvent
->
mask
&
RRCrtcChangeNotifyMask
)
{
if
(
pRREvent
->
mask
&
RRCrtcChangeNotifyMask
)
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
{
{
RRCrtcPtr
crtc
=
pScrPriv
->
crtcs
[
i
];
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
{
if
(
crtc
->
changed
)
RRCrtcPtr
crtc
=
pScrPriv
->
crtcs
[
i
];
RRDeliverCrtcEvent
(
client
,
pWin
,
crtc
);
if
(
crtc
->
changed
)
}
RRDeliverCrtcEvent
(
client
,
pWin
,
crtc
);
}
}
}
if
(
pRREvent
->
mask
&
RROutputChangeNotifyMask
)
{
for
(
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
{
if
(
pRREvent
->
mask
&
RROutputChangeNotifyMask
)
RROutputPtr
output
=
pScrPriv
->
outputs
[
i
];
{
for
(
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
if
(
output
->
changed
)
{
RRDeliverOutputEvent
(
client
,
pWin
,
output
);
RROutputPtr
output
=
pScrPriv
->
outputs
[
i
];
}
if
(
output
->
changed
)
}
RRDeliverOutputEvent
(
client
,
pWin
,
output
);
}
}
}
}
return
WT_WALKCHILDREN
;
return
WT_WALKCHILDREN
;
}
}
...
@@ -438,31 +432,28 @@ TellChanged (WindowPtr pWin, void * value)
...
@@ -438,31 +432,28 @@ TellChanged (WindowPtr pWin, void * value)
* Something changed; send events and adjust pointer position
* Something changed; send events and adjust pointer position
*/
*/
void
void
RRTellChanged
(
ScreenPtr
pScreen
)
RRTellChanged
(
ScreenPtr
pScreen
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
int
i
;
int
i
;
if
(
pScrPriv
->
changed
)
if
(
pScrPriv
->
changed
)
{
{
UpdateCurrentTime
();
UpdateCurrentTime
();
if
(
pScrPriv
->
configChanged
)
{
if
(
pScrPriv
->
configChanged
)
pScrPriv
->
lastConfigTime
=
currentTime
;
{
pScrPriv
->
configChanged
=
FALSE
;
pScrPriv
->
lastConfigTime
=
currentTime
;
}
pScrPriv
->
configChanged
=
FALSE
;
pScrPriv
->
changed
=
FALSE
;
}
WalkTree
(
pScreen
,
TellChanged
,
(
void
*
)
pScreen
);
pScrPriv
->
changed
=
FALSE
;
for
(
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
WalkTree
(
pScreen
,
TellChanged
,
(
void
*
)
pScreen
);
pScrPriv
->
outputs
[
i
]
->
changed
=
FALSE
;
for
(
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
pScrPriv
->
outputs
[
i
]
->
changed
=
FALSE
;
pScrPriv
->
crtcs
[
i
]
->
changed
=
FALSE
;
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
if
(
pScrPriv
->
layoutChanged
)
{
pScrPriv
->
crtcs
[
i
]
->
changed
=
FALSE
;
pScrPriv
->
layoutChanged
=
FALSE
;
if
(
pScrPriv
->
layoutChanged
)
RRPointerScreenConfigured
(
pScreen
);
{
RRSendConfigNotify
(
pScreen
);
pScrPriv
->
layoutChanged
=
FALSE
;
}
RRPointerScreenConfigured
(
pScreen
);
RRSendConfigNotify
(
pScreen
);
}
}
}
}
}
...
@@ -471,53 +462,52 @@ RRTellChanged (ScreenPtr pScreen)
...
@@ -471,53 +462,52 @@ RRTellChanged (ScreenPtr pScreen)
* Used in emulating 1.0 behaviour
* Used in emulating 1.0 behaviour
*/
*/
RROutputPtr
RROutputPtr
RRFirstOutput
(
ScreenPtr
pScreen
)
RRFirstOutput
(
ScreenPtr
pScreen
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
RROutputPtr
output
;
RROutputPtr
output
;
int
i
,
j
;
int
i
,
j
;
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
{
{
RRCrtcPtr
crtc
=
pScrPriv
->
crtcs
[
i
];
RRCrtcPtr
crtc
=
pScrPriv
->
crtcs
[
i
];
for
(
j
=
0
;
j
<
pScrPriv
->
numOutputs
;
j
++
)
for
(
j
=
0
;
j
<
pScrPriv
->
numOutputs
;
j
++
)
{
{
output
=
pScrPriv
->
outputs
[
j
];
output
=
pScrPriv
->
outputs
[
j
];
if
(
output
->
crtc
==
crtc
)
if
(
output
->
crtc
==
crtc
)
return
output
;
return
output
;
}
}
}
}
return
NULL
;
return
NULL
;
}
}
CARD16
CARD16
RRVerticalRefresh
(
xRRModeInfo
*
mode
)
RRVerticalRefresh
(
xRRModeInfo
*
mode
)
{
{
CARD32
refresh
;
CARD32
refresh
;
CARD32
dots
=
mode
->
hTotal
*
mode
->
vTotal
;
CARD32
dots
=
mode
->
hTotal
*
mode
->
vTotal
;
if
(
!
dots
)
if
(
!
dots
)
return
0
;
return
0
;
refresh
=
(
mode
->
dotClock
+
dots
/
2
)
/
dots
;
refresh
=
(
mode
->
dotClock
+
dots
/
2
)
/
dots
;
if
(
refresh
>
0xffff
)
if
(
refresh
>
0xffff
)
refresh
=
0xffff
;
refresh
=
0xffff
;
return
(
CARD16
)
refresh
;
return
(
CARD16
)
refresh
;
}
}
static
int
static
int
ProcRRDispatch
(
ClientPtr
client
)
ProcRRDispatch
(
ClientPtr
client
)
{
{
REQUEST
(
xReq
);
REQUEST
(
xReq
);
if
(
stuff
->
data
>=
RRNumberRequests
||
!
ProcRandrVector
[
stuff
->
data
])
if
(
stuff
->
data
>=
RRNumberRequests
||
!
ProcRandrVector
[
stuff
->
data
])
return
BadRequest
;
return
BadRequest
;
return
(
*
ProcRandrVector
[
stuff
->
data
])
(
client
);
return
(
*
ProcRandrVector
[
stuff
->
data
])
(
client
);
}
}
static
int
static
int
SProcRRDispatch
(
ClientPtr
client
)
SProcRRDispatch
(
ClientPtr
client
)
{
{
REQUEST
(
xReq
);
REQUEST
(
xReq
);
if
(
stuff
->
data
>=
RRNumberRequests
||
!
ProcRandrVector
[
stuff
->
data
])
if
(
stuff
->
data
>=
RRNumberRequests
||
!
ProcRandrVector
[
stuff
->
data
])
return
BadRequest
;
return
BadRequest
;
return
(
*
SProcRandrVector
[
stuff
->
data
])
(
client
);
return
(
*
SProcRandrVector
[
stuff
->
data
])
(
client
);
}
}
nx-X11/programs/Xserver/randr/randr.h
View file @
e440ea76
...
@@ -28,14 +28,14 @@
...
@@ -28,14 +28,14 @@
#ifndef _RANDR_H_
#ifndef _RANDR_H_
#define _RANDR_H_
#define _RANDR_H_
typedef
unsigned
short
Rotation
;
typedef
unsigned
short
Rotation
;
typedef
unsigned
short
SizeID
;
typedef
unsigned
short
SizeID
;
typedef
unsigned
short
SubpixelOrder
;
typedef
unsigned
short
SubpixelOrder
;
typedef
unsigned
short
Connection
;
typedef
unsigned
short
Connection
;
typedef
unsigned
short
XRandrRotation
;
typedef
unsigned
short
XRandrRotation
;
typedef
unsigned
short
XRandrSizeID
;
typedef
unsigned
short
XRandrSizeID
;
typedef
unsigned
short
XRandrSubpixelOrder
;
typedef
unsigned
short
XRandrSubpixelOrder
;
typedef
unsigned
long
XRandrModeFlags
;
typedef
unsigned
long
XRandrModeFlags
;
#define RANDR_NAME "RANDR"
#define RANDR_NAME "RANDR"
#define RANDR_MAJOR 1
#define RANDR_MAJOR 1
...
@@ -138,4 +138,4 @@ typedef unsigned long XRandrModeFlags;
...
@@ -138,4 +138,4 @@ typedef unsigned long XRandrModeFlags;
#define RR_PROPERTY_RANDR_EDID "RANDR_EDID"
#define RR_PROPERTY_RANDR_EDID "RANDR_EDID"
#endif
/* _RANDR_H_ */
#endif
/* _RANDR_H_ */
nx-X11/programs/Xserver/randr/randrproto.h
View file @
e440ea76
...
@@ -63,6 +63,7 @@ typedef struct {
...
@@ -63,6 +63,7 @@ typedef struct {
CARD16
widthInMillimeters
B16
;
CARD16
widthInMillimeters
B16
;
CARD16
heightInMillimeters
B16
;
CARD16
heightInMillimeters
B16
;
}
xScreenSizes
;
}
xScreenSizes
;
#define sz_xScreenSizes 8
#define sz_xScreenSizes 8
/*
/*
...
@@ -70,34 +71,37 @@ typedef struct {
...
@@ -70,34 +71,37 @@ typedef struct {
*/
*/
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
CARD32
majorVersion
B32
;
CARD32
majorVersion
B32
;
CARD32
minorVersion
B32
;
CARD32
minorVersion
B32
;
}
xRRQueryVersionReq
;
}
xRRQueryVersionReq
;
#define sz_xRRQueryVersionReq 12
#define sz_xRRQueryVersionReq 12
typedef
struct
{
typedef
struct
{
BYTE
type
;
/* X_Reply */
BYTE
type
;
/* X_Reply */
BYTE
pad1
;
BYTE
pad1
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
CARD32
majorVersion
B32
;
CARD32
majorVersion
B32
;
CARD32
minorVersion
B32
;
CARD32
minorVersion
B32
;
CARD32
pad2
B32
;
CARD32
pad2
B32
;
CARD32
pad3
B32
;
CARD32
pad3
B32
;
CARD32
pad4
B32
;
CARD32
pad4
B32
;
CARD32
pad5
B32
;
CARD32
pad5
B32
;
}
xRRQueryVersionReply
;
}
xRRQueryVersionReply
;
#define sz_xRRQueryVersionReply 32
#define sz_xRRQueryVersionReply 32
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
Window
window
B32
;
Window
window
B32
;
}
xRRGetScreenInfoReq
;
}
xRRGetScreenInfoReq
;
#define sz_xRRGetScreenInfoReq 8
#define sz_xRRGetScreenInfoReq 8
/*
/*
...
@@ -106,73 +110,77 @@ typedef struct {
...
@@ -106,73 +110,77 @@ typedef struct {
* the size information
* the size information
*/
*/
typedef
struct
{
typedef
struct
{
BYTE
type
;
/* X_Reply */
BYTE
type
;
/* X_Reply */
BYTE
setOfRotations
;
BYTE
setOfRotations
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
Window
root
B32
;
Window
root
B32
;
Time
timestamp
B32
;
Time
timestamp
B32
;
Time
configTimestamp
B32
;
Time
configTimestamp
B32
;
CARD16
nSizes
B16
;
CARD16
nSizes
B16
;
SizeID
sizeID
B16
;
SizeID
sizeID
B16
;
Rotation
rotation
B16
;
Rotation
rotation
B16
;
CARD16
rate
B16
;
CARD16
rate
B16
;
CARD16
nrateEnts
B16
;
CARD16
nrateEnts
B16
;
CARD16
pad
B16
;
CARD16
pad
B16
;
}
xRRGetScreenInfoReply
;
}
xRRGetScreenInfoReply
;
#define sz_xRRGetScreenInfoReply 32
#define sz_xRRGetScreenInfoReply 32
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
Drawable
drawable
B32
;
Drawable
drawable
B32
;
Time
timestamp
B32
;
Time
timestamp
B32
;
Time
configTimestamp
B32
;
Time
configTimestamp
B32
;
SizeID
sizeID
B16
;
SizeID
sizeID
B16
;
Rotation
rotation
B16
;
Rotation
rotation
B16
;
}
xRR1_0SetScreenConfigReq
;
}
xRR1_0SetScreenConfigReq
;
#define sz_xRR1_0SetScreenConfigReq 20
#define sz_xRR1_0SetScreenConfigReq 20
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
Drawable
drawable
B32
;
Drawable
drawable
B32
;
Time
timestamp
B32
;
Time
timestamp
B32
;
Time
configTimestamp
B32
;
Time
configTimestamp
B32
;
SizeID
sizeID
B16
;
SizeID
sizeID
B16
;
Rotation
rotation
B16
;
Rotation
rotation
B16
;
CARD16
rate
B16
;
CARD16
rate
B16
;
CARD16
pad
B16
;
CARD16
pad
B16
;
}
xRRSetScreenConfigReq
;
}
xRRSetScreenConfigReq
;
#define sz_xRRSetScreenConfigReq 24
#define sz_xRRSetScreenConfigReq 24
typedef
struct
{
typedef
struct
{
BYTE
type
;
/* X_Reply */
BYTE
type
;
/* X_Reply */
CARD8
status
;
CARD8
status
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
Time
newTimestamp
B32
;
Time
newTimestamp
B32
;
Time
newConfigTimestamp
B32
;
Time
newConfigTimestamp
B32
;
Window
root
;
Window
root
;
CARD16
subpixelOrder
B16
;
CARD16
subpixelOrder
B16
;
CARD16
pad4
B16
;
CARD16
pad4
B16
;
CARD32
pad5
B32
;
CARD32
pad5
B32
;
CARD32
pad6
B32
;
CARD32
pad6
B32
;
}
xRRSetScreenConfigReply
;
}
xRRSetScreenConfigReply
;
#define sz_xRRSetScreenConfigReply 32
#define sz_xRRSetScreenConfigReply 32
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
Window
window
B32
;
Window
window
B32
;
CARD16
enable
B16
;
CARD16
enable
B16
;
CARD16
pad2
B16
;
CARD16
pad2
B16
;
}
xRRSelectInputReq
;
}
xRRSelectInputReq
;
#define sz_xRRSelectInputReq 12
#define sz_xRRSelectInputReq 12
/*
/*
...
@@ -180,455 +188,490 @@ typedef struct {
...
@@ -180,455 +188,490 @@ typedef struct {
*/
*/
typedef
struct
_xRRModeInfo
{
typedef
struct
_xRRModeInfo
{
RRMode
id
B32
;
RRMode
id
B32
;
CARD16
width
B16
;
CARD16
width
B16
;
CARD16
height
B16
;
CARD16
height
B16
;
CARD32
dotClock
B32
;
CARD32
dotClock
B32
;
CARD16
hSyncStart
B16
;
CARD16
hSyncStart
B16
;
CARD16
hSyncEnd
B16
;
CARD16
hSyncEnd
B16
;
CARD16
hTotal
B16
;
CARD16
hTotal
B16
;
CARD16
hSkew
B16
;
CARD16
hSkew
B16
;
CARD16
vSyncStart
B16
;
CARD16
vSyncStart
B16
;
CARD16
vSyncEnd
B16
;
CARD16
vSyncEnd
B16
;
CARD16
vTotal
B16
;
CARD16
vTotal
B16
;
CARD16
nameLength
B16
;
CARD16
nameLength
B16
;
RRModeFlags
modeFlags
B32
;
RRModeFlags
modeFlags
B32
;
}
xRRModeInfo
;
}
xRRModeInfo
;
#define sz_xRRModeInfo 32
#define sz_xRRModeInfo 32
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
Window
window
B32
;
Window
window
B32
;
}
xRRGetScreenSizeRangeReq
;
}
xRRGetScreenSizeRangeReq
;
#define sz_xRRGetScreenSizeRangeReq 8
#define sz_xRRGetScreenSizeRangeReq 8
typedef
struct
{
typedef
struct
{
BYTE
type
;
/* X_Reply */
BYTE
type
;
/* X_Reply */
CARD8
pad
;
CARD8
pad
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
CARD16
minWidth
B16
;
CARD16
minWidth
B16
;
CARD16
minHeight
B16
;
CARD16
minHeight
B16
;
CARD16
maxWidth
B16
;
CARD16
maxWidth
B16
;
CARD16
maxHeight
B16
;
CARD16
maxHeight
B16
;
CARD32
pad0
B32
;
CARD32
pad0
B32
;
CARD32
pad1
B32
;
CARD32
pad1
B32
;
CARD32
pad2
B32
;
CARD32
pad2
B32
;
CARD32
pad3
B32
;
CARD32
pad3
B32
;
}
xRRGetScreenSizeRangeReply
;
}
xRRGetScreenSizeRangeReply
;
#define sz_xRRGetScreenSizeRangeReply 32
#define sz_xRRGetScreenSizeRangeReply 32
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
Window
window
B32
;
Window
window
B32
;
CARD16
width
B16
;
CARD16
width
B16
;
CARD16
height
B16
;
CARD16
height
B16
;
CARD32
widthInMillimeters
B32
;
CARD32
widthInMillimeters
B32
;
CARD32
heightInMillimeters
B32
;
CARD32
heightInMillimeters
B32
;
}
xRRSetScreenSizeReq
;
}
xRRSetScreenSizeReq
;
#define sz_xRRSetScreenSizeReq 20
#define sz_xRRSetScreenSizeReq 20
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
Window
window
B32
;
Window
window
B32
;
}
xRRGetScreenResourcesReq
;
}
xRRGetScreenResourcesReq
;
#define sz_xRRGetScreenResourcesReq 8
#define sz_xRRGetScreenResourcesReq 8
typedef
struct
{
typedef
struct
{
BYTE
type
;
BYTE
type
;
CARD8
pad
;
CARD8
pad
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
Time
timestamp
B32
;
Time
timestamp
B32
;
Time
configTimestamp
B32
;
Time
configTimestamp
B32
;
CARD16
nCrtcs
B16
;
CARD16
nCrtcs
B16
;
CARD16
nOutputs
B16
;
CARD16
nOutputs
B16
;
CARD16
nModes
B16
;
CARD16
nModes
B16
;
CARD16
nbytesNames
B16
;
CARD16
nbytesNames
B16
;
CARD32
pad1
B32
;
CARD32
pad1
B32
;
CARD32
pad2
B32
;
CARD32
pad2
B32
;
}
xRRGetScreenResourcesReply
;
}
xRRGetScreenResourcesReply
;
#define sz_xRRGetScreenResourcesReply 32
#define sz_xRRGetScreenResourcesReply 32
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
RROutput
output
B32
;
RROutput
output
B32
;
Time
configTimestamp
B32
;
Time
configTimestamp
B32
;
}
xRRGetOutputInfoReq
;
}
xRRGetOutputInfoReq
;
#define sz_xRRGetOutputInfoReq 12
#define sz_xRRGetOutputInfoReq 12
typedef
struct
{
typedef
struct
{
BYTE
type
;
BYTE
type
;
CARD8
status
;
CARD8
status
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
Time
timestamp
B32
;
Time
timestamp
B32
;
RRCrtc
crtc
B32
;
RRCrtc
crtc
B32
;
CARD32
mmWidth
B32
;
CARD32
mmWidth
B32
;
CARD32
mmHeight
B32
;
CARD32
mmHeight
B32
;
CARD8
connection
;
CARD8
connection
;
CARD8
subpixelOrder
;
CARD8
subpixelOrder
;
CARD16
nCrtcs
B16
;
CARD16
nCrtcs
B16
;
CARD16
nModes
B16
;
CARD16
nModes
B16
;
CARD16
nPreferred
B16
;
CARD16
nPreferred
B16
;
CARD16
nClones
B16
;
CARD16
nClones
B16
;
CARD16
nameLength
B16
;
CARD16
nameLength
B16
;
}
xRRGetOutputInfoReply
;
}
xRRGetOutputInfoReply
;
#define sz_xRRGetOutputInfoReply 36
#define sz_xRRGetOutputInfoReply 36
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
RROutput
output
B32
;
RROutput
output
B32
;
}
xRRListOutputPropertiesReq
;
}
xRRListOutputPropertiesReq
;
#define sz_xRRListOutputPropertiesReq 8
#define sz_xRRListOutputPropertiesReq 8
typedef
struct
{
typedef
struct
{
BYTE
type
;
BYTE
type
;
CARD8
pad0
;
CARD8
pad0
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
CARD16
nAtoms
B16
;
CARD16
nAtoms
B16
;
CARD16
pad1
B16
;
CARD16
pad1
B16
;
CARD32
pad2
B32
;
CARD32
pad2
B32
;
CARD32
pad3
B32
;
CARD32
pad3
B32
;
CARD32
pad4
B32
;
CARD32
pad4
B32
;
CARD32
pad5
B32
;
CARD32
pad5
B32
;
CARD32
pad6
B32
;
CARD32
pad6
B32
;
}
xRRListOutputPropertiesReply
;
}
xRRListOutputPropertiesReply
;
#define sz_xRRListOutputPropertiesReply 32
#define sz_xRRListOutputPropertiesReply 32
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
RROutput
output
B32
;
RROutput
output
B32
;
Atom
property
B32
;
Atom
property
B32
;
}
xRRQueryOutputPropertyReq
;
}
xRRQueryOutputPropertyReq
;
#define sz_xRRQueryOutputPropertyReq 12
#define sz_xRRQueryOutputPropertyReq 12
typedef
struct
{
typedef
struct
{
BYTE
type
;
BYTE
type
;
BYTE
pad0
;
BYTE
pad0
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
BOOL
pending
;
BOOL
pending
;
BOOL
range
;
BOOL
range
;
BOOL
immutable
;
BOOL
immutable
;
BYTE
pad1
;
BYTE
pad1
;
CARD32
pad2
B32
;
CARD32
pad2
B32
;
CARD32
pad3
B32
;
CARD32
pad3
B32
;
CARD32
pad4
B32
;
CARD32
pad4
B32
;
CARD32
pad5
B32
;
CARD32
pad5
B32
;
CARD32
pad6
B32
;
CARD32
pad6
B32
;
}
xRRQueryOutputPropertyReply
;
}
xRRQueryOutputPropertyReply
;
#define sz_xRRQueryOutputPropertyReply 32
#define sz_xRRQueryOutputPropertyReply 32
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
RROutput
output
B32
;
RROutput
output
B32
;
Atom
property
B32
;
Atom
property
B32
;
BOOL
pending
;
BOOL
pending
;
BOOL
range
;
BOOL
range
;
CARD16
pad
B16
;
CARD16
pad
B16
;
}
xRRConfigureOutputPropertyReq
;
}
xRRConfigureOutputPropertyReq
;
#define sz_xRRConfigureOutputPropertyReq 16
#define sz_xRRConfigureOutputPropertyReq 16
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
RROutput
output
B32
;
RROutput
output
B32
;
Atom
property
B32
;
Atom
property
B32
;
Atom
type
B32
;
Atom
type
B32
;
CARD8
format
;
CARD8
format
;
CARD8
mode
;
CARD8
mode
;
CARD16
pad
;
CARD16
pad
;
CARD32
nUnits
B32
;
CARD32
nUnits
B32
;
}
xRRChangeOutputPropertyReq
;
}
xRRChangeOutputPropertyReq
;
#define sz_xRRChangeOutputPropertyReq 24
#define sz_xRRChangeOutputPropertyReq 24
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
RROutput
output
B32
;
RROutput
output
B32
;
Atom
property
B32
;
Atom
property
B32
;
}
xRRDeleteOutputPropertyReq
;
}
xRRDeleteOutputPropertyReq
;
#define sz_xRRDeleteOutputPropertyReq 12
#define sz_xRRDeleteOutputPropertyReq 12
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
RROutput
output
B32
;
RROutput
output
B32
;
Atom
property
B32
;
Atom
property
B32
;
Atom
type
B32
;
Atom
type
B32
;
CARD32
longOffset
B32
;
CARD32
longOffset
B32
;
CARD32
longLength
B32
;
CARD32
longLength
B32
;
#ifdef __cplusplus
#ifdef __cplusplus
BOOL
_delete
;
BOOL
_delete
;
#else
#else
BOOL
delete
;
BOOL
delete
;
#endif
#endif
BOOL
pending
;
BOOL
pending
;
CARD16
pad1
B16
;
CARD16
pad1
B16
;
}
xRRGetOutputPropertyReq
;
}
xRRGetOutputPropertyReq
;
#define sz_xRRGetOutputPropertyReq 28
#define sz_xRRGetOutputPropertyReq 28
typedef
struct
{
typedef
struct
{
BYTE
type
;
BYTE
type
;
CARD8
format
;
CARD8
format
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
Atom
propertyType
B32
;
Atom
propertyType
B32
;
CARD32
bytesAfter
B32
;
CARD32
bytesAfter
B32
;
CARD32
nItems
B32
;
CARD32
nItems
B32
;
CARD32
pad1
B32
;
CARD32
pad1
B32
;
CARD32
pad2
B32
;
CARD32
pad2
B32
;
CARD32
pad3
B32
;
CARD32
pad3
B32
;
}
xRRGetOutputPropertyReply
;
}
xRRGetOutputPropertyReply
;
#define sz_xRRGetOutputPropertyReply 32
#define sz_xRRGetOutputPropertyReply 32
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
Window
window
B32
;
Window
window
B32
;
xRRModeInfo
modeInfo
;
xRRModeInfo
modeInfo
;
}
xRRCreateModeReq
;
}
xRRCreateModeReq
;
#define sz_xRRCreateModeReq 40
#define sz_xRRCreateModeReq 40
typedef
struct
{
typedef
struct
{
BYTE
type
;
BYTE
type
;
CARD8
pad0
;
CARD8
pad0
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
RRMode
mode
B32
;
RRMode
mode
B32
;
CARD32
pad1
B32
;
CARD32
pad1
B32
;
CARD32
pad2
B32
;
CARD32
pad2
B32
;
CARD32
pad3
B32
;
CARD32
pad3
B32
;
CARD32
pad4
B32
;
CARD32
pad4
B32
;
CARD32
pad5
B32
;
CARD32
pad5
B32
;
}
xRRCreateModeReply
;
}
xRRCreateModeReply
;
#define sz_xRRCreateModeReply 32
#define sz_xRRCreateModeReply 32
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
RRMode
mode
B32
;
RRMode
mode
B32
;
}
xRRDestroyModeReq
;
}
xRRDestroyModeReq
;
#define sz_xRRDestroyModeReq 8
#define sz_xRRDestroyModeReq 8
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
RROutput
output
B32
;
RROutput
output
B32
;
RRMode
mode
B32
;
RRMode
mode
B32
;
}
xRRAddOutputModeReq
;
}
xRRAddOutputModeReq
;
#define sz_xRRAddOutputModeReq 12
#define sz_xRRAddOutputModeReq 12
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
RROutput
output
B32
;
RROutput
output
B32
;
RRMode
mode
B32
;
RRMode
mode
B32
;
}
xRRDeleteOutputModeReq
;
}
xRRDeleteOutputModeReq
;
#define sz_xRRDeleteOutputModeReq 12
#define sz_xRRDeleteOutputModeReq 12
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
RRCrtc
crtc
B32
;
RRCrtc
crtc
B32
;
Time
configTimestamp
B32
;
Time
configTimestamp
B32
;
}
xRRGetCrtcInfoReq
;
}
xRRGetCrtcInfoReq
;
#define sz_xRRGetCrtcInfoReq 12
#define sz_xRRGetCrtcInfoReq 12
typedef
struct
{
typedef
struct
{
BYTE
type
;
BYTE
type
;
CARD8
status
;
CARD8
status
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
Time
timestamp
B32
;
Time
timestamp
B32
;
INT16
x
B16
;
INT16
x
B16
;
INT16
y
B16
;
INT16
y
B16
;
CARD16
width
B16
;
CARD16
width
B16
;
CARD16
height
B16
;
CARD16
height
B16
;
RRMode
mode
B32
;
RRMode
mode
B32
;
Rotation
rotation
B16
;
Rotation
rotation
B16
;
Rotation
rotations
B16
;
Rotation
rotations
B16
;
CARD16
nOutput
B16
;
CARD16
nOutput
B16
;
CARD16
nPossibleOutput
B16
;
CARD16
nPossibleOutput
B16
;
}
xRRGetCrtcInfoReply
;
}
xRRGetCrtcInfoReply
;
#define sz_xRRGetCrtcInfoReply 32
#define sz_xRRGetCrtcInfoReply 32
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
RRCrtc
crtc
B32
;
RRCrtc
crtc
B32
;
Time
timestamp
B32
;
Time
timestamp
B32
;
Time
configTimestamp
B32
;
Time
configTimestamp
B32
;
INT16
x
B16
;
INT16
x
B16
;
INT16
y
B16
;
INT16
y
B16
;
RRMode
mode
B32
;
RRMode
mode
B32
;
Rotation
rotation
B16
;
Rotation
rotation
B16
;
CARD16
pad
B16
;
CARD16
pad
B16
;
}
xRRSetCrtcConfigReq
;
}
xRRSetCrtcConfigReq
;
#define sz_xRRSetCrtcConfigReq 28
#define sz_xRRSetCrtcConfigReq 28
typedef
struct
{
typedef
struct
{
BYTE
type
;
BYTE
type
;
CARD8
status
;
CARD8
status
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
Time
newTimestamp
B32
;
Time
newTimestamp
B32
;
CARD32
pad1
B32
;
CARD32
pad1
B32
;
CARD32
pad2
B16
;
CARD32
pad2
B16
;
CARD32
pad3
B32
;
CARD32
pad3
B32
;
CARD32
pad4
B32
;
CARD32
pad4
B32
;
CARD32
pad5
B32
;
CARD32
pad5
B32
;
}
xRRSetCrtcConfigReply
;
}
xRRSetCrtcConfigReply
;
#define sz_xRRSetCrtcConfigReply 32
#define sz_xRRSetCrtcConfigReply 32
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
RRCrtc
crtc
B32
;
RRCrtc
crtc
B32
;
}
xRRGetCrtcGammaSizeReq
;
}
xRRGetCrtcGammaSizeReq
;
#define sz_xRRGetCrtcGammaSizeReq 8
#define sz_xRRGetCrtcGammaSizeReq 8
typedef
struct
{
typedef
struct
{
BYTE
type
;
BYTE
type
;
CARD8
status
;
CARD8
status
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
CARD16
size
B16
;
CARD16
size
B16
;
CARD16
pad1
B16
;
CARD16
pad1
B16
;
CARD32
pad2
B32
;
CARD32
pad2
B32
;
CARD32
pad3
B32
;
CARD32
pad3
B32
;
CARD32
pad4
B32
;
CARD32
pad4
B32
;
CARD32
pad5
B32
;
CARD32
pad5
B32
;
CARD32
pad6
B32
;
CARD32
pad6
B32
;
}
xRRGetCrtcGammaSizeReply
;
}
xRRGetCrtcGammaSizeReply
;
#define sz_xRRGetCrtcGammaSizeReply 32
#define sz_xRRGetCrtcGammaSizeReply 32
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
RRCrtc
crtc
B32
;
RRCrtc
crtc
B32
;
}
xRRGetCrtcGammaReq
;
}
xRRGetCrtcGammaReq
;
#define sz_xRRGetCrtcGammaReq 8
#define sz_xRRGetCrtcGammaReq 8
typedef
struct
{
typedef
struct
{
BYTE
type
;
BYTE
type
;
CARD8
status
;
CARD8
status
;
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
length
B32
;
CARD16
size
B16
;
CARD16
size
B16
;
CARD16
pad1
B16
;
CARD16
pad1
B16
;
CARD32
pad2
B32
;
CARD32
pad2
B32
;
CARD32
pad3
B32
;
CARD32
pad3
B32
;
CARD32
pad4
B32
;
CARD32
pad4
B32
;
CARD32
pad5
B32
;
CARD32
pad5
B32
;
CARD32
pad6
B32
;
CARD32
pad6
B32
;
}
xRRGetCrtcGammaReply
;
}
xRRGetCrtcGammaReply
;
#define sz_xRRGetCrtcGammaReply 32
#define sz_xRRGetCrtcGammaReply 32
typedef
struct
{
typedef
struct
{
CARD8
reqType
;
CARD8
reqType
;
CARD8
randrReqType
;
CARD8
randrReqType
;
CARD16
length
B16
;
CARD16
length
B16
;
RRCrtc
crtc
B32
;
RRCrtc
crtc
B32
;
CARD16
size
B16
;
CARD16
size
B16
;
CARD16
pad1
B16
;
CARD16
pad1
B16
;
}
xRRSetCrtcGammaReq
;
}
xRRSetCrtcGammaReq
;
#define sz_xRRSetCrtcGammaReq 12
#define sz_xRRSetCrtcGammaReq 12
/*
/*
* event
* event
*/
*/
typedef
struct
{
typedef
struct
{
CARD8
type
;
/* always evBase + ScreenChangeNotify */
CARD8
type
;
/* always evBase + ScreenChangeNotify */
CARD8
rotation
;
/* new rotation */
CARD8
rotation
;
/* new rotation */
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
Time
timestamp
B32
;
/* time screen was changed */
Time
timestamp
B32
;
/* time screen was changed */
Time
configTimestamp
B32
;
/* time config data was changed */
Time
configTimestamp
B32
;
/* time config data was changed */
Window
root
B32
;
/* root window */
Window
root
B32
;
/* root window */
Window
window
B32
;
/* window requesting notification */
Window
window
B32
;
/* window requesting notification */
SizeID
sizeID
B16
;
/* new size ID */
SizeID
sizeID
B16
;
/* new size ID */
CARD16
subpixelOrder
B16
;
/* subpixel order */
CARD16
subpixelOrder
B16
;
/* subpixel order */
CARD16
widthInPixels
B16
;
/* new size */
CARD16
widthInPixels
B16
;
/* new size */
CARD16
heightInPixels
B16
;
CARD16
heightInPixels
B16
;
CARD16
widthInMillimeters
B16
;
CARD16
widthInMillimeters
B16
;
CARD16
heightInMillimeters
B16
;
CARD16
heightInMillimeters
B16
;
}
xRRScreenChangeNotifyEvent
;
}
xRRScreenChangeNotifyEvent
;
#define sz_xRRScreenChangeNotifyEvent 32
#define sz_xRRScreenChangeNotifyEvent 32
typedef
struct
{
typedef
struct
{
CARD8
type
;
/* always evBase + RRNotify */
CARD8
type
;
/* always evBase + RRNotify */
CARD8
subCode
;
/* RRNotify_CrtcChange */
CARD8
subCode
;
/* RRNotify_CrtcChange */
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
Time
timestamp
B32
;
/* time crtc was changed */
Time
timestamp
B32
;
/* time crtc was changed */
Window
window
B32
;
/* window requesting notification */
Window
window
B32
;
/* window requesting notification */
RRCrtc
crtc
B32
;
/* affected CRTC */
RRCrtc
crtc
B32
;
/* affected CRTC */
RRMode
mode
B32
;
/* current mode */
RRMode
mode
B32
;
/* current mode */
CARD16
rotation
B16
;
/* rotation and reflection */
CARD16
rotation
B16
;
/* rotation and reflection */
CARD16
pad1
B16
;
/* unused */
CARD16
pad1
B16
;
/* unused */
INT16
x
B16
;
/* new location */
INT16
x
B16
;
/* new location */
INT16
y
B16
;
INT16
y
B16
;
CARD16
width
B16
;
/* new size */
CARD16
width
B16
;
/* new size */
CARD16
height
B16
;
CARD16
height
B16
;
}
xRRCrtcChangeNotifyEvent
;
}
xRRCrtcChangeNotifyEvent
;
#define sz_xRRCrtcChangeNotifyEvent 32
#define sz_xRRCrtcChangeNotifyEvent 32
typedef
struct
{
typedef
struct
{
CARD8
type
;
/* always evBase + RRNotify */
CARD8
type
;
/* always evBase + RRNotify */
CARD8
subCode
;
/* RRNotify_OutputChange */
CARD8
subCode
;
/* RRNotify_OutputChange */
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
Time
timestamp
B32
;
/* time crtc was changed */
Time
timestamp
B32
;
/* time crtc was changed */
Time
configTimestamp
B32
;
/* time crtc was changed */
Time
configTimestamp
B32
;
/* time crtc was changed */
Window
window
B32
;
/* window requesting notification */
Window
window
B32
;
/* window requesting notification */
RROutput
output
B32
;
/* affected output */
RROutput
output
B32
;
/* affected output */
RRCrtc
crtc
B32
;
/* current crtc */
RRCrtc
crtc
B32
;
/* current crtc */
RRMode
mode
B32
;
/* current mode */
RRMode
mode
B32
;
/* current mode */
CARD16
rotation
B16
;
/* rotation and reflection */
CARD16
rotation
B16
;
/* rotation and reflection */
CARD8
connection
;
/* connection status */
CARD8
connection
;
/* connection status */
CARD8
subpixelOrder
;
/* subpixel order */
CARD8
subpixelOrder
;
/* subpixel order */
}
xRROutputChangeNotifyEvent
;
}
xRROutputChangeNotifyEvent
;
#define sz_xRROutputChangeNotifyEvent 32
#define sz_xRROutputChangeNotifyEvent 32
typedef
struct
{
typedef
struct
{
CARD8
type
;
/* always evBase + RRNotify */
CARD8
type
;
/* always evBase + RRNotify */
CARD8
subCode
;
/* RRNotify_OutputProperty */
CARD8
subCode
;
/* RRNotify_OutputProperty */
CARD16
sequenceNumber
B16
;
CARD16
sequenceNumber
B16
;
Window
window
B32
;
/* window requesting notification */
Window
window
B32
;
/* window requesting notification */
RROutput
output
B32
;
/* affected output */
RROutput
output
B32
;
/* affected output */
Atom
atom
B32
;
/* property name */
Atom
atom
B32
;
/* property name */
Time
timestamp
B32
;
/* time crtc was changed */
Time
timestamp
B32
;
/* time crtc was changed */
CARD8
state
;
/* NewValue or Deleted */
CARD8
state
;
/* NewValue or Deleted */
CARD8
pad1
;
CARD8
pad1
;
CARD16
pad2
B16
;
CARD16
pad2
B16
;
CARD32
pad3
B32
;
CARD32
pad3
B32
;
CARD32
pad4
B32
;
CARD32
pad4
B32
;
}
xRROutputPropertyNotifyEvent
;
}
xRROutputPropertyNotifyEvent
;
#define sz_xRROutputPropertyNotifyEvent 32
#define sz_xRROutputPropertyNotifyEvent 32
#undef RRModeFlags
#undef RRModeFlags
...
@@ -652,4 +695,4 @@ typedef struct {
...
@@ -652,4 +695,4 @@ typedef struct {
#undef SizeID
#undef SizeID
#undef SubpixelOrder
#undef SubpixelOrder
#endif
/* _XRANDRP_H_ */
#endif
/* _XRANDRP_H_ */
nx-X11/programs/Xserver/randr/randrstr.h
View file @
e440ea76
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
#include "randrproto.h"
#include "randrproto.h"
#endif
#endif
#ifdef RENDER
#ifdef RENDER
#include <nx-X11/extensions/render.h>
/* we share subpixel order information */
#include <nx-X11/extensions/render.h>
/* we share subpixel order information */
#include "picturestr.h"
#include "picturestr.h"
#endif
#endif
#include <nx-X11/Xfuncproto.h>
#include <nx-X11/Xfuncproto.h>
...
@@ -60,153 +60,147 @@
...
@@ -60,153 +60,147 @@
#define RANDR_10_INTERFACE 1
#define RANDR_10_INTERFACE 1
#define RANDR_12_INTERFACE 1
#define RANDR_12_INTERFACE 1
typedef
XID
RRMode
;
typedef
XID
RRMode
;
typedef
XID
RROutput
;
typedef
XID
RROutput
;
typedef
XID
RRCrtc
;
typedef
XID
RRCrtc
;
extern
int
RREventBase
,
RRErrorBase
;
extern
int
RREventBase
,
RRErrorBase
;
extern
int
(
*
ProcRandrVector
[
RRNumberRequests
])(
ClientPtr
);
extern
int
(
*
ProcRandrVector
[
RRNumberRequests
])
(
ClientPtr
);
extern
int
(
*
SProcRandrVector
[
RRNumberRequests
])(
ClientPtr
);
extern
int
(
*
SProcRandrVector
[
RRNumberRequests
])
(
ClientPtr
);
/*
/*
* Modeline for a monitor. Name follows directly after this struct
* Modeline for a monitor. Name follows directly after this struct
*/
*/
#define RRModeName(pMode) ((char *) (pMode + 1))
#define RRModeName(pMode) ((char *) (pMode + 1))
typedef
struct
_rrMode
RRModeRec
,
*
RRModePtr
;
typedef
struct
_rrMode
RRModeRec
,
*
RRModePtr
;
typedef
struct
_rrPropertyValue
RRPropertyValueRec
,
*
RRPropertyValuePtr
;
typedef
struct
_rrPropertyValue
RRPropertyValueRec
,
*
RRPropertyValuePtr
;
typedef
struct
_rrProperty
RRPropertyRec
,
*
RRPropertyPtr
;
typedef
struct
_rrProperty
RRPropertyRec
,
*
RRPropertyPtr
;
typedef
struct
_rrCrtc
RRCrtcRec
,
*
RRCrtcPtr
;
typedef
struct
_rrCrtc
RRCrtcRec
,
*
RRCrtcPtr
;
typedef
struct
_rrOutput
RROutputRec
,
*
RROutputPtr
;
typedef
struct
_rrOutput
RROutputRec
,
*
RROutputPtr
;
struct
_rrMode
{
struct
_rrMode
{
int
refcnt
;
int
refcnt
;
xRRModeInfo
mode
;
xRRModeInfo
mode
;
char
*
name
;
char
*
name
;
ScreenPtr
userScreen
;
ScreenPtr
userScreen
;
};
};
struct
_rrPropertyValue
{
struct
_rrPropertyValue
{
Atom
type
;
/* ignored by server */
Atom
type
;
/* ignored by server */
short
format
;
/* format of data for swapping - 8,16,32 */
short
format
;
/* format of data for swapping - 8,16,32 */
long
size
;
/* size of data in (format/8) bytes */
long
size
;
/* size of data in (format/8) bytes */
void
*
data
;
/* private to client */
void
*
data
;
/* private to client */
};
};
struct
_rrProperty
{
struct
_rrProperty
{
RRPropertyPtr
next
;
RRPropertyPtr
next
;
ATOM
propertyName
;
ATOM
propertyName
;
Bool
is_pending
;
Bool
is_pending
;
Bool
range
;
Bool
range
;
Bool
immutable
;
Bool
immutable
;
int
num_valid
;
int
num_valid
;
INT32
*
valid_values
;
INT32
*
valid_values
;
RRPropertyValueRec
current
,
pending
;
RRPropertyValueRec
current
,
pending
;
};
};
struct
_rrCrtc
{
struct
_rrCrtc
{
RRCrtc
id
;
RRCrtc
id
;
ScreenPtr
pScreen
;
ScreenPtr
pScreen
;
RRModePtr
mode
;
RRModePtr
mode
;
int
x
,
y
;
int
x
,
y
;
Rotation
rotation
;
Rotation
rotation
;
Rotation
rotations
;
Rotation
rotations
;
Bool
changed
;
Bool
changed
;
int
numOutputs
;
int
numOutputs
;
RROutputPtr
*
outputs
;
RROutputPtr
*
outputs
;
int
gammaSize
;
int
gammaSize
;
CARD16
*
gammaRed
;
CARD16
*
gammaRed
;
CARD16
*
gammaBlue
;
CARD16
*
gammaBlue
;
CARD16
*
gammaGreen
;
CARD16
*
gammaGreen
;
void
*
devPrivate
;
void
*
devPrivate
;
};
};
struct
_rrOutput
{
struct
_rrOutput
{
RROutput
id
;
RROutput
id
;
ScreenPtr
pScreen
;
ScreenPtr
pScreen
;
char
*
name
;
char
*
name
;
int
nameLength
;
int
nameLength
;
CARD8
connection
;
CARD8
connection
;
CARD8
subpixelOrder
;
CARD8
subpixelOrder
;
int
mmWidth
;
int
mmWidth
;
int
mmHeight
;
int
mmHeight
;
RRCrtcPtr
crtc
;
RRCrtcPtr
crtc
;
int
numCrtcs
;
int
numCrtcs
;
RRCrtcPtr
*
crtcs
;
RRCrtcPtr
*
crtcs
;
int
numClones
;
int
numClones
;
RROutputPtr
*
clones
;
RROutputPtr
*
clones
;
int
numModes
;
int
numModes
;
int
numPreferred
;
int
numPreferred
;
RRModePtr
*
modes
;
RRModePtr
*
modes
;
int
numUserModes
;
int
numUserModes
;
RRModePtr
*
userModes
;
RRModePtr
*
userModes
;
Bool
changed
;
Bool
changed
;
RRPropertyPtr
properties
;
RRPropertyPtr
properties
;
Bool
pendingProperties
;
Bool
pendingProperties
;
void
*
devPrivate
;
void
*
devPrivate
;
};
};
#if RANDR_12_INTERFACE
#if RANDR_12_INTERFACE
typedef
Bool
(
*
RRScreenSetSizeProcPtr
)
(
ScreenPtr
pScreen
,
typedef
Bool
(
*
RRScreenSetSizeProcPtr
)
(
ScreenPtr
pScreen
,
CARD16
width
,
CARD16
width
,
CARD16
height
,
CARD16
height
,
CARD32
mmWidth
,
CARD32
mmWidth
,
CARD32
mmHeight
);
CARD32
mmHeight
);
typedef
Bool
(
*
RRCrtcSetProcPtr
)
(
ScreenPtr
pScreen
,
typedef
Bool
(
*
RRCrtcSetProcPtr
)
(
ScreenPtr
pScreen
,
RRCrtcPtr
crtc
,
RRCrtcPtr
crtc
,
RRModePtr
mode
,
RRModePtr
mode
,
int
x
,
int
x
,
int
y
,
int
y
,
Rotation
rotation
,
Rotation
rotation
,
int
numOutputs
,
RROutputPtr
*
outputs
);
int
numOutputs
,
RROutputPtr
*
outputs
);
typedef
Bool
(
*
RRCrtcSetGammaProcPtr
)
(
ScreenPtr
pScreen
,
RRCrtcPtr
crtc
);
typedef
Bool
(
*
RRCrtcSetGammaProcPtr
)
(
ScreenPtr
pScreen
,
typedef
Bool
(
*
RROutputSetPropertyProcPtr
)
(
ScreenPtr
pScreen
,
RRCrtcPtr
crtc
);
RROutputPtr
output
,
Atom
property
,
typedef
Bool
(
*
RROutputSetPropertyProcPtr
)
(
ScreenPtr
pScreen
,
RRPropertyValuePtr
value
);
RROutputPtr
output
,
Atom
property
,
typedef
Bool
(
*
RROutputValidateModeProcPtr
)
(
ScreenPtr
pScreen
,
RRPropertyValuePtr
value
);
RROutputPtr
output
,
RRModePtr
mode
);
typedef
Bool
(
*
RROutputValidateModeProcPtr
)
(
ScreenPtr
pScreen
,
RROutputPtr
output
,
typedef
void
(
*
RRModeDestroyProcPtr
)
(
ScreenPtr
pScreen
,
RRModePtr
mode
);
RRModePtr
mode
);
typedef
void
(
*
RRModeDestroyProcPtr
)
(
ScreenPtr
pScreen
,
RRModePtr
mode
);
#endif
#endif
typedef
Bool
(
*
RRGetInfoProcPtr
)
(
ScreenPtr
pScreen
,
Rotation
*
rotations
);
typedef
Bool
(
*
RRGetInfoProcPtr
)
(
ScreenPtr
pScreen
,
Rotation
*
rotations
);
typedef
Bool
(
*
RRCloseScreenProcPtr
)
(
int
i
,
ScreenPtr
pscreen
);
typedef
Bool
(
*
RRCloseScreenProcPtr
)
(
int
i
,
ScreenPtr
pscreen
);
/* These are for 1.0 compatibility */
/* These are for 1.0 compatibility */
typedef
struct
_rrRefresh
{
typedef
struct
_rrRefresh
{
CARD16
rate
;
CARD16
rate
;
RRModePtr
mode
;
RRModePtr
mode
;
}
RRScreenRate
,
*
RRScreenRatePtr
;
}
RRScreenRate
,
*
RRScreenRatePtr
;
typedef
struct
_rrScreenSize
{
typedef
struct
_rrScreenSize
{
int
id
;
int
id
;
short
width
,
height
;
short
width
,
height
;
short
mmWidth
,
mmHeight
;
short
mmWidth
,
mmHeight
;
int
nRates
;
int
nRates
;
RRScreenRatePtr
pRates
;
RRScreenRatePtr
pRates
;
}
RRScreenSize
,
*
RRScreenSizePtr
;
}
RRScreenSize
,
*
RRScreenSizePtr
;
#ifdef RANDR_10_INTERFACE
#ifdef RANDR_10_INTERFACE
typedef
Bool
(
*
RRSetConfigProcPtr
)
(
ScreenPtr
pScreen
,
typedef
Bool
(
*
RRSetConfigProcPtr
)
(
ScreenPtr
pScreen
,
Rotation
rotation
,
Rotation
rotation
,
int
rate
,
int
rate
,
RRScreenSizePtr
pSize
);
RRScreenSizePtr
pSize
);
#endif
#endif
typedef
struct
_rrScrPriv
{
typedef
struct
_rrScrPriv
{
/*
/*
...
@@ -214,56 +208,56 @@ typedef struct _rrScrPriv {
...
@@ -214,56 +208,56 @@ typedef struct _rrScrPriv {
* as they initialize
* as they initialize
*/
*/
#if RANDR_10_INTERFACE
#if RANDR_10_INTERFACE
RRSetConfigProcPtr
rrSetConfig
;
RRSetConfigProcPtr
rrSetConfig
;
#endif
#endif
RRGetInfoProcPtr
rrGetInfo
;
RRGetInfoProcPtr
rrGetInfo
;
#if RANDR_12_INTERFACE
#if RANDR_12_INTERFACE
RRScreenSetSizeProcPtr
rrScreenSetSize
;
RRScreenSetSizeProcPtr
rrScreenSetSize
;
RRCrtcSetProcPtr
rrCrtcSet
;
RRCrtcSetProcPtr
rrCrtcSet
;
RRCrtcSetGammaProcPtr
rrCrtcSetGamma
;
RRCrtcSetGammaProcPtr
rrCrtcSetGamma
;
RROutputSetPropertyProcPtr
rrOutputSetProperty
;
RROutputSetPropertyProcPtr
rrOutputSetProperty
;
RROutputValidateModeProcPtr
rrOutputValidateMode
;
RROutputValidateModeProcPtr
rrOutputValidateMode
;
RRModeDestroyProcPtr
rrModeDestroy
;
RRModeDestroyProcPtr
rrModeDestroy
;
#endif
#endif
/*
/*
* Private part of the structure; not considered part of the ABI
* Private part of the structure; not considered part of the ABI
*/
*/
TimeStamp
lastSetTime
;
/* last changed by client */
TimeStamp
lastSetTime
;
/* last changed by client */
TimeStamp
lastConfigTime
;
/* possible configs changed */
TimeStamp
lastConfigTime
;
/* possible configs changed */
RRCloseScreenProcPtr
CloseScreen
;
RRCloseScreenProcPtr
CloseScreen
;
Bool
changed
;
/* some config changed */
Bool
changed
;
/* some config changed */
Bool
configChanged
;
/* configuration changed */
Bool
configChanged
;
/* configuration changed */
Bool
layoutChanged
;
/* screen layout changed */
Bool
layoutChanged
;
/* screen layout changed */
CARD16
minWidth
,
minHeight
;
CARD16
minWidth
,
minHeight
;
CARD16
maxWidth
,
maxHeight
;
CARD16
maxWidth
,
maxHeight
;
CARD16
width
,
height
;
/* last known screen size */
CARD16
width
,
height
;
/* last known screen size */
CARD16
mmWidth
,
mmHeight
;
/* last known screen size */
CARD16
mmWidth
,
mmHeight
;
/* last known screen size */
int
numOutputs
;
int
numOutputs
;
RROutputPtr
*
outputs
;
RROutputPtr
*
outputs
;
int
numCrtcs
;
int
numCrtcs
;
RRCrtcPtr
*
crtcs
;
RRCrtcPtr
*
crtcs
;
/* Last known pointer position */
/* Last known pointer position */
RRCrtcPtr
pointerCrtc
;
RRCrtcPtr
pointerCrtc
;
#ifdef RANDR_10_INTERFACE
#ifdef RANDR_10_INTERFACE
/*
/*
* Configuration information
* Configuration information
*/
*/
Rotation
rotations
;
Rotation
rotations
;
CARD16
reqWidth
,
reqHeight
;
CARD16
reqWidth
,
reqHeight
;
int
nSizes
;
int
nSizes
;
RRScreenSizePtr
pSizes
;
RRScreenSizePtr
pSizes
;
Rotation
rotation
;
Rotation
rotation
;
int
rate
;
int
rate
;
int
size
;
int
size
;
#endif
#endif
}
rrScrPrivRec
,
*
rrScrPrivPtr
;
}
rrScrPrivRec
,
*
rrScrPrivPtr
;
...
@@ -298,31 +292,32 @@ extern int rrPrivIndex;
...
@@ -298,31 +292,32 @@ extern int rrPrivIndex;
typedef
struct
_RREvent
*
RREventPtr
;
typedef
struct
_RREvent
*
RREventPtr
;
typedef
struct
_RREvent
{
typedef
struct
_RREvent
{
RREventPtr
next
;
RREventPtr
next
;
ClientPtr
client
;
ClientPtr
client
;
WindowPtr
window
;
WindowPtr
window
;
XID
clientResource
;
XID
clientResource
;
int
mask
;
int
mask
;
}
RREventRec
;
}
RREventRec
;
typedef
struct
_RRTimes
{
typedef
struct
_RRTimes
{
TimeStamp
setTime
;
TimeStamp
setTime
;
TimeStamp
configTime
;
TimeStamp
configTime
;
}
RRTimesRec
,
*
RRTimesPtr
;
}
RRTimesRec
,
*
RRTimesPtr
;
typedef
struct
_RRClient
{
typedef
struct
_RRClient
{
int
major_version
;
int
major_version
;
int
minor_version
;
int
minor_version
;
/* RRTimesRec times[0]; */
/* RRTimesRec times[0]; */
}
RRClientRec
,
*
RRClientPtr
;
}
RRClientRec
,
*
RRClientPtr
;
extern
RESTYPE
RRClientType
,
RREventType
;
/* resource types for event masks */
extern
RESTYPE
RRClientType
,
RREventType
;
/* resource types for event masks */
#ifndef NXAGENT_SERVER
#ifndef NXAGENT_SERVER
extern
DevPrivateKey
RRClientPrivateKey
;
extern
DevPrivateKey
RRClientPrivateKey
;
#else
#else
extern
int
RRClientPrivateIndex
;
extern
int
RRClientPrivateIndex
;
#endif
#endif
extern
RESTYPE
RRCrtcType
,
RRModeType
,
RROutputType
;
extern
RESTYPE
RRCrtcType
,
RRModeType
,
RROutputType
;
#define LookupOutput(client,id,a) ((RROutputPtr) \
#define LookupOutput(client,id,a) ((RROutputPtr) \
(SecurityLookupIDByType (client, id, \
(SecurityLookupIDByType (client, id, \
...
@@ -352,18 +347,17 @@ extern RESTYPE RRCrtcType, RRModeType, RROutputType;
...
@@ -352,18 +347,17 @@ extern RESTYPE RRCrtcType, RRModeType, RROutputType;
/* Initialize the extension */
/* Initialize the extension */
void
void
RRExtensionInit
(
void
);
RRExtensionInit
(
void
);
#ifdef RANDR_12_INTERFACE
#ifdef RANDR_12_INTERFACE
/*
/*
* Set the range of sizes for the screen
* Set the range of sizes for the screen
*/
*/
void
void
RRScreenSetSizeRange
(
ScreenPtr
pScreen
,
CARD16
minWidth
,
RRScreenSetSizeRange
(
ScreenPtr
pScreen
,
CARD16
minHeight
,
CARD16
minWidth
,
CARD16
maxWidth
,
CARD16
minHeight
,
CARD16
maxWidth
,
CARD16
maxHeight
);
CARD16
maxHeight
);
#endif
#endif
/* rrscreen.c */
/* rrscreen.c */
...
@@ -373,110 +367,101 @@ RRScreenSetSizeRange (ScreenPtr pScreen,
...
@@ -373,110 +367,101 @@ RRScreenSetSizeRange (ScreenPtr pScreen,
* the size of the screen
* the size of the screen
*/
*/
void
void
RRScreenSizeNotify
(
ScreenPtr
pScreen
);
RRScreenSizeNotify
(
ScreenPtr
pScreen
);
/*
/*
* Request that the screen be resized
* Request that the screen be resized
*/
*/
Bool
Bool
RRScreenSizeSet
(
ScreenPtr
pScreen
,
CARD16
width
,
RRScreenSizeSet
(
ScreenPtr
pScreen
,
CARD16
height
,
CARD16
width
,
CARD16
height
,
CARD32
mmWidth
,
CARD32
mmHeight
);
CARD32
mmWidth
,
CARD32
mmHeight
);
/*
/*
* Send ConfigureNotify event to root window when 'something' happens
* Send ConfigureNotify event to root window when 'something' happens
*/
*/
void
void
RRSendConfigNotify
(
ScreenPtr
pScreen
);
RRSendConfigNotify
(
ScreenPtr
pScreen
);
/*
/*
* screen dispatch
* screen dispatch
*/
*/
int
int
ProcRRGetScreenSizeRange
(
ClientPtr
client
);
ProcRRGetScreenSizeRange
(
ClientPtr
client
);
int
int
ProcRRSetScreenSize
(
ClientPtr
client
);
ProcRRSetScreenSize
(
ClientPtr
client
);
int
int
ProcRRGetScreenResources
(
ClientPtr
client
);
ProcRRGetScreenResources
(
ClientPtr
client
);
int
int
ProcRRSetScreenConfig
(
ClientPtr
client
);
ProcRRSetScreenConfig
(
ClientPtr
client
);
int
int
ProcRRGetScreenInfo
(
ClientPtr
client
);
ProcRRGetScreenInfo
(
ClientPtr
client
);
/*
/*
* Deliver a ScreenNotify event
* Deliver a ScreenNotify event
*/
*/
void
void
RRDeliverScreenEvent
(
ClientPtr
client
,
WindowPtr
pWin
,
ScreenPtr
pScreen
);
RRDeliverScreenEvent
(
ClientPtr
client
,
WindowPtr
pWin
,
ScreenPtr
pScreen
);
/* mirandr.c */
/* mirandr.c */
Bool
Bool
miRandRInit
(
ScreenPtr
pScreen
);
miRandRInit
(
ScreenPtr
pScreen
);
Bool
Bool
miRRGetInfo
(
ScreenPtr
pScreen
,
Rotation
*
rotations
);
miRRGetInfo
(
ScreenPtr
pScreen
,
Rotation
*
rotations
);
Bool
Bool
miRRGetScreenInfo
(
ScreenPtr
pScreen
);
miRRGetScreenInfo
(
ScreenPtr
pScreen
);
Bool
Bool
miRRCrtcSet
(
ScreenPtr
pScreen
,
RRCrtcPtr
crtc
,
miRRCrtcSet
(
ScreenPtr
pScreen
,
RRModePtr
mode
,
RRCrtcPtr
crtc
,
int
x
,
RRModePtr
mode
,
int
y
,
int
x
,
Rotation
rotation
,
int
y
,
Rotation
rotation
,
int
numOutput
,
RROutputPtr
*
outputs
);
int
numOutput
,
RROutputPtr
*
outputs
);
Bool
Bool
miRROutputSetProperty
(
ScreenPtr
pScreen
,
RROutputPtr
output
,
miRROutputSetProperty
(
ScreenPtr
pScreen
,
Atom
property
,
RROutputPtr
output
,
RRPropertyValuePtr
value
);
Atom
property
,
RRPropertyValuePtr
value
);
Bool
Bool
miRROutputValidateMode
(
ScreenPtr
pScreen
,
miRROutputValidateMode
(
ScreenPtr
pScreen
,
RROutputPtr
output
,
RRModePtr
mode
);
RROutputPtr
output
,
RRModePtr
mode
);
void
void
miRRModeDestroy
(
ScreenPtr
pScreen
,
miRRModeDestroy
(
ScreenPtr
pScreen
,
RRModePtr
mode
);
RRModePtr
mode
);
/* randr.c */
/* randr.c */
/*
/*
* Send all pending events
* Send all pending events
*/
*/
void
void
RRTellChanged
(
ScreenPtr
pScreen
);
RRTellChanged
(
ScreenPtr
pScreen
);
/*
/*
* Poll the driver for changed information
* Poll the driver for changed information
*/
*/
Bool
Bool
RRGetInfo
(
ScreenPtr
pScreen
);
RRGetInfo
(
ScreenPtr
pScreen
);
Bool
RRInit
(
void
);
Bool
RRInit
(
void
);
Bool
RRScreenInit
(
ScreenPtr
pScreen
);
Bool
RRScreenInit
(
ScreenPtr
pScreen
);
RROutputPtr
RROutputPtr
RRFirstOutput
(
ScreenPtr
pScreen
);
RRFirstOutput
(
ScreenPtr
pScreen
);
Rotation
Rotation
RRGetRotation
(
ScreenPtr
pScreen
);
RRGetRotation
(
ScreenPtr
pScreen
);
CARD16
CARD16
RRVerticalRefresh
(
xRRModeInfo
*
mode
);
RRVerticalRefresh
(
xRRModeInfo
*
mode
);
#ifdef RANDR_10_INTERFACE
#ifdef RANDR_10_INTERFACE
/*
/*
* This is the old interface, deprecated but left
* This is the old interface, deprecated but left
* around for compatibility
* around for compatibility
...
@@ -487,38 +472,30 @@ RRVerticalRefresh (xRRModeInfo *mode);
...
@@ -487,38 +472,30 @@ RRVerticalRefresh (xRRModeInfo *mode);
*/
*/
RRScreenSizePtr
RRScreenSizePtr
RRRegisterSize
(
ScreenPtr
pScreen
,
RRRegisterSize
(
ScreenPtr
pScreen
,
short
width
,
short
width
,
short
height
,
short
mmWidth
,
short
mmHeight
);
short
height
,
short
mmWidth
,
short
mmHeight
);
Bool
RRRegisterRate
(
ScreenPtr
pScreen
,
Bool
RRRegisterRate
(
ScreenPtr
pScreen
,
RRScreenSizePtr
pSize
,
int
rate
);
RRScreenSizePtr
pSize
,
int
rate
);
/*
/*
* Finally, set the current configuration of the screen
* Finally, set the current configuration of the screen
*/
*/
void
void
RRSetCurrentConfig
(
ScreenPtr
pScreen
,
Rotation
rotation
,
int
rate
,
RRScreenSizePtr
pSize
);
Bool
RRScreenInit
(
ScreenPtr
pScreen
);
RRSetCurrentConfig
(
ScreenPtr
pScreen
,
Rotation
rotation
,
int
rate
,
RRScreenSizePtr
pSize
);
Bool
RRScreenInit
(
ScreenPtr
pScreen
);
Rotation
Rotation
RRGetRotation
(
ScreenPtr
pScreen
);
RRGetRotation
(
ScreenPtr
pScreen
);
int
int
RRSetScreenConfig
(
ScreenPtr
pScreen
,
Rotation
rotation
,
int
rate
,
RRScreenSizePtr
pSize
);
#endif
RRSetScreenConfig
(
ScreenPtr
pScreen
,
Rotation
rotation
,
int
rate
,
RRScreenSizePtr
pSize
);
#endif
/* rrcrtc.c */
/* rrcrtc.c */
...
@@ -527,57 +504,49 @@ RRSetScreenConfig (ScreenPtr pScreen,
...
@@ -527,57 +504,49 @@ RRSetScreenConfig (ScreenPtr pScreen,
* some position or size element changed
* some position or size element changed
*/
*/
void
void
RRCrtcChanged
(
RRCrtcPtr
crtc
,
Bool
layoutChanged
);
RRCrtcChanged
(
RRCrtcPtr
crtc
,
Bool
layoutChanged
);
/*
/*
* Create a CRTC
* Create a CRTC
*/
*/
RRCrtcPtr
RRCrtcPtr
RRCrtcCreate
(
ScreenPtr
pScreen
,
void
*
devPrivate
);
RRCrtcCreate
(
ScreenPtr
pScreen
,
void
*
devPrivate
);
/*
/*
* Set the allowed rotations on a CRTC
* Set the allowed rotations on a CRTC
*/
*/
void
void
RRCrtcSetRotations
(
RRCrtcPtr
crtc
,
Rotation
rotations
);
RRCrtcSetRotations
(
RRCrtcPtr
crtc
,
Rotation
rotations
);
/*
/*
* Notify the extension that the Crtc has been reconfigured,
* Notify the extension that the Crtc has been reconfigured,
* the driver calls this whenever it has updated the mode
* the driver calls this whenever it has updated the mode
*/
*/
Bool
Bool
RRCrtcNotify
(
RRCrtcPtr
crtc
,
RRModePtr
mode
,
RRCrtcNotify
(
RRCrtcPtr
crtc
,
int
x
,
RRModePtr
mode
,
int
y
,
int
x
,
Rotation
rotation
,
int
y
,
Rotation
rotation
,
int
numOutputs
,
RROutputPtr
*
outputs
);
int
numOutputs
,
RROutputPtr
*
outputs
);
void
void
RRDeliverCrtcEvent
(
ClientPtr
client
,
WindowPtr
pWin
,
RRCrtcPtr
crtc
);
RRDeliverCrtcEvent
(
ClientPtr
client
,
WindowPtr
pWin
,
RRCrtcPtr
crtc
);
/*
/*
* Request that the Crtc be reconfigured
* Request that the Crtc be reconfigured
*/
*/
Bool
Bool
RRCrtcSet
(
RRCrtcPtr
crtc
,
RRModePtr
mode
,
RRCrtcSet
(
RRCrtcPtr
crtc
,
int
x
,
RRModePtr
mode
,
int
y
,
int
x
,
Rotation
rotation
,
int
y
,
Rotation
rotation
,
int
numOutput
,
RROutputPtr
*
outputs
);
int
numOutput
,
RROutputPtr
*
outputs
);
/*
/*
* Request that the Crtc gamma be changed
* Request that the Crtc gamma be changed
*/
*/
Bool
Bool
RRCrtcGammaSet
(
RRCrtcPtr
crtc
,
RRCrtcGammaSet
(
RRCrtcPtr
crtc
,
CARD16
*
red
,
CARD16
*
green
,
CARD16
*
blue
);
CARD16
*
red
,
CARD16
*
green
,
CARD16
*
blue
);
/*
/*
* Notify the extension that the Crtc gamma has been changed
* Notify the extension that the Crtc gamma has been changed
...
@@ -586,15 +555,14 @@ RRCrtcGammaSet (RRCrtcPtr crtc,
...
@@ -586,15 +555,14 @@ RRCrtcGammaSet (RRCrtcPtr crtc,
*/
*/
Bool
Bool
RRCrtcGammaNotify
(
RRCrtcPtr
crtc
);
RRCrtcGammaNotify
(
RRCrtcPtr
crtc
);
/*
/*
* Set the size of the gamma table at server startup time
* Set the size of the gamma table at server startup time
*/
*/
Bool
Bool
RRCrtcGammaSetSize
(
RRCrtcPtr
crtc
,
RRCrtcGammaSetSize
(
RRCrtcPtr
crtc
,
int
size
);
int
size
);
/*
/*
* Return the area of the frame buffer scanned out by the crtc,
* Return the area of the frame buffer scanned out by the crtc,
...
@@ -602,85 +570,82 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc,
...
@@ -602,85 +570,82 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc,
*/
*/
void
void
RRCrtcGetScanoutSize
(
RRCrtcPtr
crtc
,
int
*
width
,
int
*
height
);
RRCrtcGetScanoutSize
(
RRCrtcPtr
crtc
,
int
*
width
,
int
*
height
);
/*
/*
* Destroy a Crtc at shutdown
* Destroy a Crtc at shutdown
*/
*/
void
void
RRCrtcDestroy
(
RRCrtcPtr
crtc
);
RRCrtcDestroy
(
RRCrtcPtr
crtc
);
/*
/*
* Initialize crtc type
* Initialize crtc type
*/
*/
Bool
Bool
RRCrtcInit
(
void
);
RRCrtcInit
(
void
);
/*
/*
* Crtc dispatch
* Crtc dispatch
*/
*/
int
int
ProcRRGetCrtcInfo
(
ClientPtr
client
);
ProcRRGetCrtcInfo
(
ClientPtr
client
);
int
int
ProcRRSetCrtcConfig
(
ClientPtr
client
);
ProcRRSetCrtcConfig
(
ClientPtr
client
);
int
int
ProcRRGetCrtcGammaSize
(
ClientPtr
client
);
ProcRRGetCrtcGammaSize
(
ClientPtr
client
);
int
int
ProcRRGetCrtcGamma
(
ClientPtr
client
);
ProcRRGetCrtcGamma
(
ClientPtr
client
);
int
int
ProcRRSetCrtcGamma
(
ClientPtr
client
);
ProcRRSetCrtcGamma
(
ClientPtr
client
);
/* rrdispatch.c */
/* rrdispatch.c */
Bool
Bool
RRClientKnowsRates
(
ClientPtr
pClient
);
RRClientKnowsRates
(
ClientPtr
pClient
);
/* rrmode.c */
/* rrmode.c */
/*
/*
* Find, and if necessary, create a mode
* Find, and if necessary, create a mode
*/
*/
RRModePtr
RRModePtr
RRModeGet
(
xRRModeInfo
*
modeInfo
,
const
char
*
name
);
RRModeGet
(
xRRModeInfo
*
modeInfo
,
const
char
*
name
);
void
void
RRModePruneUnused
(
ScreenPtr
pScreen
);
RRModePruneUnused
(
ScreenPtr
pScreen
);
/*
/*
* Destroy a mode.
* Destroy a mode.
*/
*/
void
void
RRModeDestroy
(
RRModePtr
mode
);
RRModeDestroy
(
RRModePtr
mode
);
/*
/*
* Return a list of modes that are valid for some output in pScreen
* Return a list of modes that are valid for some output in pScreen
*/
*/
RRModePtr
*
RRModePtr
*
RRModesForScreen
(
ScreenPtr
pScreen
,
int
*
num_ret
);
RRModesForScreen
(
ScreenPtr
pScreen
,
int
*
num_ret
);
/*
/*
* Initialize mode type
* Initialize mode type
*/
*/
Bool
Bool
RRModeInit
(
void
);
RRModeInit
(
void
);
int
int
ProcRRCreateMode
(
ClientPtr
client
);
ProcRRCreateMode
(
ClientPtr
client
);
int
int
ProcRRDestroyMode
(
ClientPtr
client
);
ProcRRDestroyMode
(
ClientPtr
client
);
int
int
ProcRRAddOutputMode
(
ClientPtr
client
);
ProcRRAddOutputMode
(
ClientPtr
client
);
int
int
ProcRRDeleteOutputMode
(
ClientPtr
client
);
ProcRRDeleteOutputMode
(
ClientPtr
client
);
/* rroutput.c */
/* rroutput.c */
...
@@ -691,129 +656,117 @@ ProcRRDeleteOutputMode (ClientPtr client);
...
@@ -691,129 +656,117 @@ ProcRRDeleteOutputMode (ClientPtr client);
* (which crtc is in use)
* (which crtc is in use)
*/
*/
void
void
RROutputChanged
(
RROutputPtr
output
,
Bool
configChanged
);
RROutputChanged
(
RROutputPtr
output
,
Bool
configChanged
);
/*
/*
* Create an output
* Create an output
*/
*/
RROutputPtr
RROutputPtr
RROutputCreate
(
ScreenPtr
pScreen
,
RROutputCreate
(
ScreenPtr
pScreen
,
const
char
*
name
,
const
char
*
name
,
int
nameLength
,
void
*
devPrivate
);
int
nameLength
,
void
*
devPrivate
);
/*
/*
* Notify extension that output parameters have been changed
* Notify extension that output parameters have been changed
*/
*/
Bool
Bool
RROutputSetClones
(
RROutputPtr
output
,
RROutputSetClones
(
RROutputPtr
output
,
RROutputPtr
*
clones
,
int
numClones
);
RROutputPtr
*
clones
,
int
numClones
);
Bool
Bool
RROutputSetModes
(
RROutputPtr
output
,
RRModePtr
*
modes
,
RROutputSetModes
(
RROutputPtr
output
,
int
numModes
,
RRModePtr
*
modes
,
int
numModes
,
int
numPreferred
);
int
numPreferred
);
int
int
RROutputAddUserMode
(
RROutputPtr
output
,
RROutputAddUserMode
(
RROutputPtr
output
,
RRModePtr
mode
);
RRModePtr
mode
);
int
int
RROutputDeleteUserMode
(
RROutputPtr
output
,
RROutputDeleteUserMode
(
RROutputPtr
output
,
RRModePtr
mode
);
RRModePtr
mode
);
Bool
Bool
RROutputSetCrtcs
(
RROutputPtr
output
,
RROutputSetCrtcs
(
RROutputPtr
output
,
RRCrtcPtr
*
crtcs
,
int
numCrtcs
);
RRCrtcPtr
*
crtcs
,
int
numCrtcs
);
Bool
Bool
RROutputSetConnection
(
RROutputPtr
output
,
RROutputSetConnection
(
RROutputPtr
output
,
CARD8
connection
);
CARD8
connection
);
Bool
Bool
RROutputSetSubpixelOrder
(
RROutputPtr
output
,
RROutputSetSubpixelOrder
(
RROutputPtr
output
,
int
subpixelOrder
);
int
subpixelOrder
);
Bool
Bool
RROutputSetPhysicalSize
(
RROutputPtr
output
,
RROutputSetPhysicalSize
(
RROutputPtr
output
,
int
mmWidth
,
int
mmHeight
);
int
mmWidth
,
int
mmHeight
);
void
void
RRDeliverOutputEvent
(
ClientPtr
client
,
WindowPtr
pWin
,
RROutputPtr
output
);
RRDeliverOutputEvent
(
ClientPtr
client
,
WindowPtr
pWin
,
RROutputPtr
output
);
void
void
RROutputDestroy
(
RROutputPtr
output
);
RROutputDestroy
(
RROutputPtr
output
);
int
int
ProcRRGetOutputInfo
(
ClientPtr
client
);
ProcRRGetOutputInfo
(
ClientPtr
client
);
/*
/*
* Initialize output type
* Initialize output type
*/
*/
Bool
Bool
RROutputInit
(
void
);
RROutputInit
(
void
);
/* rrpointer.c */
/* rrpointer.c */
void
void
RRPointerMoved
(
ScreenPtr
pScreen
,
int
x
,
int
y
);
RRPointerMoved
(
ScreenPtr
pScreen
,
int
x
,
int
y
);
void
void
RRPointerScreenConfigured
(
ScreenPtr
pScreen
);
RRPointerScreenConfigured
(
ScreenPtr
pScreen
);
/* rrproperty.c */
/* rrproperty.c */
void
void
RRDeleteAllOutputProperties
(
RROutputPtr
output
);
RRDeleteAllOutputProperties
(
RROutputPtr
output
);
RRPropertyValuePtr
RRPropertyValuePtr
RRGetOutputProperty
(
RROutputPtr
output
,
Atom
property
,
Bool
pending
);
RRGetOutputProperty
(
RROutputPtr
output
,
Atom
property
,
Bool
pending
);
RRPropertyPtr
RRQueryOutputProperty
(
RROutputPtr
output
,
Atom
property
);
RRPropertyPtr
RRQueryOutputProperty
(
RROutputPtr
output
,
Atom
property
);
void
void
RRDeleteOutputProperty
(
RROutputPtr
output
,
Atom
property
);
RRDeleteOutputProperty
(
RROutputPtr
output
,
Atom
property
);
Bool
Bool
RRPostPendingProperties
(
RROutputPtr
output
);
RRPostPendingProperties
(
RROutputPtr
output
);
int
int
RRChangeOutputProperty
(
RROutputPtr
output
,
Atom
property
,
Atom
type
,
int
format
,
int
mode
,
unsigned
long
len
,
RRChangeOutputProperty
(
RROutputPtr
output
,
Atom
property
,
Atom
type
,
void
*
value
,
Bool
sendevent
,
Bool
pending
);
int
format
,
int
mode
,
unsigned
long
len
,
void
*
value
,
Bool
sendevent
,
Bool
pending
);
int
int
RRConfigureOutputProperty
(
RROutputPtr
output
,
Atom
property
,
Bool
pending
,
Bool
range
,
Bool
immutable
,
RRConfigureOutputProperty
(
RROutputPtr
output
,
Atom
property
,
int
num_values
,
INT32
*
values
);
Bool
pending
,
Bool
range
,
Bool
immutable
,
int
num_values
,
INT32
*
values
);
int
int
ProcRRChangeOutputProperty
(
ClientPtr
client
);
ProcRRChangeOutputProperty
(
ClientPtr
client
);
int
int
ProcRRGetOutputProperty
(
ClientPtr
client
);
ProcRRGetOutputProperty
(
ClientPtr
client
);
int
int
ProcRRListOutputProperties
(
ClientPtr
client
);
ProcRRListOutputProperties
(
ClientPtr
client
);
int
int
ProcRRQueryOutputProperty
(
ClientPtr
client
);
ProcRRQueryOutputProperty
(
ClientPtr
client
);
int
int
ProcRRConfigureOutputProperty
(
ClientPtr
client
);
ProcRRConfigureOutputProperty
(
ClientPtr
client
);
int
int
ProcRRDeleteOutputProperty
(
ClientPtr
client
);
ProcRRDeleteOutputProperty
(
ClientPtr
client
);
/* rrxinerama.c */
/* rrxinerama.c */
void
void
RRXineramaExtensionInit
(
void
);
RRXineramaExtensionInit
(
void
);
#endif
/* _RANDRSTR_H_ */
#endif
/* _RANDRSTR_H_ */
/*
/*
...
...
nx-X11/programs/Xserver/randr/registry.h
View file @
e440ea76
...
@@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
...
@@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* not be a stack variable.
* not be a stack variable.
*/
*/
void
RegisterResourceName
(
RESTYPE
type
,
char
*
name
);
void
RegisterResourceName
(
RESTYPE
type
,
char
*
name
);
void
RegisterExtensionNames
(
ExtensionEntry
*
ext
);
void
RegisterExtensionNames
(
ExtensionEntry
*
ext
);
/*
/*
* Lookup functions. The returned string must not be modified or freed.
* Lookup functions. The returned string must not be modified or freed.
...
@@ -45,7 +45,7 @@ const char *LookupResourceName(RESTYPE rtype);
...
@@ -45,7 +45,7 @@ const char *LookupResourceName(RESTYPE rtype);
*/
*/
void
dixResetRegistry
(
void
);
void
dixResetRegistry
(
void
);
#else
/* XREGISTRY */
#else
/* XREGISTRY */
/* Define calls away when the registry is not being built. */
/* Define calls away when the registry is not being built. */
...
@@ -60,5 +60,5 @@ void dixResetRegistry(void);
...
@@ -60,5 +60,5 @@ void dixResetRegistry(void);
#define dixResetRegistry() { ; }
#define dixResetRegistry() { ; }
#endif
/* XREGISTRY */
#endif
/* XREGISTRY */
#endif
/* DIX_REGISTRY_H */
#endif
/* DIX_REGISTRY_H */
nx-X11/programs/Xserver/randr/rrcrtc.c
View file @
e440ea76
...
@@ -41,27 +41,26 @@
...
@@ -41,27 +41,26 @@
#include "swaprep.h"
#include "swaprep.h"
#include "registry.h"
#include "registry.h"
RESTYPE
RRCrtcType
;
RESTYPE
RRCrtcType
;
/*
/*
* Notify the CRTC of some change
* Notify the CRTC of some change
*/
*/
void
void
RRCrtcChanged
(
RRCrtcPtr
crtc
,
Bool
layoutChanged
)
RRCrtcChanged
(
RRCrtcPtr
crtc
,
Bool
layoutChanged
)
{
{
ScreenPtr
pScreen
=
crtc
->
pScreen
;
ScreenPtr
pScreen
=
crtc
->
pScreen
;
crtc
->
changed
=
TRUE
;
crtc
->
changed
=
TRUE
;
if
(
pScreen
)
if
(
pScreen
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
pScrPriv
->
changed
=
TRUE
;
pScrPriv
->
changed
=
TRUE
;
/*
/*
* Send ConfigureNotify on any layout change
* Send ConfigureNotify on any layout change
*/
*/
if
(
layoutChanged
)
if
(
layoutChanged
)
pScrPriv
->
layoutChanged
=
TRUE
;
pScrPriv
->
layoutChanged
=
TRUE
;
}
}
}
}
...
@@ -69,31 +68,31 @@ RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged)
...
@@ -69,31 +68,31 @@ RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged)
* Create a CRTC
* Create a CRTC
*/
*/
RRCrtcPtr
RRCrtcPtr
RRCrtcCreate
(
ScreenPtr
pScreen
,
void
*
devPrivate
)
RRCrtcCreate
(
ScreenPtr
pScreen
,
void
*
devPrivate
)
{
{
RRCrtcPtr
crtc
;
RRCrtcPtr
crtc
;
RRCrtcPtr
*
crtcs
;
RRCrtcPtr
*
crtcs
;
rrScrPrivPtr
pScrPriv
;
rrScrPrivPtr
pScrPriv
;
if
(
!
RRInit
())
if
(
!
RRInit
())
return
NULL
;
return
NULL
;
pScrPriv
=
rrGetScrPriv
(
pScreen
);
pScrPriv
=
rrGetScrPriv
(
pScreen
);
/* make space for the crtc pointer */
/* make space for the crtc pointer */
if
(
pScrPriv
->
numCrtcs
)
if
(
pScrPriv
->
numCrtcs
)
crtcs
=
xrealloc
(
pScrPriv
->
crtcs
,
crtcs
=
xrealloc
(
pScrPriv
->
crtcs
,
(
pScrPriv
->
numCrtcs
+
1
)
*
sizeof
(
RRCrtcPtr
));
(
pScrPriv
->
numCrtcs
+
1
)
*
sizeof
(
RRCrtcPtr
));
else
else
crtcs
=
xalloc
(
sizeof
(
RRCrtcPtr
));
crtcs
=
xalloc
(
sizeof
(
RRCrtcPtr
));
if
(
!
crtcs
)
if
(
!
crtcs
)
return
FALSE
;
return
FALSE
;
pScrPriv
->
crtcs
=
crtcs
;
pScrPriv
->
crtcs
=
crtcs
;
crtc
=
xcalloc
(
1
,
sizeof
(
RRCrtcRec
));
crtc
=
xcalloc
(
1
,
sizeof
(
RRCrtcRec
));
if
(
!
crtc
)
if
(
!
crtc
)
return
NULL
;
return
NULL
;
crtc
->
id
=
FakeClientID
(
0
);
crtc
->
id
=
FakeClientID
(
0
);
crtc
->
pScreen
=
pScreen
;
crtc
->
pScreen
=
pScreen
;
crtc
->
mode
=
NULL
;
crtc
->
mode
=
NULL
;
crtc
->
x
=
0
;
crtc
->
x
=
0
;
...
@@ -107,8 +106,8 @@ RRCrtcCreate (ScreenPtr pScreen, void *devPrivate)
...
@@ -107,8 +106,8 @@ RRCrtcCreate (ScreenPtr pScreen, void *devPrivate)
crtc
->
changed
=
FALSE
;
crtc
->
changed
=
FALSE
;
crtc
->
devPrivate
=
devPrivate
;
crtc
->
devPrivate
=
devPrivate
;
if
(
!
AddResource
(
crtc
->
id
,
RRCrtcType
,
(
void
*
)
crtc
))
if
(
!
AddResource
(
crtc
->
id
,
RRCrtcType
,
(
void
*
)
crtc
))
return
NULL
;
return
NULL
;
/* attach the screen and crtc together */
/* attach the screen and crtc together */
crtc
->
pScreen
=
pScreen
;
crtc
->
pScreen
=
pScreen
;
...
@@ -121,7 +120,7 @@ RRCrtcCreate (ScreenPtr pScreen, void *devPrivate)
...
@@ -121,7 +120,7 @@ RRCrtcCreate (ScreenPtr pScreen, void *devPrivate)
* Set the allowed rotations on a CRTC
* Set the allowed rotations on a CRTC
*/
*/
void
void
RRCrtcSetRotations
(
RRCrtcPtr
crtc
,
Rotation
rotations
)
RRCrtcSetRotations
(
RRCrtcPtr
crtc
,
Rotation
rotations
)
{
{
crtc
->
rotations
=
rotations
;
crtc
->
rotations
=
rotations
;
}
}
...
@@ -131,116 +130,103 @@ RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations)
...
@@ -131,116 +130,103 @@ RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations)
* the driver calls this whenever it has updated the mode
* the driver calls this whenever it has updated the mode
*/
*/
Bool
Bool
RRCrtcNotify
(
RRCrtcPtr
crtc
,
RRCrtcNotify
(
RRCrtcPtr
crtc
,
RRModePtr
mode
,
RRModePtr
mode
,
int
x
,
int
x
,
int
y
,
int
y
,
Rotation
rotation
,
int
numOutputs
,
RROutputPtr
*
outputs
)
Rotation
rotation
,
int
numOutputs
,
RROutputPtr
*
outputs
)
{
{
int
i
,
j
;
int
i
,
j
;
/*
/*
* Check to see if any of the new outputs were
* Check to see if any of the new outputs were
* not in the old list and mark them as changed
* not in the old list and mark them as changed
*/
*/
for
(
i
=
0
;
i
<
numOutputs
;
i
++
)
for
(
i
=
0
;
i
<
numOutputs
;
i
++
)
{
{
for
(
j
=
0
;
j
<
crtc
->
numOutputs
;
j
++
)
for
(
j
=
0
;
j
<
crtc
->
numOutputs
;
j
++
)
if
(
outputs
[
i
]
==
crtc
->
outputs
[
j
])
if
(
outputs
[
i
]
==
crtc
->
outputs
[
j
])
break
;
break
;
if
(
j
==
crtc
->
numOutputs
)
{
if
(
j
==
crtc
->
numOutputs
)
outputs
[
i
]
->
crtc
=
crtc
;
{
RROutputChanged
(
outputs
[
i
],
FALSE
);
outputs
[
i
]
->
crtc
=
crtc
;
RRCrtcChanged
(
crtc
,
FALSE
);
RROutputChanged
(
outputs
[
i
],
FALSE
);
}
RRCrtcChanged
(
crtc
,
FALSE
);
}
}
}
/*
/*
* Check to see if any of the old outputs are
* Check to see if any of the old outputs are
* not in the new list and mark them as changed
* not in the new list and mark them as changed
*/
*/
for
(
j
=
0
;
j
<
crtc
->
numOutputs
;
j
++
)
for
(
j
=
0
;
j
<
crtc
->
numOutputs
;
j
++
)
{
{
for
(
i
=
0
;
i
<
numOutputs
;
i
++
)
for
(
i
=
0
;
i
<
numOutputs
;
i
++
)
if
(
outputs
[
i
]
==
crtc
->
outputs
[
j
])
if
(
outputs
[
i
]
==
crtc
->
outputs
[
j
])
break
;
break
;
if
(
i
==
numOutputs
)
{
if
(
i
==
numOutputs
)
if
(
crtc
->
outputs
[
j
]
->
crtc
==
crtc
)
{
crtc
->
outputs
[
j
]
->
crtc
=
NULL
;
if
(
crtc
->
outputs
[
j
]
->
crtc
==
crtc
)
RROutputChanged
(
crtc
->
outputs
[
j
],
FALSE
);
crtc
->
outputs
[
j
]
->
crtc
=
NULL
;
RRCrtcChanged
(
crtc
,
FALSE
);
RROutputChanged
(
crtc
->
outputs
[
j
],
FALSE
);
}
RRCrtcChanged
(
crtc
,
FALSE
);
}
}
}
/*
/*
* Reallocate the crtc output array if necessary
* Reallocate the crtc output array if necessary
*/
*/
if
(
numOutputs
!=
crtc
->
numOutputs
)
if
(
numOutputs
!=
crtc
->
numOutputs
)
{
{
RROutputPtr
*
newoutputs
;
RROutputPtr
*
newoutputs
;
if
(
numOutputs
)
{
if
(
numOutputs
)
if
(
crtc
->
numOutputs
)
{
newoutputs
=
xrealloc
(
crtc
->
outputs
,
if
(
crtc
->
numOutputs
)
numOutputs
*
sizeof
(
RROutputPtr
));
newoutputs
=
xrealloc
(
crtc
->
outputs
,
else
numOutputs
*
sizeof
(
RROutputPtr
));
newoutputs
=
xalloc
(
numOutputs
*
sizeof
(
RROutputPtr
));
else
if
(
!
newoutputs
)
newoutputs
=
xalloc
(
numOutputs
*
sizeof
(
RROutputPtr
));
return
FALSE
;
if
(
!
newoutputs
)
}
return
FALSE
;
else
{
}
if
(
crtc
->
outputs
)
else
xfree
(
crtc
->
outputs
);
{
newoutputs
=
NULL
;
if
(
crtc
->
outputs
)
}
xfree
(
crtc
->
outputs
);
crtc
->
outputs
=
newoutputs
;
newoutputs
=
NULL
;
crtc
->
numOutputs
=
numOutputs
;
}
crtc
->
outputs
=
newoutputs
;
crtc
->
numOutputs
=
numOutputs
;
}
}
/*
/*
* Copy the new list of outputs into the crtc
* Copy the new list of outputs into the crtc
*/
*/
memcpy
(
crtc
->
outputs
,
outputs
,
numOutputs
*
sizeof
(
RROutputPtr
));
memcpy
(
crtc
->
outputs
,
outputs
,
numOutputs
*
sizeof
(
RROutputPtr
));
/*
/*
* Update remaining crtc fields
* Update remaining crtc fields
*/
*/
if
(
mode
!=
crtc
->
mode
)
if
(
mode
!=
crtc
->
mode
)
{
{
if
(
crtc
->
mode
)
if
(
crtc
->
mode
)
RRModeDestroy
(
crtc
->
mode
);
RRModeDestroy
(
crtc
->
mode
);
crtc
->
mode
=
mode
;
crtc
->
mode
=
mode
;
if
(
mode
!=
NULL
)
if
(
mode
!=
NULL
)
mode
->
refcnt
++
;
mode
->
refcnt
++
;
RRCrtcChanged
(
crtc
,
TRUE
);
RRCrtcChanged
(
crtc
,
TRUE
);
}
}
if
(
x
!=
crtc
->
x
)
{
if
(
x
!=
crtc
->
x
)
crtc
->
x
=
x
;
{
RRCrtcChanged
(
crtc
,
TRUE
);
crtc
->
x
=
x
;
}
RRCrtcChanged
(
crtc
,
TRUE
);
if
(
y
!=
crtc
->
y
)
{
}
crtc
->
y
=
y
;
if
(
y
!=
crtc
->
y
)
RRCrtcChanged
(
crtc
,
TRUE
);
{
}
crtc
->
y
=
y
;
if
(
rotation
!=
crtc
->
rotation
)
{
RRCrtcChanged
(
crtc
,
TRUE
);
crtc
->
rotation
=
rotation
;
}
RRCrtcChanged
(
crtc
,
TRUE
);
if
(
rotation
!=
crtc
->
rotation
)
{
crtc
->
rotation
=
rotation
;
RRCrtcChanged
(
crtc
,
TRUE
);
}
}
return
TRUE
;
return
TRUE
;
}
}
void
void
RRDeliverCrtcEvent
(
ClientPtr
client
,
WindowPtr
pWin
,
RRCrtcPtr
crtc
)
RRDeliverCrtcEvent
(
ClientPtr
client
,
WindowPtr
pWin
,
RRCrtcPtr
crtc
)
{
{
ScreenPtr
pScreen
=
pWin
->
drawable
.
pScreen
;
ScreenPtr
pScreen
=
pWin
->
drawable
.
pScreen
;
rrScrPriv
(
pScreen
);
xRRCrtcChangeNotifyEvent
ce
;
rrScrPriv
(
pScreen
);
RRModePtr
mode
=
crtc
->
mode
;
xRRCrtcChangeNotifyEvent
ce
;
RRModePtr
mode
=
crtc
->
mode
;
ce
.
type
=
RRNotify
+
RREventBase
;
ce
.
type
=
RRNotify
+
RREventBase
;
ce
.
subCode
=
RRNotify_CrtcChange
;
ce
.
subCode
=
RRNotify_CrtcChange
;
...
@@ -249,37 +235,36 @@ RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc)
...
@@ -249,37 +235,36 @@ RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc)
ce
.
window
=
pWin
->
drawable
.
id
;
ce
.
window
=
pWin
->
drawable
.
id
;
ce
.
crtc
=
crtc
->
id
;
ce
.
crtc
=
crtc
->
id
;
ce
.
rotation
=
crtc
->
rotation
;
ce
.
rotation
=
crtc
->
rotation
;
if
(
mode
)
if
(
mode
)
{
{
ce
.
mode
=
mode
->
mode
.
id
;
ce
.
mode
=
mode
->
mode
.
id
;
ce
.
x
=
crtc
->
x
;
ce
.
x
=
crtc
->
x
;
ce
.
y
=
crtc
->
y
;
ce
.
y
=
crtc
->
y
;
ce
.
width
=
mode
->
mode
.
width
;
ce
.
width
=
mode
->
mode
.
width
;
ce
.
height
=
mode
->
mode
.
height
;
ce
.
height
=
mode
->
mode
.
height
;
}
}
else
{
else
ce
.
mode
=
None
;
{
ce
.
x
=
0
;
ce
.
mode
=
None
;
ce
.
y
=
0
;
ce
.
x
=
0
;
ce
.
width
=
0
;
ce
.
y
=
0
;
ce
.
height
=
0
;
ce
.
width
=
0
;
}
ce
.
height
=
0
;
WriteEventsToClient
(
client
,
1
,
(
xEvent
*
)
&
ce
);
}
WriteEventsToClient
(
client
,
1
,
(
xEvent
*
)
&
ce
);
}
}
static
Bool
static
Bool
RRCrtcPendingProperties
(
RRCrtcPtr
crtc
)
RRCrtcPendingProperties
(
RRCrtcPtr
crtc
)
{
{
ScreenPtr
pScreen
=
crtc
->
pScreen
;
ScreenPtr
pScreen
=
crtc
->
pScreen
;
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
int
o
;
int
o
;
for
(
o
=
0
;
o
<
pScrPriv
->
numOutputs
;
o
++
)
{
RROutputPtr
output
=
pScrPriv
->
outputs
[
o
];
for
(
o
=
0
;
o
<
pScrPriv
->
numOutputs
;
o
++
)
if
(
output
->
crtc
==
crtc
&&
output
->
pendingProperties
)
{
return
TRUE
;
RROutputPtr
output
=
pScrPriv
->
outputs
[
o
];
if
(
output
->
crtc
==
crtc
&&
output
->
pendingProperties
)
return
TRUE
;
}
}
return
FALSE
;
return
FALSE
;
}
}
...
@@ -288,89 +273,80 @@ RRCrtcPendingProperties (RRCrtcPtr crtc)
...
@@ -288,89 +273,80 @@ RRCrtcPendingProperties (RRCrtcPtr crtc)
* Request that the Crtc be reconfigured
* Request that the Crtc be reconfigured
*/
*/
Bool
Bool
RRCrtcSet
(
RRCrtcPtr
crtc
,
RRCrtcSet
(
RRCrtcPtr
crtc
,
RRModePtr
mode
,
RRModePtr
mode
,
int
x
,
int
x
,
int
y
,
int
y
,
Rotation
rotation
,
int
numOutputs
,
RROutputPtr
*
outputs
)
Rotation
rotation
,
int
numOutputs
,
RROutputPtr
*
outputs
)
{
{
ScreenPtr
pScreen
=
crtc
->
pScreen
;
ScreenPtr
pScreen
=
crtc
->
pScreen
;
Bool
ret
=
FALSE
;
Bool
ret
=
FALSE
;
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
/* See if nothing changed */
/* See if nothing changed */
if
(
crtc
->
mode
==
mode
&&
if
(
crtc
->
mode
==
mode
&&
crtc
->
x
==
x
&&
crtc
->
x
==
x
&&
crtc
->
y
==
y
&&
crtc
->
y
==
y
&&
crtc
->
rotation
==
rotation
&&
crtc
->
rotation
==
rotation
&&
crtc
->
numOutputs
==
numOutputs
&&
crtc
->
numOutputs
==
numOutputs
&&
!
memcmp
(
crtc
->
outputs
,
outputs
,
numOutputs
*
sizeof
(
RROutputPtr
))
&&
!
memcmp
(
crtc
->
outputs
,
outputs
,
numOutputs
*
sizeof
(
RROutputPtr
))
&&
!
RRCrtcPendingProperties
(
crtc
))
!
RRCrtcPendingProperties
(
crtc
))
{
{
ret
=
TRUE
;
ret
=
TRUE
;
}
}
else
{
else
{
#if RANDR_12_INTERFACE
#if RANDR_12_INTERFACE
if
(
pScrPriv
->
rrCrtcSet
)
if
(
pScrPriv
->
rrCrtcSet
)
{
{
ret
=
(
*
pScrPriv
->
rrCrtcSet
)
(
pScreen
,
crtc
,
mode
,
x
,
y
,
ret
=
(
*
pScrPriv
->
rrCrtcSet
)
(
pScreen
,
crtc
,
mode
,
x
,
y
,
rotation
,
numOutputs
,
outputs
);
rotation
,
numOutputs
,
outputs
);
}
}
else
else
#endif
#endif
{
{
#if RANDR_10_INTERFACE
#if RANDR_10_INTERFACE
if
(
pScrPriv
->
rrSetConfig
)
if
(
pScrPriv
->
rrSetConfig
)
{
{
RRScreenSize
size
;
RRScreenSize
size
;
RRScreenRate
rate
;
RRScreenRate
rate
;
if
(
!
mode
)
{
if
(
!
mode
)
RRCrtcNotify
(
crtc
,
NULL
,
x
,
y
,
rotation
,
0
,
NULL
);
{
ret
=
TRUE
;
RRCrtcNotify
(
crtc
,
NULL
,
x
,
y
,
rotation
,
0
,
NULL
);
}
ret
=
TRUE
;
else
{
}
size
.
width
=
mode
->
mode
.
width
;
else
size
.
height
=
mode
->
mode
.
height
;
{
if
(
outputs
[
0
]
->
mmWidth
&&
outputs
[
0
]
->
mmHeight
)
{
size
.
width
=
mode
->
mode
.
width
;
size
.
mmWidth
=
outputs
[
0
]
->
mmWidth
;
size
.
height
=
mode
->
mode
.
height
;
size
.
mmHeight
=
outputs
[
0
]
->
mmHeight
;
if
(
outputs
[
0
]
->
mmWidth
&&
outputs
[
0
]
->
mmHeight
)
}
{
else
{
size
.
mmWidth
=
outputs
[
0
]
->
mmWidth
;
size
.
mmWidth
=
pScreen
->
mmWidth
;
size
.
mmHeight
=
outputs
[
0
]
->
mmHeight
;
size
.
mmHeight
=
pScreen
->
mmHeight
;
}
}
else
size
.
nRates
=
1
;
{
rate
.
rate
=
RRVerticalRefresh
(
&
mode
->
mode
);
size
.
mmWidth
=
pScreen
->
mmWidth
;
size
.
pRates
=
&
rate
;
size
.
mmHeight
=
pScreen
->
mmHeight
;
ret
=
}
(
*
pScrPriv
->
rrSetConfig
)
(
pScreen
,
rotation
,
rate
.
rate
,
size
.
nRates
=
1
;
&
size
);
rate
.
rate
=
RRVerticalRefresh
(
&
mode
->
mode
);
/*
size
.
pRates
=
&
rate
;
* Old 1.0 interface tied screen size to mode size
ret
=
(
*
pScrPriv
->
rrSetConfig
)
(
pScreen
,
rotation
,
rate
.
rate
,
&
size
);
*/
/*
if
(
ret
)
{
* Old 1.0 interface tied screen size to mode size
RRCrtcNotify
(
crtc
,
mode
,
x
,
y
,
rotation
,
1
,
outputs
);
*/
RRScreenSizeNotify
(
pScreen
);
if
(
ret
)
}
{
}
RRCrtcNotify
(
crtc
,
mode
,
x
,
y
,
rotation
,
1
,
outputs
);
}
RRScreenSizeNotify
(
pScreen
);
}
}
}
#endif
#endif
}
}
if
(
ret
)
if
(
ret
)
{
{
int
o
;
int
o
;
RRTellChanged
(
pScreen
);
for
(
o
=
0
;
o
<
numOutputs
;
o
++
)
RRTellChanged
(
pScreen
);
RRPostPendingProperties
(
outputs
[
o
]);
}
for
(
o
=
0
;
o
<
numOutputs
;
o
++
)
RRPostPendingProperties
(
outputs
[
o
]);
}
}
}
return
ret
;
return
ret
;
}
}
...
@@ -379,38 +355,35 @@ RRCrtcSet (RRCrtcPtr crtc,
...
@@ -379,38 +355,35 @@ RRCrtcSet (RRCrtcPtr crtc,
* Destroy a Crtc at shutdown
* Destroy a Crtc at shutdown
*/
*/
void
void
RRCrtcDestroy
(
RRCrtcPtr
crtc
)
RRCrtcDestroy
(
RRCrtcPtr
crtc
)
{
{
FreeResource
(
crtc
->
id
,
0
);
FreeResource
(
crtc
->
id
,
0
);
}
}
static
int
static
int
RRCrtcDestroyResource
(
void
*
value
,
XID
pid
)
RRCrtcDestroyResource
(
void
*
value
,
XID
pid
)
{
{
RRCrtcPtr
crtc
=
(
RRCrtcPtr
)
value
;
RRCrtcPtr
crtc
=
(
RRCrtcPtr
)
value
;
ScreenPtr
pScreen
=
crtc
->
pScreen
;
ScreenPtr
pScreen
=
crtc
->
pScreen
;
if
(
pScreen
)
if
(
pScreen
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
int
i
;
int
i
;
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
{
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
if
(
pScrPriv
->
crtcs
[
i
]
==
crtc
)
{
{
memmove
(
pScrPriv
->
crtcs
+
i
,
pScrPriv
->
crtcs
+
i
+
1
,
if
(
pScrPriv
->
crtcs
[
i
]
==
crtc
)
(
pScrPriv
->
numCrtcs
-
(
i
+
1
))
*
sizeof
(
RRCrtcPtr
));
{
--
pScrPriv
->
numCrtcs
;
memmove
(
pScrPriv
->
crtcs
+
i
,
pScrPriv
->
crtcs
+
i
+
1
,
break
;
(
pScrPriv
->
numCrtcs
-
(
i
+
1
))
*
sizeof
(
RRCrtcPtr
));
}
--
pScrPriv
->
numCrtcs
;
}
break
;
}
}
}
}
if
(
crtc
->
gammaRed
)
if
(
crtc
->
gammaRed
)
xfree
(
crtc
->
gammaRed
);
xfree
(
crtc
->
gammaRed
);
if
(
crtc
->
mode
)
if
(
crtc
->
mode
)
RRModeDestroy
(
crtc
->
mode
);
RRModeDestroy
(
crtc
->
mode
);
xfree
(
crtc
);
xfree
(
crtc
);
return
1
;
return
1
;
}
}
...
@@ -419,25 +392,22 @@ RRCrtcDestroyResource (void * value, XID pid)
...
@@ -419,25 +392,22 @@ RRCrtcDestroyResource (void * value, XID pid)
*/
*/
Bool
Bool
RRCrtcGammaSet
(
RRCrtcPtr
crtc
,
RRCrtcGammaSet
(
RRCrtcPtr
crtc
,
CARD16
*
red
,
CARD16
*
green
,
CARD16
*
blue
)
CARD16
*
red
,
CARD16
*
green
,
CARD16
*
blue
)
{
{
Bool
ret
=
TRUE
;
Bool
ret
=
TRUE
;
#if RANDR_12_INTERFACE
#if RANDR_12_INTERFACE
ScreenPtr
pScreen
=
crtc
->
pScreen
;
ScreenPtr
pScreen
=
crtc
->
pScreen
;
#endif
#endif
memcpy
(
crtc
->
gammaRed
,
red
,
crtc
->
gammaSize
*
sizeof
(
CARD16
));
memcpy
(
crtc
->
gammaRed
,
red
,
crtc
->
gammaSize
*
sizeof
(
CARD16
));
memcpy
(
crtc
->
gammaGreen
,
green
,
crtc
->
gammaSize
*
sizeof
(
CARD16
));
memcpy
(
crtc
->
gammaGreen
,
green
,
crtc
->
gammaSize
*
sizeof
(
CARD16
));
memcpy
(
crtc
->
gammaBlue
,
blue
,
crtc
->
gammaSize
*
sizeof
(
CARD16
));
memcpy
(
crtc
->
gammaBlue
,
blue
,
crtc
->
gammaSize
*
sizeof
(
CARD16
));
#if RANDR_12_INTERFACE
#if RANDR_12_INTERFACE
if
(
pScreen
)
if
(
pScreen
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
if
(
pScrPriv
->
rrCrtcSetGamma
)
if
(
pScrPriv
->
rrCrtcSetGamma
)
ret
=
(
*
pScrPriv
->
rrCrtcSetGamma
)
(
pScreen
,
crtc
);
ret
=
(
*
pScrPriv
->
rrCrtcSetGamma
)
(
pScreen
,
crtc
);
}
}
#endif
#endif
return
ret
;
return
ret
;
...
@@ -450,9 +420,9 @@ RRCrtcGammaSet (RRCrtcPtr crtc,
...
@@ -450,9 +420,9 @@ RRCrtcGammaSet (RRCrtcPtr crtc,
*/
*/
Bool
Bool
RRCrtcGammaNotify
(
RRCrtcPtr
crtc
)
RRCrtcGammaNotify
(
RRCrtcPtr
crtc
)
{
{
return
TRUE
;
/* not much going on here */
return
TRUE
;
/* not much going on here */
}
}
/**
/**
...
@@ -462,22 +432,22 @@ void
...
@@ -462,22 +432,22 @@ void
RRCrtcGetScanoutSize
(
RRCrtcPtr
crtc
,
int
*
width
,
int
*
height
)
RRCrtcGetScanoutSize
(
RRCrtcPtr
crtc
,
int
*
width
,
int
*
height
)
{
{
if
(
crtc
->
mode
==
NULL
)
{
if
(
crtc
->
mode
==
NULL
)
{
*
width
=
0
;
*
width
=
0
;
*
height
=
0
;
*
height
=
0
;
return
;
return
;
}
}
switch
(
crtc
->
rotation
&
0xf
)
{
switch
(
crtc
->
rotation
&
0xf
)
{
case
RR_Rotate_0
:
case
RR_Rotate_0
:
case
RR_Rotate_180
:
case
RR_Rotate_180
:
*
width
=
crtc
->
mode
->
mode
.
width
;
*
width
=
crtc
->
mode
->
mode
.
width
;
*
height
=
crtc
->
mode
->
mode
.
height
;
*
height
=
crtc
->
mode
->
mode
.
height
;
break
;
break
;
case
RR_Rotate_90
:
case
RR_Rotate_90
:
case
RR_Rotate_270
:
case
RR_Rotate_270
:
*
width
=
crtc
->
mode
->
mode
.
height
;
*
width
=
crtc
->
mode
->
mode
.
height
;
*
height
=
crtc
->
mode
->
mode
.
width
;
*
height
=
crtc
->
mode
->
mode
.
width
;
break
;
break
;
}
}
}
}
...
@@ -486,26 +456,24 @@ RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height)
...
@@ -486,26 +456,24 @@ RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height)
*/
*/
Bool
Bool
RRCrtcGammaSetSize
(
RRCrtcPtr
crtc
,
RRCrtcGammaSetSize
(
RRCrtcPtr
crtc
,
int
size
)
int
size
)
{
{
CARD16
*
gamma
;
CARD16
*
gamma
;
if
(
size
==
crtc
->
gammaSize
)
if
(
size
==
crtc
->
gammaSize
)
return
TRUE
;
return
TRUE
;
if
(
size
)
if
(
size
)
{
{
gamma
=
xalloc
(
size
*
3
*
sizeof
(
CARD16
));
gamma
=
xalloc
(
size
*
3
*
sizeof
(
CARD16
));
if
(
!
gamma
)
if
(
!
gamma
)
return
FALSE
;
return
FALSE
;
}
}
else
else
gamma
=
NULL
;
gamma
=
NULL
;
if
(
crtc
->
gammaRed
)
if
(
crtc
->
gammaRed
)
xfree
(
crtc
->
gammaRed
);
xfree
(
crtc
->
gammaRed
);
crtc
->
gammaRed
=
gamma
;
crtc
->
gammaRed
=
gamma
;
crtc
->
gammaGreen
=
gamma
+
size
;
crtc
->
gammaGreen
=
gamma
+
size
;
crtc
->
gammaBlue
=
gamma
+
size
*
2
;
crtc
->
gammaBlue
=
gamma
+
size
*
2
;
crtc
->
gammaSize
=
size
;
crtc
->
gammaSize
=
size
;
return
TRUE
;
return
TRUE
;
}
}
...
@@ -514,36 +482,36 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc,
...
@@ -514,36 +482,36 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc,
* Initialize crtc type
* Initialize crtc type
*/
*/
Bool
Bool
RRCrtcInit
(
void
)
RRCrtcInit
(
void
)
{
{
RRCrtcType
=
CreateNewResourceType
(
RRCrtcDestroyResource
);
RRCrtcType
=
CreateNewResourceType
(
RRCrtcDestroyResource
);
if
(
!
RRCrtcType
)
if
(
!
RRCrtcType
)
return
FALSE
;
return
FALSE
;
RegisterResourceName
(
RRCrtcType
,
"CRTC"
);
RegisterResourceName
(
RRCrtcType
,
"CRTC"
);
return
TRUE
;
return
TRUE
;
}
}
int
int
ProcRRGetCrtcInfo
(
ClientPtr
client
)
ProcRRGetCrtcInfo
(
ClientPtr
client
)
{
{
REQUEST
(
xRRGetCrtcInfoReq
);
REQUEST
(
xRRGetCrtcInfoReq
);
xRRGetCrtcInfoReply
rep
;
xRRGetCrtcInfoReply
rep
;
RRCrtcPtr
crtc
;
RRCrtcPtr
crtc
;
CARD8
*
extra
;
CARD8
*
extra
;
unsigned
long
extraLen
;
unsigned
long
extraLen
;
ScreenPtr
pScreen
;
ScreenPtr
pScreen
;
rrScrPrivPtr
pScrPriv
;
rrScrPrivPtr
pScrPriv
;
RRModePtr
mode
;
RRModePtr
mode
;
RROutput
*
outputs
;
RROutput
*
outputs
;
RROutput
*
possible
;
RROutput
*
possible
;
int
i
,
j
,
k
,
n
;
int
i
,
j
,
k
,
n
;
int
width
,
height
;
int
width
,
height
;
REQUEST_SIZE_MATCH
(
xRRGetCrtcInfoReq
);
REQUEST_SIZE_MATCH
(
xRRGetCrtcInfoReq
);
crtc
=
LookupCrtc
(
client
,
stuff
->
crtc
,
DixReadAccess
);
crtc
=
LookupCrtc
(
client
,
stuff
->
crtc
,
DixReadAccess
);
if
(
!
crtc
)
if
(
!
crtc
)
return
RRErrorBase
+
BadRRCrtc
;
return
RRErrorBase
+
BadRRCrtc
;
/* All crtcs must be associated with screens before client
/* All crtcs must be associated with screens before client
* requests are processed
* requests are processed
...
@@ -560,7 +528,7 @@ ProcRRGetCrtcInfo (ClientPtr client)
...
@@ -560,7 +528,7 @@ ProcRRGetCrtcInfo (ClientPtr client)
rep
.
timestamp
=
pScrPriv
->
lastSetTime
.
milliseconds
;
rep
.
timestamp
=
pScrPriv
->
lastSetTime
.
milliseconds
;
rep
.
x
=
crtc
->
x
;
rep
.
x
=
crtc
->
x
;
rep
.
y
=
crtc
->
y
;
rep
.
y
=
crtc
->
y
;
RRCrtcGetScanoutSize
(
crtc
,
&
width
,
&
height
);
RRCrtcGetScanoutSize
(
crtc
,
&
width
,
&
height
);
rep
.
width
=
width
;
rep
.
width
=
width
;
rep
.
height
=
height
;
rep
.
height
=
height
;
rep
.
mode
=
mode
?
mode
->
mode
.
id
:
0
;
rep
.
mode
=
mode
?
mode
->
mode
.
id
:
0
;
...
@@ -569,175 +537,158 @@ ProcRRGetCrtcInfo (ClientPtr client)
...
@@ -569,175 +537,158 @@ ProcRRGetCrtcInfo (ClientPtr client)
rep
.
nOutput
=
crtc
->
numOutputs
;
rep
.
nOutput
=
crtc
->
numOutputs
;
k
=
0
;
k
=
0
;
for
(
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
for
(
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
for
(
j
=
0
;
j
<
pScrPriv
->
outputs
[
i
]
->
numCrtcs
;
j
++
)
for
(
j
=
0
;
j
<
pScrPriv
->
outputs
[
i
]
->
numCrtcs
;
j
++
)
if
(
pScrPriv
->
outputs
[
i
]
->
crtcs
[
j
]
==
crtc
)
if
(
pScrPriv
->
outputs
[
i
]
->
crtcs
[
j
]
==
crtc
)
k
++
;
k
++
;
rep
.
nPossibleOutput
=
k
;
rep
.
nPossibleOutput
=
k
;
rep
.
length
=
rep
.
nOutput
+
rep
.
nPossibleOutput
;
rep
.
length
=
rep
.
nOutput
+
rep
.
nPossibleOutput
;
extraLen
=
rep
.
length
<<
2
;
extraLen
=
rep
.
length
<<
2
;
if
(
extraLen
)
if
(
extraLen
)
{
{
extra
=
xalloc
(
extraLen
);
extra
=
xalloc
(
extraLen
);
if
(
!
extra
)
if
(
!
extra
)
return
BadAlloc
;
return
BadAlloc
;
}
}
else
else
extra
=
NULL
;
extra
=
NULL
;
outputs
=
(
RROutput
*
)
extra
;
outputs
=
(
RROutput
*
)
extra
;
possible
=
(
RROutput
*
)
(
outputs
+
rep
.
nOutput
);
possible
=
(
RROutput
*
)
(
outputs
+
rep
.
nOutput
);
for
(
i
=
0
;
i
<
crtc
->
numOutputs
;
i
++
)
for
(
i
=
0
;
i
<
crtc
->
numOutputs
;
i
++
)
{
{
outputs
[
i
]
=
crtc
->
outputs
[
i
]
->
id
;
outputs
[
i
]
=
crtc
->
outputs
[
i
]
->
id
;
if
(
client
->
swapped
)
if
(
client
->
swapped
)
swapl
(
&
outputs
[
i
],
n
);
swapl
(
&
outputs
[
i
],
n
);
}
}
k
=
0
;
k
=
0
;
for
(
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
for
(
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
for
(
j
=
0
;
j
<
pScrPriv
->
outputs
[
i
]
->
numCrtcs
;
j
++
)
for
(
j
=
0
;
j
<
pScrPriv
->
outputs
[
i
]
->
numCrtcs
;
j
++
)
if
(
pScrPriv
->
outputs
[
i
]
->
crtcs
[
j
]
==
crtc
)
if
(
pScrPriv
->
outputs
[
i
]
->
crtcs
[
j
]
==
crtc
)
{
{
possible
[
k
]
=
pScrPriv
->
outputs
[
i
]
->
id
;
possible
[
k
]
=
pScrPriv
->
outputs
[
i
]
->
id
;
if
(
client
->
swapped
)
if
(
client
->
swapped
)
swapl
(
&
possible
[
k
],
n
);
swapl
(
&
possible
[
k
],
n
);
k
++
;
k
++
;
}
}
if
(
client
->
swapped
)
{
if
(
client
->
swapped
)
{
swaps
(
&
rep
.
sequenceNumber
,
n
);
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
timestamp
,
n
);
swapl
(
&
rep
.
timestamp
,
n
);
swaps
(
&
rep
.
x
,
n
);
swaps
(
&
rep
.
x
,
n
);
swaps
(
&
rep
.
y
,
n
);
swaps
(
&
rep
.
y
,
n
);
swaps
(
&
rep
.
width
,
n
);
swaps
(
&
rep
.
width
,
n
);
swaps
(
&
rep
.
height
,
n
);
swaps
(
&
rep
.
height
,
n
);
swapl
(
&
rep
.
mode
,
n
);
swapl
(
&
rep
.
mode
,
n
);
swaps
(
&
rep
.
rotation
,
n
);
swaps
(
&
rep
.
rotation
,
n
);
swaps
(
&
rep
.
rotations
,
n
);
swaps
(
&
rep
.
rotations
,
n
);
swaps
(
&
rep
.
nOutput
,
n
);
swaps
(
&
rep
.
nOutput
,
n
);
swaps
(
&
rep
.
nPossibleOutput
,
n
);
swaps
(
&
rep
.
nPossibleOutput
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xRRGetCrtcInfoReply
),
(
char
*
)
&
rep
);
WriteToClient
(
client
,
sizeof
(
xRRGetCrtcInfoReply
),
(
char
*
)
&
rep
);
if
(
extraLen
)
if
(
extraLen
)
{
{
WriteToClient
(
client
,
extraLen
,
(
char
*
)
extra
);
WriteToClient
(
client
,
extraLen
,
(
char
*
)
extra
);
xfree
(
extra
);
xfree
(
extra
);
}
}
return
client
->
noClientException
;
return
client
->
noClientException
;
}
}
int
int
ProcRRSetCrtcConfig
(
ClientPtr
client
)
ProcRRSetCrtcConfig
(
ClientPtr
client
)
{
{
REQUEST
(
xRRSetCrtcConfigReq
);
REQUEST
(
xRRSetCrtcConfigReq
);
xRRSetCrtcConfigReply
rep
;
xRRSetCrtcConfigReply
rep
;
ScreenPtr
pScreen
;
ScreenPtr
pScreen
;
rrScrPrivPtr
pScrPriv
;
rrScrPrivPtr
pScrPriv
;
RRCrtcPtr
crtc
;
RRCrtcPtr
crtc
;
RRModePtr
mode
;
RRModePtr
mode
;
int
numOutputs
;
int
numOutputs
;
RROutputPtr
*
outputs
=
NULL
;
RROutputPtr
*
outputs
=
NULL
;
RROutput
*
outputIds
;
RROutput
*
outputIds
;
TimeStamp
time
;
TimeStamp
time
;
Rotation
rotation
;
Rotation
rotation
;
int
i
,
j
;
int
i
,
j
;
REQUEST_AT_LEAST_SIZE
(
xRRSetCrtcConfigReq
);
REQUEST_AT_LEAST_SIZE
(
xRRSetCrtcConfigReq
);
numOutputs
=
(
stuff
->
length
-
(
SIZEOF
(
xRRSetCrtcConfigReq
)
>>
2
));
numOutputs
=
(
stuff
->
length
-
(
SIZEOF
(
xRRSetCrtcConfigReq
)
>>
2
));
crtc
=
LookupIDByType
(
stuff
->
crtc
,
RRCrtcType
);
crtc
=
LookupIDByType
(
stuff
->
crtc
,
RRCrtcType
);
if
(
!
crtc
)
if
(
!
crtc
)
{
{
client
->
errorValue
=
stuff
->
crtc
;
client
->
errorValue
=
stuff
->
crtc
;
return
RRErrorBase
+
BadRRCrtc
;
return
RRErrorBase
+
BadRRCrtc
;
}
}
if
(
stuff
->
mode
==
None
)
{
if
(
stuff
->
mode
==
None
)
mode
=
NULL
;
{
if
(
numOutputs
>
0
)
mode
=
NULL
;
return
BadMatch
;
if
(
numOutputs
>
0
)
}
return
BadMatch
;
else
{
}
mode
=
LookupIDByType
(
stuff
->
mode
,
RRModeType
);
else
if
(
!
mode
)
{
{
client
->
errorValue
=
stuff
->
mode
;
mode
=
LookupIDByType
(
stuff
->
mode
,
RRModeType
);
return
RRErrorBase
+
BadRRMode
;
if
(
!
mode
)
}
{
if
(
numOutputs
==
0
)
client
->
errorValue
=
stuff
->
mode
;
return
BadMatch
;
return
RRErrorBase
+
BadRRMode
;
}
}
if
(
numOutputs
)
{
if
(
numOutputs
==
0
)
outputs
=
xalloc
(
numOutputs
*
sizeof
(
RROutputPtr
));
return
BadMatch
;
if
(
!
outputs
)
}
return
BadAlloc
;
if
(
numOutputs
)
{
outputs
=
xalloc
(
numOutputs
*
sizeof
(
RROutputPtr
));
if
(
!
outputs
)
return
BadAlloc
;
}
}
else
else
outputs
=
NULL
;
outputs
=
NULL
;
outputIds
=
(
RROutput
*
)
(
stuff
+
1
);
outputIds
=
(
RROutput
*
)
(
stuff
+
1
);
for
(
i
=
0
;
i
<
numOutputs
;
i
++
)
for
(
i
=
0
;
i
<
numOutputs
;
i
++
)
{
{
outputs
[
i
]
=
(
RROutputPtr
)
LookupIDByType
(
outputIds
[
i
],
RROutputType
);
outputs
[
i
]
=
(
RROutputPtr
)
LookupIDByType
(
outputIds
[
i
],
RROutputType
);
if
(
!
outputs
[
i
])
{
if
(
!
outputs
[
i
])
client
->
errorValue
=
outputIds
[
i
];
{
if
(
outputs
)
client
->
errorValue
=
outputIds
[
i
];
xfree
(
outputs
);
if
(
outputs
)
return
RRErrorBase
+
BadRROutput
;
xfree
(
outputs
);
}
return
RRErrorBase
+
BadRROutput
;
/* validate crtc for this output */
}
for
(
j
=
0
;
j
<
outputs
[
i
]
->
numCrtcs
;
j
++
)
/* validate crtc for this output */
if
(
outputs
[
i
]
->
crtcs
[
j
]
==
crtc
)
for
(
j
=
0
;
j
<
outputs
[
i
]
->
numCrtcs
;
j
++
)
break
;
if
(
outputs
[
i
]
->
crtcs
[
j
]
==
crtc
)
if
(
j
==
outputs
[
i
]
->
numCrtcs
)
{
break
;
if
(
outputs
)
if
(
j
==
outputs
[
i
]
->
numCrtcs
)
xfree
(
outputs
);
{
return
BadMatch
;
if
(
outputs
)
}
xfree
(
outputs
);
/* validate mode for this output */
return
BadMatch
;
for
(
j
=
0
;
j
<
outputs
[
i
]
->
numModes
+
outputs
[
i
]
->
numUserModes
;
j
++
)
{
}
RRModePtr
m
=
(
j
<
outputs
[
i
]
->
numModes
?
/* validate mode for this output */
outputs
[
i
]
->
modes
[
j
]
:
for
(
j
=
0
;
j
<
outputs
[
i
]
->
numModes
+
outputs
[
i
]
->
numUserModes
;
j
++
)
outputs
[
i
]
->
userModes
[
j
-
outputs
[
i
]
->
numModes
]);
{
if
(
m
==
mode
)
RRModePtr
m
=
(
j
<
outputs
[
i
]
->
numModes
?
break
;
outputs
[
i
]
->
modes
[
j
]
:
}
outputs
[
i
]
->
userModes
[
j
-
outputs
[
i
]
->
numModes
]);
if
(
j
==
outputs
[
i
]
->
numModes
+
outputs
[
i
]
->
numUserModes
)
{
if
(
m
==
mode
)
if
(
outputs
)
break
;
xfree
(
outputs
);
}
return
BadMatch
;
if
(
j
==
outputs
[
i
]
->
numModes
+
outputs
[
i
]
->
numUserModes
)
}
{
if
(
outputs
)
xfree
(
outputs
);
return
BadMatch
;
}
}
}
/* validate clones */
/* validate clones */
for
(
i
=
0
;
i
<
numOutputs
;
i
++
)
for
(
i
=
0
;
i
<
numOutputs
;
i
++
)
{
{
for
(
j
=
0
;
j
<
numOutputs
;
j
++
)
{
for
(
j
=
0
;
j
<
numOutputs
;
j
++
)
int
k
;
{
int
k
;
if
(
i
==
j
)
if
(
i
==
j
)
continue
;
continue
;
for
(
k
=
0
;
k
<
outputs
[
i
]
->
numClones
;
k
++
)
{
for
(
k
=
0
;
k
<
outputs
[
i
]
->
numClones
;
k
++
)
if
(
outputs
[
i
]
->
clones
[
k
]
==
outputs
[
j
])
{
break
;
if
(
outputs
[
i
]
->
clones
[
k
]
==
outputs
[
j
])
}
break
;
if
(
k
==
outputs
[
i
]
->
numClones
)
{
}
if
(
outputs
)
if
(
k
==
outputs
[
i
]
->
numClones
)
xfree
(
outputs
);
{
return
BadMatch
;
if
(
outputs
)
}
xfree
(
outputs
);
}
return
BadMatch
;
}
}
}
}
pScreen
=
crtc
->
pScreen
;
pScreen
=
crtc
->
pScreen
;
...
@@ -745,11 +696,10 @@ ProcRRSetCrtcConfig (ClientPtr client)
...
@@ -745,11 +696,10 @@ ProcRRSetCrtcConfig (ClientPtr client)
time
=
ClientTimeToServerTime
(
stuff
->
timestamp
);
time
=
ClientTimeToServerTime
(
stuff
->
timestamp
);
if
(
!
pScrPriv
)
if
(
!
pScrPriv
)
{
{
time
=
currentTime
;
time
=
currentTime
;
rep
.
status
=
RRSetConfigFailed
;
rep
.
status
=
RRSetConfigFailed
;
goto
sendReply
;
goto
sendReply
;
}
}
/*
/*
...
@@ -763,62 +713,57 @@ ProcRRSetCrtcConfig (ClientPtr client)
...
@@ -763,62 +713,57 @@ ProcRRSetCrtcConfig (ClientPtr client)
case
RR_Rotate_90
:
case
RR_Rotate_90
:
case
RR_Rotate_180
:
case
RR_Rotate_180
:
case
RR_Rotate_270
:
case
RR_Rotate_270
:
break
;
break
;
default:
default:
/*
/*
* Invalid rotation
* Invalid rotation
*/
*/
client
->
errorValue
=
stuff
->
rotation
;
client
->
errorValue
=
stuff
->
rotation
;
if
(
outputs
)
if
(
outputs
)
xfree
(
outputs
);
xfree
(
outputs
);
return
BadValue
;
return
BadValue
;
}
}
if
(
mode
)
if
(
mode
)
{
{
if
((
~
crtc
->
rotations
)
&
rotation
)
{
if
((
~
crtc
->
rotations
)
&
rotation
)
/*
{
* requested rotation or reflection not supported by screen
/*
*/
* requested rotation or reflection not supported by screen
client
->
errorValue
=
stuff
->
rotation
;
*/
if
(
outputs
)
client
->
errorValue
=
stuff
->
rotation
;
xfree
(
outputs
);
if
(
outputs
)
return
BadMatch
;
xfree
(
outputs
);
}
return
BadMatch
;
}
#ifdef RANDR_12_INTERFACE
#ifdef RANDR_12_INTERFACE
/*
/*
* Check screen size bounds if the DDX provides a 1.2 interface
* Check screen size bounds if the DDX provides a 1.2 interface
* for setting screen size. Else, assume the CrtcSet sets
* for setting screen size. Else, assume the CrtcSet sets
* the size along with the mode
* the size along with the mode
*/
*/
if
(
pScrPriv
->
rrScreenSetSize
)
if
(
pScrPriv
->
rrScreenSetSize
)
{
{
int
source_width
=
mode
->
mode
.
width
;
int
source_width
=
mode
->
mode
.
width
;
int
source_height
=
mode
->
mode
.
height
;
int
source_height
=
mode
->
mode
.
height
;
if
((
rotation
&
0xf
)
==
RR_Rotate_90
||
if
((
rotation
&
0xf
)
==
RR_Rotate_90
||
(
rotation
&
0xf
)
==
RR_Rotate_270
)
(
rotation
&
0xf
)
==
RR_Rotate_270
)
{
{
source_width
=
mode
->
mode
.
height
;
source_width
=
mode
->
mode
.
height
;
source_height
=
mode
->
mode
.
width
;
source_height
=
mode
->
mode
.
width
;
}
}
if
(
stuff
->
x
+
source_width
>
pScreen
->
width
)
{
if
(
stuff
->
x
+
source_width
>
pScreen
->
width
)
client
->
errorValue
=
stuff
->
x
;
{
if
(
outputs
)
client
->
errorValue
=
stuff
->
x
;
xfree
(
outputs
);
if
(
outputs
)
return
BadValue
;
xfree
(
outputs
);
}
return
BadValue
;
}
if
(
stuff
->
y
+
source_height
>
pScreen
->
height
)
{
client
->
errorValue
=
stuff
->
y
;
if
(
stuff
->
y
+
source_height
>
pScreen
->
height
)
if
(
outputs
)
{
xfree
(
outputs
);
client
->
errorValue
=
stuff
->
y
;
return
BadValue
;
if
(
outputs
)
}
xfree
(
outputs
);
}
return
BadValue
;
}
}
#endif
#endif
}
}
...
@@ -826,24 +771,22 @@ ProcRRSetCrtcConfig (ClientPtr client)
...
@@ -826,24 +771,22 @@ ProcRRSetCrtcConfig (ClientPtr client)
* Make sure the requested set-time is not older than
* Make sure the requested set-time is not older than
* the last set-time
* the last set-time
*/
*/
if
(
CompareTimeStamps
(
time
,
pScrPriv
->
lastSetTime
)
<
0
)
if
(
CompareTimeStamps
(
time
,
pScrPriv
->
lastSetTime
)
<
0
)
{
{
rep
.
status
=
RRSetConfigInvalidTime
;
rep
.
status
=
RRSetConfigInvalidTime
;
goto
sendReply
;
goto
sendReply
;
}
}
if
(
!
RRCrtcSet
(
crtc
,
mode
,
stuff
->
x
,
stuff
->
y
,
if
(
!
RRCrtcSet
(
crtc
,
mode
,
stuff
->
x
,
stuff
->
y
,
rotation
,
numOutputs
,
outputs
))
rotation
,
numOutputs
,
outputs
))
{
{
rep
.
status
=
RRSetConfigFailed
;
rep
.
status
=
RRSetConfigFailed
;
goto
sendReply
;
goto
sendReply
;
}
}
rep
.
status
=
RRSetConfigSuccess
;
rep
.
status
=
RRSetConfigSuccess
;
pScrPriv
->
lastSetTime
=
time
;
pScrPriv
->
lastSetTime
=
time
;
sendReply:
sendReply:
if
(
outputs
)
if
(
outputs
)
xfree
(
outputs
);
xfree
(
outputs
);
rep
.
type
=
X_Reply
;
rep
.
type
=
X_Reply
;
/* rep.status has already been filled in */
/* rep.status has already been filled in */
...
@@ -851,65 +794,65 @@ sendReply:
...
@@ -851,65 +794,65 @@ sendReply:
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
newTimestamp
=
pScrPriv
->
lastSetTime
.
milliseconds
;
rep
.
newTimestamp
=
pScrPriv
->
lastSetTime
.
milliseconds
;
if
(
client
->
swapped
)
if
(
client
->
swapped
)
{
{
int
n
;
int
n
;
swaps
(
&
rep
.
sequenceNumber
,
n
);
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
newTimestamp
,
n
);
swapl
(
&
rep
.
newTimestamp
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xRRSetCrtcConfigReply
),
(
char
*
)
&
rep
);
WriteToClient
(
client
,
sizeof
(
xRRSetCrtcConfigReply
),
(
char
*
)
&
rep
);
return
client
->
noClientException
;
return
client
->
noClientException
;
}
}
int
int
ProcRRGetCrtcGammaSize
(
ClientPtr
client
)
ProcRRGetCrtcGammaSize
(
ClientPtr
client
)
{
{
REQUEST
(
xRRGetCrtcGammaSizeReq
);
REQUEST
(
xRRGetCrtcGammaSizeReq
);
xRRGetCrtcGammaSizeReply
reply
;
xRRGetCrtcGammaSizeReply
reply
;
RRCrtcPtr
crtc
;
RRCrtcPtr
crtc
;
int
n
;
int
n
;
REQUEST_SIZE_MATCH
(
xRRGetCrtcGammaSizeReq
);
REQUEST_SIZE_MATCH
(
xRRGetCrtcGammaSizeReq
);
crtc
=
LookupCrtc
(
client
,
stuff
->
crtc
,
DixReadAccess
);
crtc
=
LookupCrtc
(
client
,
stuff
->
crtc
,
DixReadAccess
);
if
(
!
crtc
)
if
(
!
crtc
)
return
RRErrorBase
+
BadRRCrtc
;
return
RRErrorBase
+
BadRRCrtc
;
reply
.
type
=
X_Reply
;
reply
.
type
=
X_Reply
;
reply
.
sequenceNumber
=
client
->
sequence
;
reply
.
sequenceNumber
=
client
->
sequence
;
reply
.
length
=
0
;
reply
.
length
=
0
;
reply
.
size
=
crtc
->
gammaSize
;
reply
.
size
=
crtc
->
gammaSize
;
if
(
client
->
swapped
)
{
if
(
client
->
swapped
)
{
swaps
(
&
reply
.
sequenceNumber
,
n
);
swaps
(
&
reply
.
sequenceNumber
,
n
);
swapl
(
&
reply
.
length
,
n
);
swapl
(
&
reply
.
length
,
n
);
swaps
(
&
reply
.
size
,
n
);
swaps
(
&
reply
.
size
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xRRGetCrtcGammaSizeReply
),
(
char
*
)
&
reply
);
WriteToClient
(
client
,
sizeof
(
xRRGetCrtcGammaSizeReply
),
(
char
*
)
&
reply
);
return
client
->
noClientException
;
return
client
->
noClientException
;
}
}
int
int
ProcRRGetCrtcGamma
(
ClientPtr
client
)
ProcRRGetCrtcGamma
(
ClientPtr
client
)
{
{
REQUEST
(
xRRGetCrtcGammaReq
);
REQUEST
(
xRRGetCrtcGammaReq
);
xRRGetCrtcGammaReply
reply
;
xRRGetCrtcGammaReply
reply
;
RRCrtcPtr
crtc
;
RRCrtcPtr
crtc
;
int
n
;
int
n
;
unsigned
long
len
;
unsigned
long
len
;
char
*
extra
;
char
*
extra
;
REQUEST_SIZE_MATCH
(
xRRGetCrtcGammaReq
);
REQUEST_SIZE_MATCH
(
xRRGetCrtcGammaReq
);
crtc
=
LookupCrtc
(
client
,
stuff
->
crtc
,
DixReadAccess
);
crtc
=
LookupCrtc
(
client
,
stuff
->
crtc
,
DixReadAccess
);
if
(
!
crtc
)
if
(
!
crtc
)
return
RRErrorBase
+
BadRRCrtc
;
return
RRErrorBase
+
BadRRCrtc
;
len
=
crtc
->
gammaSize
*
3
*
2
;
len
=
crtc
->
gammaSize
*
3
*
2
;
if
(
crtc
->
gammaSize
)
{
if
(
crtc
->
gammaSize
)
{
extra
=
xalloc
(
len
);
extra
=
xalloc
(
len
);
if
(
!
extra
)
if
(
!
extra
)
return
BadAlloc
;
return
BadAlloc
;
}
}
reply
.
type
=
X_Reply
;
reply
.
type
=
X_Reply
;
...
@@ -917,47 +860,45 @@ ProcRRGetCrtcGamma (ClientPtr client)
...
@@ -917,47 +860,45 @@ ProcRRGetCrtcGamma (ClientPtr client)
reply
.
length
=
(
len
+
3
)
>>
2
;
reply
.
length
=
(
len
+
3
)
>>
2
;
reply
.
size
=
crtc
->
gammaSize
;
reply
.
size
=
crtc
->
gammaSize
;
if
(
client
->
swapped
)
{
if
(
client
->
swapped
)
{
swaps
(
&
reply
.
sequenceNumber
,
n
);
swaps
(
&
reply
.
sequenceNumber
,
n
);
swapl
(
&
reply
.
length
,
n
);
swapl
(
&
reply
.
length
,
n
);
swaps
(
&
reply
.
size
,
n
);
swaps
(
&
reply
.
size
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xRRGetCrtcGammaReply
),
(
char
*
)
&
reply
);
WriteToClient
(
client
,
sizeof
(
xRRGetCrtcGammaReply
),
(
char
*
)
&
reply
);
if
(
crtc
->
gammaSize
)
if
(
crtc
->
gammaSize
)
{
{
memcpy
(
extra
,
crtc
->
gammaRed
,
len
);
memcpy
(
extra
,
crtc
->
gammaRed
,
len
);
client
->
pSwapReplyFunc
=
(
ReplySwapPtr
)
CopySwap16Write
;
client
->
pSwapReplyFunc
=
(
ReplySwapPtr
)
CopySwap16Write
;
WriteSwappedDataToClient
(
client
,
len
,
extra
);
WriteSwappedDataToClient
(
client
,
len
,
extra
);
xfree
(
extra
);
xfree
(
extra
);
}
}
return
client
->
noClientException
;
return
client
->
noClientException
;
}
}
int
int
ProcRRSetCrtcGamma
(
ClientPtr
client
)
ProcRRSetCrtcGamma
(
ClientPtr
client
)
{
{
REQUEST
(
xRRSetCrtcGammaReq
);
REQUEST
(
xRRSetCrtcGammaReq
);
RRCrtcPtr
crtc
;
RRCrtcPtr
crtc
;
unsigned
long
len
;
unsigned
long
len
;
CARD16
*
red
,
*
green
,
*
blue
;
CARD16
*
red
,
*
green
,
*
blue
;
REQUEST_AT_LEAST_SIZE
(
xRRSetCrtcGammaReq
);
REQUEST_AT_LEAST_SIZE
(
xRRSetCrtcGammaReq
);
crtc
=
LookupCrtc
(
client
,
stuff
->
crtc
,
DixWriteAccess
);
crtc
=
LookupCrtc
(
client
,
stuff
->
crtc
,
DixWriteAccess
);
if
(
!
crtc
)
if
(
!
crtc
)
return
RRErrorBase
+
BadRRCrtc
;
return
RRErrorBase
+
BadRRCrtc
;
len
=
client
->
req_len
-
(
sizeof
(
xRRSetCrtcGammaReq
)
>>
2
);
len
=
client
->
req_len
-
(
sizeof
(
xRRSetCrtcGammaReq
)
>>
2
);
if
(
len
<
(
stuff
->
size
*
3
+
1
)
>>
1
)
if
(
len
<
(
stuff
->
size
*
3
+
1
)
>>
1
)
return
BadLength
;
return
BadLength
;
if
(
stuff
->
size
!=
crtc
->
gammaSize
)
if
(
stuff
->
size
!=
crtc
->
gammaSize
)
return
BadMatch
;
return
BadMatch
;
red
=
(
CARD16
*
)
(
stuff
+
1
);
red
=
(
CARD16
*
)
(
stuff
+
1
);
green
=
red
+
crtc
->
gammaSize
;
green
=
red
+
crtc
->
gammaSize
;
blue
=
green
+
crtc
->
gammaSize
;
blue
=
green
+
crtc
->
gammaSize
;
RRCrtcGammaSet
(
crtc
,
red
,
green
,
blue
);
RRCrtcGammaSet
(
crtc
,
red
,
green
,
blue
);
return
Success
;
return
Success
;
}
}
nx-X11/programs/Xserver/randr/rrdispatch.c
View file @
e440ea76
...
@@ -26,19 +26,20 @@
...
@@ -26,19 +26,20 @@
#define SERVER_RANDR_MINOR 2
#define SERVER_RANDR_MINOR 2
Bool
Bool
RRClientKnowsRates
(
ClientPtr
pClient
)
RRClientKnowsRates
(
ClientPtr
pClient
)
{
{
rrClientPriv
(
pClient
);
rrClientPriv
(
pClient
);
return
(
pRRClient
->
major_version
>
1
||
return
(
pRRClient
->
major_version
>
1
||
(
pRRClient
->
major_version
==
1
&&
pRRClient
->
minor_version
>=
1
));
(
pRRClient
->
major_version
==
1
&&
pRRClient
->
minor_version
>=
1
));
}
}
static
int
static
int
ProcRRQueryVersion
(
ClientPtr
client
)
ProcRRQueryVersion
(
ClientPtr
client
)
{
{
xRRQueryVersionReply
rep
;
xRRQueryVersionReply
rep
;
register
int
n
;
register
int
n
;
REQUEST
(
xRRQueryVersionReq
);
REQUEST
(
xRRQueryVersionReq
);
rrClientPriv
(
client
);
rrClientPriv
(
client
);
...
@@ -55,165 +56,157 @@ ProcRRQueryVersion (ClientPtr client)
...
@@ -55,165 +56,157 @@ ProcRRQueryVersion (ClientPtr client)
rep
.
majorVersion
=
SERVER_RANDR_MAJOR
;
rep
.
majorVersion
=
SERVER_RANDR_MAJOR
;
rep
.
minorVersion
=
SERVER_RANDR_MINOR
;
rep
.
minorVersion
=
SERVER_RANDR_MINOR
;
if
(
client
->
swapped
)
{
if
(
client
->
swapped
)
{
swaps
(
&
rep
.
sequenceNumber
,
n
);
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
majorVersion
,
n
);
swapl
(
&
rep
.
majorVersion
,
n
);
swapl
(
&
rep
.
minorVersion
,
n
);
swapl
(
&
rep
.
minorVersion
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xRRQueryVersionReply
),
(
char
*
)
&
rep
);
WriteToClient
(
client
,
sizeof
(
xRRQueryVersionReply
),
(
char
*
)
&
rep
);
return
(
client
->
noClientException
);
return
(
client
->
noClientException
);
}
}
static
int
static
int
ProcRRSelectInput
(
ClientPtr
client
)
ProcRRSelectInput
(
ClientPtr
client
)
{
{
REQUEST
(
xRRSelectInputReq
);
REQUEST
(
xRRSelectInputReq
);
rrClientPriv
(
client
);
rrClientPriv
(
client
);
RRTimesPtr
pTimes
;
RRTimesPtr
pTimes
;
WindowPtr
pWin
;
WindowPtr
pWin
;
RREventPtr
pRREvent
,
*
pHead
;
RREventPtr
pRREvent
,
*
pHead
;
XID
clientResource
;
XID
clientResource
;
int
rc
;
int
rc
;
REQUEST_SIZE_MATCH
(
xRRSelectInputReq
);
REQUEST_SIZE_MATCH
(
xRRSelectInputReq
);
#ifndef NXAGENT_SERVER
#ifndef NXAGENT_SERVER
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixWriteAccess
);
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixWriteAccess
);
#else
#else
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityWriteAccess
);
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityWriteAccess
);
rc
=
pWin
?
Success
:
BadWindow
;
rc
=
pWin
?
Success
:
BadWindow
;
#endif
#endif
if
(
rc
!=
Success
)
if
(
rc
!=
Success
)
return
rc
;
return
rc
;
pHead
=
(
RREventPtr
*
)
SecurityLookupIDByType
(
client
,
pHead
=
(
RREventPtr
*
)
SecurityLookupIDByType
(
client
,
pWin
->
drawable
.
id
,
RREventType
,
pWin
->
drawable
.
id
,
DixWriteAccess
);
RREventType
,
DixWriteAccess
);
if
(
stuff
->
enable
&
(
RRScreenChangeNotifyMask
|
RRCrtcChangeNotifyMask
|
RROutputChangeNotifyMask
))
{
ScreenPtr
pScreen
=
pWin
->
drawable
.
pScreen
;
if
(
stuff
->
enable
&
(
RRScreenChangeNotifyMask
|
rrScrPriv
(
pScreen
);
RRCrtcChangeNotifyMask
|
RROutputChangeNotifyMask
))
{
ScreenPtr
pScreen
=
pWin
->
drawable
.
pScreen
;
rrScrPriv
(
pScreen
);
pRREvent
=
NULL
;
pRREvent
=
NULL
;
if
(
pHead
)
if
(
pHead
)
{
{
/* check for existing entry. */
/* check for existing entry. */
for
(
pRREvent
=
*
pHead
;
pRREvent
;
pRREvent
=
pRREvent
->
next
)
for
(
pRREvent
=
*
pHead
;
pRREvent
;
pRREvent
=
pRREvent
->
next
)
if
(
pRREvent
->
client
==
client
)
if
(
pRREvent
->
client
==
client
)
break
;
break
;
}
}
if
(
!
pRREvent
)
if
(
!
pRREvent
)
{
{
/* build the entry */
/* build the entry */
pRREvent
=
(
RREventPtr
)
xalloc
(
sizeof
(
RREventRec
));
pRREvent
=
(
RREventPtr
)
xalloc
(
sizeof
(
RREventRec
));
if
(
!
pRREvent
)
if
(
!
pRREvent
)
return
BadAlloc
;
return
BadAlloc
;
pRREvent
->
next
=
0
;
pRREvent
->
next
=
0
;
pRREvent
->
client
=
client
;
pRREvent
->
client
=
client
;
pRREvent
->
window
=
pWin
;
pRREvent
->
window
=
pWin
;
pRREvent
->
mask
=
stuff
->
enable
;
pRREvent
->
mask
=
stuff
->
enable
;
/*
/*
* add a resource that will be deleted when
* add a resource that will be deleted when
* the client goes away
* the client goes away
*/
*/
clientResource
=
FakeClientID
(
client
->
index
);
clientResource
=
FakeClientID
(
client
->
index
);
pRREvent
->
clientResource
=
clientResource
;
pRREvent
->
clientResource
=
clientResource
;
if
(
!
AddResource
(
clientResource
,
RRClientType
,
(
void
*
)
pRREvent
))
if
(
!
AddResource
(
clientResource
,
RRClientType
,
(
void
*
)
pRREvent
))
return
BadAlloc
;
return
BadAlloc
;
/*
/*
* create a resource to contain a pointer to the list
* create a resource to contain a pointer to the list
* of clients selecting input. This must be indirect as
* of clients selecting input. This must be indirect as
* the list may be arbitrarily rearranged which cannot be
* the list may be arbitrarily rearranged which cannot be
* done through the resource database.
* done through the resource database.
*/
*/
if
(
!
pHead
)
{
if
(
!
pHead
)
pHead
=
(
RREventPtr
*
)
xalloc
(
sizeof
(
RREventPtr
));
{
if
(
!
pHead
||
pHead
=
(
RREventPtr
*
)
xalloc
(
sizeof
(
RREventPtr
));
!
AddResource
(
pWin
->
drawable
.
id
,
RREventType
,
if
(
!
pHead
||
(
void
*
)
pHead
))
{
!
AddResource
(
pWin
->
drawable
.
id
,
RREventType
,
(
void
*
)
pHead
))
FreeResource
(
clientResource
,
RT_NONE
);
{
return
BadAlloc
;
FreeResource
(
clientResource
,
RT_NONE
);
}
return
BadAlloc
;
*
pHead
=
0
;
}
}
*
pHead
=
0
;
pRREvent
->
next
=
*
pHead
;
}
*
pHead
=
pRREvent
;
pRREvent
->
next
=
*
pHead
;
}
*
pHead
=
pRREvent
;
/*
}
* Now see if the client needs an event
/*
*/
* Now see if the client needs an event
if
(
pScrPriv
&&
(
pRREvent
->
mask
&
RRScreenChangeNotifyMask
))
{
*/
pTimes
=
&
((
RRTimesPtr
)
(
pRRClient
+
1
))[
pScreen
->
myNum
];
if
(
pScrPriv
&&
(
pRREvent
->
mask
&
RRScreenChangeNotifyMask
))
if
(
CompareTimeStamps
(
pTimes
->
setTime
,
{
pScrPriv
->
lastSetTime
)
!=
0
||
pTimes
=
&
((
RRTimesPtr
)
(
pRRClient
+
1
))[
pScreen
->
myNum
];
CompareTimeStamps
(
pTimes
->
configTime
,
if
(
CompareTimeStamps
(
pTimes
->
setTime
,
pScrPriv
->
lastConfigTime
)
!=
0
)
{
pScrPriv
->
lastSetTime
)
!=
0
||
RRDeliverScreenEvent
(
client
,
pWin
,
pScreen
);
CompareTimeStamps
(
pTimes
->
configTime
,
}
pScrPriv
->
lastConfigTime
)
!=
0
)
}
{
RRDeliverScreenEvent
(
client
,
pWin
,
pScreen
);
}
}
}
}
else
if
(
stuff
->
enable
==
0
)
else
if
(
stuff
->
enable
==
0
)
{
{
/* delete the interest */
/* delete the interest */
if
(
pHead
)
{
if
(
pHead
)
{
RREventPtr
pNewRREvent
=
0
;
RREventPtr
pNewRREvent
=
0
;
for
(
pRREvent
=
*
pHead
;
pRREvent
;
pRREvent
=
pRREvent
->
next
)
{
for
(
pRREvent
=
*
pHead
;
pRREvent
;
pRREvent
=
pRREvent
->
next
)
{
if
(
pRREvent
->
client
==
client
)
if
(
pRREvent
->
client
==
client
)
break
;
break
;
pNewRREvent
=
pRREvent
;
pNewRREvent
=
pRREvent
;
}
}
if
(
pRREvent
)
{
if
(
pRREvent
)
{
FreeResource
(
pRREvent
->
clientResource
,
RRClientType
);
FreeResource
(
pRREvent
->
clientResource
,
RRClientType
);
if
(
pNewRREvent
)
if
(
pNewRREvent
)
pNewRREvent
->
next
=
pRREvent
->
next
;
pNewRREvent
->
next
=
pRREvent
->
next
;
else
else
*
pHead
=
pRREvent
->
next
;
*
pHead
=
pRREvent
->
next
;
xfree
(
pRREvent
);
xfree
(
pRREvent
);
}
}
}
}
}
}
else
else
{
{
client
->
errorValue
=
stuff
->
enable
;
client
->
errorValue
=
stuff
->
enable
;
return
BadValue
;
return
BadValue
;
}
}
return
Success
;
return
Success
;
}
}
int
(
*
ProcRandrVector
[
RRNumberRequests
])(
ClientPtr
)
=
{
int
(
*
ProcRandrVector
[
RRNumberRequests
])
(
ClientPtr
)
=
{
ProcRRQueryVersion
,
/* 0 */
ProcRRQueryVersion
,
/* 0 */
/* we skip 1 to make old clients fail pretty immediately */
/* we skip 1 to make old clients fail pretty immediately */
NULL
,
/* 1 ProcRandrOldGetScreenInfo */
NULL
,
/* 1 ProcRandrOldGetScreenInfo */
/* V1.0 apps share the same set screen config request id */
/* V1.0 apps share the same set screen config request id */
ProcRRSetScreenConfig
,
/* 2 */
ProcRRSetScreenConfig
,
/* 2 */
NULL
,
/* 3 ProcRandrOldScreenChangeSelectInput */
NULL
,
/* 3 ProcRandrOldScreenChangeSelectInput */
/* 3 used to be ScreenChangeSelectInput; deprecated */
/* 3 used to be ScreenChangeSelectInput; deprecated */
ProcRRSelectInput
,
/* 4 */
ProcRRSelectInput
,
/* 4 */
ProcRRGetScreenInfo
,
/* 5 */
ProcRRGetScreenInfo
,
/* 5 */
/* V1.2 additions */
/* V1.2 additions */
ProcRRGetScreenSizeRange
,
/* 6 */
ProcRRGetScreenSizeRange
,
/* 6 */
ProcRRSetScreenSize
,
/* 7 */
ProcRRSetScreenSize
,
/* 7 */
ProcRRGetScreenResources
,
/* 8 */
ProcRRGetScreenResources
,
/* 8 */
ProcRRGetOutputInfo
,
/* 9 */
ProcRRGetOutputInfo
,
/* 9 */
ProcRRListOutputProperties
,
/* 10 */
ProcRRListOutputProperties
,
/* 10 */
ProcRRQueryOutputProperty
,
/* 11 */
ProcRRQueryOutputProperty
,
/* 11 */
ProcRRConfigureOutputProperty
,
/* 12 */
ProcRRConfigureOutputProperty
,
/* 12 */
ProcRRChangeOutputProperty
,
/* 13 */
ProcRRChangeOutputProperty
,
/* 13 */
ProcRRDeleteOutputProperty
,
/* 14 */
ProcRRDeleteOutputProperty
,
/* 14 */
ProcRRGetOutputProperty
,
/* 15 */
ProcRRGetOutputProperty
,
/* 15 */
ProcRRCreateMode
,
/* 16 */
ProcRRCreateMode
,
/* 16 */
ProcRRDestroyMode
,
/* 17 */
ProcRRDestroyMode
,
/* 17 */
ProcRRAddOutputMode
,
/* 18 */
ProcRRAddOutputMode
,
/* 18 */
ProcRRDeleteOutputMode
,
/* 19 */
ProcRRDeleteOutputMode
,
/* 19 */
ProcRRGetCrtcInfo
,
/* 20 */
ProcRRGetCrtcInfo
,
/* 20 */
ProcRRSetCrtcConfig
,
/* 21 */
ProcRRSetCrtcConfig
,
/* 21 */
ProcRRGetCrtcGammaSize
,
/* 22 */
ProcRRGetCrtcGammaSize
,
/* 22 */
ProcRRGetCrtcGamma
,
/* 23 */
ProcRRGetCrtcGamma
,
/* 23 */
ProcRRSetCrtcGamma
,
/* 24 */
ProcRRSetCrtcGamma
,
/* 24 */
};
};
nx-X11/programs/Xserver/randr/rrinfo.c
View file @
e440ea76
...
@@ -24,46 +24,45 @@
...
@@ -24,46 +24,45 @@
#ifdef RANDR_10_INTERFACE
#ifdef RANDR_10_INTERFACE
static
RRModePtr
static
RRModePtr
RROldModeAdd
(
RROutputPtr
output
,
RRScreenSizePtr
size
,
int
refresh
)
RROldModeAdd
(
RROutputPtr
output
,
RRScreenSizePtr
size
,
int
refresh
)
{
{
ScreenPtr
pScreen
=
output
->
pScreen
;
ScreenPtr
pScreen
=
output
->
pScreen
;
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
xRRModeInfo
modeInfo
;
xRRModeInfo
modeInfo
;
char
name
[
100
];
char
name
[
100
];
RRModePtr
mode
;
RRModePtr
mode
;
int
i
;
int
i
;
RRModePtr
*
modes
;
RRModePtr
*
modes
;
memset
(
&
modeInfo
,
'\0'
,
sizeof
(
modeInfo
));
memset
(
&
modeInfo
,
'\0'
,
sizeof
(
modeInfo
));
sprintf
(
name
,
"%dx%d"
,
size
->
width
,
size
->
height
);
sprintf
(
name
,
"%dx%d"
,
size
->
width
,
size
->
height
);
modeInfo
.
width
=
size
->
width
;
modeInfo
.
width
=
size
->
width
;
modeInfo
.
height
=
size
->
height
;
modeInfo
.
height
=
size
->
height
;
modeInfo
.
hTotal
=
size
->
width
;
modeInfo
.
hTotal
=
size
->
width
;
modeInfo
.
vTotal
=
size
->
height
;
modeInfo
.
vTotal
=
size
->
height
;
modeInfo
.
dotClock
=
((
CARD32
)
size
->
width
*
(
CARD32
)
size
->
height
*
modeInfo
.
dotClock
=
((
CARD32
)
size
->
width
*
(
CARD32
)
size
->
height
*
(
CARD32
)
refresh
);
(
CARD32
)
refresh
);
modeInfo
.
nameLength
=
strlen
(
name
);
modeInfo
.
nameLength
=
strlen
(
name
);
mode
=
RRModeGet
(
&
modeInfo
,
name
);
mode
=
RRModeGet
(
&
modeInfo
,
name
);
if
(
!
mode
)
if
(
!
mode
)
return
NULL
;
return
NULL
;
for
(
i
=
0
;
i
<
output
->
numModes
;
i
++
)
for
(
i
=
0
;
i
<
output
->
numModes
;
i
++
)
if
(
output
->
modes
[
i
]
==
mode
)
if
(
output
->
modes
[
i
]
==
mode
)
{
{
RRModeDestroy
(
mode
);
RRModeDestroy
(
mode
);
return
mode
;
return
mode
;
}
}
if
(
output
->
numModes
)
if
(
output
->
numModes
)
modes
=
xrealloc
(
output
->
modes
,
modes
=
xrealloc
(
output
->
modes
,
(
output
->
numModes
+
1
)
*
sizeof
(
RRModePtr
));
(
output
->
numModes
+
1
)
*
sizeof
(
RRModePtr
));
else
else
modes
=
xalloc
(
sizeof
(
RRModePtr
));
modes
=
xalloc
(
sizeof
(
RRModePtr
));
if
(
!
modes
)
if
(
!
modes
)
{
{
RRModeDestroy
(
mode
);
RRModeDestroy
(
mode
);
FreeResource
(
mode
->
mode
.
id
,
0
);
FreeResource
(
mode
->
mode
.
id
,
0
);
return
NULL
;
return
NULL
;
}
}
modes
[
output
->
numModes
++
]
=
mode
;
modes
[
output
->
numModes
++
]
=
mode
;
output
->
modes
=
modes
;
output
->
modes
=
modes
;
...
@@ -74,104 +73,97 @@ RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh)
...
@@ -74,104 +73,97 @@ RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh)
}
}
static
void
static
void
RRScanOldConfig
(
ScreenPtr
pScreen
,
Rotation
rotations
)
RRScanOldConfig
(
ScreenPtr
pScreen
,
Rotation
rotations
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
RROutputPtr
output
;
RROutputPtr
output
;
RRCrtcPtr
crtc
;
RRCrtcPtr
crtc
;
RRModePtr
mode
,
newMode
=
NULL
;
RRModePtr
mode
,
newMode
=
NULL
;
int
i
;
int
i
;
CARD16
minWidth
=
MAXSHORT
,
minHeight
=
MAXSHORT
;
CARD16
minWidth
=
MAXSHORT
,
minHeight
=
MAXSHORT
;
CARD16
maxWidth
=
0
,
maxHeight
=
0
;
CARD16
maxWidth
=
0
,
maxHeight
=
0
;
CARD16
width
,
height
;
CARD16
width
,
height
;
/*
/*
* First time through, create a crtc and output and hook
* First time through, create a crtc and output and hook
* them together
* them together
*/
*/
if
(
pScrPriv
->
numOutputs
==
0
&&
if
(
pScrPriv
->
numOutputs
==
0
&&
pScrPriv
->
numCrtcs
==
0
)
{
pScrPriv
->
numCrtcs
==
0
)
crtc
=
RRCrtcCreate
(
pScreen
,
NULL
);
{
if
(
!
crtc
)
crtc
=
RRCrtcCreate
(
pScreen
,
NULL
);
return
;
if
(
!
crtc
)
output
=
RROutputCreate
(
pScreen
,
"default"
,
7
,
NULL
);
return
;
if
(
!
output
)
output
=
RROutputCreate
(
pScreen
,
"default"
,
7
,
NULL
);
return
;
if
(
!
output
)
RROutputSetCrtcs
(
output
,
&
crtc
,
1
);
return
;
RROutputSetConnection
(
output
,
RR_Connected
);
RROutputSetCrtcs
(
output
,
&
crtc
,
1
);
RROutputSetConnection
(
output
,
RR_Connected
);
#ifdef RENDER
#ifdef RENDER
RROutputSetSubpixelOrder
(
output
,
PictureGetSubpixelOrder
(
pScreen
));
RROutputSetSubpixelOrder
(
output
,
PictureGetSubpixelOrder
(
pScreen
));
#endif
#endif
}
}
output
=
pScrPriv
->
outputs
[
0
];
output
=
pScrPriv
->
outputs
[
0
];
if
(
!
output
)
if
(
!
output
)
return
;
return
;
crtc
=
pScrPriv
->
crtcs
[
0
];
crtc
=
pScrPriv
->
crtcs
[
0
];
if
(
!
crtc
)
if
(
!
crtc
)
return
;
return
;
/* check rotations */
/* check rotations */
if
(
rotations
!=
crtc
->
rotations
)
if
(
rotations
!=
crtc
->
rotations
)
{
{
crtc
->
rotations
=
rotations
;
crtc
->
rotations
=
rotations
;
crtc
->
changed
=
TRUE
;
crtc
->
changed
=
TRUE
;
pScrPriv
->
changed
=
TRUE
;
pScrPriv
->
changed
=
TRUE
;
}
}
/* regenerate mode list */
/* regenerate mode list */
for
(
i
=
0
;
i
<
pScrPriv
->
nSizes
;
i
++
)
for
(
i
=
0
;
i
<
pScrPriv
->
nSizes
;
i
++
)
{
{
RRScreenSizePtr
size
=
&
pScrPriv
->
pSizes
[
i
];
RRScreenSizePtr
size
=
&
pScrPriv
->
pSizes
[
i
];
int
r
;
int
r
;
if
(
size
->
nRates
)
{
if
(
size
->
nRates
)
for
(
r
=
0
;
r
<
size
->
nRates
;
r
++
)
{
{
mode
=
RROldModeAdd
(
output
,
size
,
size
->
pRates
[
r
].
rate
);
for
(
r
=
0
;
r
<
size
->
nRates
;
r
++
)
if
(
i
==
pScrPriv
->
size
&&
{
size
->
pRates
[
r
].
rate
==
pScrPriv
->
rate
)
{
mode
=
RROldModeAdd
(
output
,
size
,
size
->
pRates
[
r
].
rate
);
newMode
=
mode
;
if
(
i
==
pScrPriv
->
size
&&
}
size
->
pRates
[
r
].
rate
==
pScrPriv
->
rate
)
}
{
xfree
(
size
->
pRates
);
newMode
=
mode
;
}
}
else
{
}
mode
=
RROldModeAdd
(
output
,
size
,
0
);
xfree
(
size
->
pRates
);
if
(
i
==
pScrPriv
->
size
)
}
newMode
=
mode
;
else
}
{
mode
=
RROldModeAdd
(
output
,
size
,
0
);
if
(
i
==
pScrPriv
->
size
)
newMode
=
mode
;
}
}
}
if
(
pScrPriv
->
nSizes
)
if
(
pScrPriv
->
nSizes
)
xfree
(
pScrPriv
->
pSizes
);
xfree
(
pScrPriv
->
pSizes
);
pScrPriv
->
pSizes
=
NULL
;
pScrPriv
->
pSizes
=
NULL
;
pScrPriv
->
nSizes
=
0
;
pScrPriv
->
nSizes
=
0
;
/* find size bounds */
/* find size bounds */
for
(
i
=
0
;
i
<
output
->
numModes
+
output
->
numUserModes
;
i
++
)
for
(
i
=
0
;
i
<
output
->
numModes
+
output
->
numUserModes
;
i
++
)
{
{
mode
=
(
i
<
output
->
numModes
?
mode
=
(
i
<
output
->
numModes
?
output
->
modes
[
i
]
:
output
->
userModes
[
i
-
output
->
numModes
]);
output
->
modes
[
i
]
:
output
->
userModes
[
i
-
output
->
numModes
]);
width
=
mode
->
mode
.
width
;
width
=
mode
->
mode
.
width
;
height
=
mode
->
mode
.
height
;
height
=
mode
->
mode
.
height
;
if
(
width
<
minWidth
)
minWidth
=
width
;
if
(
width
<
minWidth
)
if
(
width
>
maxWidth
)
maxWidth
=
width
;
minWidth
=
width
;
if
(
height
<
minHeight
)
minHeight
=
height
;
if
(
width
>
maxWidth
)
if
(
height
>
maxHeight
)
maxHeight
=
height
;
maxWidth
=
width
;
if
(
height
<
minHeight
)
minHeight
=
height
;
if
(
height
>
maxHeight
)
maxHeight
=
height
;
}
}
RRScreenSetSizeRange
(
pScreen
,
minWidth
,
minHeight
,
maxWidth
,
maxHeight
);
RRScreenSetSizeRange
(
pScreen
,
minWidth
,
minHeight
,
maxWidth
,
maxHeight
);
/* notice current mode */
/* notice current mode */
if
(
newMode
)
if
(
newMode
)
RRCrtcNotify
(
crtc
,
newMode
,
0
,
0
,
pScrPriv
->
rotation
,
RRCrtcNotify
(
crtc
,
newMode
,
0
,
0
,
pScrPriv
->
rotation
,
1
,
&
output
);
1
,
&
output
);
}
}
#endif
#endif
...
@@ -179,29 +171,29 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
...
@@ -179,29 +171,29 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
* Poll the driver for changed information
* Poll the driver for changed information
*/
*/
Bool
Bool
RRGetInfo
(
ScreenPtr
pScreen
)
RRGetInfo
(
ScreenPtr
pScreen
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
Rotation
rotations
;
Rotation
rotations
;
int
i
;
int
i
;
for
(
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
for
(
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
pScrPriv
->
outputs
[
i
]
->
changed
=
FALSE
;
pScrPriv
->
outputs
[
i
]
->
changed
=
FALSE
;
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
pScrPriv
->
crtcs
[
i
]
->
changed
=
FALSE
;
pScrPriv
->
crtcs
[
i
]
->
changed
=
FALSE
;
rotations
=
0
;
rotations
=
0
;
pScrPriv
->
changed
=
FALSE
;
pScrPriv
->
changed
=
FALSE
;
pScrPriv
->
configChanged
=
FALSE
;
pScrPriv
->
configChanged
=
FALSE
;
if
(
!
(
*
pScrPriv
->
rrGetInfo
)
(
pScreen
,
&
rotations
))
if
(
!
(
*
pScrPriv
->
rrGetInfo
)
(
pScreen
,
&
rotations
))
return
FALSE
;
return
FALSE
;
#if RANDR_10_INTERFACE
#if RANDR_10_INTERFACE
if
(
pScrPriv
->
nSizes
)
if
(
pScrPriv
->
nSizes
)
RRScanOldConfig
(
pScreen
,
rotations
);
RRScanOldConfig
(
pScreen
,
rotations
);
#endif
#endif
RRTellChanged
(
pScreen
);
RRTellChanged
(
pScreen
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -209,25 +201,22 @@ RRGetInfo (ScreenPtr pScreen)
...
@@ -209,25 +201,22 @@ RRGetInfo (ScreenPtr pScreen)
* Register the range of sizes for the screen
* Register the range of sizes for the screen
*/
*/
void
void
RRScreenSetSizeRange
(
ScreenPtr
pScreen
,
RRScreenSetSizeRange
(
ScreenPtr
pScreen
,
CARD16
minWidth
,
CARD16
minWidth
,
CARD16
minHeight
,
CARD16
minHeight
,
CARD16
maxWidth
,
CARD16
maxHeight
)
CARD16
maxWidth
,
CARD16
maxHeight
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
if
(
!
pScrPriv
)
if
(
!
pScrPriv
)
return
;
return
;
if
(
pScrPriv
->
minWidth
==
minWidth
&&
pScrPriv
->
minHeight
==
minHeight
&&
if
(
pScrPriv
->
minWidth
==
minWidth
&&
pScrPriv
->
minHeight
==
minHeight
&&
pScrPriv
->
maxWidth
==
maxWidth
&&
pScrPriv
->
maxHeight
==
maxHeight
)
pScrPriv
->
maxWidth
==
maxWidth
&&
pScrPriv
->
maxHeight
==
maxHeight
)
{
{
return
;
return
;
}
}
pScrPriv
->
minWidth
=
minWidth
;
pScrPriv
->
minWidth
=
minWidth
;
pScrPriv
->
minHeight
=
minHeight
;
pScrPriv
->
minHeight
=
minHeight
;
pScrPriv
->
maxWidth
=
maxWidth
;
pScrPriv
->
maxWidth
=
maxWidth
;
pScrPriv
->
maxHeight
=
maxHeight
;
pScrPriv
->
maxHeight
=
maxHeight
;
pScrPriv
->
changed
=
TRUE
;
pScrPriv
->
changed
=
TRUE
;
pScrPriv
->
configChanged
=
TRUE
;
pScrPriv
->
configChanged
=
TRUE
;
...
@@ -235,73 +224,67 @@ RRScreenSetSizeRange (ScreenPtr pScreen,
...
@@ -235,73 +224,67 @@ RRScreenSetSizeRange (ScreenPtr pScreen,
#ifdef RANDR_10_INTERFACE
#ifdef RANDR_10_INTERFACE
static
Bool
static
Bool
RRScreenSizeMatches
(
RRScreenSizePtr
a
,
RRScreenSizeMatches
(
RRScreenSizePtr
a
,
RRScreenSizePtr
b
)
RRScreenSizePtr
b
)
{
{
if
(
a
->
width
!=
b
->
width
)
if
(
a
->
width
!=
b
->
width
)
return
FALSE
;
return
FALSE
;
if
(
a
->
height
!=
b
->
height
)
if
(
a
->
height
!=
b
->
height
)
return
FALSE
;
return
FALSE
;
if
(
a
->
mmWidth
!=
b
->
mmWidth
)
if
(
a
->
mmWidth
!=
b
->
mmWidth
)
return
FALSE
;
return
FALSE
;
if
(
a
->
mmHeight
!=
b
->
mmHeight
)
if
(
a
->
mmHeight
!=
b
->
mmHeight
)
return
FALSE
;
return
FALSE
;
return
TRUE
;
return
TRUE
;
}
}
RRScreenSizePtr
RRScreenSizePtr
RRRegisterSize
(
ScreenPtr
pScreen
,
RRRegisterSize
(
ScreenPtr
pScreen
,
short
width
,
short
width
,
short
height
,
short
mmWidth
,
short
mmHeight
)
short
height
,
short
mmWidth
,
short
mmHeight
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
int
i
;
int
i
;
RRScreenSize
tmp
;
RRScreenSize
tmp
;
RRScreenSizePtr
pNew
;
RRScreenSizePtr
pNew
;
if
(
!
pScrPriv
)
if
(
!
pScrPriv
)
return
0
;
return
0
;
tmp
.
id
=
0
;
tmp
.
id
=
0
;
tmp
.
width
=
width
;
tmp
.
width
=
width
;
tmp
.
height
=
height
;
tmp
.
height
=
height
;
tmp
.
mmWidth
=
mmWidth
;
tmp
.
mmWidth
=
mmWidth
;
tmp
.
mmHeight
=
mmHeight
;
tmp
.
mmHeight
=
mmHeight
;
tmp
.
pRates
=
0
;
tmp
.
pRates
=
0
;
tmp
.
nRates
=
0
;
tmp
.
nRates
=
0
;
for
(
i
=
0
;
i
<
pScrPriv
->
nSizes
;
i
++
)
for
(
i
=
0
;
i
<
pScrPriv
->
nSizes
;
i
++
)
if
(
RRScreenSizeMatches
(
&
tmp
,
&
pScrPriv
->
pSizes
[
i
]))
if
(
RRScreenSizeMatches
(
&
tmp
,
&
pScrPriv
->
pSizes
[
i
]))
return
&
pScrPriv
->
pSizes
[
i
];
return
&
pScrPriv
->
pSizes
[
i
];
pNew
=
xrealloc
(
pScrPriv
->
pSizes
,
pNew
=
xrealloc
(
pScrPriv
->
pSizes
,
(
pScrPriv
->
nSizes
+
1
)
*
sizeof
(
RRScreenSize
));
(
pScrPriv
->
nSizes
+
1
)
*
sizeof
(
RRScreenSize
));
if
(
!
pNew
)
if
(
!
pNew
)
return
0
;
return
0
;
pNew
[
pScrPriv
->
nSizes
++
]
=
tmp
;
pNew
[
pScrPriv
->
nSizes
++
]
=
tmp
;
pScrPriv
->
pSizes
=
pNew
;
pScrPriv
->
pSizes
=
pNew
;
return
&
pNew
[
pScrPriv
->
nSizes
-
1
];
return
&
pNew
[
pScrPriv
->
nSizes
-
1
];
}
}
Bool
RRRegisterRate
(
ScreenPtr
pScreen
,
Bool
RRScreenSizePtr
pSize
,
RRRegisterRate
(
ScreenPtr
pScreen
,
RRScreenSizePtr
pSize
,
int
rate
)
int
rate
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
int
i
;
int
i
;
RRScreenRatePtr
pNew
,
pRate
;
RRScreenRatePtr
pNew
,
pRate
;
if
(
!
pScrPriv
)
if
(
!
pScrPriv
)
return
FALSE
;
return
FALSE
;
for
(
i
=
0
;
i
<
pSize
->
nRates
;
i
++
)
for
(
i
=
0
;
i
<
pSize
->
nRates
;
i
++
)
if
(
pSize
->
pRates
[
i
].
rate
==
rate
)
if
(
pSize
->
pRates
[
i
].
rate
==
rate
)
return
TRUE
;
return
TRUE
;
pNew
=
xrealloc
(
pSize
->
pRates
,
pNew
=
xrealloc
(
pSize
->
pRates
,
(
pSize
->
nRates
+
1
)
*
sizeof
(
RRScreenRate
));
(
pSize
->
nRates
+
1
)
*
sizeof
(
RRScreenRate
));
if
(
!
pNew
)
if
(
!
pNew
)
return
FALSE
;
return
FALSE
;
pRate
=
&
pNew
[
pSize
->
nRates
++
];
pRate
=
&
pNew
[
pSize
->
nRates
++
];
pRate
->
rate
=
rate
;
pRate
->
rate
=
rate
;
pSize
->
pRates
=
pNew
;
pSize
->
pRates
=
pNew
;
...
@@ -311,24 +294,22 @@ Bool RRRegisterRate (ScreenPtr pScreen,
...
@@ -311,24 +294,22 @@ Bool RRRegisterRate (ScreenPtr pScreen,
Rotation
Rotation
RRGetRotation
(
ScreenPtr
pScreen
)
RRGetRotation
(
ScreenPtr
pScreen
)
{
{
RROutputPtr
output
=
RRFirstOutput
(
pScreen
);
RROutputPtr
output
=
RRFirstOutput
(
pScreen
);
if
(
!
output
)
if
(
!
output
)
return
RR_Rotate_0
;
return
RR_Rotate_0
;
return
output
->
crtc
->
rotation
;
return
output
->
crtc
->
rotation
;
}
}
void
void
RRSetCurrentConfig
(
ScreenPtr
pScreen
,
RRSetCurrentConfig
(
ScreenPtr
pScreen
,
Rotation
rotation
,
Rotation
rotation
,
int
rate
,
RRScreenSizePtr
pSize
)
int
rate
,
RRScreenSizePtr
pSize
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
if
(
!
pScrPriv
)
if
(
!
pScrPriv
)
return
;
return
;
pScrPriv
->
size
=
pSize
-
pScrPriv
->
pSizes
;
pScrPriv
->
size
=
pSize
-
pScrPriv
->
pSizes
;
pScrPriv
->
rotation
=
rotation
;
pScrPriv
->
rotation
=
rotation
;
pScrPriv
->
rate
=
rate
;
pScrPriv
->
rate
=
rate
;
...
...
nx-X11/programs/Xserver/randr/rrmode.c
View file @
e440ea76
...
@@ -40,61 +40,70 @@
...
@@ -40,61 +40,70 @@
#include "randrstr.h"
#include "randrstr.h"
#include "registry.h"
#include "registry.h"
RESTYPE
RRModeType
;
RESTYPE
RRModeType
;
static
Bool
static
Bool
RRModeEqual
(
xRRModeInfo
*
a
,
xRRModeInfo
*
b
)
RRModeEqual
(
xRRModeInfo
*
a
,
xRRModeInfo
*
b
)
{
{
if
(
a
->
width
!=
b
->
width
)
return
FALSE
;
if
(
a
->
width
!=
b
->
width
)
if
(
a
->
height
!=
b
->
height
)
return
FALSE
;
return
FALSE
;
if
(
a
->
dotClock
!=
b
->
dotClock
)
return
FALSE
;
if
(
a
->
height
!=
b
->
height
)
if
(
a
->
hSyncStart
!=
b
->
hSyncStart
)
return
FALSE
;
return
FALSE
;
if
(
a
->
hSyncEnd
!=
b
->
hSyncEnd
)
return
FALSE
;
if
(
a
->
dotClock
!=
b
->
dotClock
)
if
(
a
->
hTotal
!=
b
->
hTotal
)
return
FALSE
;
return
FALSE
;
if
(
a
->
hSkew
!=
b
->
hSkew
)
return
FALSE
;
if
(
a
->
hSyncStart
!=
b
->
hSyncStart
)
if
(
a
->
vSyncStart
!=
b
->
vSyncStart
)
return
FALSE
;
return
FALSE
;
if
(
a
->
vSyncEnd
!=
b
->
vSyncEnd
)
return
FALSE
;
if
(
a
->
hSyncEnd
!=
b
->
hSyncEnd
)
if
(
a
->
vTotal
!=
b
->
vTotal
)
return
FALSE
;
return
FALSE
;
if
(
a
->
nameLength
!=
b
->
nameLength
)
return
FALSE
;
if
(
a
->
hTotal
!=
b
->
hTotal
)
if
(
a
->
modeFlags
!=
b
->
modeFlags
)
return
FALSE
;
return
FALSE
;
if
(
a
->
hSkew
!=
b
->
hSkew
)
return
FALSE
;
if
(
a
->
vSyncStart
!=
b
->
vSyncStart
)
return
FALSE
;
if
(
a
->
vSyncEnd
!=
b
->
vSyncEnd
)
return
FALSE
;
if
(
a
->
vTotal
!=
b
->
vTotal
)
return
FALSE
;
if
(
a
->
nameLength
!=
b
->
nameLength
)
return
FALSE
;
if
(
a
->
modeFlags
!=
b
->
modeFlags
)
return
FALSE
;
return
TRUE
;
return
TRUE
;
}
}
/*
/*
* Keep a list so it's easy to find modes in the resource database.
* Keep a list so it's easy to find modes in the resource database.
*/
*/
static
int
num_modes
;
static
int
num_modes
;
static
RRModePtr
*
modes
;
static
RRModePtr
*
modes
;
static
RRModePtr
static
RRModePtr
RRModeCreate
(
xRRModeInfo
*
modeInfo
,
RRModeCreate
(
xRRModeInfo
*
modeInfo
,
const
char
*
name
,
ScreenPtr
userScreen
)
const
char
*
name
,
ScreenPtr
userScreen
)
{
{
RRModePtr
mode
,
*
newModes
;
RRModePtr
mode
,
*
newModes
;
if
(
!
RRInit
())
if
(
!
RRInit
())
return
NULL
;
return
NULL
;
mode
=
xalloc
(
sizeof
(
RRModeRec
)
+
modeInfo
->
nameLength
+
1
);
mode
=
xalloc
(
sizeof
(
RRModeRec
)
+
modeInfo
->
nameLength
+
1
);
if
(
!
mode
)
if
(
!
mode
)
return
NULL
;
return
NULL
;
mode
->
refcnt
=
1
;
mode
->
refcnt
=
1
;
mode
->
mode
=
*
modeInfo
;
mode
->
mode
=
*
modeInfo
;
mode
->
name
=
(
char
*
)
(
mode
+
1
);
mode
->
name
=
(
char
*
)
(
mode
+
1
);
memcpy
(
mode
->
name
,
name
,
modeInfo
->
nameLength
);
memcpy
(
mode
->
name
,
name
,
modeInfo
->
nameLength
);
mode
->
name
[
modeInfo
->
nameLength
]
=
'\0'
;
mode
->
name
[
modeInfo
->
nameLength
]
=
'\0'
;
mode
->
userScreen
=
userScreen
;
mode
->
userScreen
=
userScreen
;
if
(
num_modes
)
if
(
num_modes
)
newModes
=
xrealloc
(
modes
,
(
num_modes
+
1
)
*
sizeof
(
RRModePtr
));
newModes
=
xrealloc
(
modes
,
(
num_modes
+
1
)
*
sizeof
(
RRModePtr
));
else
else
newModes
=
xalloc
(
sizeof
(
RRModePtr
));
newModes
=
xalloc
(
sizeof
(
RRModePtr
));
if
(
!
newModes
)
if
(
!
newModes
)
{
{
xfree
(
mode
);
xfree
(
mode
);
return
NULL
;
return
NULL
;
}
}
mode
->
mode
.
id
=
FakeClientID
(
0
);
mode
->
mode
.
id
=
FakeClientID
(
0
);
...
@@ -109,151 +118,145 @@ RRModeCreate (xRRModeInfo *modeInfo,
...
@@ -109,151 +118,145 @@ RRModeCreate (xRRModeInfo *modeInfo,
*/
*/
++
mode
->
refcnt
;
++
mode
->
refcnt
;
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"RRModeCreate: num_modes [%d] new mode [%s] ([%p]) refcnt [%d]
\n
"
,
num_modes
,
mode
->
name
,
mode
,
mode
->
refcnt
);
fprintf
(
stderr
,
"RRModeCreate: num_modes [%d] new mode [%s] ([%p]) refcnt [%d]
\n
"
,
num_modes
,
mode
->
name
,
mode
,
mode
->
refcnt
);
#endif
#endif
return
mode
;
return
mode
;
}
}
static
RRModePtr
static
RRModePtr
RRModeFindByName
(
const
char
*
name
,
RRModeFindByName
(
const
char
*
name
,
CARD16
nameLength
)
CARD16
nameLength
)
{
{
int
i
;
int
i
;
RRModePtr
mode
;
RRModePtr
mode
;
for
(
i
=
0
;
i
<
num_modes
;
i
++
)
for
(
i
=
0
;
i
<
num_modes
;
i
++
)
{
{
mode
=
modes
[
i
];
mode
=
modes
[
i
];
if
(
mode
->
mode
.
nameLength
==
nameLength
&&
if
(
mode
->
mode
.
nameLength
==
nameLength
&&
!
memcmp
(
name
,
mode
->
name
,
nameLength
))
{
!
memcmp
(
name
,
mode
->
name
,
nameLength
))
return
mode
;
{
}
return
mode
;
}
}
}
return
NULL
;
return
NULL
;
}
}
RRModePtr
RRModePtr
RRModeGet
(
xRRModeInfo
*
modeInfo
,
RRModeGet
(
xRRModeInfo
*
modeInfo
,
const
char
*
name
)
const
char
*
name
)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
num_modes
;
i
++
)
for
(
i
=
0
;
i
<
num_modes
;
i
++
)
{
{
RRModePtr
mode
=
modes
[
i
];
RRModePtr
mode
=
modes
[
i
];
if
(
RRModeEqual
(
&
mode
->
mode
,
modeInfo
)
&&
if
(
RRModeEqual
(
&
mode
->
mode
,
modeInfo
)
&&
!
memcmp
(
name
,
mode
->
name
,
modeInfo
->
nameLength
))
!
memcmp
(
name
,
mode
->
name
,
modeInfo
->
nameLength
))
{
{
++
mode
->
refcnt
;
++
mode
->
refcnt
;
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"RRModeGet: return existing mode [%s] ([%p]) refcnt [%d]
\n
"
,
mode
->
name
,
mode
,
mode
->
refcnt
);
fprintf
(
stderr
,
"RRModeGet: return existing mode [%s] ([%p]) refcnt [%d]
\n
"
,
mode
->
name
,
mode
,
mode
->
refcnt
);
#endif
#endif
return
mode
;
return
mode
;
}
}
}
}
#ifdef DEBUG
#ifdef DEBUG
{
{
RRModePtr
mode
=
RRModeCreate
(
modeInfo
,
name
,
NULL
);
RRModePtr
mode
=
RRModeCreate
(
modeInfo
,
name
,
NULL
);
fprintf
(
stderr
,
"RRModeGet: return new mode [%s] ([%p]) refcnt [%d]
\n
"
,
mode
->
name
,
mode
,
mode
->
refcnt
);
return
mode
;
fprintf
(
stderr
,
"RRModeGet: return new mode [%s] ([%p]) refcnt [%d]
\n
"
,
mode
->
name
,
mode
,
mode
->
refcnt
);
return
mode
;
}
}
#else
#else
return
RRModeCreate
(
modeInfo
,
name
,
NULL
);
return
RRModeCreate
(
modeInfo
,
name
,
NULL
);
#endif
#endif
}
}
static
RRModePtr
static
RRModePtr
RRModeCreateUser
(
ScreenPtr
pScreen
,
RRModeCreateUser
(
ScreenPtr
pScreen
,
xRRModeInfo
*
modeInfo
,
xRRModeInfo
*
modeInfo
,
const
char
*
name
,
int
*
error
)
const
char
*
name
,
int
*
error
)
{
{
RRModePtr
mode
;
RRModePtr
mode
;
mode
=
RRModeFindByName
(
name
,
modeInfo
->
nameLength
);
mode
=
RRModeFindByName
(
name
,
modeInfo
->
nameLength
);
if
(
mode
)
if
(
mode
)
{
{
*
error
=
BadName
;
*
error
=
BadName
;
return
NULL
;
return
NULL
;
}
}
mode
=
RRModeCreate
(
modeInfo
,
name
,
pScreen
);
mode
=
RRModeCreate
(
modeInfo
,
name
,
pScreen
);
if
(
!
mode
)
if
(
!
mode
)
{
{
*
error
=
BadAlloc
;
*
error
=
BadAlloc
;
return
NULL
;
return
NULL
;
}
}
*
error
=
Success
;
*
error
=
Success
;
return
mode
;
return
mode
;
}
}
RRModePtr
*
RRModePtr
*
RRModesForScreen
(
ScreenPtr
pScreen
,
int
*
num_ret
)
RRModesForScreen
(
ScreenPtr
pScreen
,
int
*
num_ret
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
int
o
,
c
,
m
;
int
o
,
c
,
m
;
RRModePtr
*
screen_modes
;
RRModePtr
*
screen_modes
;
int
num_screen_modes
=
0
;
int
num_screen_modes
=
0
;
screen_modes
=
xalloc
((
num_modes
?
num_modes
:
1
)
*
sizeof
(
RRModePtr
));
screen_modes
=
xalloc
((
num_modes
?
num_modes
:
1
)
*
sizeof
(
RRModePtr
));
if
(
!
screen_modes
)
if
(
!
screen_modes
)
return
NULL
;
return
NULL
;
/*
/*
* Add modes from all outputs
* Add modes from all outputs
*/
*/
for
(
o
=
0
;
o
<
pScrPriv
->
numOutputs
;
o
++
)
for
(
o
=
0
;
o
<
pScrPriv
->
numOutputs
;
o
++
)
{
{
RROutputPtr
output
=
pScrPriv
->
outputs
[
o
];
RROutputPtr
output
=
pScrPriv
->
outputs
[
o
];
int
n
;
int
n
;
for
(
m
=
0
;
m
<
output
->
numModes
+
output
->
numUserModes
;
m
++
)
{
for
(
m
=
0
;
m
<
output
->
numModes
+
output
->
numUserModes
;
m
++
)
RRModePtr
mode
=
(
m
<
output
->
numModes
?
{
output
->
modes
[
m
]
:
RRModePtr
mode
=
(
m
<
output
->
numModes
?
output
->
userModes
[
m
-
output
->
numModes
]);
output
->
modes
[
m
]
:
for
(
n
=
0
;
n
<
num_screen_modes
;
n
++
)
output
->
userModes
[
m
-
output
->
numModes
]);
if
(
screen_modes
[
n
]
==
mode
)
for
(
n
=
0
;
n
<
num_screen_modes
;
n
++
)
break
;
if
(
screen_modes
[
n
]
==
mode
)
if
(
n
==
num_screen_modes
)
break
;
screen_modes
[
num_screen_modes
++
]
=
mode
;
if
(
n
==
num_screen_modes
)
}
screen_modes
[
num_screen_modes
++
]
=
mode
;
}
}
}
/*
/*
* Add modes from all crtcs. The goal is to
* Add modes from all crtcs. The goal is to
* make sure all available and active modes
* make sure all available and active modes
* are visible to the client
* are visible to the client
*/
*/
for
(
c
=
0
;
c
<
pScrPriv
->
numCrtcs
;
c
++
)
for
(
c
=
0
;
c
<
pScrPriv
->
numCrtcs
;
c
++
)
{
{
RRCrtcPtr
crtc
=
pScrPriv
->
crtcs
[
c
];
RRCrtcPtr
crtc
=
pScrPriv
->
crtcs
[
c
]
;
RRModePtr
mode
=
crtc
->
mode
;
RRModePtr
mode
=
crtc
->
mode
;
int
n
;
int
n
;
if
(
!
mode
)
if
(
!
mode
)
continue
;
continue
;
for
(
n
=
0
;
n
<
num_screen_modes
;
n
++
)
for
(
n
=
0
;
n
<
num_screen_modes
;
n
++
)
if
(
screen_modes
[
n
]
==
mode
)
if
(
screen_modes
[
n
]
==
mode
)
break
;
break
;
if
(
n
==
num_screen_modes
)
if
(
n
==
num_screen_modes
)
screen_modes
[
num_screen_modes
++
]
=
mode
;
screen_modes
[
num_screen_modes
++
]
=
mode
;
}
}
/*
/*
* Add all user modes for this screen
* Add all user modes for this screen
*/
*/
for
(
m
=
0
;
m
<
num_modes
;
m
++
)
for
(
m
=
0
;
m
<
num_modes
;
m
++
)
{
{
RRModePtr
mode
=
modes
[
m
];
RRModePtr
mode
=
modes
[
m
];
int
n
;
int
n
;
if
(
mode
->
userScreen
!=
pScreen
)
if
(
mode
->
userScreen
!=
pScreen
)
continue
;
continue
;
for
(
n
=
0
;
n
<
num_screen_modes
;
n
++
)
for
(
n
=
0
;
n
<
num_screen_modes
;
n
++
)
if
(
screen_modes
[
n
]
==
mode
)
if
(
screen_modes
[
n
]
==
mode
)
break
;
break
;
if
(
n
==
num_screen_modes
)
if
(
n
==
num_screen_modes
)
screen_modes
[
num_screen_modes
++
]
=
mode
;
screen_modes
[
num_screen_modes
++
]
=
mode
;
}
}
*
num_ret
=
num_screen_modes
;
*
num_ret
=
num_screen_modes
;
...
@@ -261,184 +264,180 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret)
...
@@ -261,184 +264,180 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret)
}
}
void
void
RRModeDestroy
(
RRModePtr
mode
)
RRModeDestroy
(
RRModePtr
mode
)
{
{
int
m
;
int
m
;
if
(
--
mode
->
refcnt
>
0
)
{
if
(
--
mode
->
refcnt
>
0
)
{
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"RRModeDestroy: mode [%s] ([%p]) refcnt [%d -> %d]
\n
"
,
mode
->
name
,
mode
,
mode
->
refcnt
+
1
,
mode
->
refcnt
);
fprintf
(
stderr
,
"RRModeDestroy: mode [%s] ([%p]) refcnt [%d -> %d]
\n
"
,
mode
->
name
,
mode
,
mode
->
refcnt
+
1
,
mode
->
refcnt
);
#endif
#endif
return
;
return
;
}
}
for
(
m
=
0
;
m
<
num_modes
;
m
++
)
for
(
m
=
0
;
m
<
num_modes
;
m
++
)
{
{
if
(
modes
[
m
]
==
mode
)
{
if
(
modes
[
m
]
==
mode
)
memmove
(
modes
+
m
,
modes
+
m
+
1
,
{
(
num_modes
-
m
-
1
)
*
sizeof
(
RRModePtr
));
memmove
(
modes
+
m
,
modes
+
m
+
1
,
num_modes
--
;
(
num_modes
-
m
-
1
)
*
sizeof
(
RRModePtr
));
if
(
!
num_modes
)
{
num_modes
--
;
xfree
(
modes
);
if
(
!
num_modes
)
modes
=
NULL
;
{
}
xfree
(
modes
);
break
;
modes
=
NULL
;
}
}
break
;
}
}
}
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"RRModeDestroy: destroyed mode [%s] ([%p])
\n
"
,
mode
->
name
,
mode
);
fprintf
(
stderr
,
"RRModeDestroy: destroyed mode [%s] ([%p])
\n
"
,
mode
->
name
,
mode
);
#endif
#endif
xfree
(
mode
);
xfree
(
mode
);
}
}
static
int
static
int
RRModeDestroyResource
(
void
*
value
,
XID
pid
)
RRModeDestroyResource
(
void
*
value
,
XID
pid
)
{
{
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"RRModeDestroyResource: mode [%s] ([%p]) refcnt [%d]
\n
"
,
((
RRModePtr
)
value
)
->
name
,
(
RRModePtr
)
value
,
((
RRModePtr
)
value
)
->
refcnt
);
fprintf
(
stderr
,
"RRModeDestroyResource: mode [%s] ([%p]) refcnt [%d]
\n
"
,
((
RRModePtr
)
value
)
->
name
,
(
RRModePtr
)
value
,
((
RRModePtr
)
value
)
->
refcnt
);
#endif
#endif
RRModeDestroy
((
RRModePtr
)
value
);
RRModeDestroy
((
RRModePtr
)
value
);
return
1
;
return
1
;
}
}
Bool
Bool
RRModeInit
(
void
)
RRModeInit
(
void
)
{
{
assert
(
num_modes
==
0
);
assert
(
num_modes
==
0
);
assert
(
modes
==
NULL
);
assert
(
modes
==
NULL
);
RRModeType
=
CreateNewResourceType
(
RRModeDestroyResource
);
RRModeType
=
CreateNewResourceType
(
RRModeDestroyResource
);
if
(
!
RRModeType
)
if
(
!
RRModeType
)
return
FALSE
;
return
FALSE
;
RegisterResourceName
(
RRModeType
,
"MODE"
);
RegisterResourceName
(
RRModeType
,
"MODE"
);
return
TRUE
;
return
TRUE
;
}
}
int
int
ProcRRCreateMode
(
ClientPtr
client
)
ProcRRCreateMode
(
ClientPtr
client
)
{
{
REQUEST
(
xRRCreateModeReq
);
REQUEST
(
xRRCreateModeReq
);
xRRCreateModeReply
rep
;
xRRCreateModeReply
rep
;
WindowPtr
pWin
;
WindowPtr
pWin
;
ScreenPtr
pScreen
;
ScreenPtr
pScreen
;
xRRModeInfo
*
modeInfo
;
xRRModeInfo
*
modeInfo
;
long
units_after
;
long
units_after
;
char
*
name
;
char
*
name
;
int
error
,
rc
;
int
error
,
rc
;
RRModePtr
mode
;
RRModePtr
mode
;
REQUEST_AT_LEAST_SIZE
(
xRRCreateModeReq
);
REQUEST_AT_LEAST_SIZE
(
xRRCreateModeReq
);
#ifndef NXAGENT_SERVER
#ifndef NXAGENT_SERVER
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixReadAccess
);
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixReadAccess
);
#else
#else
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityReadAccess
);
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityReadAccess
);
rc
=
pWin
?
Success
:
BadWindow
;
rc
=
pWin
?
Success
:
BadWindow
;
#endif
#endif
if
(
rc
!=
Success
)
if
(
rc
!=
Success
)
return
rc
;
return
rc
;
pScreen
=
pWin
->
drawable
.
pScreen
;
pScreen
=
pWin
->
drawable
.
pScreen
;
modeInfo
=
&
stuff
->
modeInfo
;
modeInfo
=
&
stuff
->
modeInfo
;
name
=
(
char
*
)
(
stuff
+
1
);
name
=
(
char
*
)
(
stuff
+
1
);
units_after
=
(
stuff
->
length
-
(
sizeof
(
xRRCreateModeReq
)
>>
2
));
units_after
=
(
stuff
->
length
-
(
sizeof
(
xRRCreateModeReq
)
>>
2
));
/* check to make sure requested name fits within the data provided */
/* check to make sure requested name fits within the data provided */
if
((
int
)
(
modeInfo
->
nameLength
+
3
)
>>
2
>
units_after
)
if
((
int
)
(
modeInfo
->
nameLength
+
3
)
>>
2
>
units_after
)
return
BadLength
;
return
BadLength
;
mode
=
RRModeCreateUser
(
pScreen
,
modeInfo
,
name
,
&
error
);
mode
=
RRModeCreateUser
(
pScreen
,
modeInfo
,
name
,
&
error
);
if
(
!
mode
)
if
(
!
mode
)
return
error
;
return
error
;
rep
.
type
=
X_Reply
;
rep
.
type
=
X_Reply
;
rep
.
pad0
=
0
;
rep
.
pad0
=
0
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
length
=
0
;
rep
.
length
=
0
;
rep
.
mode
=
mode
->
mode
.
id
;
rep
.
mode
=
mode
->
mode
.
id
;
if
(
client
->
swapped
)
if
(
client
->
swapped
)
{
{
int
n
;
int
n
;
swaps
(
&
rep
.
sequenceNumber
,
n
);
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
mode
,
n
);
swapl
(
&
rep
.
mode
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xRRCreateModeReply
),
(
char
*
)
&
rep
);
WriteToClient
(
client
,
sizeof
(
xRRCreateModeReply
),
(
char
*
)
&
rep
);
/* Drop out reference to this mode */
/* Drop out reference to this mode */
RRModeDestroy
(
mode
);
RRModeDestroy
(
mode
);
return
client
->
noClientException
;
return
client
->
noClientException
;
}
}
int
int
ProcRRDestroyMode
(
ClientPtr
client
)
ProcRRDestroyMode
(
ClientPtr
client
)
{
{
REQUEST
(
xRRDestroyModeReq
);
REQUEST
(
xRRDestroyModeReq
);
RRModePtr
mode
;
RRModePtr
mode
;
REQUEST_SIZE_MATCH
(
xRRDestroyModeReq
);
REQUEST_SIZE_MATCH
(
xRRDestroyModeReq
);
mode
=
LookupIDByType
(
stuff
->
mode
,
RRModeType
);
mode
=
LookupIDByType
(
stuff
->
mode
,
RRModeType
);
if
(
!
mode
)
if
(
!
mode
)
{
{
client
->
errorValue
=
stuff
->
mode
;
client
->
errorValue
=
stuff
->
mode
;
return
RRErrorBase
+
BadRRMode
;
return
RRErrorBase
+
BadRRMode
;
}
}
if
(
!
mode
->
userScreen
)
if
(
!
mode
->
userScreen
)
return
BadMatch
;
return
BadMatch
;
if
(
mode
->
refcnt
>
1
)
if
(
mode
->
refcnt
>
1
)
return
BadAccess
;
return
BadAccess
;
FreeResource
(
stuff
->
mode
,
0
);
FreeResource
(
stuff
->
mode
,
0
);
return
Success
;
return
Success
;
}
}
int
int
ProcRRAddOutputMode
(
ClientPtr
client
)
ProcRRAddOutputMode
(
ClientPtr
client
)
{
{
REQUEST
(
xRRAddOutputModeReq
);
REQUEST
(
xRRAddOutputModeReq
);
RRModePtr
mode
;
RRModePtr
mode
;
RROutputPtr
output
;
RROutputPtr
output
;
REQUEST_SIZE_MATCH
(
xRRAddOutputModeReq
);
REQUEST_SIZE_MATCH
(
xRRAddOutputModeReq
);
output
=
LookupOutput
(
client
,
stuff
->
output
,
DixReadAccess
);
output
=
LookupOutput
(
client
,
stuff
->
output
,
DixReadAccess
);
if
(
!
output
)
if
(
!
output
)
{
{
client
->
errorValue
=
stuff
->
output
;
client
->
errorValue
=
stuff
->
output
;
return
RRErrorBase
+
BadRROutput
;
return
RRErrorBase
+
BadRROutput
;
}
}
mode
=
LookupIDByType
(
stuff
->
mode
,
RRModeType
);
mode
=
LookupIDByType
(
stuff
->
mode
,
RRModeType
);
if
(
!
mode
)
if
(
!
mode
)
{
{
client
->
errorValue
=
stuff
->
mode
;
client
->
errorValue
=
stuff
->
mode
;
return
RRErrorBase
+
BadRRMode
;
return
RRErrorBase
+
BadRRMode
;
}
}
return
RROutputAddUserMode
(
output
,
mode
);
return
RROutputAddUserMode
(
output
,
mode
);
}
}
int
int
ProcRRDeleteOutputMode
(
ClientPtr
client
)
ProcRRDeleteOutputMode
(
ClientPtr
client
)
{
{
REQUEST
(
xRRDeleteOutputModeReq
);
REQUEST
(
xRRDeleteOutputModeReq
);
RRModePtr
mode
;
RRModePtr
mode
;
RROutputPtr
output
;
RROutputPtr
output
;
REQUEST_SIZE_MATCH
(
xRRDeleteOutputModeReq
);
REQUEST_SIZE_MATCH
(
xRRDeleteOutputModeReq
);
output
=
LookupOutput
(
client
,
stuff
->
output
,
DixReadAccess
);
output
=
LookupOutput
(
client
,
stuff
->
output
,
DixReadAccess
);
if
(
!
output
)
if
(
!
output
)
{
{
client
->
errorValue
=
stuff
->
output
;
client
->
errorValue
=
stuff
->
output
;
return
RRErrorBase
+
BadRROutput
;
return
RRErrorBase
+
BadRROutput
;
}
}
mode
=
LookupIDByType
(
stuff
->
mode
,
RRModeType
);
mode
=
LookupIDByType
(
stuff
->
mode
,
RRModeType
);
if
(
!
mode
)
if
(
!
mode
)
{
{
client
->
errorValue
=
stuff
->
mode
;
client
->
errorValue
=
stuff
->
mode
;
return
RRErrorBase
+
BadRRMode
;
return
RRErrorBase
+
BadRRMode
;
}
}
return
RROutputDeleteUserMode
(
output
,
mode
);
return
RROutputDeleteUserMode
(
output
,
mode
);
}
}
nx-X11/programs/Xserver/randr/rroutput.c
View file @
e440ea76
...
@@ -23,23 +23,22 @@
...
@@ -23,23 +23,22 @@
#include "randrstr.h"
#include "randrstr.h"
#include "registry.h"
#include "registry.h"
RESTYPE
RROutputType
;
RESTYPE
RROutputType
;
/*
/*
* Notify the output of some change
* Notify the output of some change
*/
*/
void
void
RROutputChanged
(
RROutputPtr
output
,
Bool
configChanged
)
RROutputChanged
(
RROutputPtr
output
,
Bool
configChanged
)
{
{
ScreenPtr
pScreen
=
output
->
pScreen
;
ScreenPtr
pScreen
=
output
->
pScreen
;
output
->
changed
=
TRUE
;
output
->
changed
=
TRUE
;
if
(
pScreen
)
if
(
pScreen
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
pScrPriv
->
changed
=
TRUE
;
pScrPriv
->
changed
=
TRUE
;
if
(
configChanged
)
if
(
configChanged
)
pScrPriv
->
configChanged
=
TRUE
;
pScrPriv
->
configChanged
=
TRUE
;
}
}
}
}
...
@@ -48,38 +47,36 @@ RROutputChanged (RROutputPtr output, Bool configChanged)
...
@@ -48,38 +47,36 @@ RROutputChanged (RROutputPtr output, Bool configChanged)
*/
*/
RROutputPtr
RROutputPtr
RROutputCreate
(
ScreenPtr
pScreen
,
RROutputCreate
(
ScreenPtr
pScreen
,
const
char
*
name
,
const
char
*
name
,
int
nameLength
,
void
*
devPrivate
)
int
nameLength
,
void
*
devPrivate
)
{
{
RROutputPtr
output
;
RROutputPtr
output
;
RROutputPtr
*
outputs
;
RROutputPtr
*
outputs
;
rrScrPrivPtr
pScrPriv
;
rrScrPrivPtr
pScrPriv
;
if
(
!
RRInit
())
if
(
!
RRInit
())
return
NULL
;
return
NULL
;
pScrPriv
=
rrGetScrPriv
(
pScreen
);
pScrPriv
=
rrGetScrPriv
(
pScreen
);
if
(
pScrPriv
->
numOutputs
)
if
(
pScrPriv
->
numOutputs
)
outputs
=
xrealloc
(
pScrPriv
->
outputs
,
outputs
=
xrealloc
(
pScrPriv
->
outputs
,
(
pScrPriv
->
numOutputs
+
1
)
*
sizeof
(
RROutputPtr
));
(
pScrPriv
->
numOutputs
+
1
)
*
sizeof
(
RROutputPtr
));
else
else
outputs
=
xalloc
(
sizeof
(
RROutputPtr
));
outputs
=
xalloc
(
sizeof
(
RROutputPtr
));
if
(
!
outputs
)
if
(
!
outputs
)
return
FALSE
;
return
FALSE
;
pScrPriv
->
outputs
=
outputs
;
pScrPriv
->
outputs
=
outputs
;
output
=
xalloc
(
sizeof
(
RROutputRec
)
+
nameLength
+
1
);
output
=
xalloc
(
sizeof
(
RROutputRec
)
+
nameLength
+
1
);
if
(
!
output
)
if
(
!
output
)
return
NULL
;
return
NULL
;
output
->
id
=
FakeClientID
(
0
);
output
->
id
=
FakeClientID
(
0
);
output
->
pScreen
=
pScreen
;
output
->
pScreen
=
pScreen
;
output
->
name
=
(
char
*
)
(
output
+
1
);
output
->
name
=
(
char
*
)
(
output
+
1
);
output
->
nameLength
=
nameLength
;
output
->
nameLength
=
nameLength
;
memcpy
(
output
->
name
,
name
,
nameLength
);
memcpy
(
output
->
name
,
name
,
nameLength
);
output
->
name
[
nameLength
]
=
'\0'
;
output
->
name
[
nameLength
]
=
'\0'
;
output
->
connection
=
RR_UnknownConnection
;
output
->
connection
=
RR_UnknownConnection
;
output
->
subpixelOrder
=
SubPixelUnknown
;
output
->
subpixelOrder
=
SubPixelUnknown
;
...
@@ -100,8 +97,8 @@ RROutputCreate (ScreenPtr pScreen,
...
@@ -100,8 +97,8 @@ RROutputCreate (ScreenPtr pScreen,
output
->
changed
=
FALSE
;
output
->
changed
=
FALSE
;
output
->
devPrivate
=
devPrivate
;
output
->
devPrivate
=
devPrivate
;
if
(
!
AddResource
(
output
->
id
,
RROutputType
,
(
void
*
)
output
))
if
(
!
AddResource
(
output
->
id
,
RROutputType
,
(
void
*
)
output
))
return
NULL
;
return
NULL
;
pScrPriv
->
outputs
[
pScrPriv
->
numOutputs
++
]
=
output
;
pScrPriv
->
outputs
[
pScrPriv
->
numOutputs
++
]
=
output
;
return
output
;
return
output
;
...
@@ -111,229 +108,208 @@ RROutputCreate (ScreenPtr pScreen,
...
@@ -111,229 +108,208 @@ RROutputCreate (ScreenPtr pScreen,
* Notify extension that output parameters have been changed
* Notify extension that output parameters have been changed
*/
*/
Bool
Bool
RROutputSetClones
(
RROutputPtr
output
,
RROutputSetClones
(
RROutputPtr
output
,
RROutputPtr
*
clones
,
int
numClones
)
RROutputPtr
*
clones
,
int
numClones
)
{
{
RROutputPtr
*
newClones
;
RROutputPtr
*
newClones
;
int
i
;
int
i
;
if
(
numClones
==
output
->
numClones
)
if
(
numClones
==
output
->
numClones
)
{
{
for
(
i
=
0
;
i
<
numClones
;
i
++
)
for
(
i
=
0
;
i
<
numClones
;
i
++
)
if
(
output
->
clones
[
i
]
!=
clones
[
i
])
if
(
output
->
clones
[
i
]
!=
clones
[
i
])
break
;
break
;
if
(
i
==
numClones
)
if
(
i
==
numClones
)
return
TRUE
;
return
TRUE
;
}
}
if
(
numClones
)
if
(
numClones
)
{
{
newClones
=
xalloc
(
numClones
*
sizeof
(
RROutputPtr
));
newClones
=
xalloc
(
numClones
*
sizeof
(
RROutputPtr
));
if
(
!
newClones
)
if
(
!
newClones
)
return
FALSE
;
return
FALSE
;
}
}
else
else
newClones
=
NULL
;
newClones
=
NULL
;
if
(
output
->
clones
)
if
(
output
->
clones
)
xfree
(
output
->
clones
);
xfree
(
output
->
clones
);
memcpy
(
newClones
,
clones
,
numClones
*
sizeof
(
RROutputPtr
));
memcpy
(
newClones
,
clones
,
numClones
*
sizeof
(
RROutputPtr
));
output
->
clones
=
newClones
;
output
->
clones
=
newClones
;
output
->
numClones
=
numClones
;
output
->
numClones
=
numClones
;
RROutputChanged
(
output
,
TRUE
);
RROutputChanged
(
output
,
TRUE
);
return
TRUE
;
return
TRUE
;
}
}
Bool
Bool
RROutputSetModes
(
RROutputPtr
output
,
RROutputSetModes
(
RROutputPtr
output
,
RRModePtr
*
modes
,
RRModePtr
*
modes
,
int
numModes
,
int
numPreferred
)
int
numModes
,
int
numPreferred
)
{
{
RRModePtr
*
newModes
;
RRModePtr
*
newModes
;
int
i
;
int
i
;
if
(
numModes
==
output
->
numModes
&&
numPreferred
==
output
->
numPreferred
)
if
(
numModes
==
output
->
numModes
&&
numPreferred
==
output
->
numPreferred
)
{
{
for
(
i
=
0
;
i
<
numModes
;
i
++
)
for
(
i
=
0
;
i
<
numModes
;
i
++
)
if
(
output
->
modes
[
i
]
!=
modes
[
i
])
if
(
output
->
modes
[
i
]
!=
modes
[
i
])
break
;
break
;
if
(
i
==
numModes
)
{
if
(
i
==
numModes
)
for
(
i
=
0
;
i
<
numModes
;
i
++
)
{
RRModeDestroy
(
modes
[
i
]);
for
(
i
=
0
;
i
<
numModes
;
i
++
)
return
TRUE
;
RRModeDestroy
(
modes
[
i
]);
}
return
TRUE
;
}
}
}
if
(
numModes
)
if
(
numModes
)
{
{
newModes
=
xalloc
(
numModes
*
sizeof
(
RRModePtr
));
newModes
=
xalloc
(
numModes
*
sizeof
(
RRModePtr
));
if
(
!
newModes
)
if
(
!
newModes
)
return
FALSE
;
return
FALSE
;
}
}
else
else
newModes
=
NULL
;
newModes
=
NULL
;
if
(
output
->
modes
)
if
(
output
->
modes
)
{
{
for
(
i
=
0
;
i
<
output
->
numModes
;
i
++
)
for
(
i
=
0
;
i
<
output
->
numModes
;
i
++
)
RRModeDestroy
(
output
->
modes
[
i
]);
RRModeDestroy
(
output
->
modes
[
i
]);
xfree
(
output
->
modes
);
xfree
(
output
->
modes
);
}
}
memcpy
(
newModes
,
modes
,
numModes
*
sizeof
(
RRModePtr
));
memcpy
(
newModes
,
modes
,
numModes
*
sizeof
(
RRModePtr
));
output
->
modes
=
newModes
;
output
->
modes
=
newModes
;
output
->
numModes
=
numModes
;
output
->
numModes
=
numModes
;
output
->
numPreferred
=
numPreferred
;
output
->
numPreferred
=
numPreferred
;
RROutputChanged
(
output
,
TRUE
);
RROutputChanged
(
output
,
TRUE
);
return
TRUE
;
return
TRUE
;
}
}
int
int
RROutputAddUserMode
(
RROutputPtr
output
,
RROutputAddUserMode
(
RROutputPtr
output
,
RRModePtr
mode
)
RRModePtr
mode
)
{
{
int
m
;
int
m
;
ScreenPtr
pScreen
=
output
->
pScreen
;
ScreenPtr
pScreen
=
output
->
pScreen
;
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
RRModePtr
*
newModes
;
RRModePtr
*
newModes
;
/* Check to see if this mode is already listed for this output */
/* Check to see if this mode is already listed for this output */
for
(
m
=
0
;
m
<
output
->
numModes
+
output
->
numUserModes
;
m
++
)
for
(
m
=
0
;
m
<
output
->
numModes
+
output
->
numUserModes
;
m
++
)
{
{
RRModePtr
e
=
(
m
<
output
->
numModes
?
RRModePtr
e
=
(
m
<
output
->
numModes
?
output
->
modes
[
m
]
:
output
->
modes
[
m
]
:
output
->
userModes
[
m
-
output
->
numModes
]);
output
->
userModes
[
m
-
output
->
numModes
]);
if
(
mode
==
e
)
if
(
mode
==
e
)
return
Success
;
return
Success
;
}
}
/* Check with the DDX to see if this mode is OK */
/* Check with the DDX to see if this mode is OK */
if
(
pScrPriv
->
rrOutputValidateMode
)
if
(
pScrPriv
->
rrOutputValidateMode
)
if
(
!
pScrPriv
->
rrOutputValidateMode
(
pScreen
,
output
,
mode
))
if
(
!
pScrPriv
->
rrOutputValidateMode
(
pScreen
,
output
,
mode
))
return
BadMatch
;
return
BadMatch
;
if
(
output
->
userModes
)
if
(
output
->
userModes
)
newModes
=
xrealloc
(
output
->
userModes
,
newModes
=
xrealloc
(
output
->
userModes
,
(
output
->
numUserModes
+
1
)
*
sizeof
(
RRModePtr
));
(
output
->
numUserModes
+
1
)
*
sizeof
(
RRModePtr
));
else
else
newModes
=
xalloc
(
sizeof
(
RRModePtr
));
newModes
=
xalloc
(
sizeof
(
RRModePtr
));
if
(
!
newModes
)
if
(
!
newModes
)
return
BadAlloc
;
return
BadAlloc
;
output
->
userModes
=
newModes
;
output
->
userModes
=
newModes
;
output
->
userModes
[
output
->
numUserModes
++
]
=
mode
;
output
->
userModes
[
output
->
numUserModes
++
]
=
mode
;
++
mode
->
refcnt
;
++
mode
->
refcnt
;
RROutputChanged
(
output
,
TRUE
);
RROutputChanged
(
output
,
TRUE
);
RRTellChanged
(
pScreen
);
RRTellChanged
(
pScreen
);
return
Success
;
return
Success
;
}
}
int
int
RROutputDeleteUserMode
(
RROutputPtr
output
,
RROutputDeleteUserMode
(
RROutputPtr
output
,
RRModePtr
mode
)
RRModePtr
mode
)
{
{
int
m
;
int
m
;
/* Find this mode in the user mode list */
/* Find this mode in the user mode list */
for
(
m
=
0
;
m
<
output
->
numUserModes
;
m
++
)
for
(
m
=
0
;
m
<
output
->
numUserModes
;
m
++
)
{
{
RRModePtr
e
=
output
->
userModes
[
m
];
RRModePtr
e
=
output
->
userModes
[
m
];
if
(
mode
==
e
)
if
(
mode
==
e
)
break
;
break
;
}
}
/* Not there, access error */
/* Not there, access error */
if
(
m
==
output
->
numUserModes
)
if
(
m
==
output
->
numUserModes
)
return
BadAccess
;
return
BadAccess
;
/* make sure the mode isn't active for this output */
/* make sure the mode isn't active for this output */
if
(
output
->
crtc
&&
output
->
crtc
->
mode
==
mode
)
if
(
output
->
crtc
&&
output
->
crtc
->
mode
==
mode
)
return
BadMatch
;
return
BadMatch
;
memmove
(
output
->
userModes
+
m
,
output
->
userModes
+
m
+
1
,
memmove
(
output
->
userModes
+
m
,
output
->
userModes
+
m
+
1
,
(
output
->
numUserModes
-
m
-
1
)
*
sizeof
(
RRModePtr
));
(
output
->
numUserModes
-
m
-
1
)
*
sizeof
(
RRModePtr
));
output
->
numUserModes
--
;
output
->
numUserModes
--
;
RRModeDestroy
(
mode
);
RRModeDestroy
(
mode
);
return
Success
;
return
Success
;
}
}
Bool
Bool
RROutputSetCrtcs
(
RROutputPtr
output
,
RROutputSetCrtcs
(
RROutputPtr
output
,
RRCrtcPtr
*
crtcs
,
int
numCrtcs
)
RRCrtcPtr
*
crtcs
,
int
numCrtcs
)
{
{
RRCrtcPtr
*
newCrtcs
;
RRCrtcPtr
*
newCrtcs
;
int
i
;
int
i
;
if
(
numCrtcs
==
output
->
numCrtcs
)
if
(
numCrtcs
==
output
->
numCrtcs
)
{
{
for
(
i
=
0
;
i
<
numCrtcs
;
i
++
)
for
(
i
=
0
;
i
<
numCrtcs
;
i
++
)
if
(
output
->
crtcs
[
i
]
!=
crtcs
[
i
])
if
(
output
->
crtcs
[
i
]
!=
crtcs
[
i
])
break
;
break
;
if
(
i
==
numCrtcs
)
if
(
i
==
numCrtcs
)
return
TRUE
;
return
TRUE
;
}
}
if
(
numCrtcs
)
if
(
numCrtcs
)
{
{
newCrtcs
=
xalloc
(
numCrtcs
*
sizeof
(
RRCrtcPtr
));
newCrtcs
=
xalloc
(
numCrtcs
*
sizeof
(
RRCrtcPtr
));
if
(
!
newCrtcs
)
if
(
!
newCrtcs
)
return
FALSE
;
return
FALSE
;
}
}
else
else
newCrtcs
=
NULL
;
newCrtcs
=
NULL
;
if
(
output
->
crtcs
)
if
(
output
->
crtcs
)
xfree
(
output
->
crtcs
);
xfree
(
output
->
crtcs
);
memcpy
(
newCrtcs
,
crtcs
,
numCrtcs
*
sizeof
(
RRCrtcPtr
));
memcpy
(
newCrtcs
,
crtcs
,
numCrtcs
*
sizeof
(
RRCrtcPtr
));
output
->
crtcs
=
newCrtcs
;
output
->
crtcs
=
newCrtcs
;
output
->
numCrtcs
=
numCrtcs
;
output
->
numCrtcs
=
numCrtcs
;
RROutputChanged
(
output
,
TRUE
);
RROutputChanged
(
output
,
TRUE
);
return
TRUE
;
return
TRUE
;
}
}
Bool
Bool
RROutputSetConnection
(
RROutputPtr
output
,
RROutputSetConnection
(
RROutputPtr
output
,
CARD8
connection
)
CARD8
connection
)
{
{
if
(
output
->
connection
==
connection
)
if
(
output
->
connection
==
connection
)
return
TRUE
;
return
TRUE
;
output
->
connection
=
connection
;
output
->
connection
=
connection
;
RROutputChanged
(
output
,
TRUE
);
RROutputChanged
(
output
,
TRUE
);
return
TRUE
;
return
TRUE
;
}
}
Bool
Bool
RROutputSetSubpixelOrder
(
RROutputPtr
output
,
RROutputSetSubpixelOrder
(
RROutputPtr
output
,
int
subpixelOrder
)
int
subpixelOrder
)
{
{
if
(
output
->
subpixelOrder
==
subpixelOrder
)
if
(
output
->
subpixelOrder
==
subpixelOrder
)
return
TRUE
;
return
TRUE
;
output
->
subpixelOrder
=
subpixelOrder
;
output
->
subpixelOrder
=
subpixelOrder
;
RROutputChanged
(
output
,
FALSE
);
RROutputChanged
(
output
,
FALSE
);
return
TRUE
;
return
TRUE
;
}
}
Bool
Bool
RROutputSetPhysicalSize
(
RROutputPtr
output
,
RROutputSetPhysicalSize
(
RROutputPtr
output
,
int
mmWidth
,
int
mmHeight
)
int
mmWidth
,
int
mmHeight
)
{
{
if
(
output
->
mmWidth
==
mmWidth
&&
output
->
mmHeight
==
mmHeight
)
if
(
output
->
mmWidth
==
mmWidth
&&
output
->
mmHeight
==
mmHeight
)
return
TRUE
;
return
TRUE
;
output
->
mmWidth
=
mmWidth
;
output
->
mmWidth
=
mmWidth
;
output
->
mmHeight
=
mmHeight
;
output
->
mmHeight
=
mmHeight
;
RROutputChanged
(
output
,
FALSE
);
RROutputChanged
(
output
,
FALSE
);
return
TRUE
;
return
TRUE
;
}
}
void
void
RRDeliverOutputEvent
(
ClientPtr
client
,
WindowPtr
pWin
,
RROutputPtr
output
)
RRDeliverOutputEvent
(
ClientPtr
client
,
WindowPtr
pWin
,
RROutputPtr
output
)
{
{
ScreenPtr
pScreen
=
pWin
->
drawable
.
pScreen
;
ScreenPtr
pScreen
=
pWin
->
drawable
.
pScreen
;
rrScrPriv
(
pScreen
);
xRROutputChangeNotifyEvent
oe
;
rrScrPriv
(
pScreen
);
RRCrtcPtr
crtc
=
output
->
crtc
;
xRROutputChangeNotifyEvent
oe
;
RRModePtr
mode
=
crtc
?
crtc
->
mode
:
0
;
RRCrtcPtr
crtc
=
output
->
crtc
;
RRModePtr
mode
=
crtc
?
crtc
->
mode
:
0
;
oe
.
type
=
RRNotify
+
RREventBase
;
oe
.
type
=
RRNotify
+
RREventBase
;
oe
.
subCode
=
RRNotify_OutputChange
;
oe
.
subCode
=
RRNotify_OutputChange
;
...
@@ -342,73 +318,67 @@ RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output)
...
@@ -342,73 +318,67 @@ RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output)
oe
.
configTimestamp
=
pScrPriv
->
lastConfigTime
.
milliseconds
;
oe
.
configTimestamp
=
pScrPriv
->
lastConfigTime
.
milliseconds
;
oe
.
window
=
pWin
->
drawable
.
id
;
oe
.
window
=
pWin
->
drawable
.
id
;
oe
.
output
=
output
->
id
;
oe
.
output
=
output
->
id
;
if
(
crtc
)
if
(
crtc
)
{
{
oe
.
crtc
=
crtc
->
id
;
oe
.
crtc
=
crtc
->
id
;
oe
.
mode
=
mode
?
mode
->
mode
.
id
:
None
;
oe
.
mode
=
mode
?
mode
->
mode
.
id
:
None
;
oe
.
rotation
=
crtc
->
rotation
;
oe
.
rotation
=
crtc
->
rotation
;
}
}
else
else
{
{
oe
.
crtc
=
None
;
oe
.
crtc
=
None
;
oe
.
mode
=
None
;
oe
.
mode
=
None
;
oe
.
rotation
=
RR_Rotate_0
;
oe
.
rotation
=
RR_Rotate_0
;
}
}
oe
.
connection
=
output
->
connection
;
oe
.
connection
=
output
->
connection
;
oe
.
subpixelOrder
=
output
->
subpixelOrder
;
oe
.
subpixelOrder
=
output
->
subpixelOrder
;
WriteEventsToClient
(
client
,
1
,
(
xEvent
*
)
&
oe
);
WriteEventsToClient
(
client
,
1
,
(
xEvent
*
)
&
oe
);
}
}
/*
/*
* Destroy a Output at shutdown
* Destroy a Output at shutdown
*/
*/
void
void
RROutputDestroy
(
RROutputPtr
output
)
RROutputDestroy
(
RROutputPtr
output
)
{
{
FreeResource
(
output
->
id
,
0
);
FreeResource
(
output
->
id
,
0
);
}
}
static
int
static
int
RROutputDestroyResource
(
void
*
value
,
XID
pid
)
RROutputDestroyResource
(
void
*
value
,
XID
pid
)
{
{
RROutputPtr
output
=
(
RROutputPtr
)
value
;
RROutputPtr
output
=
(
RROutputPtr
)
value
;
ScreenPtr
pScreen
=
output
->
pScreen
;
ScreenPtr
pScreen
=
output
->
pScreen
;
int
m
;
int
m
;
if
(
pScreen
)
if
(
pScreen
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
int
i
;
int
i
;
for
(
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
{
for
(
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
if
(
pScrPriv
->
outputs
[
i
]
==
output
)
{
{
memmove
(
pScrPriv
->
outputs
+
i
,
pScrPriv
->
outputs
+
i
+
1
,
if
(
pScrPriv
->
outputs
[
i
]
==
output
)
(
pScrPriv
->
numOutputs
-
(
i
+
1
))
*
sizeof
(
RROutputPtr
));
{
--
pScrPriv
->
numOutputs
;
memmove
(
pScrPriv
->
outputs
+
i
,
pScrPriv
->
outputs
+
i
+
1
,
break
;
(
pScrPriv
->
numOutputs
-
(
i
+
1
))
*
sizeof
(
RROutputPtr
));
}
--
pScrPriv
->
numOutputs
;
}
break
;
}
}
}
}
if
(
output
->
modes
)
if
(
output
->
modes
)
{
{
for
(
m
=
0
;
m
<
output
->
numModes
;
m
++
)
for
(
m
=
0
;
m
<
output
->
numModes
;
m
++
)
RRModeDestroy
(
output
->
modes
[
m
]);
RRModeDestroy
(
output
->
modes
[
m
]);
xfree
(
output
->
modes
);
xfree
(
output
->
modes
);
}
}
for
(
m
=
0
;
m
<
output
->
numUserModes
;
m
++
)
for
(
m
=
0
;
m
<
output
->
numUserModes
;
m
++
)
RRModeDestroy
(
output
->
userModes
[
m
]);
RRModeDestroy
(
output
->
userModes
[
m
]);
if
(
output
->
userModes
)
if
(
output
->
userModes
)
xfree
(
output
->
userModes
);
xfree
(
output
->
userModes
);
if
(
output
->
crtcs
)
if
(
output
->
crtcs
)
xfree
(
output
->
crtcs
);
xfree
(
output
->
crtcs
);
if
(
output
->
clones
)
if
(
output
->
clones
)
xfree
(
output
->
clones
);
xfree
(
output
->
clones
);
RRDeleteAllOutputProperties
(
output
);
RRDeleteAllOutputProperties
(
output
);
xfree
(
output
);
xfree
(
output
);
return
1
;
return
1
;
}
}
...
@@ -416,40 +386,39 @@ RROutputDestroyResource (void * value, XID pid)
...
@@ -416,40 +386,39 @@ RROutputDestroyResource (void * value, XID pid)
* Initialize output type
* Initialize output type
*/
*/
Bool
Bool
RROutputInit
(
void
)
RROutputInit
(
void
)
{
{
RROutputType
=
CreateNewResourceType
(
RROutputDestroyResource
);
RROutputType
=
CreateNewResourceType
(
RROutputDestroyResource
);
if
(
!
RROutputType
)
if
(
!
RROutputType
)
return
FALSE
;
return
FALSE
;
RegisterResourceName
(
RROutputType
,
"OUTPUT"
);
RegisterResourceName
(
RROutputType
,
"OUTPUT"
);
return
TRUE
;
return
TRUE
;
}
}
#define OutputInfoExtra (SIZEOF(xRRGetOutputInfoReply) - 32)
#define OutputInfoExtra (SIZEOF(xRRGetOutputInfoReply) - 32)
int
int
ProcRRGetOutputInfo
(
ClientPtr
client
)
ProcRRGetOutputInfo
(
ClientPtr
client
)
{
{
REQUEST
(
xRRGetOutputInfoReq
);
REQUEST
(
xRRGetOutputInfoReq
);
xRRGetOutputInfoReply
rep
;
xRRGetOutputInfoReply
rep
;
RROutputPtr
output
;
RROutputPtr
output
;
CARD8
*
extra
;
CARD8
*
extra
;
unsigned
long
extraLen
;
unsigned
long
extraLen
;
ScreenPtr
pScreen
;
ScreenPtr
pScreen
;
rrScrPrivPtr
pScrPriv
;
rrScrPrivPtr
pScrPriv
;
RRCrtc
*
crtcs
;
RRCrtc
*
crtcs
;
RRMode
*
modes
;
RRMode
*
modes
;
RROutput
*
clones
;
RROutput
*
clones
;
char
*
name
;
char
*
name
;
int
i
,
n
;
int
i
,
n
;
REQUEST_SIZE_MATCH
(
xRRGetOutputInfoReq
);
REQUEST_SIZE_MATCH
(
xRRGetOutputInfoReq
);
output
=
LookupOutput
(
client
,
stuff
->
output
,
DixReadAccess
);
output
=
LookupOutput
(
client
,
stuff
->
output
,
DixReadAccess
);
if
(
!
output
)
if
(
!
output
)
{
{
client
->
errorValue
=
stuff
->
output
;
client
->
errorValue
=
stuff
->
output
;
return
RRErrorBase
+
BadRROutput
;
return
RRErrorBase
+
BadRROutput
;
}
}
pScreen
=
output
->
pScreen
;
pScreen
=
output
->
pScreen
;
...
@@ -472,64 +441,58 @@ ProcRRGetOutputInfo (ClientPtr client)
...
@@ -472,64 +441,58 @@ ProcRRGetOutputInfo (ClientPtr client)
rep
.
nameLength
=
output
->
nameLength
;
rep
.
nameLength
=
output
->
nameLength
;
extraLen
=
((
output
->
numCrtcs
+
extraLen
=
((
output
->
numCrtcs
+
output
->
numModes
+
output
->
numUserModes
+
output
->
numModes
+
output
->
numUserModes
+
output
->
numClones
+
output
->
numClones
+
((
rep
.
nameLength
+
3
)
>>
2
))
<<
2
);
((
rep
.
nameLength
+
3
)
>>
2
))
<<
2
);
if
(
extraLen
)
{
if
(
extraLen
)
rep
.
length
+=
extraLen
>>
2
;
{
extra
=
xalloc
(
extraLen
);
rep
.
length
+=
extraLen
>>
2
;
if
(
!
extra
)
extra
=
xalloc
(
extraLen
);
return
BadAlloc
;
if
(
!
extra
)
return
BadAlloc
;
}
}
else
else
extra
=
NULL
;
extra
=
NULL
;
crtcs
=
(
RRCrtc
*
)
extra
;
crtcs
=
(
RRCrtc
*
)
extra
;
modes
=
(
RRMode
*
)
(
crtcs
+
output
->
numCrtcs
);
modes
=
(
RRMode
*
)
(
crtcs
+
output
->
numCrtcs
);
clones
=
(
RROutput
*
)
(
modes
+
output
->
numModes
+
output
->
numUserModes
);
clones
=
(
RROutput
*
)
(
modes
+
output
->
numModes
+
output
->
numUserModes
);
name
=
(
char
*
)
(
clones
+
output
->
numClones
);
name
=
(
char
*
)
(
clones
+
output
->
numClones
);
for
(
i
=
0
;
i
<
output
->
numCrtcs
;
i
++
)
for
(
i
=
0
;
i
<
output
->
numCrtcs
;
i
++
)
{
{
crtcs
[
i
]
=
output
->
crtcs
[
i
]
->
id
;
crtcs
[
i
]
=
output
->
crtcs
[
i
]
->
id
;
if
(
client
->
swapped
)
if
(
client
->
swapped
)
swapl
(
&
crtcs
[
i
],
n
);
swapl
(
&
crtcs
[
i
],
n
);
}
}
for
(
i
=
0
;
i
<
output
->
numModes
+
output
->
numUserModes
;
i
++
)
for
(
i
=
0
;
i
<
output
->
numModes
+
output
->
numUserModes
;
i
++
)
{
{
if
(
i
<
output
->
numModes
)
if
(
i
<
output
->
numModes
)
modes
[
i
]
=
output
->
modes
[
i
]
->
mode
.
id
;
modes
[
i
]
=
output
->
modes
[
i
]
->
mode
.
id
;
else
else
modes
[
i
]
=
output
->
userModes
[
i
-
output
->
numModes
]
->
mode
.
id
;
modes
[
i
]
=
output
->
userModes
[
i
-
output
->
numModes
]
->
mode
.
id
;
if
(
client
->
swapped
)
if
(
client
->
swapped
)
swapl
(
&
modes
[
i
],
n
);
swapl
(
&
modes
[
i
],
n
);
}
}
for
(
i
=
0
;
i
<
output
->
numClones
;
i
++
)
for
(
i
=
0
;
i
<
output
->
numClones
;
i
++
)
{
{
clones
[
i
]
=
output
->
clones
[
i
]
->
id
;
clones
[
i
]
=
output
->
clones
[
i
]
->
id
;
if
(
client
->
swapped
)
if
(
client
->
swapped
)
swapl
(
&
clones
[
i
],
n
);
swapl
(
&
clones
[
i
],
n
);
}
}
memcpy
(
name
,
output
->
name
,
output
->
nameLength
);
memcpy
(
name
,
output
->
name
,
output
->
nameLength
);
if
(
client
->
swapped
)
{
if
(
client
->
swapped
)
{
swaps
(
&
rep
.
sequenceNumber
,
n
);
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
timestamp
,
n
);
swapl
(
&
rep
.
timestamp
,
n
);
swapl
(
&
rep
.
crtc
,
n
);
swapl
(
&
rep
.
crtc
,
n
);
swapl
(
&
rep
.
mmWidth
,
n
);
swapl
(
&
rep
.
mmWidth
,
n
);
swapl
(
&
rep
.
mmHeight
,
n
);
swapl
(
&
rep
.
mmHeight
,
n
);
swaps
(
&
rep
.
nCrtcs
,
n
);
swaps
(
&
rep
.
nCrtcs
,
n
);
swaps
(
&
rep
.
nModes
,
n
);
swaps
(
&
rep
.
nModes
,
n
);
swaps
(
&
rep
.
nClones
,
n
);
swaps
(
&
rep
.
nClones
,
n
);
swaps
(
&
rep
.
nameLength
,
n
);
swaps
(
&
rep
.
nameLength
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xRRGetOutputInfoReply
),
(
char
*
)
&
rep
);
WriteToClient
(
client
,
sizeof
(
xRRGetOutputInfoReply
),
(
char
*
)
&
rep
);
if
(
extraLen
)
if
(
extraLen
)
{
{
WriteToClient
(
client
,
extraLen
,
(
char
*
)
extra
);
WriteToClient
(
client
,
extraLen
,
(
char
*
)
extra
);
xfree
(
extra
);
xfree
(
extra
);
}
}
return
client
->
noClientException
;
return
client
->
noClientException
;
...
...
nx-X11/programs/Xserver/randr/rrpointer.c
View file @
e440ea76
...
@@ -31,19 +31,19 @@
...
@@ -31,19 +31,19 @@
*/
*/
static
Bool
static
Bool
RRCrtcContainsPosition
(
RRCrtcPtr
crtc
,
int
x
,
int
y
)
RRCrtcContainsPosition
(
RRCrtcPtr
crtc
,
int
x
,
int
y
)
{
{
RRModePtr
mode
=
crtc
->
mode
;
RRModePtr
mode
=
crtc
->
mode
;
int
scan_width
,
scan_height
;
int
scan_width
,
scan_height
;
if
(
!
mode
)
if
(
!
mode
)
return
FALSE
;
return
FALSE
;
RRCrtcGetScanoutSize
(
crtc
,
&
scan_width
,
&
scan_height
);
RRCrtcGetScanoutSize
(
crtc
,
&
scan_width
,
&
scan_height
);
if
(
crtc
->
x
<=
x
&&
x
<
crtc
->
x
+
scan_width
&&
if
(
crtc
->
x
<=
x
&&
x
<
crtc
->
x
+
scan_width
&&
crtc
->
y
<=
y
&&
y
<
crtc
->
y
+
scan_height
)
crtc
->
y
<=
y
&&
y
<
crtc
->
y
+
scan_height
)
return
TRUE
;
return
TRUE
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -51,80 +51,76 @@ RRCrtcContainsPosition (RRCrtcPtr crtc, int x, int y)
...
@@ -51,80 +51,76 @@ RRCrtcContainsPosition (RRCrtcPtr crtc, int x, int y)
* Find the CRTC nearest the specified position, ignoring 'skip'
* Find the CRTC nearest the specified position, ignoring 'skip'
*/
*/
static
void
static
void
RRPointerToNearestCrtc
(
ScreenPtr
pScreen
,
int
x
,
int
y
,
RRCrtcPtr
skip
)
RRPointerToNearestCrtc
(
ScreenPtr
pScreen
,
int
x
,
int
y
,
RRCrtcPtr
skip
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
int
c
;
int
c
;
RRCrtcPtr
nearest
=
NULL
;
RRCrtcPtr
nearest
=
NULL
;
int
best
=
0
;
int
best
=
0
;
int
best_dx
=
0
,
best_dy
=
0
;
int
best_dx
=
0
,
best_dy
=
0
;
for
(
c
=
0
;
c
<
pScrPriv
->
numCrtcs
;
c
++
)
for
(
c
=
0
;
c
<
pScrPriv
->
numCrtcs
;
c
++
)
{
{
RRCrtcPtr
crtc
=
pScrPriv
->
crtcs
[
c
];
RRCrtcPtr
crtc
=
pScrPriv
->
crtcs
[
c
];
RRModePtr
mode
=
crtc
->
mode
;
RRModePtr
mode
=
crtc
->
mode
;
int
dx
,
dy
;
int
dx
,
dy
;
int
dist
;
int
dist
;
int
scan_width
,
scan_height
;
int
scan_width
,
scan_height
;
if
(
!
mode
)
if
(
!
mode
)
continue
;
continue
;
if
(
crtc
==
skip
)
if
(
crtc
==
skip
)
continue
;
continue
;
RRCrtcGetScanoutSize
(
crtc
,
&
scan_width
,
&
scan_height
);
RRCrtcGetScanoutSize
(
crtc
,
&
scan_width
,
&
scan_height
);
if
(
x
<
crtc
->
x
)
if
(
x
<
crtc
->
x
)
dx
=
crtc
->
x
-
x
;
dx
=
crtc
->
x
-
x
;
else
if
(
x
>
crtc
->
x
+
scan_width
)
else
if
(
x
>
crtc
->
x
+
scan_width
)
dx
=
x
-
(
crtc
->
x
+
scan_width
);
dx
=
x
-
(
crtc
->
x
+
scan_width
);
else
else
dx
=
0
;
dx
=
0
;
if
(
y
<
crtc
->
y
)
if
(
y
<
crtc
->
y
)
dy
=
crtc
->
y
-
x
;
dy
=
crtc
->
y
-
x
;
else
if
(
y
>
crtc
->
y
+
scan_height
)
else
if
(
y
>
crtc
->
y
+
scan_height
)
dy
=
y
-
(
crtc
->
y
+
scan_height
);
dy
=
y
-
(
crtc
->
y
+
scan_height
);
else
else
dy
=
0
;
dy
=
0
;
dist
=
dx
+
dy
;
dist
=
dx
+
dy
;
if
(
!
nearest
||
dist
<
best
)
{
if
(
!
nearest
||
dist
<
best
)
nearest
=
crtc
;
{
best_dx
=
dx
;
nearest
=
crtc
;
best_dy
=
dy
;
best_dx
=
dx
;
}
best_dy
=
dy
;
}
}
}
if
(
best_dx
||
best_dy
)
if
(
best_dx
||
best_dy
)
(
*
pScreen
->
SetCursorPosition
)
(
pScreen
,
x
+
best_dx
,
y
+
best_dy
,
TRUE
);
(
*
pScreen
->
SetCursorPosition
)
(
pScreen
,
x
+
best_dx
,
y
+
best_dy
,
TRUE
);
pScrPriv
->
pointerCrtc
=
nearest
;
pScrPriv
->
pointerCrtc
=
nearest
;
}
}
void
void
RRPointerMoved
(
ScreenPtr
pScreen
,
int
x
,
int
y
)
RRPointerMoved
(
ScreenPtr
pScreen
,
int
x
,
int
y
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
RRCrtcPtr
pointerCrtc
=
pScrPriv
->
pointerCrtc
;
RRCrtcPtr
pointerCrtc
=
pScrPriv
->
pointerCrtc
;
int
c
;
int
c
;
/* Check last known CRTC */
/* Check last known CRTC */
if
(
pointerCrtc
&&
RRCrtcContainsPosition
(
pointerCrtc
,
x
,
y
))
if
(
pointerCrtc
&&
RRCrtcContainsPosition
(
pointerCrtc
,
x
,
y
))
return
;
return
;
/* Check all CRTCs */
/* Check all CRTCs */
for
(
c
=
0
;
c
<
pScrPriv
->
numCrtcs
;
c
++
)
for
(
c
=
0
;
c
<
pScrPriv
->
numCrtcs
;
c
++
)
{
{
RRCrtcPtr
crtc
=
pScrPriv
->
crtcs
[
c
];
RRCrtcPtr
crtc
=
pScrPriv
->
crtcs
[
c
];
if
(
RRCrtcContainsPosition
(
crtc
,
x
,
y
))
{
if
(
RRCrtcContainsPosition
(
crtc
,
x
,
y
))
/* Remember containing CRTC */
{
pScrPriv
->
pointerCrtc
=
crtc
;
/* Remember containing CRTC */
return
;
pScrPriv
->
pointerCrtc
=
crtc
;
}
return
;
}
}
}
/* None contain pointer, find nearest */
/* None contain pointer, find nearest */
RRPointerToNearestCrtc
(
pScreen
,
x
,
y
,
pointerCrtc
);
RRPointerToNearestCrtc
(
pScreen
,
x
,
y
,
pointerCrtc
);
}
}
/*
/*
...
@@ -132,14 +128,14 @@ RRPointerMoved (ScreenPtr pScreen, int x, int y)
...
@@ -132,14 +128,14 @@ RRPointerMoved (ScreenPtr pScreen, int x, int y)
* CRTC
* CRTC
*/
*/
void
void
RRPointerScreenConfigured
(
ScreenPtr
pScreen
)
RRPointerScreenConfigured
(
ScreenPtr
pScreen
)
{
{
WindowPtr
pRoot
=
GetCurrentRootWindow
();
WindowPtr
pRoot
=
GetCurrentRootWindow
();
ScreenPtr
pCurrentScreen
=
pRoot
?
pRoot
->
drawable
.
pScreen
:
NULL
;
ScreenPtr
pCurrentScreen
=
pRoot
?
pRoot
->
drawable
.
pScreen
:
NULL
;
int
x
,
y
;
int
x
,
y
;
if
(
pScreen
!=
pCurrentScreen
)
if
(
pScreen
!=
pCurrentScreen
)
return
;
return
;
GetSpritePosition
(
&
x
,
&
y
);
GetSpritePosition
(
&
x
,
&
y
);
RRPointerToNearestCrtc
(
pScreen
,
x
,
y
,
NULL
);
RRPointerToNearestCrtc
(
pScreen
,
x
,
y
,
NULL
);
}
}
nx-X11/programs/Xserver/randr/rrproperty.c
View file @
e440ea76
...
@@ -25,37 +25,37 @@
...
@@ -25,37 +25,37 @@
#include "swaprep.h"
#include "swaprep.h"
static
void
static
void
RRDeliverEvent
(
ScreenPtr
pScreen
,
xEvent
*
event
,
CARD32
mask
)
RRDeliverEvent
(
ScreenPtr
pScreen
,
xEvent
*
event
,
CARD32
mask
)
{
{
}
}
void
void
RRDeleteAllOutputProperties
(
RROutputPtr
output
)
RRDeleteAllOutputProperties
(
RROutputPtr
output
)
{
{
RRPropertyPtr
prop
,
next
;
RRPropertyPtr
prop
,
next
;
xRROutputPropertyNotifyEvent
event
;
xRROutputPropertyNotifyEvent
event
;
for
(
prop
=
output
->
properties
;
prop
;
prop
=
next
)
for
(
prop
=
output
->
properties
;
prop
;
prop
=
next
)
{
{
next
=
prop
->
next
;
next
=
prop
->
next
;
event
.
type
=
RREventBase
+
RRNotify
;
event
.
type
=
RREventBase
+
RRNotif
y
;
event
.
subCode
=
RRNotify_OutputPropert
y
;
event
.
subCode
=
RRNotify_OutputProperty
;
event
.
output
=
output
->
id
;
event
.
output
=
output
->
id
;
event
.
state
=
PropertyDelete
;
event
.
state
=
PropertyDelet
e
;
event
.
atom
=
prop
->
propertyNam
e
;
event
.
atom
=
prop
->
propertyName
;
event
.
timestamp
=
currentTime
.
milliseconds
;
event
.
timestamp
=
currentTime
.
milliseconds
;
RRDeliverEvent
(
output
->
pScreen
,
(
xEvent
*
)
&
event
,
RRDeliverEvent
(
output
->
pScreen
,
(
xEvent
*
)
&
event
,
RROutputPropertyNotifyMask
);
RROutputPropertyNotifyMask
);
if
(
prop
->
current
.
data
)
if
(
prop
->
current
.
data
)
xfree
(
prop
->
current
.
data
);
xfree
(
prop
->
current
.
data
);
if
(
prop
->
pending
.
data
)
if
(
prop
->
pending
.
data
)
xfree
(
prop
->
pending
.
data
);
xfree
(
prop
->
pending
.
data
);
xfree
(
prop
);
xfree
(
prop
);
}
}
}
}
static
void
static
void
RRInitOutputPropertyValue
(
RRPropertyValuePtr
property_value
)
RRInitOutputPropertyValue
(
RRPropertyValuePtr
property_value
)
{
{
property_value
->
type
=
None
;
property_value
->
type
=
None
;
property_value
->
format
=
0
;
property_value
->
format
=
0
;
...
@@ -64,13 +64,13 @@ RRInitOutputPropertyValue (RRPropertyValuePtr property_value)
...
@@ -64,13 +64,13 @@ RRInitOutputPropertyValue (RRPropertyValuePtr property_value)
}
}
static
RRPropertyPtr
static
RRPropertyPtr
RRCreateOutputProperty
(
Atom
property
)
RRCreateOutputProperty
(
Atom
property
)
{
{
RRPropertyPtr
prop
;
RRPropertyPtr
prop
;
prop
=
(
RRPropertyPtr
)
xalloc
(
sizeof
(
RRPropertyRec
));
prop
=
(
RRPropertyPtr
)
xalloc
(
sizeof
(
RRPropertyRec
));
if
(
!
prop
)
if
(
!
prop
)
return
NULL
;
return
NULL
;
prop
->
next
=
NULL
;
prop
->
next
=
NULL
;
prop
->
propertyName
=
property
;
prop
->
propertyName
=
property
;
prop
->
is_pending
=
FALSE
;
prop
->
is_pending
=
FALSE
;
...
@@ -78,276 +78,267 @@ RRCreateOutputProperty (Atom property)
...
@@ -78,276 +78,267 @@ RRCreateOutputProperty (Atom property)
prop
->
immutable
=
FALSE
;
prop
->
immutable
=
FALSE
;
prop
->
num_valid
=
0
;
prop
->
num_valid
=
0
;
prop
->
valid_values
=
NULL
;
prop
->
valid_values
=
NULL
;
RRInitOutputPropertyValue
(
&
prop
->
current
);
RRInitOutputPropertyValue
(
&
prop
->
current
);
RRInitOutputPropertyValue
(
&
prop
->
pending
);
RRInitOutputPropertyValue
(
&
prop
->
pending
);
return
prop
;
return
prop
;
}
}
static
void
static
void
RRDestroyOutputProperty
(
RRPropertyPtr
prop
)
RRDestroyOutputProperty
(
RRPropertyPtr
prop
)
{
{
if
(
prop
->
valid_values
)
if
(
prop
->
valid_values
)
xfree
(
prop
->
valid_values
);
xfree
(
prop
->
valid_values
);
if
(
prop
->
current
.
data
)
if
(
prop
->
current
.
data
)
xfree
(
prop
->
current
.
data
);
xfree
(
prop
->
current
.
data
);
if
(
prop
->
pending
.
data
)
if
(
prop
->
pending
.
data
)
xfree
(
prop
->
pending
.
data
);
xfree
(
prop
->
pending
.
data
);
xfree
(
prop
);
xfree
(
prop
);
}
}
void
void
RRDeleteOutputProperty
(
RROutputPtr
output
,
Atom
property
)
RRDeleteOutputProperty
(
RROutputPtr
output
,
Atom
property
)
{
{
RRPropertyPtr
prop
,
*
prev
;
RRPropertyPtr
prop
,
*
prev
;
xRROutputPropertyNotifyEvent
event
;
xRROutputPropertyNotifyEvent
event
;
for
(
prev
=
&
output
->
properties
;
(
prop
=
*
prev
);
prev
=
&
(
prop
->
next
))
for
(
prev
=
&
output
->
properties
;
(
prop
=
*
prev
);
prev
=
&
(
prop
->
next
))
if
(
prop
->
propertyName
==
property
)
if
(
prop
->
propertyName
==
property
)
break
;
break
;
if
(
prop
)
if
(
prop
)
{
{
*
prev
=
prop
->
next
;
*
prev
=
prop
->
next
;
event
.
type
=
RREventBase
+
RRNotify
;
event
.
type
=
RREventBase
+
RRNotif
y
;
event
.
subCode
=
RRNotify_OutputPropert
y
;
event
.
subCode
=
RRNotify_OutputProperty
;
event
.
output
=
output
->
id
;
event
.
output
=
output
->
id
;
event
.
state
=
PropertyDelete
;
event
.
state
=
PropertyDelet
e
;
event
.
atom
=
prop
->
propertyNam
e
;
event
.
atom
=
prop
->
propertyName
;
event
.
timestamp
=
currentTime
.
milliseconds
;
event
.
timestamp
=
currentTime
.
milliseconds
;
RRDeliverEvent
(
output
->
pScreen
,
(
xEvent
*
)
&
event
,
RRDeliverEvent
(
output
->
pScreen
,
(
xEvent
*
)
&
event
,
RROutputPropertyNotifyMask
);
RROutputPropertyNotifyMask
);
RRDestroyOutputProperty
(
prop
);
RRDestroyOutputProperty
(
prop
);
}
}
}
}
int
int
RRChangeOutputProperty
(
RROutputPtr
output
,
Atom
property
,
Atom
type
,
RRChangeOutputProperty
(
RROutputPtr
output
,
Atom
property
,
Atom
type
,
int
format
,
int
mode
,
unsigned
long
len
,
int
format
,
int
mode
,
unsigned
long
len
,
void
*
value
,
Bool
sendevent
,
Bool
pending
)
void
*
value
,
Bool
sendevent
,
Bool
pending
)
{
{
RRPropertyPtr
prop
;
RRPropertyPtr
prop
;
xRROutputPropertyNotifyEvent
event
;
xRROutputPropertyNotifyEvent
event
;
rrScrPrivPtr
pScrPriv
=
rrGetScrPriv
(
output
->
pScreen
);
rrScrPrivPtr
pScrPriv
=
rrGetScrPriv
(
output
->
pScreen
);
int
size_in_bytes
;
int
size_in_bytes
;
int
total_size
;
int
total_size
;
unsigned
long
total_len
;
unsigned
long
total_len
;
RRPropertyValuePtr
prop_value
;
RRPropertyValuePtr
prop_value
;
RRPropertyValueRec
new_value
;
RRPropertyValueRec
new_value
;
Bool
add
=
FALSE
;
Bool
add
=
FALSE
;
size_in_bytes
=
format
>>
3
;
size_in_bytes
=
format
>>
3
;
/* first see if property already exists */
/* first see if property already exists */
prop
=
RRQueryOutputProperty
(
output
,
property
);
prop
=
RRQueryOutputProperty
(
output
,
property
);
if
(
!
prop
)
/* just add to list */
if
(
!
prop
)
{
/* just add to list */
{
prop
=
RRCreateOutputProperty
(
property
);
prop
=
RRCreateOutputProperty
(
property
);
if
(
!
prop
)
if
(
!
prop
)
return
(
BadAlloc
);
return
(
BadAlloc
);
add
=
TRUE
;
add
=
TRUE
;
mode
=
PropModeReplace
;
mode
=
PropModeReplace
;
}
}
if
(
pending
&&
prop
->
is_pending
)
if
(
pending
&&
prop
->
is_pending
)
prop_value
=
&
prop
->
pending
;
prop_value
=
&
prop
->
pending
;
else
else
prop_value
=
&
prop
->
current
;
prop_value
=
&
prop
->
current
;
/* To append or prepend to a property the request format and type
/* To append or prepend to a property the request format and type
must match those of the already defined property. The
must match those of the already defined property. The
existing format and type are irrelevant when using the mode
existing format and type are irrelevant when using the mode
"PropModeReplace" since they will be written over. */
"PropModeReplace" since they will be written over. */
if
((
format
!=
prop_value
->
format
)
&&
(
mode
!=
PropModeReplace
))
if
((
format
!=
prop_value
->
format
)
&&
(
mode
!=
PropModeReplace
))
return
(
BadMatch
);
return
(
BadMatch
);
if
((
prop_value
->
type
!=
type
)
&&
(
mode
!=
PropModeReplace
))
if
((
prop_value
->
type
!=
type
)
&&
(
mode
!=
PropModeReplace
))
return
(
BadMatch
);
return
(
BadMatch
);
new_value
=
*
prop_value
;
new_value
=
*
prop_value
;
if
(
mode
==
PropModeReplace
)
if
(
mode
==
PropModeReplace
)
total_len
=
len
;
total_len
=
len
;
else
else
total_len
=
prop_value
->
size
+
len
;
total_len
=
prop_value
->
size
+
len
;
if
(
mode
==
PropModeReplace
||
len
>
0
)
if
(
mode
==
PropModeReplace
||
len
>
0
)
{
{
void
*
new_data
=
NULL
,
*
old_data
=
NULL
;
void
*
new_data
=
NULL
,
*
old_data
=
NULL
;
total_size
=
total_len
*
size_in_bytes
;
total_size
=
total_len
*
size_in_bytes
;
new_value
.
data
=
(
void
*
)
xalloc
(
total_size
);
new_value
.
data
=
(
void
*
)
xalloc
(
total_size
);
if
(
!
new_value
.
data
&&
total_size
)
{
if
(
!
new_value
.
data
&&
total_size
)
if
(
add
)
{
RRDestroyOutputProperty
(
prop
);
if
(
add
)
return
BadAlloc
;
RRDestroyOutputProperty
(
prop
);
}
return
BadAlloc
;
new_value
.
size
=
len
;
}
new_value
.
type
=
type
;
new_value
.
size
=
len
;
new_value
.
format
=
format
;
new_value
.
type
=
type
;
new_value
.
format
=
format
;
switch
(
mode
)
{
case
PropModeReplace
:
switch
(
mode
)
{
new_data
=
new_value
.
data
;
case
PropModeReplace
:
old_data
=
NULL
;
new_data
=
new_value
.
data
;
break
;
old_data
=
NULL
;
case
PropModeAppend
:
break
;
new_data
=
(
void
*
)
(((
char
*
)
new_value
.
data
)
+
case
PropModeAppend
:
(
prop_value
->
size
*
size_in_bytes
));
new_data
=
(
void
*
)
(((
char
*
)
new_value
.
data
)
+
old_data
=
new_value
.
data
;
(
prop_value
->
size
*
size_in_bytes
));
break
;
old_data
=
new_value
.
data
;
case
PropModePrepend
:
break
;
new_data
=
new_value
.
data
;
case
PropModePrepend
:
old_data
=
(
void
*
)
(((
char
*
)
new_value
.
data
)
+
new_data
=
new_value
.
data
;
(
prop_value
->
size
*
size_in_bytes
));
old_data
=
(
void
*
)
(((
char
*
)
new_value
.
data
)
+
break
;
(
prop_value
->
size
*
size_in_bytes
));
}
break
;
if
(
new_data
)
}
memcpy
((
char
*
)
new_data
,
(
char
*
)
value
,
len
*
size_in_bytes
);
if
(
new_data
)
if
(
old_data
)
memcpy
((
char
*
)
new_data
,
(
char
*
)
value
,
len
*
size_in_bytes
);
memcpy
((
char
*
)
old_data
,
(
char
*
)
prop_value
->
data
,
if
(
old_data
)
prop_value
->
size
*
size_in_bytes
);
memcpy
((
char
*
)
old_data
,
(
char
*
)
prop_value
->
data
,
prop_value
->
size
*
size_in_bytes
);
if
(
pending
&&
pScrPriv
->
rrOutputSetProperty
&&
!
pScrPriv
->
rrOutputSetProperty
(
output
->
pScreen
,
output
,
if
(
pending
&&
pScrPriv
->
rrOutputSetProperty
&&
prop
->
propertyName
,
&
new_value
))
{
!
pScrPriv
->
rrOutputSetProperty
(
output
->
pScreen
,
output
,
if
(
new_value
.
data
)
prop
->
propertyName
,
&
new_value
))
xfree
(
new_value
.
data
);
{
return
(
BadValue
);
if
(
new_value
.
data
)
}
xfree
(
new_value
.
data
);
if
(
prop_value
->
data
)
return
(
BadValue
);
xfree
(
prop_value
->
data
);
}
*
prop_value
=
new_value
;
if
(
prop_value
->
data
)
}
xfree
(
prop_value
->
data
);
*
prop_value
=
new_value
;
else
if
(
len
==
0
)
{
}
/* do nothing */
}
else
if
(
len
==
0
)
{
if
(
add
)
{
/* do nothing */
prop
->
next
=
output
->
properties
;
}
output
->
properties
=
prop
;
if
(
add
)
{
prop
->
next
=
output
->
properties
;
output
->
properties
=
prop
;
}
}
if
(
pending
&&
prop
->
is_pending
)
if
(
pending
&&
prop
->
is_pending
)
output
->
pendingProperties
=
TRUE
;
output
->
pendingProperties
=
TRUE
;
if
(
sendevent
)
if
(
sendevent
)
{
{
event
.
type
=
RREventBase
+
RRNotify
;
event
.
type
=
RREventBase
+
RRNotif
y
;
event
.
subCode
=
RRNotify_OutputPropert
y
;
event
.
subCode
=
RRNotify_OutputProperty
;
event
.
output
=
output
->
id
;
event
.
output
=
output
->
id
;
event
.
state
=
PropertyNewValue
;
event
.
state
=
PropertyNewValu
e
;
event
.
atom
=
prop
->
propertyNam
e
;
event
.
atom
=
prop
->
propertyName
;
event
.
timestamp
=
currentTime
.
milliseconds
;
event
.
timestamp
=
currentTime
.
milliseconds
;
RRDeliverEvent
(
output
->
pScreen
,
(
xEvent
*
)
&
event
,
RRDeliverEvent
(
output
->
pScreen
,
(
xEvent
*
)
&
event
,
RROutputPropertyNotifyMask
);
RROutputPropertyNotifyMask
);
}
}
return
(
Success
);
return
(
Success
);
}
}
Bool
Bool
RRPostPendingProperties
(
RROutputPtr
output
)
RRPostPendingProperties
(
RROutputPtr
output
)
{
{
RRPropertyValuePtr
pending_value
;
RRPropertyValuePtr
pending_value
;
RRPropertyValuePtr
current_value
;
RRPropertyValuePtr
current_value
;
RRPropertyPtr
property
;
RRPropertyPtr
property
;
Bool
ret
=
TRUE
;
Bool
ret
=
TRUE
;
if
(
!
output
->
pendingProperties
)
if
(
!
output
->
pendingProperties
)
return
TRUE
;
return
TRUE
;
output
->
pendingProperties
=
FALSE
;
output
->
pendingProperties
=
FALSE
;
for
(
property
=
output
->
properties
;
property
;
property
=
property
->
next
)
for
(
property
=
output
->
properties
;
property
;
property
=
property
->
next
)
{
{
/* Skip non-pending properties */
/* Skip non-pending properties */
if
(
!
property
->
is_pending
)
if
(
!
property
->
is_pending
)
continue
;
continue
;
pending_value
=
&
property
->
pending
;
pending_value
=
&
property
->
pending
;
current_value
=
&
property
->
current
;
current_value
=
&
property
->
current
;
/*
/*
* If the pending and current values are equal, don't mark it
* If the pending and current values are equal, don't mark it
* as changed (which would deliver an event)
* as changed (which would deliver an event)
*/
*/
if
(
pending_value
->
type
==
current_value
->
type
&&
if
(
pending_value
->
type
==
current_value
->
type
&&
pending_value
->
format
==
current_value
->
format
&&
pending_value
->
format
==
current_value
->
format
&&
pending_value
->
size
==
current_value
->
size
&&
pending_value
->
size
==
current_value
->
size
&&
!
memcmp
(
pending_value
->
data
,
current_value
->
data
,
!
memcmp
(
pending_value
->
data
,
current_value
->
data
,
pending_value
->
size
))
pending_value
->
size
))
continue
;
continue
;
if
(
RRChangeOutputProperty
(
output
,
property
->
propertyName
,
if
(
RRChangeOutputProperty
(
output
,
property
->
propertyName
,
pending_value
->
type
,
pending_value
->
format
,
pending_value
->
type
,
pending_value
->
format
,
PropModeReplace
,
pending_value
->
size
,
PropModeReplace
,
pending_value
->
size
,
pending_value
->
data
,
TRUE
,
FALSE
)
!=
Success
)
pending_value
->
data
,
TRUE
,
ret
=
FALSE
;
FALSE
)
!=
Success
)
ret
=
FALSE
;
}
}
return
ret
;
return
ret
;
}
}
RRPropertyPtr
RRPropertyPtr
RRQueryOutputProperty
(
RROutputPtr
output
,
Atom
property
)
RRQueryOutputProperty
(
RROutputPtr
output
,
Atom
property
)
{
{
RRPropertyPtr
prop
;
RRPropertyPtr
prop
;
for
(
prop
=
output
->
properties
;
prop
;
prop
=
prop
->
next
)
for
(
prop
=
output
->
properties
;
prop
;
prop
=
prop
->
next
)
if
(
prop
->
propertyName
==
property
)
if
(
prop
->
propertyName
==
property
)
return
prop
;
return
prop
;
return
NULL
;
return
NULL
;
}
}
RRPropertyValuePtr
RRPropertyValuePtr
RRGetOutputProperty
(
RROutputPtr
output
,
Atom
property
,
Bool
pending
)
RRGetOutputProperty
(
RROutputPtr
output
,
Atom
property
,
Bool
pending
)
{
{
RRPropertyPtr
prop
=
RRQueryOutputProperty
(
output
,
property
);
RRPropertyPtr
prop
=
RRQueryOutputProperty
(
output
,
property
);
if
(
!
prop
)
if
(
!
prop
)
return
NULL
;
return
NULL
;
if
(
pending
&&
prop
->
is_pending
)
if
(
pending
&&
prop
->
is_pending
)
return
&
prop
->
pending
;
return
&
prop
->
pending
;
else
else
return
&
prop
->
current
;
return
&
prop
->
current
;
}
}
int
int
RRConfigureOutputProperty
(
RROutputPtr
output
,
Atom
property
,
RRConfigureOutputProperty
(
RROutputPtr
output
,
Atom
property
,
Bool
pending
,
Bool
range
,
Bool
immutable
,
Bool
pending
,
Bool
range
,
Bool
immutable
,
int
num_values
,
INT32
*
values
)
int
num_values
,
INT32
*
values
)
{
{
RRPropertyPtr
prop
=
RRQueryOutputProperty
(
output
,
property
);
RRPropertyPtr
prop
=
RRQueryOutputProperty
(
output
,
property
);
Bool
add
=
FALSE
;
Bool
add
=
FALSE
;
INT32
*
new_values
;
INT32
*
new_values
;
if
(
!
prop
)
if
(
!
prop
)
{
{
prop
=
RRCreateOutputProperty
(
property
);
prop
=
RRCreateOutputProperty
(
property
);
if
(
!
prop
)
if
(
!
prop
)
return
(
BadAlloc
);
return
(
BadAlloc
)
;
add
=
TRUE
;
add
=
TRUE
;
}
}
else
if
(
prop
->
immutable
&&
!
immutable
)
else
if
(
prop
->
immutable
&&
!
immutable
)
return
(
BadAccess
);
return
(
BadAccess
);
/*
/*
* ranges must have even number of values
* ranges must have even number of values
*/
*/
if
(
range
&&
(
num_values
&
1
))
if
(
range
&&
(
num_values
&
1
))
return
BadMatch
;
return
BadMatch
;
new_values
=
xalloc
(
num_values
*
sizeof
(
INT32
));
new_values
=
xalloc
(
num_values
*
sizeof
(
INT32
));
if
(
!
new_values
&&
num_values
)
if
(
!
new_values
&&
num_values
)
return
BadAlloc
;
return
BadAlloc
;
if
(
num_values
)
if
(
num_values
)
memcpy
(
new_values
,
values
,
num_values
*
sizeof
(
INT32
));
memcpy
(
new_values
,
values
,
num_values
*
sizeof
(
INT32
));
/*
/*
* Property moving from pending to non-pending
* Property moving from pending to non-pending
* loses any pending values
* loses any pending values
*/
*/
if
(
prop
->
is_pending
&&
!
pending
)
if
(
prop
->
is_pending
&&
!
pending
)
{
{
if
(
prop
->
pending
.
data
)
if
(
prop
->
pending
.
data
)
xfree
(
prop
->
pending
.
data
);
xfree
(
prop
->
pending
.
data
);
RRInitOutputPropertyValue
(
&
prop
->
pending
);
RRInitOutputPropertyValue
(
&
prop
->
pending
);
}
}
prop
->
is_pending
=
pending
;
prop
->
is_pending
=
pending
;
...
@@ -355,89 +346,88 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
...
@@ -355,89 +346,88 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
prop
->
immutable
=
immutable
;
prop
->
immutable
=
immutable
;
prop
->
num_valid
=
num_values
;
prop
->
num_valid
=
num_values
;
if
(
prop
->
valid_values
)
if
(
prop
->
valid_values
)
xfree
(
prop
->
valid_values
);
xfree
(
prop
->
valid_values
);
prop
->
valid_values
=
new_values
;
prop
->
valid_values
=
new_values
;
if
(
add
)
{
if
(
add
)
{
prop
->
next
=
output
->
properties
;
prop
->
next
=
output
->
properties
;
output
->
properties
=
prop
;
output
->
properties
=
prop
;
}
}
return
Success
;
return
Success
;
}
}
int
int
ProcRRListOutputProperties
(
ClientPtr
client
)
ProcRRListOutputProperties
(
ClientPtr
client
)
{
{
REQUEST
(
xRRListOutputPropertiesReq
);
REQUEST
(
xRRListOutputPropertiesReq
);
Atom
*
pAtoms
=
NULL
,
*
temppAtoms
;
Atom
*
pAtoms
=
NULL
,
*
temppAtoms
;
xRRListOutputPropertiesReply
rep
;
xRRListOutputPropertiesReply
rep
;
int
numProps
=
0
;
int
numProps
=
0
;
RROutputPtr
output
;
RROutputPtr
output
;
RRPropertyPtr
prop
;
RRPropertyPtr
prop
;
REQUEST_SIZE_MATCH
(
xRRListOutputPropertiesReq
);
REQUEST_SIZE_MATCH
(
xRRListOutputPropertiesReq
);
output
=
LookupOutput
(
client
,
stuff
->
output
,
DixReadAccess
);
output
=
LookupOutput
(
client
,
stuff
->
output
,
DixReadAccess
);
if
(
!
output
)
if
(
!
output
)
return
RRErrorBase
+
BadRROutput
;
return
RRErrorBase
+
BadRROutput
;
for
(
prop
=
output
->
properties
;
prop
;
prop
=
prop
->
next
)
for
(
prop
=
output
->
properties
;
prop
;
prop
=
prop
->
next
)
numProps
++
;
numProps
++
;
if
(
numProps
)
if
(
numProps
)
if
(
!
(
pAtoms
=
(
Atom
*
)
xalloc
(
numProps
*
sizeof
(
Atom
))))
if
(
!
(
pAtoms
=
(
Atom
*
)
xalloc
(
numProps
*
sizeof
(
Atom
))))
return
(
BadAlloc
);
return
(
BadAlloc
);
rep
.
type
=
X_Reply
;
rep
.
type
=
X_Reply
;
rep
.
length
=
(
numProps
*
sizeof
(
Atom
))
>>
2
;
rep
.
length
=
(
numProps
*
sizeof
(
Atom
))
>>
2
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
nAtoms
=
numProps
;
rep
.
nAtoms
=
numProps
;
if
(
client
->
swapped
)
if
(
client
->
swapped
)
{
{
int
n
;
int
n
;
swaps
(
&
rep
.
sequenceNumber
,
n
);
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
length
,
n
);
swaps
(
&
rep
.
nAtoms
,
n
);
swaps
(
&
rep
.
nAtoms
,
n
);
}
}
temppAtoms
=
pAtoms
;
temppAtoms
=
pAtoms
;
for
(
prop
=
output
->
properties
;
prop
;
prop
=
prop
->
next
)
for
(
prop
=
output
->
properties
;
prop
;
prop
=
prop
->
next
)
*
temppAtoms
++
=
prop
->
propertyName
;
*
temppAtoms
++
=
prop
->
propertyName
;
WriteToClient
(
client
,
sizeof
(
xRRListOutputPropertiesReply
),
(
char
*
)
&
rep
);
WriteToClient
(
client
,
sizeof
(
xRRListOutputPropertiesReply
),
(
char
*
)
&
rep
);
if
(
numProps
)
if
(
numProps
)
{
{
client
->
pSwapReplyFunc
=
(
ReplySwapPtr
)
Swap32Write
;
client
->
pSwapReplyFunc
=
(
ReplySwapPtr
)
Swap32Write
;
WriteSwappedDataToClient
(
client
,
numProps
*
sizeof
(
Atom
),
pAtoms
);
WriteSwappedDataToClient
(
client
,
numProps
*
sizeof
(
Atom
),
pAtoms
);
xfree
(
pAtoms
);
xfree
(
pAtoms
);
}
}
return
(
client
->
noClientException
);
return
(
client
->
noClientException
);
}
}
int
int
ProcRRQueryOutputProperty
(
ClientPtr
client
)
ProcRRQueryOutputProperty
(
ClientPtr
client
)
{
{
REQUEST
(
xRRQueryOutputPropertyReq
);
REQUEST
(
xRRQueryOutputPropertyReq
);
xRRQueryOutputPropertyReply
rep
;
xRRQueryOutputPropertyReply
rep
;
RROutputPtr
output
;
RROutputPtr
output
;
RRPropertyPtr
prop
;
RRPropertyPtr
prop
;
char
*
extra
;
char
*
extra
;
REQUEST_SIZE_MATCH
(
xRRQueryOutputPropertyReq
);
REQUEST_SIZE_MATCH
(
xRRQueryOutputPropertyReq
);
output
=
LookupOutput
(
client
,
stuff
->
output
,
DixReadAccess
);
output
=
LookupOutput
(
client
,
stuff
->
output
,
DixReadAccess
);
if
(
!
output
)
if
(
!
output
)
return
RRErrorBase
+
BadRROutput
;
return
RRErrorBase
+
BadRROutput
;
prop
=
RRQueryOutputProperty
(
output
,
stuff
->
property
);
prop
=
RRQueryOutputProperty
(
output
,
stuff
->
property
);
if
(
!
prop
)
if
(
!
prop
)
return
BadName
;
return
BadName
;
if
(
prop
->
num_valid
)
{
if
(
prop
->
num_valid
)
{
extra
=
xalloc
(
prop
->
num_valid
*
sizeof
(
INT32
));
extra
=
xalloc
(
prop
->
num_valid
*
sizeof
(
INT32
));
if
(
!
extra
)
if
(
!
extra
)
return
BadAlloc
;
return
BadAlloc
;
}
}
rep
.
type
=
X_Reply
;
rep
.
type
=
X_Reply
;
rep
.
length
=
prop
->
num_valid
;
rep
.
length
=
prop
->
num_valid
;
...
@@ -445,292 +435,279 @@ ProcRRQueryOutputProperty (ClientPtr client)
...
@@ -445,292 +435,279 @@ ProcRRQueryOutputProperty (ClientPtr client)
rep
.
pending
=
prop
->
is_pending
;
rep
.
pending
=
prop
->
is_pending
;
rep
.
range
=
prop
->
range
;
rep
.
range
=
prop
->
range
;
rep
.
immutable
=
prop
->
immutable
;
rep
.
immutable
=
prop
->
immutable
;
if
(
client
->
swapped
)
if
(
client
->
swapped
)
{
{
int
n
;
int
n
;
swaps
(
&
rep
.
sequenceNumber
,
n
);
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
length
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xRRQueryOutputPropertyReply
),
(
char
*
)
&
rep
);
WriteToClient
(
client
,
sizeof
(
xRRQueryOutputPropertyReply
),
(
char
*
)
&
rep
);
if
(
prop
->
num_valid
)
if
(
prop
->
num_valid
)
{
{
memcpy
(
extra
,
prop
->
valid_values
,
prop
->
num_valid
*
sizeof
(
INT32
));
memcpy
(
extra
,
prop
->
valid_values
,
prop
->
num_valid
*
sizeof
(
INT32
));
client
->
pSwapReplyFunc
=
(
ReplySwapPtr
)
Swap32Write
;
client
->
pSwapReplyFunc
=
(
ReplySwapPtr
)
Swap32Write
;
WriteSwappedDataToClient
(
client
,
prop
->
num_valid
*
sizeof
(
INT32
),
WriteSwappedDataToClient
(
client
,
prop
->
num_valid
*
sizeof
(
INT32
),
extra
);
extra
);
xfree
(
extra
);
xfree
(
extra
);
}
}
return
(
client
->
noClientException
);
return
(
client
->
noClientException
);
}
}
int
int
ProcRRConfigureOutputProperty
(
ClientPtr
client
)
ProcRRConfigureOutputProperty
(
ClientPtr
client
)
{
{
REQUEST
(
xRRConfigureOutputPropertyReq
);
REQUEST
(
xRRConfigureOutputPropertyReq
);
RROutputPtr
output
;
RROutputPtr
output
;
int
num_valid
;
int
num_valid
;
REQUEST_AT_LEAST_SIZE
(
xRRConfigureOutputPropertyReq
);
REQUEST_AT_LEAST_SIZE
(
xRRConfigureOutputPropertyReq
);
output
=
LookupOutput
(
client
,
stuff
->
output
,
DixReadAccess
);
output
=
LookupOutput
(
client
,
stuff
->
output
,
DixReadAccess
);
if
(
!
output
)
if
(
!
output
)
return
RRErrorBase
+
BadRROutput
;
return
RRErrorBase
+
BadRROutput
;
num_valid
=
stuff
->
length
-
(
sizeof
(
xRRConfigureOutputPropertyReq
)
>>
2
);
num_valid
=
stuff
->
length
-
(
sizeof
(
xRRConfigureOutputPropertyReq
)
>>
2
);
return
RRConfigureOutputProperty
(
output
,
stuff
->
property
,
return
RRConfigureOutputProperty
(
output
,
stuff
->
property
,
stuff
->
pending
,
stuff
->
range
,
stuff
->
pending
,
stuff
->
range
,
FALSE
,
num_valid
,
FALSE
,
num_valid
,
(
INT32
*
)
(
stuff
+
1
));
(
INT32
*
)
(
stuff
+
1
));
}
}
int
int
ProcRRChangeOutputProperty
(
ClientPtr
client
)
ProcRRChangeOutputProperty
(
ClientPtr
client
)
{
{
REQUEST
(
xRRChangeOutputPropertyReq
);
REQUEST
(
xRRChangeOutputPropertyReq
);
RROutputPtr
output
;
RROutputPtr
output
;
char
format
,
mode
;
char
format
,
mode
;
unsigned
long
len
;
unsigned
long
len
;
int
sizeInBytes
;
int
sizeInBytes
;
int
totalSize
;
int
totalSize
;
int
err
;
int
err
;
REQUEST_AT_LEAST_SIZE
(
xRRChangeOutputPropertyReq
);
REQUEST_AT_LEAST_SIZE
(
xRRChangeOutputPropertyReq
);
UpdateCurrentTime
();
UpdateCurrentTime
();
format
=
stuff
->
format
;
format
=
stuff
->
format
;
mode
=
stuff
->
mode
;
mode
=
stuff
->
mode
;
if
((
mode
!=
PropModeReplace
)
&&
(
mode
!=
PropModeAppend
)
&&
if
((
mode
!=
PropModeReplace
)
&&
(
mode
!=
PropModeAppend
)
&&
(
mode
!=
PropModePrepend
))
(
mode
!=
PropModePrepend
))
{
{
client
->
errorValue
=
mode
;
client
->
errorValue
=
mode
;
return
BadValue
;
return
BadValue
;
}
}
if
((
format
!=
8
)
&&
(
format
!=
16
)
&&
(
format
!=
32
))
{
if
((
format
!=
8
)
&&
(
format
!=
16
)
&&
(
format
!=
32
))
client
->
errorValue
=
format
;
{
client
->
errorValue
=
format
;
return
BadValue
;
return
BadValue
;
}
}
len
=
stuff
->
nUnits
;
len
=
stuff
->
nUnits
;
if
(
len
>
((
0xffffffff
-
sizeof
(
xChangePropertyReq
))
>>
2
))
if
(
len
>
((
0xffffffff
-
sizeof
(
xChangePropertyReq
))
>>
2
))
return
BadLength
;
return
BadLength
;
sizeInBytes
=
format
>>
3
;
sizeInBytes
=
format
>>
3
;
totalSize
=
len
*
sizeInBytes
;
totalSize
=
len
*
sizeInBytes
;
REQUEST_FIXED_SIZE
(
xRRChangeOutputPropertyReq
,
totalSize
);
REQUEST_FIXED_SIZE
(
xRRChangeOutputPropertyReq
,
totalSize
);
output
=
LookupOutput
(
client
,
stuff
->
output
,
DixWriteAccess
);
output
=
LookupOutput
(
client
,
stuff
->
output
,
DixWriteAccess
);
if
(
!
output
)
if
(
!
output
)
return
RRErrorBase
+
BadRROutput
;
return
RRErrorBase
+
BadRROutput
;
if
(
!
ValidAtom
(
stuff
->
property
))
if
(
!
ValidAtom
(
stuff
->
property
))
{
{
client
->
errorValue
=
stuff
->
property
;
client
->
errorValue
=
stuff
->
property
;
return
(
BadAtom
);
return
(
BadAtom
);
}
}
if
(
!
ValidAtom
(
stuff
->
type
))
if
(
!
ValidAtom
(
stuff
->
type
))
{
{
client
->
errorValue
=
stuff
->
type
;
client
->
errorValue
=
stuff
->
type
;
return
(
BadAtom
);
return
(
BadAtom
);
}
}
err
=
RRChangeOutputProperty
(
output
,
stuff
->
property
,
err
=
RRChangeOutputProperty
(
output
,
stuff
->
property
,
stuff
->
type
,
(
int
)
format
,
stuff
->
type
,
(
int
)
format
,
(
int
)
mode
,
len
,
(
void
*
)
&
stuff
[
1
],
TRUE
,
TRUE
);
(
int
)
mode
,
len
,
(
void
*
)
&
stuff
[
1
],
TRUE
,
TRUE
);
if
(
err
!=
Success
)
if
(
err
!=
Success
)
return
err
;
return
err
;
else
else
return
client
->
noClientException
;
return
client
->
noClientException
;
}
}
int
int
ProcRRDeleteOutputProperty
(
ClientPtr
client
)
ProcRRDeleteOutputProperty
(
ClientPtr
client
)
{
{
REQUEST
(
xRRDeleteOutputPropertyReq
);
REQUEST
(
xRRDeleteOutputPropertyReq
);
RROutputPtr
output
;
RROutputPtr
output
;
REQUEST_SIZE_MATCH
(
xRRDeleteOutputPropertyReq
);
REQUEST_SIZE_MATCH
(
xRRDeleteOutputPropertyReq
);
UpdateCurrentTime
();
UpdateCurrentTime
();
output
=
LookupOutput
(
client
,
stuff
->
output
,
DixWriteAccess
);
output
=
LookupOutput
(
client
,
stuff
->
output
,
DixWriteAccess
);
if
(
!
output
)
if
(
!
output
)
return
RRErrorBase
+
BadRROutput
;
return
RRErrorBase
+
BadRROutput
;
if
(
!
ValidAtom
(
stuff
->
property
))
if
(
!
ValidAtom
(
stuff
->
property
))
{
{
client
->
errorValue
=
stuff
->
property
;
client
->
errorValue
=
stuff
->
property
;
return
(
BadAtom
);
return
(
BadAtom
);
}
}
RRDeleteOutputProperty
(
output
,
stuff
->
property
);
RRDeleteOutputProperty
(
output
,
stuff
->
property
);
return
client
->
noClientException
;
return
client
->
noClientException
;
}
}
int
int
ProcRRGetOutputProperty
(
ClientPtr
client
)
ProcRRGetOutputProperty
(
ClientPtr
client
)
{
{
REQUEST
(
xRRGetOutputPropertyReq
);
REQUEST
(
xRRGetOutputPropertyReq
);
RRPropertyPtr
prop
,
*
prev
;
RRPropertyPtr
prop
,
*
prev
;
RRPropertyValuePtr
prop_value
;
RRPropertyValuePtr
prop_value
;
unsigned
long
n
,
len
,
ind
;
unsigned
long
n
,
len
,
ind
;
RROutputPtr
output
;
RROutputPtr
output
;
xRRGetOutputPropertyReply
reply
;
xRRGetOutputPropertyReply
reply
;
char
*
extra
;
char
*
extra
;
REQUEST_SIZE_MATCH
(
xRRGetOutputPropertyReq
);
REQUEST_SIZE_MATCH
(
xRRGetOutputPropertyReq
);
if
(
stuff
->
delete
)
if
(
stuff
->
delete
)
UpdateCurrentTime
();
UpdateCurrentTime
();
output
=
LookupOutput
(
client
,
stuff
->
output
,
output
=
LookupOutput
(
client
,
stuff
->
output
,
stuff
->
delete
?
DixWriteAccess
:
stuff
->
delete
?
DixWriteAccess
:
DixReadAccess
);
DixReadAccess
);
if
(
!
output
)
if
(
!
output
)
return
RRErrorBase
+
BadRROutput
;
return
RRErrorBase
+
BadRROutput
;
if
(
!
ValidAtom
(
stuff
->
property
))
if
(
!
ValidAtom
(
stuff
->
property
))
{
{
client
->
errorValue
=
stuff
->
property
;
client
->
errorValue
=
stuff
->
property
;
return
(
BadAtom
);
return
(
BadAtom
);
}
}
if
((
stuff
->
delete
!=
xTrue
)
&&
(
stuff
->
delete
!=
xFalse
))
if
((
stuff
->
delete
!=
xTrue
)
&&
(
stuff
->
delete
!=
xFalse
))
{
{
client
->
errorValue
=
stuff
->
delete
;
client
->
errorValue
=
stuff
->
delete
;
return
(
BadValue
);
return
(
BadValue
);
}
}
if
((
stuff
->
type
!=
AnyPropertyType
)
&&
!
ValidAtom
(
stuff
->
type
))
if
((
stuff
->
type
!=
AnyPropertyType
)
&&
!
ValidAtom
(
stuff
->
type
))
{
{
client
->
errorValue
=
stuff
->
type
;
client
->
errorValue
=
stuff
->
type
;
return
(
BadAtom
);
return
(
BadAtom
);
}
}
for
(
prev
=
&
output
->
properties
;
(
prop
=
*
prev
);
prev
=
&
prop
->
next
)
for
(
prev
=
&
output
->
properties
;
(
prop
=
*
prev
);
prev
=
&
prop
->
next
)
if
(
prop
->
propertyName
==
stuff
->
property
)
if
(
prop
->
propertyName
==
stuff
->
property
)
break
;
break
;
reply
.
type
=
X_Reply
;
reply
.
type
=
X_Reply
;
reply
.
sequenceNumber
=
client
->
sequence
;
reply
.
sequenceNumber
=
client
->
sequence
;
if
(
!
prop
)
if
(
!
prop
)
{
{
reply
.
nItems
=
0
;
reply
.
nItems
=
0
;
reply
.
length
=
0
;
reply
.
length
=
0
;
reply
.
bytesAfter
=
0
;
reply
.
bytesAfter
=
0
;
reply
.
propertyType
=
None
;
reply
.
propertyType
=
None
;
reply
.
format
=
0
;
reply
.
format
=
0
;
if
(
client
->
swapped
)
{
if
(
client
->
swapped
)
{
int
n
;
int
n
;
swaps
(
&
reply
.
sequenceNumber
,
n
);
swaps
(
&
reply
.
sequenceNumber
,
n
);
swapl
(
&
reply
.
length
,
n
);
swapl
(
&
reply
.
length
,
n
);
swapl
(
&
reply
.
propertyType
,
n
);
swapl
(
&
reply
.
propertyType
,
n
);
swapl
(
&
reply
.
bytesAfter
,
n
);
swapl
(
&
reply
.
bytesAfter
,
n
);
swapl
(
&
reply
.
nItems
,
n
);
swapl
(
&
reply
.
nItems
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xRRGetOutputPropertyReply
),
&
reply
);
WriteToClient
(
client
,
sizeof
(
xRRGetOutputPropertyReply
),
&
reply
);
return
(
client
->
noClientException
);
return
(
client
->
noClientException
);
}
}
if
(
prop
->
immutable
&&
stuff
->
delete
)
if
(
prop
->
immutable
&&
stuff
->
delete
)
return
BadAccess
;
return
BadAccess
;
if
(
stuff
->
pending
&&
prop
->
is_pending
)
if
(
stuff
->
pending
&&
prop
->
is_pending
)
prop_value
=
&
prop
->
pending
;
prop_value
=
&
prop
->
pending
;
else
else
prop_value
=
&
prop
->
current
;
prop_value
=
&
prop
->
current
;
/* If the request type and actual type don't match. Return the
/* If the request type and actual type don't match. Return the
property information, but not the data. */
property information, but not the data. */
if
(((
stuff
->
type
!=
prop_value
->
type
)
&&
if
(((
stuff
->
type
!=
prop_value
->
type
)
&&
(
stuff
->
type
!=
AnyPropertyType
))
(
stuff
->
type
!=
AnyPropertyType
))
)
{
)
reply
.
bytesAfter
=
prop_value
->
size
;
{
reply
.
format
=
prop_value
->
format
;
reply
.
bytesAfter
=
prop_value
->
size
;
reply
.
length
=
0
;
reply
.
format
=
prop_value
->
format
;
reply
.
nItems
=
0
;
reply
.
length
=
0
;
reply
.
propertyType
=
prop_value
->
type
;
reply
.
nItems
=
0
;
if
(
client
->
swapped
)
{
reply
.
propertyType
=
prop_value
->
type
;
int
n
;
if
(
client
->
swapped
)
{
int
n
;
swaps
(
&
reply
.
sequenceNumber
,
n
);
swapl
(
&
reply
.
length
,
n
);
swaps
(
&
reply
.
sequenceNumber
,
n
);
swapl
(
&
reply
.
propertyType
,
n
);
swapl
(
&
reply
.
length
,
n
);
swapl
(
&
reply
.
bytesAfter
,
n
);
swapl
(
&
reply
.
propertyType
,
n
);
swapl
(
&
reply
.
nItems
,
n
);
swapl
(
&
reply
.
bytesAfter
,
n
);
}
swapl
(
&
reply
.
nItems
,
n
);
WriteToClient
(
client
,
sizeof
(
xRRGetOutputPropertyReply
),
&
reply
);
}
return
(
client
->
noClientException
);
WriteToClient
(
client
,
sizeof
(
xRRGetOutputPropertyReply
),
&
reply
);
return
(
client
->
noClientException
);
}
}
/*
/*
* Return type, format, value to client
* Return type, format, value to client
*/
*/
n
=
(
prop_value
->
format
/
8
)
*
prop_value
->
size
;
/* size (bytes) of prop */
n
=
(
prop_value
->
format
/
8
)
*
prop_value
->
size
;
/* size (bytes) of prop */
ind
=
stuff
->
longOffset
<<
2
;
ind
=
stuff
->
longOffset
<<
2
;
/* If longOffset is invalid such that it causes "len" to
/* If longOffset is invalid such that it causes "len" to
be negative, it's a value error. */
be negative, it's a value error. */
if
(
n
<
ind
)
if
(
n
<
ind
)
{
{
client
->
errorValue
=
stuff
->
longOffset
;
client
->
errorValue
=
stuff
->
longOffset
;
return
BadValue
;
return
BadValue
;
}
}
len
=
min
(
n
-
ind
,
4
*
stuff
->
longLength
);
len
=
min
(
n
-
ind
,
4
*
stuff
->
longLength
);
if
(
len
)
{
if
(
len
)
{
extra
=
xalloc
(
len
);
extra
=
xalloc
(
len
);
if
(
!
extra
)
if
(
!
extra
)
return
BadAlloc
;
return
BadAlloc
;
}
}
reply
.
bytesAfter
=
n
-
(
ind
+
len
);
reply
.
bytesAfter
=
n
-
(
ind
+
len
);
reply
.
format
=
prop_value
->
format
;
reply
.
format
=
prop_value
->
format
;
reply
.
length
=
(
len
+
3
)
>>
2
;
reply
.
length
=
(
len
+
3
)
>>
2
;
if
(
prop_value
->
format
)
if
(
prop_value
->
format
)
reply
.
nItems
=
len
/
(
prop_value
->
format
/
8
);
reply
.
nItems
=
len
/
(
prop_value
->
format
/
8
);
else
else
reply
.
nItems
=
0
;
reply
.
nItems
=
0
;
reply
.
propertyType
=
prop_value
->
type
;
reply
.
propertyType
=
prop_value
->
type
;
if
(
stuff
->
delete
&&
(
reply
.
bytesAfter
==
0
))
if
(
stuff
->
delete
&&
(
reply
.
bytesAfter
==
0
))
{
{
xRROutputPropertyNotifyEvent
event
;
xRROutputPropertyNotifyEvent
event
;
event
.
type
=
RREventBase
+
RRNotify
;
event
.
type
=
RREventBase
+
RRNotif
y
;
event
.
subCode
=
RRNotify_OutputPropert
y
;
event
.
subCode
=
RRNotify_OutputProperty
;
event
.
output
=
output
->
id
;
event
.
output
=
output
->
id
;
event
.
state
=
PropertyDelete
;
event
.
state
=
PropertyDelet
e
;
event
.
atom
=
prop
->
propertyNam
e
;
event
.
atom
=
prop
->
propertyName
;
event
.
timestamp
=
currentTime
.
milliseconds
;
event
.
timestamp
=
currentTime
.
milliseconds
;
RRDeliverEvent
(
output
->
pScreen
,
(
xEvent
*
)
&
event
,
RRDeliverEvent
(
output
->
pScreen
,
(
xEvent
*
)
&
event
,
RROutputPropertyNotifyMask
);
RROutputPropertyNotifyMask
);
}
}
if
(
client
->
swapped
)
{
if
(
client
->
swapped
)
{
int
n
;
int
n
;
swaps
(
&
reply
.
sequenceNumber
,
n
);
swaps
(
&
reply
.
sequenceNumber
,
n
);
swapl
(
&
reply
.
length
,
n
);
swapl
(
&
reply
.
length
,
n
);
swapl
(
&
reply
.
propertyType
,
n
);
swapl
(
&
reply
.
propertyType
,
n
);
swapl
(
&
reply
.
bytesAfter
,
n
);
swapl
(
&
reply
.
bytesAfter
,
n
);
swapl
(
&
reply
.
nItems
,
n
);
swapl
(
&
reply
.
nItems
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xGenericReply
),
&
reply
);
WriteToClient
(
client
,
sizeof
(
xGenericReply
),
&
reply
);
if
(
len
)
if
(
len
)
{
{
memcpy
(
extra
,
(
char
*
)
prop_value
->
data
+
ind
,
len
);
memcpy
(
extra
,
(
char
*
)
prop_value
->
data
+
ind
,
len
);
switch
(
reply
.
format
)
{
switch
(
reply
.
format
)
{
case
32
:
case
32
:
client
->
pSwapReplyFunc
=
(
ReplySwapPtr
)
CopySwap32Write
;
break
;
client
->
pSwapReplyFunc
=
(
ReplySwapPtr
)
CopySwap32Write
;
case
16
:
client
->
pSwapReplyFunc
=
(
ReplySwapPtr
)
CopySwap16Write
;
break
;
break
;
default:
client
->
pSwapReplyFunc
=
(
ReplySwapPtr
)
WriteToClient
;
break
;
case
16
:
}
client
->
pSwapReplyFunc
=
(
ReplySwapPtr
)
CopySwap16Write
;
WriteSwappedDataToClient
(
client
,
len
,
break
;
extra
);
default:
xfree
(
extra
);
client
->
pSwapReplyFunc
=
(
ReplySwapPtr
)
WriteToClient
;
}
break
;
}
if
(
stuff
->
delete
&&
(
reply
.
bytesAfter
==
0
))
WriteSwappedDataToClient
(
client
,
len
,
extra
);
{
/* delete the Property */
xfree
(
extra
);
*
prev
=
prop
->
next
;
}
RRDestroyOutputProperty
(
prop
);
}
return
(
client
->
noClientException
);
}
if
(
stuff
->
delete
&&
(
reply
.
bytesAfter
==
0
))
{
/* delete the Property */
*
prev
=
prop
->
next
;
RRDestroyOutputProperty
(
prop
);
}
return
(
client
->
noClientException
);
}
nx-X11/programs/Xserver/randr/rrscreen.c
View file @
e440ea76
...
@@ -39,49 +39,46 @@
...
@@ -39,49 +39,46 @@
#include "randrstr.h"
#include "randrstr.h"
extern
char
*
ConnectionInfo
;
extern
char
*
ConnectionInfo
;
static
int
padlength
[
4
]
=
{
0
,
3
,
2
,
1
};
static
int
padlength
[
4
]
=
{
0
,
3
,
2
,
1
};
static
CARD16
static
CARD16
RR10CurrentSizeID
(
ScreenPtr
pScreen
);
RR10CurrentSizeID
(
ScreenPtr
pScreen
);
/*
/*
* Edit connection information block so that new clients
* Edit connection information block so that new clients
* see the current screen size on connect
* see the current screen size on connect
*/
*/
static
void
static
void
RREditConnectionInfo
(
ScreenPtr
pScreen
)
RREditConnectionInfo
(
ScreenPtr
pScreen
)
{
{
xConnSetup
*
connSetup
;
xConnSetup
*
connSetup
;
char
*
vendor
;
char
*
vendor
;
xPixmapFormat
*
formats
;
xPixmapFormat
*
formats
;
xWindowRoot
*
root
;
xWindowRoot
*
root
;
xDepth
*
depth
;
xDepth
*
depth
;
xVisualType
*
visual
;
xVisualType
*
visual
;
int
screen
=
0
;
int
screen
=
0
;
int
d
;
int
d
;
connSetup
=
(
xConnSetup
*
)
ConnectionInfo
;
connSetup
=
(
xConnSetup
*
)
ConnectionInfo
;
vendor
=
(
char
*
)
connSetup
+
sizeof
(
xConnSetup
);
vendor
=
(
char
*
)
connSetup
+
sizeof
(
xConnSetup
);
formats
=
(
xPixmapFormat
*
)
((
char
*
)
vendor
+
formats
=
(
xPixmapFormat
*
)
((
char
*
)
vendor
+
connSetup
->
nbytesVendor
+
connSetup
->
nbytesVendor
+
padlength
[
connSetup
->
nbytesVendor
&
3
]);
padlength
[
connSetup
->
nbytesVendor
&
3
]);
root
=
(
xWindowRoot
*
)
((
char
*
)
formats
+
root
=
(
xWindowRoot
*
)
((
char
*
)
formats
+
sizeof
(
xPixmapFormat
)
*
screenInfo
.
numPixmapFormats
);
sizeof
(
xPixmapFormat
)
*
while
(
screen
!=
pScreen
->
myNum
)
screenInfo
.
numPixmapFormats
);
{
while
(
screen
!=
pScreen
->
myNum
)
{
depth
=
(
xDepth
*
)
((
char
*
)
root
+
depth
=
(
xDepth
*
)
((
char
*
)
root
+
sizeof
(
xWindowRoot
));
sizeof
(
xWindowRoot
));
for
(
d
=
0
;
d
<
root
->
nDepths
;
d
++
)
{
for
(
d
=
0
;
d
<
root
->
nDepths
;
d
++
)
visual
=
(
xVisualType
*
)
((
char
*
)
depth
+
sizeof
(
xDepth
));
{
depth
=
(
xDepth
*
)
((
char
*
)
visual
+
visual
=
(
xVisualType
*
)
((
char
*
)
depth
+
depth
->
nVisuals
*
sizeof
(
xVisualType
));
sizeof
(
xDepth
));
}
depth
=
(
xDepth
*
)
((
char
*
)
visual
+
root
=
(
xWindowRoot
*
)
((
char
*
)
depth
);
depth
->
nVisuals
*
sizeof
(
xVisualType
));
screen
++
;
}
root
=
(
xWindowRoot
*
)
((
char
*
)
depth
);
screen
++
;
}
}
root
->
pixWidth
=
pScreen
->
width
;
root
->
pixWidth
=
pScreen
->
width
;
root
->
pixHeight
=
pScreen
->
height
;
root
->
pixHeight
=
pScreen
->
height
;
...
@@ -90,10 +87,10 @@ RREditConnectionInfo (ScreenPtr pScreen)
...
@@ -90,10 +87,10 @@ RREditConnectionInfo (ScreenPtr pScreen)
}
}
void
void
RRSendConfigNotify
(
ScreenPtr
pScreen
)
RRSendConfigNotify
(
ScreenPtr
pScreen
)
{
{
WindowPtr
pWin
=
WindowTable
[
pScreen
->
myNum
];
WindowPtr
pWin
=
WindowTable
[
pScreen
->
myNum
];
xEvent
event
;
xEvent
event
;
event
.
u
.
u
.
type
=
ConfigureNotify
;
event
.
u
.
u
.
type
=
ConfigureNotify
;
event
.
u
.
configureNotify
.
window
=
pWin
->
drawable
.
id
;
event
.
u
.
configureNotify
.
window
=
pWin
->
drawable
.
id
;
...
@@ -105,48 +102,49 @@ RRSendConfigNotify (ScreenPtr pScreen)
...
@@ -105,48 +102,49 @@ RRSendConfigNotify (ScreenPtr pScreen)
event
.
u
.
configureNotify
.
width
=
pWin
->
drawable
.
width
;
event
.
u
.
configureNotify
.
width
=
pWin
->
drawable
.
width
;
event
.
u
.
configureNotify
.
height
=
pWin
->
drawable
.
height
;
event
.
u
.
configureNotify
.
height
=
pWin
->
drawable
.
height
;
event
.
u
.
configureNotify
.
borderWidth
=
wBorderWidth
(
pWin
);
event
.
u
.
configureNotify
.
borderWidth
=
wBorderWidth
(
pWin
);
event
.
u
.
configureNotify
.
override
=
pWin
->
overrideRedirect
;
event
.
u
.
configureNotify
.
override
=
pWin
->
overrideRedirect
;
DeliverEvents
(
pWin
,
&
event
,
1
,
NullWindow
);
DeliverEvents
(
pWin
,
&
event
,
1
,
NullWindow
);
}
}
void
void
RRDeliverScreenEvent
(
ClientPtr
client
,
WindowPtr
pWin
,
ScreenPtr
pScreen
)
RRDeliverScreenEvent
(
ClientPtr
client
,
WindowPtr
pWin
,
ScreenPtr
pScreen
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
xRRScreenChangeNotifyEvent
se
;
xRRScreenChangeNotifyEvent
se
;
RRCrtcPtr
crtc
=
pScrPriv
->
numCrtcs
?
pScrPriv
->
crtcs
[
0
]
:
NULL
;
RRCrtcPtr
crtc
=
pScrPriv
->
numCrtcs
?
pScrPriv
->
crtcs
[
0
]
:
NULL
;
WindowPtr
pRoot
=
WindowTable
[
pScreen
->
myNum
];
WindowPtr
pRoot
=
WindowTable
[
pScreen
->
myNum
];
se
.
type
=
RRScreenChangeNotify
+
RREventBase
;
se
.
type
=
RRScreenChangeNotify
+
RREventBase
;
se
.
rotation
=
(
CARD8
)
(
crtc
?
crtc
->
rotation
:
RR_Rotate_0
);
se
.
rotation
=
(
CARD8
)
(
crtc
?
crtc
->
rotation
:
RR_Rotate_0
);
se
.
timestamp
=
pScrPriv
->
lastSetTime
.
milliseconds
;
se
.
timestamp
=
pScrPriv
->
lastSetTime
.
milliseconds
;
se
.
sequenceNumber
=
client
->
sequence
;
se
.
sequenceNumber
=
client
->
sequence
;
se
.
configTimestamp
=
pScrPriv
->
lastConfigTime
.
milliseconds
;
se
.
configTimestamp
=
pScrPriv
->
lastConfigTime
.
milliseconds
;
se
.
root
=
pRoot
->
drawable
.
id
;
se
.
root
=
pRoot
->
drawable
.
id
;
se
.
window
=
pWin
->
drawable
.
id
;
se
.
window
=
pWin
->
drawable
.
id
;
#ifdef RENDER
#ifdef RENDER
se
.
subpixelOrder
=
PictureGetSubpixelOrder
(
pScreen
);
se
.
subpixelOrder
=
PictureGetSubpixelOrder
(
pScreen
);
#else
#else
se
.
subpixelOrder
=
SubPixelUnknown
;
se
.
subpixelOrder
=
SubPixelUnknown
;
#endif
#endif
se
.
sequenceNumber
=
client
->
sequence
;
se
.
sequenceNumber
=
client
->
sequence
;
se
.
sizeID
=
RR10CurrentSizeID
(
pScreen
);
se
.
sizeID
=
RR10CurrentSizeID
(
pScreen
);
if
(
se
.
rotation
&
(
RR_Rotate_90
|
RR_Rotate_270
))
{
if
(
se
.
rotation
&
(
RR_Rotate_90
|
RR_Rotate_270
))
{
se
.
widthInPixels
=
pScreen
->
height
;
se
.
widthInPixels
=
pScreen
->
height
;
se
.
heightInPixels
=
pScreen
->
width
;
se
.
heightInPixels
=
pScreen
->
width
;
se
.
widthInMillimeters
=
pScreen
->
mmHeight
;
se
.
widthInMillimeters
=
pScreen
->
mmHeight
;
se
.
heightInMillimeters
=
pScreen
->
mmWidth
;
se
.
heightInMillimeters
=
pScreen
->
mmWidth
;
}
else
{
}
se
.
widthInPixels
=
pScreen
->
width
;
else
{
se
.
heightInPixels
=
pScreen
->
height
;
se
.
widthInPixels
=
pScreen
->
width
;
se
.
widthInMillimeters
=
pScreen
->
mmWidth
;
se
.
heightInPixels
=
pScreen
->
height
;
se
.
heightInMillimeters
=
pScreen
->
mmHeight
;
se
.
widthInMillimeters
=
pScreen
->
mmWidth
;
se
.
heightInMillimeters
=
pScreen
->
mmHeight
;
}
}
WriteEventsToClient
(
client
,
1
,
(
xEvent
*
)
&
se
);
WriteEventsToClient
(
client
,
1
,
(
xEvent
*
)
&
se
);
}
}
/*
/*
...
@@ -155,7 +153,7 @@ RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen)
...
@@ -155,7 +153,7 @@ RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen)
* the size of the screen
* the size of the screen
*/
*/
void
void
RRScreenSizeNotify
(
ScreenPtr
pScreen
)
RRScreenSizeNotify
(
ScreenPtr
pScreen
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
/*
/*
...
@@ -163,10 +161,10 @@ RRScreenSizeNotify (ScreenPtr pScreen)
...
@@ -163,10 +161,10 @@ RRScreenSizeNotify (ScreenPtr pScreen)
* pixel size
* pixel size
*/
*/
if
(
pScrPriv
->
width
==
pScreen
->
width
&&
if
(
pScrPriv
->
width
==
pScreen
->
width
&&
pScrPriv
->
height
==
pScreen
->
height
&&
pScrPriv
->
height
==
pScreen
->
height
&&
pScrPriv
->
mmWidth
==
pScreen
->
mmWidth
&&
pScrPriv
->
mmWidth
==
pScreen
->
mmWidth
&&
pScrPriv
->
mmHeight
==
pScreen
->
mmHeight
)
pScrPriv
->
mmHeight
==
pScreen
->
mmHeight
)
return
;
return
;
pScrPriv
->
width
=
pScreen
->
width
;
pScrPriv
->
width
=
pScreen
->
width
;
pScrPriv
->
height
=
pScreen
->
height
;
pScrPriv
->
height
=
pScreen
->
height
;
...
@@ -175,41 +173,35 @@ RRScreenSizeNotify (ScreenPtr pScreen)
...
@@ -175,41 +173,35 @@ RRScreenSizeNotify (ScreenPtr pScreen)
pScrPriv
->
changed
=
TRUE
;
pScrPriv
->
changed
=
TRUE
;
/* pScrPriv->sizeChanged = TRUE; */
/* pScrPriv->sizeChanged = TRUE; */
RRTellChanged
(
pScreen
);
RRTellChanged
(
pScreen
);
RRSendConfigNotify
(
pScreen
);
RRSendConfigNotify
(
pScreen
);
RREditConnectionInfo
(
pScreen
);
RREditConnectionInfo
(
pScreen
);
RRPointerScreenConfigured
(
pScreen
);
RRPointerScreenConfigured
(
pScreen
);
/*
/*
* Fix pointer bounds and location
* Fix pointer bounds and location
*/
*/
ScreenRestructured
(
pScreen
);
ScreenRestructured
(
pScreen
);
}
}
/*
/*
* Request that the screen be resized
* Request that the screen be resized
*/
*/
Bool
Bool
RRScreenSizeSet
(
ScreenPtr
pScreen
,
RRScreenSizeSet
(
ScreenPtr
pScreen
,
CARD16
width
,
CARD16
width
,
CARD16
height
,
CARD32
mmWidth
,
CARD32
mmHeight
)
CARD16
height
,
CARD32
mmWidth
,
CARD32
mmHeight
)
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
#if RANDR_12_INTERFACE
#if RANDR_12_INTERFACE
if
(
pScrPriv
->
rrScreenSetSize
)
if
(
pScrPriv
->
rrScreenSetSize
)
{
{
return
(
*
pScrPriv
->
rrScreenSetSize
)
(
pScreen
,
return
(
*
pScrPriv
->
rrScreenSetSize
)
(
pScreen
,
width
,
height
,
mmWidth
,
mmHeight
);
width
,
height
,
mmWidth
,
mmHeight
);
}
}
#endif
#endif
#if RANDR_10_INTERFACE
#if RANDR_10_INTERFACE
if
(
pScrPriv
->
rrSetConfig
)
if
(
pScrPriv
->
rrSetConfig
)
{
{
return
TRUE
;
/* can't set size separately */
return
TRUE
;
/* can't set size separately */
}
}
#endif
#endif
return
FALSE
;
return
FALSE
;
...
@@ -219,24 +211,24 @@ RRScreenSizeSet (ScreenPtr pScreen,
...
@@ -219,24 +211,24 @@ RRScreenSizeSet (ScreenPtr pScreen,
* Retrieve valid screen size range
* Retrieve valid screen size range
*/
*/
int
int
ProcRRGetScreenSizeRange
(
ClientPtr
client
)
ProcRRGetScreenSizeRange
(
ClientPtr
client
)
{
{
REQUEST
(
xRRGetScreenSizeRangeReq
);
REQUEST
(
xRRGetScreenSizeRangeReq
);
xRRGetScreenSizeRangeReply
rep
;
xRRGetScreenSizeRangeReply
rep
;
WindowPtr
pWin
;
WindowPtr
pWin
;
ScreenPtr
pScreen
;
ScreenPtr
pScreen
;
rrScrPrivPtr
pScrPriv
;
rrScrPrivPtr
pScrPriv
;
int
rc
;
int
rc
;
REQUEST_SIZE_MATCH
(
xRRGetScreenSizeRangeReq
);
REQUEST_SIZE_MATCH
(
xRRGetScreenSizeRangeReq
);
#ifndef NXAGENT_SERVER
#ifndef NXAGENT_SERVER
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixReadAccess
);
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixReadAccess
);
#else
#else
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityReadAccess
);
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityReadAccess
);
rc
=
pWin
?
Success
:
BadWindow
;
rc
=
pWin
?
Success
:
BadWindow
;
#endif
#endif
if
(
rc
!=
Success
)
if
(
rc
!=
Success
)
return
rc
;
return
rc
;
pScreen
=
pWin
->
drawable
.
pScreen
;
pScreen
=
pWin
->
drawable
.
pScreen
;
pScrPriv
=
rrGetScrPriv
(
pScreen
);
pScrPriv
=
rrGetScrPriv
(
pScreen
);
...
@@ -246,291 +238,272 @@ ProcRRGetScreenSizeRange (ClientPtr client)
...
@@ -246,291 +238,272 @@ ProcRRGetScreenSizeRange (ClientPtr client)
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
length
=
0
;
rep
.
length
=
0
;
if
(
pScrPriv
)
if
(
pScrPriv
)
{
{
if
(
!
RRGetInfo
(
pScreen
))
if
(
!
RRGetInfo
(
pScreen
))
return
BadAlloc
;
return
BadAlloc
;
rep
.
minWidth
=
pScrPriv
->
minWidth
;
rep
.
minWidth
=
pScrPriv
->
minWidth
;
rep
.
minHeight
=
pScrPriv
->
minHeight
;
rep
.
minHeight
=
pScrPriv
->
minHeight
;
rep
.
maxWidth
=
pScrPriv
->
maxWidth
;
rep
.
maxWidth
=
pScrPriv
->
maxWidth
;
rep
.
maxHeight
=
pScrPriv
->
maxHeight
;
rep
.
maxHeight
=
pScrPriv
->
maxHeight
;
}
}
else
else
{
{
rep
.
maxWidth
=
rep
.
minWidth
=
pScreen
->
width
;
rep
.
maxWidth
=
rep
.
minWidth
=
pScreen
->
width
;
rep
.
maxHeight
=
rep
.
minHeight
=
pScreen
->
height
;
rep
.
maxHeight
=
rep
.
minHeight
=
pScreen
->
height
;
}
}
if
(
client
->
swapped
)
if
(
client
->
swapped
)
{
{
int
n
;
int
n
;
swaps
(
&
rep
.
sequenceNumber
,
n
);
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
length
,
n
);
swaps
(
&
rep
.
minWidth
,
n
);
swaps
(
&
rep
.
minWidth
,
n
);
swaps
(
&
rep
.
minHeight
,
n
);
swaps
(
&
rep
.
minHeight
,
n
);
swaps
(
&
rep
.
maxWidth
,
n
);
swaps
(
&
rep
.
maxWidth
,
n
);
swaps
(
&
rep
.
maxHeight
,
n
);
swaps
(
&
rep
.
maxHeight
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xRRGetScreenSizeRangeReply
),
(
char
*
)
&
rep
);
WriteToClient
(
client
,
sizeof
(
xRRGetScreenSizeRangeReply
),
(
char
*
)
&
rep
);
return
(
client
->
noClientException
);
return
(
client
->
noClientException
);
}
}
int
int
ProcRRSetScreenSize
(
ClientPtr
client
)
ProcRRSetScreenSize
(
ClientPtr
client
)
{
{
REQUEST
(
xRRSetScreenSizeReq
);
REQUEST
(
xRRSetScreenSizeReq
);
WindowPtr
pWin
;
WindowPtr
pWin
;
ScreenPtr
pScreen
;
ScreenPtr
pScreen
;
rrScrPrivPtr
pScrPriv
;
rrScrPrivPtr
pScrPriv
;
int
i
,
rc
;
int
i
,
rc
;
REQUEST_SIZE_MATCH
(
xRRSetScreenSizeReq
);
REQUEST_SIZE_MATCH
(
xRRSetScreenSizeReq
);
#ifndef NXAGENT_SERVER
#ifndef NXAGENT_SERVER
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixReadAccess
);
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixReadAccess
);
#else
#else
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityReadAccess
);
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityReadAccess
);
rc
=
pWin
?
Success
:
BadWindow
;
rc
=
pWin
?
Success
:
BadWindow
;
#endif
#endif
if
(
rc
!=
Success
)
if
(
rc
!=
Success
)
return
rc
;
return
rc
;
pScreen
=
pWin
->
drawable
.
pScreen
;
pScreen
=
pWin
->
drawable
.
pScreen
;
pScrPriv
=
rrGetScrPriv
(
pScreen
);
pScrPriv
=
rrGetScrPriv
(
pScreen
);
if
(
stuff
->
width
<
pScrPriv
->
minWidth
||
pScrPriv
->
maxWidth
<
stuff
->
width
)
if
(
stuff
->
width
<
pScrPriv
->
minWidth
||
pScrPriv
->
maxWidth
<
stuff
->
width
)
{
{
client
->
errorValue
=
stuff
->
width
;
client
->
errorValue
=
stuff
->
width
;
return
BadValue
;
return
BadValue
;
}
}
if
(
stuff
->
height
<
pScrPriv
->
minHeight
||
if
(
stuff
->
height
<
pScrPriv
->
minHeight
||
pScrPriv
->
maxHeight
<
stuff
->
height
)
pScrPriv
->
maxHeight
<
stuff
->
height
)
{
{
client
->
errorValue
=
stuff
->
height
;
client
->
errorValue
=
stuff
->
height
;
return
BadValue
;
return
BadValue
;
}
}
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
{
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
RRCrtcPtr
crtc
=
pScrPriv
->
crtcs
[
i
];
{
RRModePtr
mode
=
crtc
->
mode
;
RRCrtcPtr
crtc
=
pScrPriv
->
crtcs
[
i
];
RRModePtr
mode
=
crtc
->
mode
;
if
(
mode
)
{
if
(
mode
)
int
source_width
=
mode
->
mode
.
width
;
{
int
source_height
=
mode
->
mode
.
height
;
int
source_width
=
mode
->
mode
.
width
;
Rotation
rotation
=
crtc
->
rotation
;
int
source_height
=
mode
->
mode
.
height
;
Rotation
rotation
=
crtc
->
rotation
;
if
(
rotation
==
RR_Rotate_90
||
rotation
==
RR_Rotate_270
)
{
source_width
=
mode
->
mode
.
height
;
if
(
rotation
==
RR_Rotate_90
||
rotation
==
RR_Rotate_270
)
source_height
=
mode
->
mode
.
width
;
{
}
source_width
=
mode
->
mode
.
height
;
source_height
=
mode
->
mode
.
width
;
if
(
crtc
->
x
+
source_width
>
stuff
->
width
||
}
crtc
->
y
+
source_height
>
stuff
->
height
)
return
BadMatch
;
if
(
crtc
->
x
+
source_width
>
stuff
->
width
||
}
crtc
->
y
+
source_height
>
stuff
->
height
)
}
return
BadMatch
;
if
(
stuff
->
widthInMillimeters
==
0
||
stuff
->
heightInMillimeters
==
0
)
{
}
client
->
errorValue
=
0
;
}
return
BadValue
;
if
(
stuff
->
widthInMillimeters
==
0
||
stuff
->
heightInMillimeters
==
0
)
}
{
if
(
!
RRScreenSizeSet
(
pScreen
,
client
->
errorValue
=
0
;
stuff
->
width
,
stuff
->
height
,
return
BadValue
;
stuff
->
widthInMillimeters
,
}
stuff
->
heightInMillimeters
))
{
if
(
!
RRScreenSizeSet
(
pScreen
,
return
BadMatch
;
stuff
->
width
,
stuff
->
height
,
stuff
->
widthInMillimeters
,
stuff
->
heightInMillimeters
))
{
return
BadMatch
;
}
}
return
Success
;
return
Success
;
}
}
int
int
ProcRRGetScreenResources
(
ClientPtr
client
)
ProcRRGetScreenResources
(
ClientPtr
client
)
{
{
REQUEST
(
xRRGetScreenResourcesReq
);
REQUEST
(
xRRGetScreenResourcesReq
);
xRRGetScreenResourcesReply
rep
;
xRRGetScreenResourcesReply
rep
;
WindowPtr
pWin
;
WindowPtr
pWin
;
ScreenPtr
pScreen
;
ScreenPtr
pScreen
;
rrScrPrivPtr
pScrPriv
;
rrScrPrivPtr
pScrPriv
;
CARD8
*
extra
;
CARD8
*
extra
;
unsigned
long
extraLen
;
unsigned
long
extraLen
;
int
i
,
n
,
rc
;
int
i
,
n
,
rc
;
RRCrtc
*
crtcs
;
RRCrtc
*
crtcs
;
RROutput
*
outputs
;
RROutput
*
outputs
;
xRRModeInfo
*
modeinfos
;
xRRModeInfo
*
modeinfos
;
CARD8
*
names
;
CARD8
*
names
;
REQUEST_SIZE_MATCH
(
xRRGetScreenResourcesReq
);
REQUEST_SIZE_MATCH
(
xRRGetScreenResourcesReq
);
#ifndef NXAGENT_SERVER
#ifndef NXAGENT_SERVER
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixReadAccess
);
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixReadAccess
);
#else
#else
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityReadAccess
);
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityReadAccess
);
rc
=
pWin
?
Success
:
BadWindow
;
rc
=
pWin
?
Success
:
BadWindow
;
#endif
#endif
if
(
rc
!=
Success
)
if
(
rc
!=
Success
)
return
rc
;
return
rc
;
pScreen
=
pWin
->
drawable
.
pScreen
;
pScreen
=
pWin
->
drawable
.
pScreen
;
pScrPriv
=
rrGetScrPriv
(
pScreen
);
pScrPriv
=
rrGetScrPriv
(
pScreen
);
rep
.
pad
=
0
;
rep
.
pad
=
0
;
if
(
pScrPriv
)
if
(
pScrPriv
)
if
(
!
RRGetInfo
(
pScreen
))
if
(
!
RRGetInfo
(
pScreen
))
return
BadAlloc
;
return
BadAlloc
;
if
(
!
pScrPriv
)
if
(
!
pScrPriv
)
{
{
rep
.
type
=
X_Reply
;
rep
.
type
=
X_Reply
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
length
=
0
;
rep
.
length
=
0
;
rep
.
timestamp
=
currentTime
.
milliseconds
;
rep
.
timestamp
=
currentTime
.
milliseconds
;
rep
.
configTimestamp
=
currentTime
.
milliseconds
;
rep
.
configTimestamp
=
currentTime
.
milliseconds
;
rep
.
nCrtcs
=
0
;
rep
.
nCrtcs
=
0
;
rep
.
nOutputs
=
0
;
rep
.
nOutputs
=
0
;
rep
.
nModes
=
0
;
rep
.
nModes
=
0
;
rep
.
nbytesNames
=
0
;
rep
.
nbytesNames
=
0
;
extra
=
NULL
;
extra
=
NULL
;
extraLen
=
0
;
extraLen
=
0
;
}
}
else
else
{
{
RRModePtr
*
modes
;
RRModePtr
*
modes
;
int
num_modes
;
int
num_modes
;
modes
=
RRModesForScreen
(
pScreen
,
&
num_modes
);
modes
=
RRModesForScreen
(
pScreen
,
&
num_modes
);
if
(
!
modes
)
if
(
!
modes
)
return
BadAlloc
;
return
BadAlloc
;
rep
.
type
=
X_Reply
;
rep
.
type
=
X_Reply
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
length
=
0
;
rep
.
length
=
0
;
rep
.
timestamp
=
pScrPriv
->
lastSetTime
.
milliseconds
;
rep
.
timestamp
=
pScrPriv
->
lastSetTime
.
milliseconds
;
rep
.
configTimestamp
=
pScrPriv
->
lastConfigTime
.
milliseconds
;
rep
.
configTimestamp
=
pScrPriv
->
lastConfigTime
.
milliseconds
;
rep
.
nCrtcs
=
pScrPriv
->
numCrtcs
;
rep
.
nCrtcs
=
pScrPriv
->
numCrtcs
;
rep
.
nOutputs
=
pScrPriv
->
numOutputs
;
rep
.
nOutputs
=
pScrPriv
->
numOutputs
;
rep
.
nModes
=
num_modes
;
rep
.
nModes
=
num_modes
;
rep
.
nbytesNames
=
0
;
rep
.
nbytesNames
=
0
;
for
(
i
=
0
;
i
<
num_modes
;
i
++
)
for
(
i
=
0
;
i
<
num_modes
;
i
++
)
rep
.
nbytesNames
+=
modes
[
i
]
->
mode
.
nameLength
;
rep
.
nbytesNames
+=
modes
[
i
]
->
mode
.
nameLength
;
rep
.
length
=
(
pScrPriv
->
numCrtcs
+
rep
.
length
=
(
pScrPriv
->
numCrtcs
+
pScrPriv
->
numOutputs
+
pScrPriv
->
numOutputs
+
num_modes
*
(
SIZEOF
(
xRRModeInfo
)
>>
2
)
+
num_modes
*
(
SIZEOF
(
xRRModeInfo
)
>>
2
)
+
((
rep
.
nbytesNames
+
3
)
>>
2
));
((
rep
.
nbytesNames
+
3
)
>>
2
));
extraLen
=
rep
.
length
<<
2
;
extraLen
=
rep
.
length
<<
2
;
if
(
extraLen
)
{
if
(
extraLen
)
extra
=
xalloc
(
extraLen
);
{
if
(
!
extra
)
{
extra
=
xalloc
(
extraLen
);
xfree
(
modes
);
if
(
!
extra
)
return
BadAlloc
;
{
}
xfree
(
modes
);
}
return
BadAlloc
;
else
}
extra
=
NULL
;
}
else
crtcs
=
(
RRCrtc
*
)
extra
;
extra
=
NULL
;
outputs
=
(
RROutput
*
)
(
crtcs
+
pScrPriv
->
numCrtcs
);
modeinfos
=
(
xRRModeInfo
*
)
(
outputs
+
pScrPriv
->
numOutputs
);
crtcs
=
(
RRCrtc
*
)
extra
;
names
=
(
CARD8
*
)
(
modeinfos
+
num_modes
);
outputs
=
(
RROutput
*
)
(
crtcs
+
pScrPriv
->
numCrtcs
);
modeinfos
=
(
xRRModeInfo
*
)
(
outputs
+
pScrPriv
->
numOutputs
);
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
{
names
=
(
CARD8
*
)
(
modeinfos
+
num_modes
);
crtcs
[
i
]
=
pScrPriv
->
crtcs
[
i
]
->
id
;
if
(
client
->
swapped
)
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
swapl
(
&
crtcs
[
i
],
n
);
{
}
crtcs
[
i
]
=
pScrPriv
->
crtcs
[
i
]
->
id
;
if
(
client
->
swapped
)
for
(
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
{
swapl
(
&
crtcs
[
i
],
n
);
outputs
[
i
]
=
pScrPriv
->
outputs
[
i
]
->
id
;
}
if
(
client
->
swapped
)
swapl
(
&
outputs
[
i
],
n
);
for
(
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
}
{
outputs
[
i
]
=
pScrPriv
->
outputs
[
i
]
->
id
;
for
(
i
=
0
;
i
<
num_modes
;
i
++
)
{
if
(
client
->
swapped
)
RRModePtr
mode
=
modes
[
i
];
swapl
(
&
outputs
[
i
],
n
);
}
modeinfos
[
i
]
=
mode
->
mode
;
if
(
client
->
swapped
)
{
for
(
i
=
0
;
i
<
num_modes
;
i
++
)
swapl
(
&
modeinfos
[
i
].
id
,
n
);
{
swaps
(
&
modeinfos
[
i
].
width
,
n
);
RRModePtr
mode
=
modes
[
i
];
swaps
(
&
modeinfos
[
i
].
height
,
n
);
modeinfos
[
i
]
=
mode
->
mode
;
swapl
(
&
modeinfos
[
i
].
dotClock
,
n
);
if
(
client
->
swapped
)
swaps
(
&
modeinfos
[
i
].
hSyncStart
,
n
);
{
swaps
(
&
modeinfos
[
i
].
hSyncEnd
,
n
);
swapl
(
&
modeinfos
[
i
].
id
,
n
);
swaps
(
&
modeinfos
[
i
].
hTotal
,
n
);
swaps
(
&
modeinfos
[
i
].
width
,
n
);
swaps
(
&
modeinfos
[
i
].
hSkew
,
n
);
swaps
(
&
modeinfos
[
i
].
height
,
n
);
swaps
(
&
modeinfos
[
i
].
vSyncStart
,
n
);
swapl
(
&
modeinfos
[
i
].
dotClock
,
n
);
swaps
(
&
modeinfos
[
i
].
vSyncEnd
,
n
);
swaps
(
&
modeinfos
[
i
].
hSyncStart
,
n
);
swaps
(
&
modeinfos
[
i
].
vTotal
,
n
);
swaps
(
&
modeinfos
[
i
].
hSyncEnd
,
n
);
swaps
(
&
modeinfos
[
i
].
nameLength
,
n
);
swaps
(
&
modeinfos
[
i
].
hTotal
,
n
);
swapl
(
&
modeinfos
[
i
].
modeFlags
,
n
);
swaps
(
&
modeinfos
[
i
].
hSkew
,
n
);
}
swaps
(
&
modeinfos
[
i
].
vSyncStart
,
n
);
memcpy
(
names
,
mode
->
name
,
mode
->
mode
.
nameLength
);
swaps
(
&
modeinfos
[
i
].
vSyncEnd
,
n
);
names
+=
mode
->
mode
.
nameLength
;
swaps
(
&
modeinfos
[
i
].
vTotal
,
n
);
}
swaps
(
&
modeinfos
[
i
].
nameLength
,
n
);
xfree
(
modes
);
swapl
(
&
modeinfos
[
i
].
modeFlags
,
n
);
assert
(((((
char
*
)
names
-
(
char
*
)
extra
)
+
3
)
>>
2
)
==
rep
.
length
);
}
memcpy
(
names
,
mode
->
name
,
mode
->
mode
.
nameLength
);
names
+=
mode
->
mode
.
nameLength
;
}
xfree
(
modes
);
assert
(((((
char
*
)
names
-
(
char
*
)
extra
)
+
3
)
>>
2
)
==
rep
.
length
);
}
}
if
(
client
->
swapped
)
{
if
(
client
->
swapped
)
{
swaps
(
&
rep
.
sequenceNumber
,
n
);
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
timestamp
,
n
);
swapl
(
&
rep
.
timestamp
,
n
);
swapl
(
&
rep
.
configTimestamp
,
n
);
swapl
(
&
rep
.
configTimestamp
,
n
);
swaps
(
&
rep
.
nCrtcs
,
n
);
swaps
(
&
rep
.
nCrtcs
,
n
);
swaps
(
&
rep
.
nOutputs
,
n
);
swaps
(
&
rep
.
nOutputs
,
n
);
swaps
(
&
rep
.
nModes
,
n
);
swaps
(
&
rep
.
nModes
,
n
);
swaps
(
&
rep
.
nbytesNames
,
n
);
swaps
(
&
rep
.
nbytesNames
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xRRGetScreenResourcesReply
),
(
char
*
)
&
rep
);
WriteToClient
(
client
,
sizeof
(
xRRGetScreenResourcesReply
),
(
char
*
)
&
rep
);
if
(
extraLen
)
if
(
extraLen
)
{
{
WriteToClient
(
client
,
extraLen
,
(
char
*
)
extra
);
WriteToClient
(
client
,
extraLen
,
(
char
*
)
extra
);
xfree
(
extra
);
xfree
(
extra
);
}
}
return
client
->
noClientException
;
return
client
->
noClientException
;
}
}
typedef
struct
_RR10Data
{
typedef
struct
_RR10Data
{
RRScreenSizePtr
sizes
;
RRScreenSizePtr
sizes
;
int
nsize
;
int
nsize
;
int
nrefresh
;
int
nrefresh
;
int
size
;
int
size
;
CARD16
refresh
;
CARD16
refresh
;
}
RR10DataRec
,
*
RR10DataPtr
;
}
RR10DataRec
,
*
RR10DataPtr
;
/*
/*
* Convert 1.2 monitor data into 1.0 screen data
* Convert 1.2 monitor data into 1.0 screen data
*/
*/
static
RR10DataPtr
static
RR10DataPtr
RR10GetData
(
ScreenPtr
pScreen
,
RROutputPtr
output
)
RR10GetData
(
ScreenPtr
pScreen
,
RROutputPtr
output
)
{
{
RR10DataPtr
data
;
RR10DataPtr
data
;
RRScreenSizePtr
size
;
RRScreenSizePtr
size
;
int
nmode
=
output
->
numModes
+
output
->
numUserModes
;
int
nmode
=
output
->
numModes
+
output
->
numUserModes
;
int
o
,
os
,
l
,
r
;
int
o
,
os
,
l
,
r
;
RRScreenRatePtr
refresh
;
RRScreenRatePtr
refresh
;
CARD16
vRefresh
;
CARD16
vRefresh
;
RRModePtr
mode
;
RRModePtr
mode
;
Bool
*
used
;
Bool
*
used
;
/* Make sure there is plenty of space for any combination */
/* Make sure there is plenty of space for any combination */
data
=
malloc
(
sizeof
(
RR10DataRec
)
+
data
=
malloc
(
sizeof
(
RR10DataRec
)
+
sizeof
(
RRScreenSize
)
*
nmode
+
sizeof
(
RRScreenSize
)
*
nmode
+
sizeof
(
RRScreenRate
)
*
nmode
+
sizeof
(
RRScreenRate
)
*
nmode
+
sizeof
(
Bool
)
*
nmode
);
sizeof
(
Bool
)
*
nmode
);
if
(
!
data
)
if
(
!
data
)
return
NULL
;
return
NULL
;
size
=
(
RRScreenSizePtr
)
(
data
+
1
);
size
=
(
RRScreenSizePtr
)
(
data
+
1
);
refresh
=
(
RRScreenRatePtr
)
(
size
+
nmode
);
refresh
=
(
RRScreenRatePtr
)
(
size
+
nmode
);
used
=
(
Bool
*
)
(
refresh
+
nmode
);
used
=
(
Bool
*
)
(
refresh
+
nmode
);
memset
(
used
,
'\0'
,
sizeof
(
Bool
)
*
nmode
);
memset
(
used
,
'\0'
,
sizeof
(
Bool
)
*
nmode
);
data
->
sizes
=
size
;
data
->
sizes
=
size
;
data
->
nsize
=
0
;
data
->
nsize
=
0
;
data
->
nrefresh
=
0
;
data
->
nrefresh
=
0
;
...
@@ -540,269 +513,254 @@ RR10GetData (ScreenPtr pScreen, RROutputPtr output)
...
@@ -540,269 +513,254 @@ RR10GetData (ScreenPtr pScreen, RROutputPtr output)
/*
/*
* find modes not yet listed
* find modes not yet listed
*/
*/
for
(
o
=
0
;
o
<
output
->
numModes
+
output
->
numUserModes
;
o
++
)
for
(
o
=
0
;
o
<
output
->
numModes
+
output
->
numUserModes
;
o
++
)
{
{
if
(
used
[
o
])
if
(
used
[
o
])
continue
;
continue
;
if
(
o
<
output
->
numModes
)
if
(
o
<
output
->
numModes
)
mode
=
output
->
modes
[
o
];
mode
=
output
->
modes
[
o
];
else
else
mode
=
output
->
userModes
[
o
-
output
->
numModes
];
mode
=
output
->
userModes
[
o
-
output
->
numModes
];
l
=
data
->
nsize
;
l
=
data
->
nsize
;
size
[
l
].
id
=
data
->
nsize
;
size
[
l
].
id
=
data
->
nsize
;
size
[
l
].
width
=
mode
->
mode
.
width
;
size
[
l
].
width
=
mode
->
mode
.
width
;
size
[
l
].
height
=
mode
->
mode
.
height
;
size
[
l
].
height
=
mode
->
mode
.
height
;
if
(
output
->
mmWidth
&&
output
->
mmHeight
)
{
if
(
output
->
mmWidth
&&
output
->
mmHeight
)
{
size
[
l
].
mmWidth
=
output
->
mmWidth
;
size
[
l
].
mmWidth
=
output
->
mmWidth
;
size
[
l
].
mmHeight
=
output
->
mmHeight
;
size
[
l
].
mmHeight
=
output
->
mmHeight
;
}
else
{
}
size
[
l
].
mmWidth
=
pScreen
->
mmWidth
;
else
{
size
[
l
].
mmHeight
=
pScreen
->
mmHeight
;
size
[
l
].
mmWidth
=
pScreen
->
mmWidth
;
}
size
[
l
].
mmHeight
=
pScreen
->
mmHeight
;
size
[
l
].
nRates
=
0
;
}
size
[
l
].
pRates
=
&
refresh
[
data
->
nrefresh
];
size
[
l
].
nRates
=
0
;
data
->
nsize
++
;
size
[
l
].
pRates
=
&
refresh
[
data
->
nrefresh
];
data
->
nsize
++
;
/*
* Find all modes with matching size
/*
*/
* Find all modes with matching size
for
(
os
=
o
;
os
<
output
->
numModes
+
output
->
numUserModes
;
os
++
)
*/
{
for
(
os
=
o
;
os
<
output
->
numModes
+
output
->
numUserModes
;
os
++
)
{
if
(
os
<
output
->
numModes
)
if
(
os
<
output
->
numModes
)
mode
=
output
->
modes
[
os
];
mode
=
output
->
modes
[
os
];
else
else
mode
=
output
->
userModes
[
os
-
output
->
numModes
];
mode
=
output
->
userModes
[
os
-
output
->
numModes
];
if
(
mode
->
mode
.
width
==
size
[
l
].
width
&&
if
(
mode
->
mode
.
width
==
size
[
l
].
width
&&
mode
->
mode
.
height
==
size
[
l
].
height
)
mode
->
mode
.
height
==
size
[
l
].
height
)
{
{
vRefresh
=
RRVerticalRefresh
(
&
mode
->
mode
);
vRefresh
=
RRVerticalRefresh
(
&
mode
->
mode
);
used
[
os
]
=
TRUE
;
used
[
os
]
=
TRUE
;
for
(
r
=
0
;
r
<
size
[
l
].
nRates
;
r
++
)
for
(
r
=
0
;
r
<
size
[
l
].
nRates
;
r
++
)
if
(
vRefresh
==
size
[
l
].
pRates
[
r
].
rate
)
if
(
vRefresh
==
size
[
l
].
pRates
[
r
].
rate
)
break
;
break
;
if
(
r
==
size
[
l
].
nRates
)
{
if
(
r
==
size
[
l
].
nRates
)
size
[
l
].
pRates
[
r
].
rate
=
vRefresh
;
{
size
[
l
].
pRates
[
r
].
mode
=
mode
;
size
[
l
].
pRates
[
r
].
rate
=
vRefresh
;
size
[
l
].
nRates
++
;
size
[
l
].
pRates
[
r
].
mode
=
mode
;
data
->
nrefresh
++
;
size
[
l
].
nRates
++
;
}
data
->
nrefresh
++
;
if
(
mode
==
output
->
crtc
->
mode
)
{
}
data
->
size
=
l
;
if
(
mode
==
output
->
crtc
->
mode
)
data
->
refresh
=
vRefresh
;
{
}
data
->
size
=
l
;
}
data
->
refresh
=
vRefresh
;
}
}
}
}
}
}
return
data
;
return
data
;
}
}
int
int
ProcRRGetScreenInfo
(
ClientPtr
client
)
ProcRRGetScreenInfo
(
ClientPtr
client
)
{
{
REQUEST
(
xRRGetScreenInfoReq
);
REQUEST
(
xRRGetScreenInfoReq
);
xRRGetScreenInfoReply
rep
;
xRRGetScreenInfoReply
rep
;
WindowPtr
pWin
;
WindowPtr
pWin
;
int
n
,
rc
;
int
n
,
rc
;
ScreenPtr
pScreen
;
ScreenPtr
pScreen
;
rrScrPrivPtr
pScrPriv
;
rrScrPrivPtr
pScrPriv
;
CARD8
*
extra
;
CARD8
*
extra
;
unsigned
long
extraLen
;
unsigned
long
extraLen
;
RROutputPtr
output
;
RROutputPtr
output
;
REQUEST_SIZE_MATCH
(
xRRGetScreenInfoReq
);
REQUEST_SIZE_MATCH
(
xRRGetScreenInfoReq
);
#ifndef NXAGENT_SERVER
#ifndef NXAGENT_SERVER
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixReadAccess
);
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixReadAccess
);
#else
#else
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityReadAccess
);
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityReadAccess
);
rc
=
pWin
?
Success
:
BadWindow
;
rc
=
pWin
?
Success
:
BadWindow
;
#endif
#endif
if
(
rc
!=
Success
)
if
(
rc
!=
Success
)
return
rc
;
return
rc
;
pScreen
=
pWin
->
drawable
.
pScreen
;
pScreen
=
pWin
->
drawable
.
pScreen
;
pScrPriv
=
rrGetScrPriv
(
pScreen
);
pScrPriv
=
rrGetScrPriv
(
pScreen
);
rep
.
pad
=
0
;
rep
.
pad
=
0
;
if
(
pScrPriv
)
if
(
pScrPriv
)
if
(
!
RRGetInfo
(
pScreen
))
if
(
!
RRGetInfo
(
pScreen
))
return
BadAlloc
;
return
BadAlloc
;
output
=
RRFirstOutput
(
pScreen
);
output
=
RRFirstOutput
(
pScreen
);
if
(
!
pScrPriv
||
!
output
)
if
(
!
pScrPriv
||
!
output
)
{
{
rep
.
type
=
X_Reply
;
rep
.
type
=
X_Reply
;
rep
.
setOfRotations
=
RR_Rotate_0
;;
rep
.
setOfRotations
=
RR_Rotate_0
;;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
length
=
0
;
rep
.
length
=
0
;
rep
.
root
=
WindowTable
[
pWin
->
drawable
.
pScreen
->
myNum
]
->
drawable
.
id
;
rep
.
root
=
WindowTable
[
pWin
->
drawable
.
pScreen
->
myNum
]
->
drawable
.
id
;
rep
.
timestamp
=
currentTime
.
milliseconds
;
rep
.
timestamp
=
currentTime
.
milliseconds
;
rep
.
configTimestamp
=
currentTime
.
milliseconds
;
rep
.
configTimestamp
=
currentTime
.
milliseconds
;
rep
.
nSizes
=
0
;
rep
.
nSizes
=
0
;
rep
.
sizeID
=
0
;
rep
.
sizeID
=
0
;
rep
.
rotation
=
RR_Rotate_0
;
rep
.
rotation
=
RR_Rotate_0
;
rep
.
rate
=
0
;
rep
.
rate
=
0
;
rep
.
nrateEnts
=
0
;
rep
.
nrateEnts
=
0
;
extra
=
0
;
extra
=
0
;
extraLen
=
0
;
extraLen
=
0
;
}
}
else
else
{
{
int
i
,
j
;
int
i
,
j
;
xScreenSizes
*
size
;
xScreenSizes
*
size
;
CARD16
*
rates
;
CARD16
*
rates
;
CARD8
*
data8
;
CARD8
*
data8
;
Bool
has_rate
=
RRClientKnowsRates
(
client
);
Bool
has_rate
=
RRClientKnowsRates
(
client
);
RR10DataPtr
pData
;
RR10DataPtr
pData
;
RRScreenSizePtr
pSize
;
RRScreenSizePtr
pSize
;
pData
=
RR10GetData
(
pScreen
,
output
);
pData
=
RR10GetData
(
pScreen
,
output
);
if
(
!
pData
)
if
(
!
pData
)
return
BadAlloc
;
return
BadAlloc
;
rep
.
type
=
X_Reply
;
rep
.
type
=
X_Reply
;
rep
.
setOfRotations
=
output
->
crtc
->
rotations
;
rep
.
setOfRotations
=
output
->
crtc
->
rotations
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
length
=
0
;
rep
.
length
=
0
;
rep
.
root
=
WindowTable
[
pWin
->
drawable
.
pScreen
->
myNum
]
->
drawable
.
id
;
rep
.
root
=
WindowTable
[
pWin
->
drawable
.
pScreen
->
myNum
]
->
drawable
.
id
;
rep
.
timestamp
=
pScrPriv
->
lastSetTime
.
milliseconds
;
rep
.
timestamp
=
pScrPriv
->
lastSetTime
.
milliseconds
;
rep
.
configTimestamp
=
pScrPriv
->
lastConfigTime
.
milliseconds
;
rep
.
configTimestamp
=
pScrPriv
->
lastConfigTime
.
milliseconds
;
rep
.
rotation
=
output
->
crtc
->
rotation
;
rep
.
rotation
=
output
->
crtc
->
rotation
;
rep
.
nSizes
=
pData
->
nsize
;
rep
.
nSizes
=
pData
->
nsize
;
rep
.
nrateEnts
=
pData
->
nrefresh
+
pData
->
nsize
;
rep
.
nrateEnts
=
pData
->
nrefresh
+
pData
->
nsize
;
rep
.
sizeID
=
pData
->
size
;
rep
.
sizeID
=
pData
->
size
;
rep
.
rate
=
pData
->
refresh
;
rep
.
rate
=
pData
->
refresh
;
extraLen
=
rep
.
nSizes
*
sizeof
(
xScreenSizes
);
extraLen
=
rep
.
nSizes
*
sizeof
(
xScreenSizes
);
if
(
has_rate
)
if
(
has_rate
)
extraLen
+=
rep
.
nrateEnts
*
sizeof
(
CARD16
);
extraLen
+=
rep
.
nrateEnts
*
sizeof
(
CARD16
);
if
(
extraLen
)
if
(
extraLen
)
{
{
extra
=
(
CARD8
*
)
xalloc
(
extraLen
);
extra
=
(
CARD8
*
)
xalloc
(
extraLen
);
if
(
!
extra
)
{
if
(
!
extra
)
xfree
(
pData
);
{
return
BadAlloc
;
xfree
(
pData
);
}
return
BadAlloc
;
}
}
else
}
extra
=
NULL
;
else
extra
=
NULL
;
/*
* First comes the size information
/*
*/
* First comes the size information
size
=
(
xScreenSizes
*
)
extra
;
*/
rates
=
(
CARD16
*
)
(
size
+
rep
.
nSizes
);
size
=
(
xScreenSizes
*
)
extra
;
for
(
i
=
0
;
i
<
pData
->
nsize
;
i
++
)
{
rates
=
(
CARD16
*
)
(
size
+
rep
.
nSizes
);
pSize
=
&
pData
->
sizes
[
i
];
for
(
i
=
0
;
i
<
pData
->
nsize
;
i
++
)
size
->
widthInPixels
=
pSize
->
width
;
{
size
->
heightInPixels
=
pSize
->
height
;
pSize
=
&
pData
->
sizes
[
i
];
size
->
widthInMillimeters
=
pSize
->
mmWidth
;
size
->
widthInPixels
=
pSize
->
width
;
size
->
heightInMillimeters
=
pSize
->
mmHeight
;
size
->
heightInPixels
=
pSize
->
height
;
if
(
client
->
swapped
)
{
size
->
widthInMillimeters
=
pSize
->
mmWidth
;
swaps
(
&
size
->
widthInPixels
,
n
);
size
->
heightInMillimeters
=
pSize
->
mmHeight
;
swaps
(
&
size
->
heightInPixels
,
n
);
if
(
client
->
swapped
)
swaps
(
&
size
->
widthInMillimeters
,
n
);
{
swaps
(
&
size
->
heightInMillimeters
,
n
);
swaps
(
&
size
->
widthInPixels
,
n
);
}
swaps
(
&
size
->
heightInPixels
,
n
);
size
++
;
swaps
(
&
size
->
widthInMillimeters
,
n
);
if
(
has_rate
)
{
swaps
(
&
size
->
heightInMillimeters
,
n
);
*
rates
=
pSize
->
nRates
;
}
if
(
client
->
swapped
)
{
size
++
;
swaps
(
rates
,
n
);
if
(
has_rate
)
}
{
rates
++
;
*
rates
=
pSize
->
nRates
;
for
(
j
=
0
;
j
<
pSize
->
nRates
;
j
++
)
{
if
(
client
->
swapped
)
*
rates
=
pSize
->
pRates
[
j
].
rate
;
{
if
(
client
->
swapped
)
{
swaps
(
rates
,
n
);
swaps
(
rates
,
n
);
}
}
rates
++
;
rates
++
;
for
(
j
=
0
;
j
<
pSize
->
nRates
;
j
++
)
}
{
}
*
rates
=
pSize
->
pRates
[
j
].
rate
;
}
if
(
client
->
swapped
)
xfree
(
pData
);
{
swaps
(
rates
,
n
);
data8
=
(
CARD8
*
)
rates
;
}
rates
++
;
if
(
data8
-
(
CARD8
*
)
extra
!=
extraLen
)
}
FatalError
(
"RRGetScreenInfo bad extra len %ld != %ld
\n
"
,
}
(
unsigned
long
)
(
data8
-
(
CARD8
*
)
extra
),
extraLen
);
}
rep
.
length
=
(
extraLen
+
3
)
>>
2
;
xfree
(
pData
);
data8
=
(
CARD8
*
)
rates
;
if
(
data8
-
(
CARD8
*
)
extra
!=
extraLen
)
FatalError
(
"RRGetScreenInfo bad extra len %ld != %ld
\n
"
,
(
unsigned
long
)(
data8
-
(
CARD8
*
)
extra
),
extraLen
);
rep
.
length
=
(
extraLen
+
3
)
>>
2
;
}
}
if
(
client
->
swapped
)
{
if
(
client
->
swapped
)
{
swaps
(
&
rep
.
sequenceNumber
,
n
);
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
timestamp
,
n
);
swapl
(
&
rep
.
timestamp
,
n
);
swapl
(
&
rep
.
configTimestamp
,
n
);
swapl
(
&
rep
.
configTimestamp
,
n
);
swaps
(
&
rep
.
rotation
,
n
);
swaps
(
&
rep
.
rotation
,
n
);
swaps
(
&
rep
.
nSizes
,
n
);
swaps
(
&
rep
.
nSizes
,
n
);
swaps
(
&
rep
.
sizeID
,
n
);
swaps
(
&
rep
.
sizeID
,
n
);
swaps
(
&
rep
.
rate
,
n
);
swaps
(
&
rep
.
rate
,
n
);
swaps
(
&
rep
.
nrateEnts
,
n
);
swaps
(
&
rep
.
nrateEnts
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xRRGetScreenInfoReply
),
(
char
*
)
&
rep
);
WriteToClient
(
client
,
sizeof
(
xRRGetScreenInfoReply
),
(
char
*
)
&
rep
);
if
(
extraLen
)
if
(
extraLen
)
{
{
WriteToClient
(
client
,
extraLen
,
(
char
*
)
extra
);
WriteToClient
(
client
,
extraLen
,
(
char
*
)
extra
);
xfree
(
extra
);
xfree
(
extra
);
}
}
return
(
client
->
noClientException
);
return
(
client
->
noClientException
);
}
}
int
int
ProcRRSetScreenConfig
(
ClientPtr
client
)
ProcRRSetScreenConfig
(
ClientPtr
client
)
{
{
REQUEST
(
xRRSetScreenConfigReq
);
REQUEST
(
xRRSetScreenConfigReq
);
xRRSetScreenConfigReply
rep
;
xRRSetScreenConfigReply
rep
;
DrawablePtr
pDraw
;
DrawablePtr
pDraw
;
int
n
,
rc
;
int
n
,
rc
;
ScreenPtr
pScreen
;
ScreenPtr
pScreen
;
rrScrPrivPtr
pScrPriv
;
rrScrPrivPtr
pScrPriv
;
TimeStamp
time
;
TimeStamp
time
;
int
i
;
int
i
;
Rotation
rotation
;
Rotation
rotation
;
int
rate
;
int
rate
;
Bool
has_rate
;
Bool
has_rate
;
RROutputPtr
output
;
RROutputPtr
output
;
RRCrtcPtr
crtc
;
RRCrtcPtr
crtc
;
RRModePtr
mode
;
RRModePtr
mode
;
RR10DataPtr
pData
=
NULL
;
RR10DataPtr
pData
=
NULL
;
RRScreenSizePtr
pSize
;
RRScreenSizePtr
pSize
;
int
width
,
height
;
int
width
,
height
;
UpdateCurrentTime
();
UpdateCurrentTime
();
if
(
RRClientKnowsRates
(
client
))
if
(
RRClientKnowsRates
(
client
))
{
{
REQUEST_SIZE_MATCH
(
xRRSetScreenConfigReq
);
REQUEST_SIZE_MATCH
(
xRRSetScreenConfigReq
);
has_rate
=
TRUE
;
has_rate
=
TRUE
;
}
}
else
else
{
{
REQUEST_SIZE_MATCH
(
xRR1_0SetScreenConfigReq
);
REQUEST_SIZE_MATCH
(
xRR1_0SetScreenConfigReq
);
has_rate
=
FALSE
;
has_rate
=
FALSE
;
}
}
#ifndef NXAGENT_SERVER
#ifndef NXAGENT_SERVER
rc
=
dixLookupDrawable
(
&
pDraw
,
stuff
->
drawable
,
client
,
0
,
DixWriteAccess
);
rc
=
dixLookupDrawable
(
&
pDraw
,
stuff
->
drawable
,
client
,
0
,
DixWriteAccess
);
#else
#else
pDraw
=
SecurityLookupDrawable
(
stuff
->
drawable
,
client
,
SecurityWriteAccess
);
pDraw
=
SecurityLookupDrawable
(
stuff
->
drawable
,
client
,
SecurityWriteAccess
);
rc
=
pDraw
?
Success
:
BadDrawable
;
rc
=
pDraw
?
Success
:
BadDrawable
;
#endif
#endif
if
(
rc
!=
Success
)
if
(
rc
!=
Success
)
return
rc
;
return
rc
;
pScreen
=
pDraw
->
pScreen
;
pScreen
=
pDraw
->
pScreen
;
...
@@ -810,21 +768,19 @@ ProcRRSetScreenConfig (ClientPtr client)
...
@@ -810,21 +768,19 @@ ProcRRSetScreenConfig (ClientPtr client)
time
=
ClientTimeToServerTime
(
stuff
->
timestamp
);
time
=
ClientTimeToServerTime
(
stuff
->
timestamp
);
if
(
!
pScrPriv
)
if
(
!
pScrPriv
)
{
{
time
=
currentTime
;
time
=
currentTime
;
rep
.
status
=
RRSetConfigFailed
;
rep
.
status
=
RRSetConfigFailed
;
goto
sendReply
;
goto
sendReply
;
}
}
if
(
!
RRGetInfo
(
pScreen
))
if
(
!
RRGetInfo
(
pScreen
))
return
BadAlloc
;
return
BadAlloc
;
output
=
RRFirstOutput
(
pScreen
);
output
=
RRFirstOutput
(
pScreen
);
if
(
!
output
)
if
(
!
output
)
{
{
time
=
currentTime
;
time
=
currentTime
;
rep
.
status
=
RRSetConfigFailed
;
rep
.
status
=
RRSetConfigFailed
;
goto
sendReply
;
goto
sendReply
;
}
}
crtc
=
output
->
crtc
;
crtc
=
output
->
crtc
;
...
@@ -838,24 +794,22 @@ ProcRRSetScreenConfig (ClientPtr client)
...
@@ -838,24 +794,22 @@ ProcRRSetScreenConfig (ClientPtr client)
* timestamp, so using CompareTimeStamps here would cause randr to suddenly
* timestamp, so using CompareTimeStamps here would cause randr to suddenly
* stop working after several hours have passed (freedesktop bug #6502).
* stop working after several hours have passed (freedesktop bug #6502).
*/
*/
if
(
stuff
->
configTimestamp
!=
pScrPriv
->
lastConfigTime
.
milliseconds
)
if
(
stuff
->
configTimestamp
!=
pScrPriv
->
lastConfigTime
.
milliseconds
)
{
{
rep
.
status
=
RRSetConfigInvalidConfigTime
;
rep
.
status
=
RRSetConfigInvalidConfigTime
;
goto
sendReply
;
goto
sendReply
;
}
}
pData
=
RR10GetData
(
pScreen
,
output
);
pData
=
RR10GetData
(
pScreen
,
output
);
if
(
!
pData
)
if
(
!
pData
)
return
BadAlloc
;
return
BadAlloc
;
if
(
stuff
->
sizeID
>=
pData
->
nsize
)
if
(
stuff
->
sizeID
>=
pData
->
nsize
)
{
{
/*
/*
* Invalid size ID
* Invalid size ID
*/
*/
client
->
errorValue
=
stuff
->
sizeID
;
client
->
errorValue
=
stuff
->
sizeID
;
xfree
(
pData
);
xfree
(
pData
);
return
BadValue
;
return
BadValue
;
}
}
pSize
=
&
pData
->
sizes
[
stuff
->
sizeID
];
pSize
=
&
pData
->
sizes
[
stuff
->
sizeID
];
...
@@ -870,63 +824,58 @@ ProcRRSetScreenConfig (ClientPtr client)
...
@@ -870,63 +824,58 @@ ProcRRSetScreenConfig (ClientPtr client)
case
RR_Rotate_90
:
case
RR_Rotate_90
:
case
RR_Rotate_180
:
case
RR_Rotate_180
:
case
RR_Rotate_270
:
case
RR_Rotate_270
:
break
;
break
;
default:
default:
/*
/*
* Invalid rotation
* Invalid rotation
*/
*/
client
->
errorValue
=
stuff
->
rotation
;
client
->
errorValue
=
stuff
->
rotation
;
xfree
(
pData
);
xfree
(
pData
);
return
BadValue
;
return
BadValue
;
}
}
if
((
~
crtc
->
rotations
)
&
rotation
)
if
((
~
crtc
->
rotations
)
&
rotation
)
{
{
/*
/*
* requested rotation or reflection not supported by screen
* requested rotation or reflection not supported by screen
*/
*/
client
->
errorValue
=
stuff
->
rotation
;
client
->
errorValue
=
stuff
->
rotation
;
xfree
(
pData
);
xfree
(
pData
);
return
BadMatch
;
return
BadMatch
;
}
}
/*
/*
* Validate requested refresh
* Validate requested refresh
*/
*/
if
(
has_rate
)
if
(
has_rate
)
rate
=
(
int
)
stuff
->
rate
;
rate
=
(
int
)
stuff
->
rate
;
else
else
rate
=
0
;
rate
=
0
;
if
(
rate
)
if
(
rate
)
{
{
for
(
i
=
0
;
i
<
pSize
->
nRates
;
i
++
)
{
for
(
i
=
0
;
i
<
pSize
->
nRates
;
i
++
)
if
(
pSize
->
pRates
[
i
].
rate
==
rate
)
{
break
;
if
(
pSize
->
pRates
[
i
].
rate
==
rate
)
}
break
;
if
(
i
==
pSize
->
nRates
)
{
}
/*
if
(
i
==
pSize
->
nRates
)
* Invalid rate
{
*/
/*
client
->
errorValue
=
rate
;
* Invalid rate
xfree
(
pData
);
*/
return
BadValue
;
client
->
errorValue
=
rate
;
}
xfree
(
pData
);
mode
=
pSize
->
pRates
[
i
].
mode
;
return
BadValue
;
}
mode
=
pSize
->
pRates
[
i
].
mode
;
}
}
else
else
mode
=
pSize
->
pRates
[
0
].
mode
;
mode
=
pSize
->
pRates
[
0
].
mode
;
/*
/*
* Make sure the requested set-time is not older than
* Make sure the requested set-time is not older than
* the last set-time
* the last set-time
*/
*/
if
(
CompareTimeStamps
(
time
,
pScrPriv
->
lastSetTime
)
<
0
)
if
(
CompareTimeStamps
(
time
,
pScrPriv
->
lastSetTime
)
<
0
)
{
{
rep
.
status
=
RRSetConfigInvalidTime
;
rep
.
status
=
RRSetConfigInvalidTime
;
goto
sendReply
;
goto
sendReply
;
}
}
/*
/*
...
@@ -935,61 +884,56 @@ ProcRRSetScreenConfig (ClientPtr client)
...
@@ -935,61 +884,56 @@ ProcRRSetScreenConfig (ClientPtr client)
*/
*/
width
=
mode
->
mode
.
width
;
width
=
mode
->
mode
.
width
;
height
=
mode
->
mode
.
height
;
height
=
mode
->
mode
.
height
;
if
(
rotation
&
(
RR_Rotate_90
|
RR_Rotate_270
))
if
(
rotation
&
(
RR_Rotate_90
|
RR_Rotate_270
))
{
{
width
=
mode
->
mode
.
height
;
width
=
mode
->
mode
.
height
;
height
=
mode
->
mode
.
width
;
height
=
mode
->
mode
.
width
;
}
}
if
(
width
<
pScrPriv
->
minWidth
||
pScrPriv
->
maxWidth
<
width
)
{
if
(
width
<
pScrPriv
->
minWidth
||
pScrPriv
->
maxWidth
<
width
)
{
client
->
errorValue
=
width
;
client
->
errorValue
=
width
;
xfree
(
pData
);
xfree
(
pData
);
return
BadValue
;
return
BadValue
;
}
}
if
(
height
<
pScrPriv
->
minHeight
||
pScrPriv
->
maxHeight
<
height
)
{
if
(
height
<
pScrPriv
->
minHeight
||
pScrPriv
->
maxHeight
<
height
)
{
client
->
errorValue
=
height
;
client
->
errorValue
=
height
;
xfree
(
pData
);
xfree
(
pData
);
return
BadValue
;
return
BadValue
;
}
}
if
(
width
!=
pScreen
->
width
||
height
!=
pScreen
->
height
)
if
(
width
!=
pScreen
->
width
||
height
!=
pScreen
->
height
)
{
{
int
c
;
int
c
;
for
(
c
=
0
;
c
<
pScrPriv
->
numCrtcs
;
c
++
)
{
for
(
c
=
0
;
c
<
pScrPriv
->
numCrtcs
;
c
++
)
if
(
!
RRCrtcSet
(
pScrPriv
->
crtcs
[
c
],
NULL
,
0
,
0
,
RR_Rotate_0
,
{
0
,
NULL
))
{
if
(
!
RRCrtcSet
(
pScrPriv
->
crtcs
[
c
],
NULL
,
0
,
0
,
RR_Rotate_0
,
rep
.
status
=
RRSetConfigFailed
;
0
,
NULL
))
/* XXX recover from failure */
{
goto
sendReply
;
rep
.
status
=
RRSetConfigFailed
;
}
/* XXX recover from failure */
}
goto
sendReply
;
if
(
!
RRScreenSizeSet
(
pScreen
,
width
,
height
,
}
pScreen
->
mmWidth
,
pScreen
->
mmHeight
))
{
}
rep
.
status
=
RRSetConfigFailed
;
if
(
!
RRScreenSizeSet
(
pScreen
,
width
,
height
,
/* XXX recover from failure */
pScreen
->
mmWidth
,
pScreen
->
mmHeight
))
goto
sendReply
;
{
}
rep
.
status
=
RRSetConfigFailed
;
}
/* XXX recover from failure */
goto
sendReply
;
if
(
!
RRCrtcSet
(
crtc
,
mode
,
0
,
0
,
stuff
->
rotation
,
1
,
&
output
))
}
rep
.
status
=
RRSetConfigFailed
;
}
if
(
!
RRCrtcSet
(
crtc
,
mode
,
0
,
0
,
stuff
->
rotation
,
1
,
&
output
))
rep
.
status
=
RRSetConfigFailed
;
else
{
else
{
pScrPriv
->
lastSetTime
=
time
;
pScrPriv
->
lastSetTime
=
time
;
rep
.
status
=
RRSetConfigSuccess
;
rep
.
status
=
RRSetConfigSuccess
;
}
}
/*
/*
* XXX Configure other crtcs to mirror as much as possible
* XXX Configure other crtcs to mirror as much as possible
*/
*/
sendReply:
sendReply:
if
(
pData
)
if
(
pData
)
xfree
(
pData
);
xfree
(
pData
);
rep
.
type
=
X_Reply
;
rep
.
type
=
X_Reply
;
/* rep.status has already been filled in */
/* rep.status has already been filled in */
...
@@ -1000,40 +944,38 @@ sendReply:
...
@@ -1000,40 +944,38 @@ sendReply:
rep
.
newConfigTimestamp
=
pScrPriv
->
lastConfigTime
.
milliseconds
;
rep
.
newConfigTimestamp
=
pScrPriv
->
lastConfigTime
.
milliseconds
;
rep
.
root
=
WindowTable
[
pDraw
->
pScreen
->
myNum
]
->
drawable
.
id
;
rep
.
root
=
WindowTable
[
pDraw
->
pScreen
->
myNum
]
->
drawable
.
id
;
if
(
client
->
swapped
)
if
(
client
->
swapped
)
{
{
swaps
(
&
rep
.
sequenceNumber
,
n
);
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
newTimestamp
,
n
);
swapl
(
&
rep
.
newTimestamp
,
n
);
swapl
(
&
rep
.
newConfigTimestamp
,
n
);
swapl
(
&
rep
.
newConfigTimestamp
,
n
);
swapl
(
&
rep
.
root
,
n
);
swapl
(
&
rep
.
root
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xRRSetScreenConfigReply
),
(
char
*
)
&
rep
);
WriteToClient
(
client
,
sizeof
(
xRRSetScreenConfigReply
),
(
char
*
)
&
rep
);
return
(
client
->
noClientException
);
return
(
client
->
noClientException
);
}
}
static
CARD16
static
CARD16
RR10CurrentSizeID
(
ScreenPtr
pScreen
)
RR10CurrentSizeID
(
ScreenPtr
pScreen
)
{
{
CARD16
sizeID
=
0xffff
;
CARD16
sizeID
=
0xffff
;
RROutputPtr
output
=
RRFirstOutput
(
pScreen
);
RROutputPtr
output
=
RRFirstOutput
(
pScreen
);
if
(
output
)
if
(
output
)
{
{
RR10DataPtr
data
=
RR10GetData
(
pScreen
,
output
);
RR10DataPtr
data
=
RR10GetData
(
pScreen
,
output
);
if
(
data
)
if
(
data
)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
data
->
nsize
;
i
++
)
for
(
i
=
0
;
i
<
data
->
nsize
;
i
++
)
if
(
data
->
sizes
[
i
].
width
==
pScreen
->
width
&&
if
(
data
->
sizes
[
i
].
width
==
pScreen
->
width
&&
data
->
sizes
[
i
].
height
==
pScreen
->
height
)
data
->
sizes
[
i
].
height
==
pScreen
->
height
)
{
{
sizeID
=
(
CARD16
)
i
;
sizeID
=
(
CARD16
)
i
;
break
;
break
;
}
}
xfree
(
data
);
xfree
(
data
);
}
}
}
}
return
sizeID
;
return
sizeID
;
}
}
nx-X11/programs/Xserver/randr/rrsdispatch.c
View file @
e440ea76
...
@@ -23,12 +23,13 @@
...
@@ -23,12 +23,13 @@
#include "randrstr.h"
#include "randrstr.h"
static
int
static
int
SProcRRQueryVersion
(
ClientPtr
client
)
SProcRRQueryVersion
(
ClientPtr
client
)
{
{
register
int
n
;
register
int
n
;
REQUEST
(
xRRQueryVersionReq
);
REQUEST
(
xRRQueryVersionReq
);
REQUEST_SIZE_MATCH
(
xRRQueryVersionReq
);
REQUEST_SIZE_MATCH
(
xRRQueryVersionReq
);
swaps
(
&
stuff
->
length
,
n
);
swaps
(
&
stuff
->
length
,
n
);
swapl
(
&
stuff
->
majorVersion
,
n
);
swapl
(
&
stuff
->
majorVersion
,
n
);
swapl
(
&
stuff
->
minorVersion
,
n
);
swapl
(
&
stuff
->
minorVersion
,
n
);
...
@@ -36,31 +37,31 @@ SProcRRQueryVersion (ClientPtr client)
...
@@ -36,31 +37,31 @@ SProcRRQueryVersion (ClientPtr client)
}
}
static
int
static
int
SProcRRGetScreenInfo
(
ClientPtr
client
)
SProcRRGetScreenInfo
(
ClientPtr
client
)
{
{
register
int
n
;
register
int
n
;
REQUEST
(
xRRGetScreenInfoReq
);
REQUEST
(
xRRGetScreenInfoReq
);
REQUEST_SIZE_MATCH
(
xRRGetScreenInfoReq
);
REQUEST_SIZE_MATCH
(
xRRGetScreenInfoReq
);
swaps
(
&
stuff
->
length
,
n
);
swaps
(
&
stuff
->
length
,
n
);
swapl
(
&
stuff
->
window
,
n
);
swapl
(
&
stuff
->
window
,
n
);
return
(
*
ProcRandrVector
[
stuff
->
randrReqType
])
(
client
);
return
(
*
ProcRandrVector
[
stuff
->
randrReqType
])
(
client
);
}
}
static
int
static
int
SProcRRSetScreenConfig
(
ClientPtr
client
)
SProcRRSetScreenConfig
(
ClientPtr
client
)
{
{
register
int
n
;
register
int
n
;
REQUEST
(
xRRSetScreenConfigReq
);
REQUEST
(
xRRSetScreenConfigReq
);
if
(
RRClientKnowsRates
(
client
))
if
(
RRClientKnowsRates
(
client
))
{
{
REQUEST_SIZE_MATCH
(
xRRSetScreenConfigReq
);
REQUEST_SIZE_MATCH
(
xRRSetScreenConfigReq
);
swaps
(
&
stuff
->
rate
,
n
);
swaps
(
&
stuff
->
rate
,
n
);
}
}
else
else
{
{
REQUEST_SIZE_MATCH
(
xRR1_0SetScreenConfigReq
);
REQUEST_SIZE_MATCH
(
xRR1_0SetScreenConfigReq
);
}
}
swaps
(
&
stuff
->
length
,
n
);
swaps
(
&
stuff
->
length
,
n
);
...
@@ -72,12 +73,13 @@ SProcRRSetScreenConfig (ClientPtr client)
...
@@ -72,12 +73,13 @@ SProcRRSetScreenConfig (ClientPtr client)
}
}
static
int
static
int
SProcRRSelectInput
(
ClientPtr
client
)
SProcRRSelectInput
(
ClientPtr
client
)
{
{
register
int
n
;
register
int
n
;
REQUEST
(
xRRSelectInputReq
);
REQUEST
(
xRRSelectInputReq
);
REQUEST_SIZE_MATCH
(
xRRSelectInputReq
);
REQUEST_SIZE_MATCH
(
xRRSelectInputReq
);
swaps
(
&
stuff
->
length
,
n
);
swaps
(
&
stuff
->
length
,
n
);
swapl
(
&
stuff
->
window
,
n
);
swapl
(
&
stuff
->
window
,
n
);
swaps
(
&
stuff
->
enable
,
n
);
swaps
(
&
stuff
->
enable
,
n
);
...
@@ -85,9 +87,10 @@ SProcRRSelectInput (ClientPtr client)
...
@@ -85,9 +87,10 @@ SProcRRSelectInput (ClientPtr client)
}
}
static
int
static
int
SProcRRGetScreenSizeRange
(
ClientPtr
client
)
SProcRRGetScreenSizeRange
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRGetScreenSizeRangeReq
);
REQUEST
(
xRRGetScreenSizeRangeReq
);
REQUEST_SIZE_MATCH
(
xRRGetScreenSizeRangeReq
);
REQUEST_SIZE_MATCH
(
xRRGetScreenSizeRangeReq
);
...
@@ -97,9 +100,10 @@ SProcRRGetScreenSizeRange (ClientPtr client)
...
@@ -97,9 +100,10 @@ SProcRRGetScreenSizeRange (ClientPtr client)
}
}
static
int
static
int
SProcRRSetScreenSize
(
ClientPtr
client
)
SProcRRSetScreenSize
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRSetScreenSizeReq
);
REQUEST
(
xRRSetScreenSizeReq
);
REQUEST_SIZE_MATCH
(
xRRSetScreenSizeReq
);
REQUEST_SIZE_MATCH
(
xRRSetScreenSizeReq
);
...
@@ -113,9 +117,10 @@ SProcRRSetScreenSize (ClientPtr client)
...
@@ -113,9 +117,10 @@ SProcRRSetScreenSize (ClientPtr client)
}
}
static
int
static
int
SProcRRGetScreenResources
(
ClientPtr
client
)
SProcRRGetScreenResources
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRGetScreenResourcesReq
);
REQUEST
(
xRRGetScreenResourcesReq
);
REQUEST_SIZE_MATCH
(
xRRGetScreenResourcesReq
);
REQUEST_SIZE_MATCH
(
xRRGetScreenResourcesReq
);
...
@@ -125,9 +130,10 @@ SProcRRGetScreenResources (ClientPtr client)
...
@@ -125,9 +130,10 @@ SProcRRGetScreenResources (ClientPtr client)
}
}
static
int
static
int
SProcRRGetOutputInfo
(
ClientPtr
client
)
SProcRRGetOutputInfo
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRGetOutputInfoReq
);;
REQUEST
(
xRRGetOutputInfoReq
);;
REQUEST_SIZE_MATCH
(
xRRGetOutputInfoReq
);
REQUEST_SIZE_MATCH
(
xRRGetOutputInfoReq
);
...
@@ -138,9 +144,10 @@ SProcRRGetOutputInfo (ClientPtr client)
...
@@ -138,9 +144,10 @@ SProcRRGetOutputInfo (ClientPtr client)
}
}
static
int
static
int
SProcRRListOutputProperties
(
ClientPtr
client
)
SProcRRListOutputProperties
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRListOutputPropertiesReq
);
REQUEST
(
xRRListOutputPropertiesReq
);
REQUEST_SIZE_MATCH
(
xRRListOutputPropertiesReq
);
REQUEST_SIZE_MATCH
(
xRRListOutputPropertiesReq
);
...
@@ -150,9 +157,10 @@ SProcRRListOutputProperties (ClientPtr client)
...
@@ -150,9 +157,10 @@ SProcRRListOutputProperties (ClientPtr client)
}
}
static
int
static
int
SProcRRQueryOutputProperty
(
ClientPtr
client
)
SProcRRQueryOutputProperty
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRQueryOutputPropertyReq
);
REQUEST
(
xRRQueryOutputPropertyReq
);
REQUEST_SIZE_MATCH
(
xRRQueryOutputPropertyReq
);
REQUEST_SIZE_MATCH
(
xRRQueryOutputPropertyReq
);
...
@@ -163,9 +171,10 @@ SProcRRQueryOutputProperty (ClientPtr client)
...
@@ -163,9 +171,10 @@ SProcRRQueryOutputProperty (ClientPtr client)
}
}
static
int
static
int
SProcRRConfigureOutputProperty
(
ClientPtr
client
)
SProcRRConfigureOutputProperty
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRConfigureOutputPropertyReq
);
REQUEST
(
xRRConfigureOutputPropertyReq
);
swaps
(
&
stuff
->
length
,
n
);
swaps
(
&
stuff
->
length
,
n
);
...
@@ -176,37 +185,39 @@ SProcRRConfigureOutputProperty (ClientPtr client)
...
@@ -176,37 +185,39 @@ SProcRRConfigureOutputProperty (ClientPtr client)
}
}
static
int
static
int
SProcRRChangeOutputProperty
(
ClientPtr
client
)
SProcRRChangeOutputProperty
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRChangeOutputPropertyReq
);
REQUEST
(
xRRChangeOutputPropertyReq
);
REQUEST_AT_LEAST_SIZE
(
xRRChangeOutputPropertyReq
);
REQUEST_AT_LEAST_SIZE
(
xRRChangeOutputPropertyReq
);
swaps
(
&
stuff
->
length
,
n
);
swaps
(
&
stuff
->
length
,
n
);
swapl
(
&
stuff
->
output
,
n
);
swapl
(
&
stuff
->
output
,
n
);
swapl
(
&
stuff
->
property
,
n
);
swapl
(
&
stuff
->
property
,
n
);
swapl
(
&
stuff
->
type
,
n
);
swapl
(
&
stuff
->
type
,
n
);
swapl
(
&
stuff
->
nUnits
,
n
);
swapl
(
&
stuff
->
nUnits
,
n
);
switch
(
stuff
->
format
)
{
switch
(
stuff
->
format
)
{
case
8
:
case
8
:
break
;
break
;
case
16
:
case
16
:
SwapRestS
(
stuff
);
SwapRestS
(
stuff
);
break
;
break
;
case
32
:
case
32
:
SwapRestL
(
stuff
);
SwapRestL
(
stuff
);
break
;
break
;
default:
default:
client
->
errorValue
=
stuff
->
format
;
client
->
errorValue
=
stuff
->
format
;
return
BadValue
;
return
BadValue
;
}
}
return
(
*
ProcRandrVector
[
stuff
->
randrReqType
])
(
client
);
return
(
*
ProcRandrVector
[
stuff
->
randrReqType
])
(
client
);
}
}
static
int
static
int
SProcRRDeleteOutputProperty
(
ClientPtr
client
)
SProcRRDeleteOutputProperty
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRDeleteOutputPropertyReq
);
REQUEST
(
xRRDeleteOutputPropertyReq
);
REQUEST_SIZE_MATCH
(
xRRDeleteOutputPropertyReq
);
REQUEST_SIZE_MATCH
(
xRRDeleteOutputPropertyReq
);
...
@@ -217,9 +228,10 @@ SProcRRDeleteOutputProperty (ClientPtr client)
...
@@ -217,9 +228,10 @@ SProcRRDeleteOutputProperty (ClientPtr client)
}
}
static
int
static
int
SProcRRGetOutputProperty
(
ClientPtr
client
)
SProcRRGetOutputProperty
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRGetOutputPropertyReq
);
REQUEST
(
xRRGetOutputPropertyReq
);
REQUEST_SIZE_MATCH
(
xRRGetOutputPropertyReq
);
REQUEST_SIZE_MATCH
(
xRRGetOutputPropertyReq
);
...
@@ -233,10 +245,11 @@ SProcRRGetOutputProperty (ClientPtr client)
...
@@ -233,10 +245,11 @@ SProcRRGetOutputProperty (ClientPtr client)
}
}
static
int
static
int
SProcRRCreateMode
(
ClientPtr
client
)
SProcRRCreateMode
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
xRRModeInfo
*
modeinfo
;
xRRModeInfo
*
modeinfo
;
REQUEST
(
xRRCreateModeReq
);
REQUEST
(
xRRCreateModeReq
);
REQUEST_AT_LEAST_SIZE
(
xRRCreateModeReq
);
REQUEST_AT_LEAST_SIZE
(
xRRCreateModeReq
);
...
@@ -260,9 +273,10 @@ SProcRRCreateMode (ClientPtr client)
...
@@ -260,9 +273,10 @@ SProcRRCreateMode (ClientPtr client)
}
}
static
int
static
int
SProcRRDestroyMode
(
ClientPtr
client
)
SProcRRDestroyMode
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRDestroyModeReq
);
REQUEST
(
xRRDestroyModeReq
);
REQUEST_SIZE_MATCH
(
xRRDestroyModeReq
);
REQUEST_SIZE_MATCH
(
xRRDestroyModeReq
);
...
@@ -272,9 +286,10 @@ SProcRRDestroyMode (ClientPtr client)
...
@@ -272,9 +286,10 @@ SProcRRDestroyMode (ClientPtr client)
}
}
static
int
static
int
SProcRRAddOutputMode
(
ClientPtr
client
)
SProcRRAddOutputMode
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRAddOutputModeReq
);
REQUEST
(
xRRAddOutputModeReq
);
REQUEST_SIZE_MATCH
(
xRRAddOutputModeReq
);
REQUEST_SIZE_MATCH
(
xRRAddOutputModeReq
);
...
@@ -285,9 +300,10 @@ SProcRRAddOutputMode (ClientPtr client)
...
@@ -285,9 +300,10 @@ SProcRRAddOutputMode (ClientPtr client)
}
}
static
int
static
int
SProcRRDeleteOutputMode
(
ClientPtr
client
)
SProcRRDeleteOutputMode
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRDeleteOutputModeReq
);
REQUEST
(
xRRDeleteOutputModeReq
);
REQUEST_SIZE_MATCH
(
xRRDeleteOutputModeReq
);
REQUEST_SIZE_MATCH
(
xRRDeleteOutputModeReq
);
...
@@ -298,9 +314,10 @@ SProcRRDeleteOutputMode (ClientPtr client)
...
@@ -298,9 +314,10 @@ SProcRRDeleteOutputMode (ClientPtr client)
}
}
static
int
static
int
SProcRRGetCrtcInfo
(
ClientPtr
client
)
SProcRRGetCrtcInfo
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRGetCrtcInfoReq
);
REQUEST
(
xRRGetCrtcInfoReq
);
REQUEST_SIZE_MATCH
(
xRRGetCrtcInfoReq
);
REQUEST_SIZE_MATCH
(
xRRGetCrtcInfoReq
);
...
@@ -311,9 +328,10 @@ SProcRRGetCrtcInfo (ClientPtr client)
...
@@ -311,9 +328,10 @@ SProcRRGetCrtcInfo (ClientPtr client)
}
}
static
int
static
int
SProcRRSetCrtcConfig
(
ClientPtr
client
)
SProcRRSetCrtcConfig
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRSetCrtcConfigReq
);
REQUEST
(
xRRSetCrtcConfigReq
);
REQUEST_AT_LEAST_SIZE
(
xRRSetCrtcConfigReq
);
REQUEST_AT_LEAST_SIZE
(
xRRSetCrtcConfigReq
);
...
@@ -330,9 +348,10 @@ SProcRRSetCrtcConfig (ClientPtr client)
...
@@ -330,9 +348,10 @@ SProcRRSetCrtcConfig (ClientPtr client)
}
}
static
int
static
int
SProcRRGetCrtcGammaSize
(
ClientPtr
client
)
SProcRRGetCrtcGammaSize
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRGetCrtcGammaSizeReq
);
REQUEST
(
xRRGetCrtcGammaSizeReq
);
REQUEST_SIZE_MATCH
(
xRRGetCrtcGammaSizeReq
);
REQUEST_SIZE_MATCH
(
xRRGetCrtcGammaSizeReq
);
...
@@ -342,9 +361,10 @@ SProcRRGetCrtcGammaSize (ClientPtr client)
...
@@ -342,9 +361,10 @@ SProcRRGetCrtcGammaSize (ClientPtr client)
}
}
static
int
static
int
SProcRRGetCrtcGamma
(
ClientPtr
client
)
SProcRRGetCrtcGamma
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRGetCrtcGammaReq
);
REQUEST
(
xRRGetCrtcGammaReq
);
REQUEST_SIZE_MATCH
(
xRRGetCrtcGammaReq
);
REQUEST_SIZE_MATCH
(
xRRGetCrtcGammaReq
);
...
@@ -354,9 +374,10 @@ SProcRRGetCrtcGamma (ClientPtr client)
...
@@ -354,9 +374,10 @@ SProcRRGetCrtcGamma (ClientPtr client)
}
}
static
int
static
int
SProcRRSetCrtcGamma
(
ClientPtr
client
)
SProcRRSetCrtcGamma
(
ClientPtr
client
)
{
{
int
n
;
int
n
;
REQUEST
(
xRRSetCrtcGammaReq
);
REQUEST
(
xRRSetCrtcGammaReq
);
REQUEST_AT_LEAST_SIZE
(
xRRSetCrtcGammaReq
);
REQUEST_AT_LEAST_SIZE
(
xRRSetCrtcGammaReq
);
...
@@ -367,35 +388,34 @@ SProcRRSetCrtcGamma (ClientPtr client)
...
@@ -367,35 +388,34 @@ SProcRRSetCrtcGamma (ClientPtr client)
return
(
*
ProcRandrVector
[
stuff
->
randrReqType
])
(
client
);
return
(
*
ProcRandrVector
[
stuff
->
randrReqType
])
(
client
);
}
}
int
(
*
SProcRandrVector
[
RRNumberRequests
])(
ClientPtr
)
=
{
int
(
*
SProcRandrVector
[
RRNumberRequests
])
(
ClientPtr
)
=
{
SProcRRQueryVersion
,
/* 0 */
SProcRRQueryVersion
,
/* 0 */
/* we skip 1 to make old clients fail pretty immediately */
/* we skip 1 to make old clients fail pretty immediately */
NULL
,
/* 1 SProcRandrOldGetScreenInfo */
NULL
,
/* 1 SProcRandrOldGetScreenInfo */
/* V1.0 apps share the same set screen config request id */
/* V1.0 apps share the same set screen config request id */
SProcRRSetScreenConfig
,
/* 2 */
SProcRRSetScreenConfig
,
/* 2 */
NULL
,
/* 3 SProcRandrOldScreenChangeSelectInput */
NULL
,
/* 3 SProcRandrOldScreenChangeSelectInput */
/* 3 used to be ScreenChangeSelectInput; deprecated */
/* 3 used to be ScreenChangeSelectInput; deprecated */
SProcRRSelectInput
,
/* 4 */
SProcRRSelectInput
,
/* 4 */
SProcRRGetScreenInfo
,
/* 5 */
SProcRRGetScreenInfo
,
/* 5 */
/* V1.2 additions */
/* V1.2 additions */
SProcRRGetScreenSizeRange
,
/* 6 */
SProcRRGetScreenSizeRange
,
/* 6 */
SProcRRSetScreenSize
,
/* 7 */
SProcRRSetScreenSize
,
/* 7 */
SProcRRGetScreenResources
,
/* 8 */
SProcRRGetScreenResources
,
/* 8 */
SProcRRGetOutputInfo
,
/* 9 */
SProcRRGetOutputInfo
,
/* 9 */
SProcRRListOutputProperties
,
/* 10 */
SProcRRListOutputProperties
,
/* 10 */
SProcRRQueryOutputProperty
,
/* 11 */
SProcRRQueryOutputProperty
,
/* 11 */
SProcRRConfigureOutputProperty
,
/* 12 */
SProcRRConfigureOutputProperty
,
/* 12 */
SProcRRChangeOutputProperty
,
/* 13 */
SProcRRChangeOutputProperty
,
/* 13 */
SProcRRDeleteOutputProperty
,
/* 14 */
SProcRRDeleteOutputProperty
,
/* 14 */
SProcRRGetOutputProperty
,
/* 15 */
SProcRRGetOutputProperty
,
/* 15 */
SProcRRCreateMode
,
/* 16 */
SProcRRCreateMode
,
/* 16 */
SProcRRDestroyMode
,
/* 17 */
SProcRRDestroyMode
,
/* 17 */
SProcRRAddOutputMode
,
/* 18 */
SProcRRAddOutputMode
,
/* 18 */
SProcRRDeleteOutputMode
,
/* 19 */
SProcRRDeleteOutputMode
,
/* 19 */
SProcRRGetCrtcInfo
,
/* 20 */
SProcRRGetCrtcInfo
,
/* 20 */
SProcRRSetCrtcConfig
,
/* 21 */
SProcRRSetCrtcConfig
,
/* 21 */
SProcRRGetCrtcGammaSize
,
/* 22 */
SProcRRGetCrtcGammaSize
,
/* 22 */
SProcRRGetCrtcGamma
,
/* 23 */
SProcRRGetCrtcGamma
,
/* 23 */
SProcRRSetCrtcGamma
,
/* 24 */
SProcRRSetCrtcGamma
,
/* 24 */
};
};
nx-X11/programs/Xserver/randr/rrxinerama.c
View file @
e440ea76
...
@@ -114,8 +114,8 @@ extern Bool noRRXineramaExtension;
...
@@ -114,8 +114,8 @@ extern Bool noRRXineramaExtension;
int
int
ProcRRXineramaQueryVersion
(
ClientPtr
client
)
ProcRRXineramaQueryVersion
(
ClientPtr
client
)
{
{
xPanoramiXQueryVersionReply
rep
;
xPanoramiXQueryVersionReply
rep
;
register
int
n
;
register
int
n
;
REQUEST_SIZE_MATCH
(
xPanoramiXQueryVersionReq
);
REQUEST_SIZE_MATCH
(
xPanoramiXQueryVersionReq
);
rep
.
type
=
X_Reply
;
rep
.
type
=
X_Reply
;
...
@@ -123,13 +123,13 @@ ProcRRXineramaQueryVersion(ClientPtr client)
...
@@ -123,13 +123,13 @@ ProcRRXineramaQueryVersion(ClientPtr client)
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
majorVersion
=
RR_XINERAMA_MAJOR_VERSION
;
rep
.
majorVersion
=
RR_XINERAMA_MAJOR_VERSION
;
rep
.
minorVersion
=
RR_XINERAMA_MINOR_VERSION
;
rep
.
minorVersion
=
RR_XINERAMA_MINOR_VERSION
;
if
(
client
->
swapped
)
{
if
(
client
->
swapped
)
{
swaps
(
&
rep
.
sequenceNumber
,
n
);
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
length
,
n
);
swaps
(
&
rep
.
majorVersion
,
n
);
swaps
(
&
rep
.
majorVersion
,
n
);
swaps
(
&
rep
.
minorVersion
,
n
);
swaps
(
&
rep
.
minorVersion
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xPanoramiXQueryVersionReply
),
(
char
*
)
&
rep
);
WriteToClient
(
client
,
sizeof
(
xPanoramiXQueryVersionReply
),
(
char
*
)
&
rep
);
return
(
client
->
noClientException
);
return
(
client
->
noClientException
);
}
}
...
@@ -137,29 +137,28 @@ int
...
@@ -137,29 +137,28 @@ int
ProcRRXineramaGetState
(
ClientPtr
client
)
ProcRRXineramaGetState
(
ClientPtr
client
)
{
{
REQUEST
(
xPanoramiXGetStateReq
);
REQUEST
(
xPanoramiXGetStateReq
);
WindowPtr
pWin
;
WindowPtr
pWin
;
xPanoramiXGetStateReply
rep
;
xPanoramiXGetStateReply
rep
;
register
int
n
,
rc
;
register
int
n
,
rc
;
ScreenPtr
pScreen
;
ScreenPtr
pScreen
;
rrScrPrivPtr
pScrPriv
;
rrScrPrivPtr
pScrPriv
;
Bool
active
=
FALSE
;
Bool
active
=
FALSE
;
REQUEST_SIZE_MATCH
(
xPanoramiXGetStateReq
);
REQUEST_SIZE_MATCH
(
xPanoramiXGetStateReq
);
#ifndef NXAGENT_SERVER
#ifndef NXAGENT_SERVER
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixGetAttrAccess
);
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixGetAttrAccess
);
#else
#else
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityReadAccess
);
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityReadAccess
);
rc
=
pWin
?
Success
:
BadWindow
;
rc
=
pWin
?
Success
:
BadWindow
;
#endif
#endif
if
(
rc
!=
Success
)
if
(
rc
!=
Success
)
return
rc
;
return
rc
;
pScreen
=
pWin
->
drawable
.
pScreen
;
pScreen
=
pWin
->
drawable
.
pScreen
;
pScrPriv
=
rrGetScrPriv
(
pScreen
);
pScrPriv
=
rrGetScrPriv
(
pScreen
);
if
(
pScrPriv
)
if
(
pScrPriv
)
{
{
/* XXX do we need more than this? */
/* XXX do we need more than this? */
active
=
TRUE
;
active
=
TRUE
;
}
}
rep
.
type
=
X_Reply
;
rep
.
type
=
X_Reply
;
...
@@ -167,72 +166,71 @@ ProcRRXineramaGetState(ClientPtr client)
...
@@ -167,72 +166,71 @@ ProcRRXineramaGetState(ClientPtr client)
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
state
=
active
;
rep
.
state
=
active
;
rep
.
window
=
stuff
->
window
;
rep
.
window
=
stuff
->
window
;
if
(
client
->
swapped
)
{
if
(
client
->
swapped
)
{
swaps
(
&
rep
.
sequenceNumber
,
n
);
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
window
,
n
);
swapl
(
&
rep
.
window
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xPanoramiXGetStateReply
),
(
char
*
)
&
rep
);
WriteToClient
(
client
,
sizeof
(
xPanoramiXGetStateReply
),
(
char
*
)
&
rep
);
return
client
->
noClientException
;
return
client
->
noClientException
;
}
}
static
Bool
static
Bool
RRXineramaCrtcActive
(
RRCrtcPtr
crtc
)
RRXineramaCrtcActive
(
RRCrtcPtr
crtc
)
{
{
return
crtc
->
mode
!=
NULL
&&
crtc
->
numOutputs
>
0
;
return
crtc
->
mode
!=
NULL
&&
crtc
->
numOutputs
>
0
;
}
}
static
int
static
int
RRXineramaScreenCount
(
ScreenPtr
pScreen
)
RRXineramaScreenCount
(
ScreenPtr
pScreen
)
{
{
int
i
,
n
;
int
i
,
n
;
n
=
0
;
n
=
0
;
if
(
rrGetScrPriv
(
pScreen
))
if
(
rrGetScrPriv
(
pScreen
))
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
if
(
RRXineramaCrtcActive
(
pScrPriv
->
crtcs
[
i
]))
if
(
RRXineramaCrtcActive
(
pScrPriv
->
crtcs
[
i
]))
n
++
;
n
++
;
}
}
return
n
;
return
n
;
}
}
static
Bool
static
Bool
RRXineramaScreenActive
(
ScreenPtr
pScreen
)
RRXineramaScreenActive
(
ScreenPtr
pScreen
)
{
{
return
RRXineramaScreenCount
(
pScreen
)
>
0
;
return
RRXineramaScreenCount
(
pScreen
)
>
0
;
}
}
int
int
ProcRRXineramaGetScreenCount
(
ClientPtr
client
)
ProcRRXineramaGetScreenCount
(
ClientPtr
client
)
{
{
REQUEST
(
xPanoramiXGetScreenCountReq
);
REQUEST
(
xPanoramiXGetScreenCountReq
);
WindowPtr
pWin
;
WindowPtr
pWin
;
xPanoramiXGetScreenCountReply
rep
;
xPanoramiXGetScreenCountReply
rep
;
register
int
n
,
rc
;
register
int
n
,
rc
;
REQUEST_SIZE_MATCH
(
xPanoramiXGetScreenCountReq
);
REQUEST_SIZE_MATCH
(
xPanoramiXGetScreenCountReq
);
#ifndef NXAGENT_SERVER
#ifndef NXAGENT_SERVER
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixGetAttrAccess
);
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixGetAttrAccess
);
#else
#else
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityReadAccess
);
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityReadAccess
);
rc
=
pWin
?
Success
:
BadWindow
;
rc
=
pWin
?
Success
:
BadWindow
;
#endif
#endif
if
(
rc
!=
Success
)
if
(
rc
!=
Success
)
return
rc
;
return
rc
;
rep
.
type
=
X_Reply
;
rep
.
type
=
X_Reply
;
rep
.
length
=
0
;
rep
.
length
=
0
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
ScreenCount
=
RRXineramaScreenCount
(
pWin
->
drawable
.
pScreen
);
rep
.
ScreenCount
=
RRXineramaScreenCount
(
pWin
->
drawable
.
pScreen
);
rep
.
window
=
stuff
->
window
;
rep
.
window
=
stuff
->
window
;
if
(
client
->
swapped
)
{
if
(
client
->
swapped
)
{
swaps
(
&
rep
.
sequenceNumber
,
n
);
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
window
,
n
);
swapl
(
&
rep
.
window
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xPanoramiXGetScreenCountReply
),
(
char
*
)
&
rep
);
WriteToClient
(
client
,
sizeof
(
xPanoramiXGetScreenCountReply
),
(
char
*
)
&
rep
);
return
client
->
noClientException
;
return
client
->
noClientException
;
}
}
...
@@ -240,20 +238,20 @@ int
...
@@ -240,20 +238,20 @@ int
ProcRRXineramaGetScreenSize
(
ClientPtr
client
)
ProcRRXineramaGetScreenSize
(
ClientPtr
client
)
{
{
REQUEST
(
xPanoramiXGetScreenSizeReq
);
REQUEST
(
xPanoramiXGetScreenSizeReq
);
WindowPtr
pWin
,
pRoot
;
WindowPtr
pWin
,
pRoot
;
ScreenPtr
pScreen
;
ScreenPtr
pScreen
;
xPanoramiXGetScreenSizeReply
rep
;
xPanoramiXGetScreenSizeReply
rep
;
register
int
n
,
rc
;
register
int
n
,
rc
;
REQUEST_SIZE_MATCH
(
xPanoramiXGetScreenSizeReq
);
REQUEST_SIZE_MATCH
(
xPanoramiXGetScreenSizeReq
);
#ifndef NXAGENT_SERVER
#ifndef NXAGENT_SERVER
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixGetAttrAccess
);
rc
=
dixLookupWindow
(
&
pWin
,
stuff
->
window
,
client
,
DixGetAttrAccess
);
#else
#else
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityReadAccess
);
pWin
=
SecurityLookupWindow
(
stuff
->
window
,
client
,
SecurityReadAccess
);
rc
=
pWin
?
Success
:
BadWindow
;
rc
=
pWin
?
Success
:
BadWindow
;
#endif
#endif
if
(
rc
!=
Success
)
if
(
rc
!=
Success
)
return
rc
;
return
rc
;
pScreen
=
pWin
->
drawable
.
pScreen
;
pScreen
=
pWin
->
drawable
.
pScreen
;
pRoot
=
WindowTable
[
pScreen
->
myNum
];
pRoot
=
WindowTable
[
pScreen
->
myNum
];
...
@@ -261,26 +259,26 @@ ProcRRXineramaGetScreenSize(ClientPtr client)
...
@@ -261,26 +259,26 @@ ProcRRXineramaGetScreenSize(ClientPtr client)
rep
.
type
=
X_Reply
;
rep
.
type
=
X_Reply
;
rep
.
length
=
0
;
rep
.
length
=
0
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
width
=
pRoot
->
drawable
.
width
;
rep
.
width
=
pRoot
->
drawable
.
width
;
rep
.
height
=
pRoot
->
drawable
.
height
;
rep
.
height
=
pRoot
->
drawable
.
height
;
rep
.
window
=
stuff
->
window
;
rep
.
window
=
stuff
->
window
;
rep
.
screen
=
stuff
->
screen
;
rep
.
screen
=
stuff
->
screen
;
if
(
client
->
swapped
)
{
if
(
client
->
swapped
)
{
swaps
(
&
rep
.
sequenceNumber
,
n
);
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
width
,
n
);
swapl
(
&
rep
.
width
,
n
);
swapl
(
&
rep
.
height
,
n
);
swapl
(
&
rep
.
height
,
n
);
swapl
(
&
rep
.
window
,
n
);
swapl
(
&
rep
.
window
,
n
);
swapl
(
&
rep
.
screen
,
n
);
swapl
(
&
rep
.
screen
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xPanoramiXGetScreenSizeReply
),
(
char
*
)
&
rep
);
WriteToClient
(
client
,
sizeof
(
xPanoramiXGetScreenSizeReply
),
(
char
*
)
&
rep
);
return
client
->
noClientException
;
return
client
->
noClientException
;
}
}
int
int
ProcRRXineramaIsActive
(
ClientPtr
client
)
ProcRRXineramaIsActive
(
ClientPtr
client
)
{
{
xXineramaIsActiveReply
rep
;
xXineramaIsActiveReply
rep
;
REQUEST_SIZE_MATCH
(
xXineramaIsActiveReq
);
REQUEST_SIZE_MATCH
(
xXineramaIsActiveReq
);
...
@@ -288,12 +286,13 @@ ProcRRXineramaIsActive(ClientPtr client)
...
@@ -288,12 +286,13 @@ ProcRRXineramaIsActive(ClientPtr client)
rep
.
type
=
X_Reply
;
rep
.
type
=
X_Reply
;
rep
.
length
=
0
;
rep
.
length
=
0
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
state
=
RRXineramaScreenActive
(
screenInfo
.
screens
[
RR_XINERAMA_SCREEN
]);
rep
.
state
=
RRXineramaScreenActive
(
screenInfo
.
screens
[
RR_XINERAMA_SCREEN
]);
if
(
client
->
swapped
)
{
if
(
client
->
swapped
)
{
register
int
n
;
register
int
n
;
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
length
,
n
);
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
state
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
state
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xXineramaIsActiveReply
),
(
char
*
)
&
rep
);
WriteToClient
(
client
,
sizeof
(
xXineramaIsActiveReply
),
(
char
*
)
&
rep
);
return
client
->
noClientException
;
return
client
->
noClientException
;
...
@@ -302,55 +301,57 @@ ProcRRXineramaIsActive(ClientPtr client)
...
@@ -302,55 +301,57 @@ ProcRRXineramaIsActive(ClientPtr client)
int
int
ProcRRXineramaQueryScreens
(
ClientPtr
client
)
ProcRRXineramaQueryScreens
(
ClientPtr
client
)
{
{
xXineramaQueryScreensReply
rep
;
xXineramaQueryScreensReply
rep
;
ScreenPtr
pScreen
=
screenInfo
.
screens
[
RR_XINERAMA_SCREEN
];
ScreenPtr
pScreen
=
screenInfo
.
screens
[
RR_XINERAMA_SCREEN
];
REQUEST_SIZE_MATCH
(
xXineramaQueryScreensReq
);
REQUEST_SIZE_MATCH
(
xXineramaQueryScreensReq
);
if
(
RRXineramaScreenActive
(
pScreen
))
if
(
RRXineramaScreenActive
(
pScreen
))
{
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
if
(
pScrPriv
->
numCrtcs
==
0
||
pScrPriv
->
numOutputs
==
0
)
if
(
pScrPriv
->
numCrtcs
==
0
||
pScrPriv
->
numOutputs
==
0
)
RRGetInfo
(
pScreen
);
RRGetInfo
(
pScreen
);
}
}
rep
.
type
=
X_Reply
;
rep
.
type
=
X_Reply
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
sequenceNumber
=
client
->
sequence
;
rep
.
number
=
RRXineramaScreenCount
(
pScreen
);
rep
.
number
=
RRXineramaScreenCount
(
pScreen
);
rep
.
length
=
rep
.
number
*
sz_XineramaScreenInfo
>>
2
;
rep
.
length
=
rep
.
number
*
sz_XineramaScreenInfo
>>
2
;
if
(
client
->
swapped
)
{
if
(
client
->
swapped
)
{
register
int
n
;
register
int
n
;
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
length
,
n
);
swaps
(
&
rep
.
sequenceNumber
,
n
);
swapl
(
&
rep
.
number
,
n
);
swapl
(
&
rep
.
length
,
n
);
swapl
(
&
rep
.
number
,
n
);
}
}
WriteToClient
(
client
,
sizeof
(
xXineramaQueryScreensReply
),
(
char
*
)
&
rep
);
WriteToClient
(
client
,
sizeof
(
xXineramaQueryScreensReply
),
(
char
*
)
&
rep
);
if
(
rep
.
number
)
{
if
(
rep
.
number
)
{
rrScrPriv
(
pScreen
);
rrScrPriv
(
pScreen
);
xXineramaScreenInfo
scratch
;
xXineramaScreenInfo
scratch
;
int
i
;
int
i
;
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
{
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
{
RRCrtcPtr
crtc
=
pScrPriv
->
crtcs
[
i
];
RRCrtcPtr
crtc
=
pScrPriv
->
crtcs
[
i
];
if
(
RRXineramaCrtcActive
(
crtc
))
{
if
(
RRXineramaCrtcActive
(
crtc
))
{
int
width
,
height
;
int
width
,
height
;
RRCrtcGetScanoutSize
(
crtc
,
&
width
,
&
height
);
scratch
.
x_org
=
crtc
->
x
;
RRCrtcGetScanoutSize
(
crtc
,
&
width
,
&
height
);
scratch
.
y_org
=
crtc
->
y
;
scratch
.
x_org
=
crtc
->
x
;
scratch
.
width
=
width
;
scratch
.
y_org
=
crtc
->
y
;
scratch
.
height
=
height
;
scratch
.
width
=
width
;
if
(
client
->
swapped
)
{
scratch
.
height
=
height
;
register
int
n
;
if
(
client
->
swapped
)
{
swaps
(
&
scratch
.
x_org
,
n
);
register
int
n
;
swaps
(
&
scratch
.
y_org
,
n
);
swaps
(
&
scratch
.
width
,
n
);
swaps
(
&
scratch
.
x_org
,
n
);
swaps
(
&
scratch
.
height
,
n
);
swaps
(
&
scratch
.
y_org
,
n
);
}
swaps
(
&
scratch
.
width
,
n
);
WriteToClient
(
client
,
sz_XineramaScreenInfo
,
(
char
*
)
&
scratch
);
swaps
(
&
scratch
.
height
,
n
);
}
}
}
WriteToClient
(
client
,
sz_XineramaScreenInfo
,
(
char
*
)
&
scratch
);
}
}
}
}
return
client
->
noClientException
;
return
client
->
noClientException
;
...
@@ -361,18 +362,18 @@ ProcRRXineramaDispatch(ClientPtr client)
...
@@ -361,18 +362,18 @@ ProcRRXineramaDispatch(ClientPtr client)
{
{
REQUEST
(
xReq
);
REQUEST
(
xReq
);
switch
(
stuff
->
data
)
{
switch
(
stuff
->
data
)
{
case
X_PanoramiXQueryVersion
:
case
X_PanoramiXQueryVersion
:
return
ProcRRXineramaQueryVersion
(
client
);
return
ProcRRXineramaQueryVersion
(
client
);
case
X_PanoramiXGetState
:
case
X_PanoramiXGetState
:
return
ProcRRXineramaGetState
(
client
);
return
ProcRRXineramaGetState
(
client
);
case
X_PanoramiXGetScreenCount
:
case
X_PanoramiXGetScreenCount
:
return
ProcRRXineramaGetScreenCount
(
client
);
return
ProcRRXineramaGetScreenCount
(
client
);
case
X_PanoramiXGetScreenSize
:
case
X_PanoramiXGetScreenSize
:
return
ProcRRXineramaGetScreenSize
(
client
);
return
ProcRRXineramaGetScreenSize
(
client
);
case
X_XineramaIsActive
:
case
X_XineramaIsActive
:
return
ProcRRXineramaIsActive
(
client
);
return
ProcRRXineramaIsActive
(
client
);
case
X_XineramaQueryScreens
:
case
X_XineramaQueryScreens
:
return
ProcRRXineramaQueryScreens
(
client
);
return
ProcRRXineramaQueryScreens
(
client
);
}
}
return
BadRequest
;
return
BadRequest
;
}
}
...
@@ -380,12 +381,13 @@ ProcRRXineramaDispatch(ClientPtr client)
...
@@ -380,12 +381,13 @@ ProcRRXineramaDispatch(ClientPtr client)
/* SProc */
/* SProc */
static
int
static
int
SProcRRXineramaQueryVersion
(
ClientPtr
client
)
SProcRRXineramaQueryVersion
(
ClientPtr
client
)
{
{
REQUEST
(
xPanoramiXQueryVersionReq
);
REQUEST
(
xPanoramiXQueryVersionReq
);
register
int
n
;
register
int
n
;
swaps
(
&
stuff
->
length
,
n
);
REQUEST_SIZE_MATCH
(
xPanoramiXQueryVersionReq
);
swaps
(
&
stuff
->
length
,
n
);
REQUEST_SIZE_MATCH
(
xPanoramiXQueryVersionReq
);
return
ProcRRXineramaQueryVersion
(
client
);
return
ProcRRXineramaQueryVersion
(
client
);
}
}
...
@@ -394,9 +396,10 @@ SProcRRXineramaGetState(ClientPtr client)
...
@@ -394,9 +396,10 @@ SProcRRXineramaGetState(ClientPtr client)
{
{
REQUEST
(
xPanoramiXGetStateReq
);
REQUEST
(
xPanoramiXGetStateReq
);
register
int
n
;
register
int
n
;
swaps
(
&
stuff
->
length
,
n
);
swaps
(
&
stuff
->
length
,
n
);
REQUEST_SIZE_MATCH
(
xPanoramiXGetStateReq
);
REQUEST_SIZE_MATCH
(
xPanoramiXGetStateReq
);
swapl
(
&
stuff
->
window
,
n
);
swapl
(
&
stuff
->
window
,
n
);
return
ProcRRXineramaGetState
(
client
);
return
ProcRRXineramaGetState
(
client
);
}
}
...
@@ -405,9 +408,10 @@ SProcRRXineramaGetScreenCount(ClientPtr client)
...
@@ -405,9 +408,10 @@ SProcRRXineramaGetScreenCount(ClientPtr client)
{
{
REQUEST
(
xPanoramiXGetScreenCountReq
);
REQUEST
(
xPanoramiXGetScreenCountReq
);
register
int
n
;
register
int
n
;
swaps
(
&
stuff
->
length
,
n
);
swaps
(
&
stuff
->
length
,
n
);
REQUEST_SIZE_MATCH
(
xPanoramiXGetScreenCountReq
);
REQUEST_SIZE_MATCH
(
xPanoramiXGetScreenCountReq
);
swapl
(
&
stuff
->
window
,
n
);
swapl
(
&
stuff
->
window
,
n
);
return
ProcRRXineramaGetScreenCount
(
client
);
return
ProcRRXineramaGetScreenCount
(
client
);
}
}
...
@@ -416,10 +420,11 @@ SProcRRXineramaGetScreenSize(ClientPtr client)
...
@@ -416,10 +420,11 @@ SProcRRXineramaGetScreenSize(ClientPtr client)
{
{
REQUEST
(
xPanoramiXGetScreenSizeReq
);
REQUEST
(
xPanoramiXGetScreenSizeReq
);
register
int
n
;
register
int
n
;
swaps
(
&
stuff
->
length
,
n
);
swaps
(
&
stuff
->
length
,
n
);
REQUEST_SIZE_MATCH
(
xPanoramiXGetScreenSizeReq
);
REQUEST_SIZE_MATCH
(
xPanoramiXGetScreenSizeReq
);
swapl
(
&
stuff
->
window
,
n
);
swapl
(
&
stuff
->
window
,
n
);
swapl
(
&
stuff
->
screen
,
n
);
swapl
(
&
stuff
->
screen
,
n
);
return
ProcRRXineramaGetScreenSize
(
client
);
return
ProcRRXineramaGetScreenSize
(
client
);
}
}
...
@@ -428,7 +433,8 @@ SProcRRXineramaIsActive(ClientPtr client)
...
@@ -428,7 +433,8 @@ SProcRRXineramaIsActive(ClientPtr client)
{
{
REQUEST
(
xXineramaIsActiveReq
);
REQUEST
(
xXineramaIsActiveReq
);
register
int
n
;
register
int
n
;
swaps
(
&
stuff
->
length
,
n
);
swaps
(
&
stuff
->
length
,
n
);
REQUEST_SIZE_MATCH
(
xXineramaIsActiveReq
);
REQUEST_SIZE_MATCH
(
xXineramaIsActiveReq
);
return
ProcRRXineramaIsActive
(
client
);
return
ProcRRXineramaIsActive
(
client
);
}
}
...
@@ -438,7 +444,8 @@ SProcRRXineramaQueryScreens(ClientPtr client)
...
@@ -438,7 +444,8 @@ SProcRRXineramaQueryScreens(ClientPtr client)
{
{
REQUEST
(
xXineramaQueryScreensReq
);
REQUEST
(
xXineramaQueryScreensReq
);
register
int
n
;
register
int
n
;
swaps
(
&
stuff
->
length
,
n
);
swaps
(
&
stuff
->
length
,
n
);
REQUEST_SIZE_MATCH
(
xXineramaQueryScreensReq
);
REQUEST_SIZE_MATCH
(
xXineramaQueryScreensReq
);
return
ProcRRXineramaQueryScreens
(
client
);
return
ProcRRXineramaQueryScreens
(
client
);
}
}
...
@@ -448,24 +455,24 @@ SProcRRXineramaDispatch(ClientPtr client)
...
@@ -448,24 +455,24 @@ SProcRRXineramaDispatch(ClientPtr client)
{
{
REQUEST
(
xReq
);
REQUEST
(
xReq
);
switch
(
stuff
->
data
)
{
switch
(
stuff
->
data
)
{
case
X_PanoramiXQueryVersion
:
case
X_PanoramiXQueryVersion
:
return
SProcRRXineramaQueryVersion
(
client
);
return
SProcRRXineramaQueryVersion
(
client
);
case
X_PanoramiXGetState
:
case
X_PanoramiXGetState
:
return
SProcRRXineramaGetState
(
client
);
return
SProcRRXineramaGetState
(
client
);
case
X_PanoramiXGetScreenCount
:
case
X_PanoramiXGetScreenCount
:
return
SProcRRXineramaGetScreenCount
(
client
);
return
SProcRRXineramaGetScreenCount
(
client
);
case
X_PanoramiXGetScreenSize
:
case
X_PanoramiXGetScreenSize
:
return
SProcRRXineramaGetScreenSize
(
client
);
return
SProcRRXineramaGetScreenSize
(
client
);
case
X_XineramaIsActive
:
case
X_XineramaIsActive
:
return
SProcRRXineramaIsActive
(
client
);
return
SProcRRXineramaIsActive
(
client
);
case
X_XineramaQueryScreens
:
case
X_XineramaQueryScreens
:
return
SProcRRXineramaQueryScreens
(
client
);
return
SProcRRXineramaQueryScreens
(
client
);
}
}
return
BadRequest
;
return
BadRequest
;
}
}
static
void
static
void
RRXineramaResetProc
(
ExtensionEntry
*
extEntry
)
RRXineramaResetProc
(
ExtensionEntry
*
extEntry
)
{
{
}
}
...
@@ -473,8 +480,8 @@ void
...
@@ -473,8 +480,8 @@ void
RRXineramaExtensionInit
(
void
)
RRXineramaExtensionInit
(
void
)
{
{
#ifdef PANORAMIX
#ifdef PANORAMIX
if
(
!
noPanoramiXExtension
)
if
(
!
noPanoramiXExtension
)
return
;
return
;
#endif
#endif
/*
/*
...
@@ -483,11 +490,10 @@ RRXineramaExtensionInit(void)
...
@@ -483,11 +490,10 @@ RRXineramaExtensionInit(void)
* screen, just don't even try.
* screen, just don't even try.
*/
*/
if
(
screenInfo
.
numScreens
>
1
)
if
(
screenInfo
.
numScreens
>
1
)
return
;
return
;
(
void
)
AddExtension
(
PANORAMIX_PROTOCOL_NAME
,
0
,
0
,
(
void
)
AddExtension
(
PANORAMIX_PROTOCOL_NAME
,
0
,
0
,
ProcRRXineramaDispatch
,
ProcRRXineramaDispatch
,
SProcRRXineramaDispatch
,
SProcRRXineramaDispatch
,
RRXineramaResetProc
,
RRXineramaResetProc
,
StandardMinorOpcode
);
StandardMinorOpcode
);
}
}
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