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
cccb25fa
Commit
cccb25fa
authored
Jul 23, 2019
by
Ulrich Sibiller
Committed by
Mike Gabriel
Sep 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Screen.c: code cleanup
no functional change
parent
17e0265a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
169 additions
and
203 deletions
+169
-203
Screen.c
nx-X11/programs/Xserver/hw/nxagent/Screen.c
+169
-203
No files found.
nx-X11/programs/Xserver/hw/nxagent/Screen.c
View file @
cccb25fa
...
@@ -268,8 +268,6 @@ void nxagentSetScreenInfo(ScreenInfo *screenInfo)
...
@@ -268,8 +268,6 @@ void nxagentSetScreenInfo(ScreenInfo *screenInfo)
void
nxagentSetPixmapFormats
(
ScreenInfo
*
screenInfo
)
void
nxagentSetPixmapFormats
(
ScreenInfo
*
screenInfo
)
{
{
int
i
;
/*
/*
* Formats are created with no care of which are supported
* Formats are created with no care of which are supported
* on the real display. Creating only formats supported
* on the real display. Creating only formats supported
...
@@ -279,7 +277,7 @@ void nxagentSetPixmapFormats(ScreenInfo *screenInfo)
...
@@ -279,7 +277,7 @@ void nxagentSetPixmapFormats(ScreenInfo *screenInfo)
screenInfo
->
numPixmapFormats
=
nxagentNumPixmapFormats
;
screenInfo
->
numPixmapFormats
=
nxagentNumPixmapFormats
;
for
(
i
=
0
;
i
<
nxagentNumPixmapFormats
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
nxagentNumPixmapFormats
;
i
++
)
{
{
screenInfo
->
formats
[
i
].
depth
=
nxagentPixmapFormats
[
i
].
depth
;
screenInfo
->
formats
[
i
].
depth
=
nxagentPixmapFormats
[
i
].
depth
;
screenInfo
->
formats
[
i
].
bitsPerPixel
=
nxagentPixmapFormats
[
i
].
bits_per_pixel
;
screenInfo
->
formats
[
i
].
bitsPerPixel
=
nxagentPixmapFormats
[
i
].
bits_per_pixel
;
...
@@ -651,14 +649,12 @@ FIXME: Do we need to check the key grab if the
...
@@ -651,14 +649,12 @@ FIXME: Do we need to check the key grab if the
Bool
nxagentCreateScreenResources
(
ScreenPtr
pScreen
)
Bool
nxagentCreateScreenResources
(
ScreenPtr
pScreen
)
{
{
Bool
ret
;
CreatePixmapProcPtr
savedCreatePixmap
=
pScreen
->
CreatePixmap
;
CreatePixmapProcPtr
savedCreatePixmap
=
pScreen
->
CreatePixmap
;
ModifyPixmapHeaderProcPtr
savedModifyPixmapHeader
=
pScreen
->
ModifyPixmapHeader
;
ModifyPixmapHeaderProcPtr
savedModifyPixmapHeader
=
pScreen
->
ModifyPixmapHeader
;
pScreen
->
CreatePixmap
=
fbCreatePixmap
;
pScreen
->
CreatePixmap
=
fbCreatePixmap
;
pScreen
->
ModifyPixmapHeader
=
miModifyPixmapHeader
;
pScreen
->
ModifyPixmapHeader
=
miModifyPixmapHeader
;
ret
=
miCreateScreenResources
(
pScreen
);
Bool
ret
=
miCreateScreenResources
(
pScreen
);
pScreen
->
CreatePixmap
=
savedCreatePixmap
;
pScreen
->
CreatePixmap
=
savedCreatePixmap
;
pScreen
->
ModifyPixmapHeader
=
savedModifyPixmapHeader
;
pScreen
->
ModifyPixmapHeader
=
savedModifyPixmapHeader
;
...
@@ -688,7 +684,6 @@ void nxagentInitViewportFrame(ScreenPtr pScreen, WindowPtr pRootWin)
...
@@ -688,7 +684,6 @@ void nxagentInitViewportFrame(ScreenPtr pScreen, WindowPtr pRootWin)
{
{
int
error
=
Success
;
int
error
=
Success
;
VisualID
visual
=
0
;
VisualID
visual
=
0
;
int
i
;
XID
xid
;
XID
xid
;
if
(
nxagentOption
(
Rootless
))
if
(
nxagentOption
(
Rootless
))
...
@@ -696,7 +691,7 @@ void nxagentInitViewportFrame(ScreenPtr pScreen, WindowPtr pRootWin)
...
@@ -696,7 +691,7 @@ void nxagentInitViewportFrame(ScreenPtr pScreen, WindowPtr pRootWin)
return
;
return
;
}
}
for
(
i
=
0
;
i
<
pScreen
->
numDepths
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
pScreen
->
numDepths
;
i
++
)
{
{
if
(
pScreen
->
allowedDepths
[
i
].
depth
==
pRootWin
->
drawable
.
depth
)
if
(
pScreen
->
allowedDepths
[
i
].
depth
==
pRootWin
->
drawable
.
depth
)
{
{
...
@@ -2714,37 +2709,31 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
...
@@ -2714,37 +2709,31 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
case
StaticGray
:
case
StaticGray
:
{
{
className
=
"StaticGray"
;
className
=
"StaticGray"
;
break
;
break
;
}
}
case
StaticColor
:
case
StaticColor
:
{
{
className
=
"StaticColor"
;
className
=
"StaticColor"
;
break
;
break
;
}
}
case
PseudoColor
:
case
PseudoColor
:
{
{
className
=
"PseudoColor"
;
className
=
"PseudoColor"
;
break
;
break
;
}
}
case
DirectColor
:
case
DirectColor
:
{
{
className
=
"DirectColor"
;
className
=
"DirectColor"
;
break
;
break
;
}
}
case
GrayScale
:
case
GrayScale
:
{
{
className
=
"GrayScale"
;
className
=
"GrayScale"
;
break
;
break
;
}
}
default:
default:
{
{
className
=
""
;
className
=
""
;
break
;
break
;
}
}
}
}
...
@@ -3222,29 +3211,14 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
...
@@ -3222,29 +3211,14 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
void
nxagentShadowAdaptDepth
(
unsigned
int
width
,
unsigned
int
height
,
void
nxagentShadowAdaptDepth
(
unsigned
int
width
,
unsigned
int
height
,
unsigned
int
lineMaster
,
char
**
buffer
)
unsigned
int
lineMaster
,
char
**
buffer
)
{
{
unsigned
char
red
;
unsigned
char
green
;
unsigned
char
blue
;
unsigned
short
color16
=
0
;
unsigned
char
*
icBuffer
;
unsigned
char
*
cBuffer
=
NULL
;
unsigned
char
*
tBuffer
=
(
unsigned
char
*
)
*
buffer
;
unsigned
char
*
tBuffer
=
(
unsigned
char
*
)
*
buffer
;
unsigned
int
lineShadow
;
unsigned
int
length
;
unsigned
int
c
;
unsigned
int
pad
;
unsigned
int
color32
=
0
;
unsigned
long
redMask
;
unsigned
long
greenMask
;
unsigned
long
blueMask
;
Visual
*
pVisual
;
length
=
nxagentImageLength
(
width
,
height
,
ZPixmap
,
0
,
nxagentShadowDepth
);
unsigned
int
length
=
nxagentImageLength
(
width
,
height
,
ZPixmap
,
0
,
nxagentShadowDepth
);
cBuffer
=
malloc
(
length
);
unsigned
char
*
cBuffer
=
malloc
(
length
);
icBuffer
=
cBuffer
;
unsigned
char
*
icBuffer
=
cBuffer
;
pVisual
=
nxagentImageVisual
((
DrawablePtr
)
nxagentShadowPixmapPtr
,
nxagentShadowDepth
);
Visual
*
pVisual
=
nxagentImageVisual
((
DrawablePtr
)
nxagentShadowPixmapPtr
,
nxagentShadowDepth
);
if
(
pVisual
==
NULL
)
if
(
pVisual
==
NULL
)
{
{
...
@@ -3260,9 +3234,9 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
...
@@ -3260,9 +3234,9 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
pVisual
->
red_mask
,
pVisual
->
green_mask
,
pVisual
->
blue_mask
);
pVisual
->
red_mask
,
pVisual
->
green_mask
,
pVisual
->
blue_mask
);
#endif
#endif
redMask
=
nxagentShadowDisplay
->
screens
[
0
].
root_visual
[
0
].
red_mask
;
unsigned
long
redMask
=
nxagentShadowDisplay
->
screens
[
0
].
root_visual
[
0
].
red_mask
;
greenMask
=
nxagentShadowDisplay
->
screens
[
0
].
root_visual
[
0
].
green_mask
;
unsigned
long
greenMask
=
nxagentShadowDisplay
->
screens
[
0
].
root_visual
[
0
].
green_mask
;
blueMask
=
nxagentShadowDisplay
->
screens
[
0
].
root_visual
[
0
].
blue_mask
;
unsigned
long
blueMask
=
nxagentShadowDisplay
->
screens
[
0
].
root_visual
[
0
].
blue_mask
;
#ifdef TEST
#ifdef TEST
fprintf
(
stderr
,
"nxagentCorrectDepthShadow: Master redMask [%lu] greenMask[%lu] blueMask[%lu].
\n
"
,
fprintf
(
stderr
,
"nxagentCorrectDepthShadow: Master redMask [%lu] greenMask[%lu] blueMask[%lu].
\n
"
,
...
@@ -3276,7 +3250,7 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
...
@@ -3276,7 +3250,7 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
*/
*/
case
16
:
case
16
:
{
{
pad
=
lineMaster
-
nxagentBppMaster
*
width
;
unsigned
int
pad
=
lineMaster
-
nxagentBppMaster
*
width
;
#ifdef TEST
#ifdef TEST
fprintf
(
stderr
,
"nxagentCorrectDepthShadow: line [%d] width[%d] pad[%d].
\n
"
,
lineMaster
,
width
,
pad
);
fprintf
(
stderr
,
"nxagentCorrectDepthShadow: line [%d] width[%d] pad[%d].
\n
"
,
lineMaster
,
width
,
pad
);
...
@@ -3284,8 +3258,13 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
...
@@ -3284,8 +3258,13 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
while
(
height
>
0
)
while
(
height
>
0
)
{
{
for
(
c
=
0
;
c
<
width
;
c
++
)
for
(
unsigned
int
c
=
0
;
c
<
width
;
c
++
)
{
{
unsigned
char
red
;
unsigned
char
green
;
unsigned
char
blue
;
unsigned
short
color16
;
if
(
imageByteOrder
==
LSBFirst
)
if
(
imageByteOrder
==
LSBFirst
)
{
{
color16
=
*
tBuffer
++
;
color16
=
*
tBuffer
++
;
...
@@ -3353,9 +3332,8 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
...
@@ -3353,9 +3332,8 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
*/
*/
case
24
:
case
24
:
{
{
lineShadow
=
PixmapBytePad
(
width
,
nxagentShadowDepth
);
unsigned
int
lineShadow
=
PixmapBytePad
(
width
,
nxagentShadowDepth
);
unsigned
int
pad
=
lineShadow
-
nxagentBppShadow
*
width
;
pad
=
lineShadow
-
nxagentBppShadow
*
width
;
#ifdef TEST
#ifdef TEST
fprintf
(
stderr
,
"nxagentCorrectDepthShadow: line [%d] width[%d] pad[%d].
\n
"
,
lineShadow
,
width
,
pad
);
fprintf
(
stderr
,
"nxagentCorrectDepthShadow: line [%d] width[%d] pad[%d].
\n
"
,
lineShadow
,
width
,
pad
);
...
@@ -3363,8 +3341,11 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
...
@@ -3363,8 +3341,11 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
while
(
height
>
0
)
while
(
height
>
0
)
{
{
for
(
c
=
0
;
c
<
width
;
c
++
)
for
(
unsigned
int
c
=
0
;
c
<
width
;
c
++
)
{
{
unsigned
short
color16
;
unsigned
int
color32
;
if
(
imageByteOrder
==
LSBFirst
)
if
(
imageByteOrder
==
LSBFirst
)
{
{
color32
=
*
tBuffer
++
;
color32
=
*
tBuffer
++
;
...
@@ -3479,8 +3460,6 @@ FIXME: The port information is not used at the moment and produces a
...
@@ -3479,8 +3460,6 @@ FIXME: The port information is not used at the moment and produces a
if
(
iReturn
==
Success
&&
atomReturnType
!=
None
&&
if
(
iReturn
==
Success
&&
atomReturnType
!=
None
&&
ulReturnItems
>
0
&&
pszReturnData
!=
NULL
)
ulReturnItems
>
0
&&
pszReturnData
!=
NULL
)
{
{
char
*
local_buf
;
#ifdef TEST
#ifdef TEST
fprintf
(
stderr
,
"nxagentPropagateArtsdProperties: Got [%ld] elements of format [%d] with [%ld] bytes left.
\n
"
,
fprintf
(
stderr
,
"nxagentPropagateArtsdProperties: Got [%ld] elements of format [%d] with [%ld] bytes left.
\n
"
,
ulReturnItems
,
iReturnFormat
,
ulReturnBytesLeft
);
ulReturnItems
,
iReturnFormat
,
ulReturnBytesLeft
);
...
@@ -3495,7 +3474,7 @@ FIXME: The port information is not used at the moment and produces a
...
@@ -3495,7 +3474,7 @@ FIXME: The port information is not used at the moment and produces a
#endif
#endif
local_buf
=
(
char
*
)
malloc
(
strlen
((
char
*
)
pszReturnData
)
+
100
);
char
*
local_buf
=
(
char
*
)
malloc
(
strlen
((
char
*
)
pszReturnData
)
+
100
);
if
(
local_buf
)
if
(
local_buf
)
{
{
...
@@ -3611,9 +3590,7 @@ FIXME: The port information is not used at the moment and produces a
...
@@ -3611,9 +3590,7 @@ FIXME: The port information is not used at the moment and produces a
Bool
nxagentReconnectScreen
(
void
*
p0
)
Bool
nxagentReconnectScreen
(
void
*
p0
)
{
{
CARD16
w
,
h
;
PixmapPtr
pPixmap
=
(
PixmapPtr
)
nxagentDefaultScreen
->
devPrivate
;
PixmapPtr
pPixmap
=
(
PixmapPtr
)
nxagentDefaultScreen
->
devPrivate
;
Mask
mask
;
#if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_SCREEN_DEBUG)
#if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_SCREEN_DEBUG)
fprintf
(
stderr
,
"nxagentReconnectScreen
\n
"
);
fprintf
(
stderr
,
"nxagentReconnectScreen
\n
"
);
...
@@ -3634,8 +3611,8 @@ Bool nxagentReconnectScreen(void *p0)
...
@@ -3634,8 +3611,8 @@ Bool nxagentReconnectScreen(void *p0)
pPixmap
,
pPixmap
,
nxagentPixmap
(
pPixmap
));
nxagentPixmap
(
pPixmap
));
#endif
#endif
w
=
16
;
CARD16
w
=
16
;
h
=
16
;
CARD16
h
=
16
;
(
*
nxagentDefaultScreen
->
QueryBestSize
)(
StippleShape
,
&
w
,
&
h
,
nxagentDefaultScreen
);
(
*
nxagentDefaultScreen
->
QueryBestSize
)(
StippleShape
,
&
w
,
&
h
,
nxagentDefaultScreen
);
if
(
!
(
nxagentPixmap
(
nxagentDefaultScreen
->
PixmapPerDepth
[
0
])
=
if
(
!
(
nxagentPixmap
(
nxagentDefaultScreen
->
PixmapPerDepth
[
0
])
=
XCreatePixmap
(
nxagentDisplay
,
XCreatePixmap
(
nxagentDisplay
,
...
@@ -3644,7 +3621,7 @@ Bool nxagentReconnectScreen(void *p0)
...
@@ -3644,7 +3621,7 @@ Bool nxagentReconnectScreen(void *p0)
h
,
h
,
1
)));
1
)));
mask
=
nxagentGetDefaultEventMask
();
Mask
mask
=
nxagentGetDefaultEventMask
();
mask
|=
NXAGENT_KEYBOARD_EVENT_MASK
|
NXAGENT_POINTER_EVENT_MASK
;
mask
|=
NXAGENT_KEYBOARD_EVENT_MASK
|
NXAGENT_POINTER_EVENT_MASK
;
nxagentSetDefaultEventMask
(
mask
);
nxagentSetDefaultEventMask
(
mask
);
XSelectInput
(
nxagentDisplay
,
nxagentDefaultWindows
[
0
],
mask
);
XSelectInput
(
nxagentDisplay
,
nxagentDefaultWindows
[
0
],
mask
);
...
@@ -3877,9 +3854,6 @@ void nxagentAdjustCustomMode(ScreenPtr pScreen)
...
@@ -3877,9 +3854,6 @@ void nxagentAdjustCustomMode(ScreenPtr pScreen)
int
nxagentChangeScreenConfig
(
int
screen
,
int
width
,
int
height
)
int
nxagentChangeScreenConfig
(
int
screen
,
int
width
,
int
height
)
{
{
ScreenPtr
pScreen
;
int
r
;
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentChangeScreenConfig: called for screen [%d], width [%d] height [%d]
\n
"
,
screen
,
width
,
height
);
fprintf
(
stderr
,
"nxagentChangeScreenConfig: called for screen [%d], width [%d] height [%d]
\n
"
,
screen
,
width
,
height
);
#endif
#endif
...
@@ -3923,13 +3897,13 @@ int nxagentChangeScreenConfig(int screen, int width, int height)
...
@@ -3923,13 +3897,13 @@ int nxagentChangeScreenConfig(int screen, int width, int height)
return
0
;
return
0
;
}
}
pScreen
=
screenInfo
.
screens
[
screen
]
->
root
->
drawable
.
pScreen
;
ScreenPtr
pScreen
=
screenInfo
.
screens
[
screen
]
->
root
->
drawable
.
pScreen
;
#ifdef TEST
#ifdef TEST
fprintf
(
stderr
,
"nxagentChangeScreenConfig: Changing config to %d x %d
\n
"
,
width
,
height
);
fprintf
(
stderr
,
"nxagentChangeScreenConfig: Changing config to %d x %d
\n
"
,
width
,
height
);
#endif
#endif
r
=
nxagentResizeScreen
(
pScreen
,
width
,
height
,
0
,
0
);
int
r
=
nxagentResizeScreen
(
pScreen
,
width
,
height
,
0
,
0
);
if
(
r
!=
0
)
if
(
r
!=
0
)
{
{
...
@@ -3958,21 +3932,25 @@ int nxagentChangeScreenConfig(int screen, int width, int height)
...
@@ -3958,21 +3932,25 @@ int nxagentChangeScreenConfig(int screen, int width, int height)
/*
/*
Destroy an output after removing it from any crtc that might reference it
Destroy an output after removing it from any crtc that might reference it
*/
*/
void
nxagentDropOutput
(
RROutputPtr
o
)
{
void
nxagentDropOutput
(
RROutputPtr
o
)
{
RRCrtcPtr
c
=
o
->
crtc
;
RRCrtcPtr
c
=
o
->
crtc
;
if
(
c
)
{
if
(
c
)
for
(
int
i
=
0
;
i
<
c
->
numOutputs
;
i
++
)
{
{
if
(
c
->
outputs
[
i
]
==
o
)
{
for
(
int
i
=
0
;
i
<
c
->
numOutputs
;
i
++
)
#ifdef DEBUG
{
if
(
c
->
outputs
[
i
]
==
o
)
{
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentDropOutput: output [%s] is in use by crtc [%p], removing it from there
\n
"
,
o
->
name
,
c
);
fprintf
(
stderr
,
"nxagentDropOutput: output [%s] is in use by crtc [%p], removing it from there
\n
"
,
o
->
name
,
c
);
#endif
#endif
RRCrtcSet
(
c
,
NULL
,
0
,
0
,
RR_Rotate_0
,
0
,
NULL
);
RRCrtcSet
(
c
,
NULL
,
0
,
0
,
RR_Rotate_0
,
0
,
NULL
);
}
}
}
}
}
}
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentDropOutput: destroying output [%s]
\n
"
,
o
->
name
);
fprintf
(
stderr
,
"nxagentDropOutput: destroying output [%s]
\n
"
,
o
->
name
);
#endif
#endif
RROutputDestroy
(
o
);
RROutputDestroy
(
o
);
}
}
...
@@ -3993,23 +3971,22 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -3993,23 +3971,22 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
int
i
;
int
i
;
int
number
=
0
;
int
number
=
0
;
XineramaScreenInfo
*
screeninfo
=
NULL
;
XineramaScreenInfo
*
screeninfo
=
XineramaQueryScreens
(
nxagentDisplay
,
&
number
)
;
screeninfo
=
XineramaQueryScreens
(
nxagentDisplay
,
&
number
);
if
(
number
)
if
(
number
)
{
{
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: XineramaQueryScreens() returned [%d] screens:
\n
"
,
number
);
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: XineramaQueryScreens() returned [%d] screens:
\n
"
,
number
);
for
(
int
i
=
0
;
i
<
number
;
i
++
)
{
for
(
int
i
=
0
;
i
<
number
;
i
++
)
{
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: screen_number [%d] x_org [%d] y_org [%d] width [%d] height [%d]
\n
"
,
screeninfo
[
i
].
screen_number
,
screeninfo
[
i
].
x_org
,
screeninfo
[
i
].
y_org
,
screeninfo
[
i
].
width
,
screeninfo
[
i
].
height
);
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: screen_number [%d] x_org [%d] y_org [%d] width [%d] height [%d]
\n
"
,
screeninfo
[
i
].
screen_number
,
screeninfo
[
i
].
x_org
,
screeninfo
[
i
].
y_org
,
screeninfo
[
i
].
width
,
screeninfo
[
i
].
height
);
}
}
#endif
#endif
}
}
else
else
{
{
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: XineramaQueryScreens() failed - continuing without Xinerama
\n
"
);
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: XineramaQueryScreens() failed - continuing without Xinerama
\n
"
);
#endif
#endif
}
}
/*
/*
...
@@ -4020,7 +3997,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4020,7 +3997,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
* behaved. The single PanoramiX/Xinerama extension however
* behaved. The single PanoramiX/Xinerama extension however
* disables xinerama if only one screen exists.
* disables xinerama if only one screen exists.
*/
*/
if
(
number
==
0
)
{
if
(
number
==
0
)
{
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: faking xinerama
\n
"
);
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: faking xinerama
\n
"
);
#endif
#endif
...
@@ -4028,7 +4006,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4028,7 +4006,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
SAFE_free
(
screeninfo
);
SAFE_free
(
screeninfo
);
if
(
!
(
screeninfo
=
malloc
(
sizeof
(
XineramaScreenInfo
))))
{
if
(
!
(
screeninfo
=
malloc
(
sizeof
(
XineramaScreenInfo
))))
{
return
FALSE
;
return
FALSE
;
}
}
...
@@ -4066,7 +4045,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4066,7 +4045,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
bbx2
=
bby2
=
0
;
bbx2
=
bby2
=
0
;
bbx1
=
bby1
=
INT_MAX
;
bbx1
=
bby1
=
INT_MAX
;
for
(
i
=
0
;
i
<
number
;
i
++
)
{
for
(
i
=
0
;
i
<
number
;
i
++
)
{
bbx2
=
max
(
bbx2
,
screeninfo
[
i
].
x_org
+
screeninfo
[
i
].
width
);
bbx2
=
max
(
bbx2
,
screeninfo
[
i
].
x_org
+
screeninfo
[
i
].
width
);
bby2
=
max
(
bby2
,
screeninfo
[
i
].
y_org
+
screeninfo
[
i
].
height
);
bby2
=
max
(
bby2
,
screeninfo
[
i
].
y_org
+
screeninfo
[
i
].
height
);
bbx1
=
min
(
bbx1
,
screeninfo
[
i
].
x_org
);
bbx1
=
min
(
bbx1
,
screeninfo
[
i
].
x_org
);
...
@@ -4083,8 +4063,10 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4083,8 +4063,10 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
/* adjust the number of CRTCs to match the number of reported
/* adjust the number of CRTCs to match the number of reported
xinerama screens on the real server */
xinerama screens on the real server */
while
(
number
!=
pScrPriv
->
numCrtcs
)
{
while
(
number
!=
pScrPriv
->
numCrtcs
)
if
(
number
<
pScrPriv
->
numCrtcs
)
{
{
if
(
number
<
pScrPriv
->
numCrtcs
)
{
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: destroying crtc
\n
"
);
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: destroying crtc
\n
"
);
#endif
#endif
...
@@ -4108,8 +4090,10 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4108,8 +4090,10 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
/* set gamma. Currently the only reason for doing this is
/* set gamma. Currently the only reason for doing this is
preventing the xrandr command from complaining about missing
preventing the xrandr command from complaining about missing
gamma. */
gamma. */
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
{
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
if
(
pScrPriv
->
crtcs
[
i
]
->
gammaSize
==
0
)
{
{
if
(
pScrPriv
->
crtcs
[
i
]
->
gammaSize
==
0
)
{
CARD16
gamma
=
0
;
CARD16
gamma
=
0
;
RRCrtcGammaSetSize
(
pScrPriv
->
crtcs
[
i
],
1
);
RRCrtcGammaSetSize
(
pScrPriv
->
crtcs
[
i
],
1
);
RRCrtcGammaSet
(
pScrPriv
->
crtcs
[
i
],
&
gamma
,
&
gamma
,
&
gamma
);
RRCrtcGammaSet
(
pScrPriv
->
crtcs
[
i
],
&
gamma
,
&
gamma
,
&
gamma
);
...
@@ -4127,8 +4111,10 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4127,8 +4111,10 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
nxagentDropOutput
(
pScrPriv
->
outputs
[
i
]);
nxagentDropOutput
(
pScrPriv
->
outputs
[
i
]);
/* add and init outputs */
/* add and init outputs */
for
(
i
=
0
;
i
<
number
;
i
++
)
{
for
(
i
=
0
;
i
<
number
;
i
++
)
if
(
i
>=
pScrPriv
->
numOutputs
)
{
{
if
(
i
>=
pScrPriv
->
numOutputs
)
{
sprintf
(
name
,
"NX%d"
,
i
+
1
);
sprintf
(
name
,
"NX%d"
,
i
+
1
);
output
=
RROutputCreate
(
pScreen
,
name
,
strlen
(
name
),
NULL
);
output
=
RROutputCreate
(
pScreen
,
name
,
strlen
(
name
),
NULL
);
/* will be done later
/* will be done later
...
@@ -4154,7 +4140,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4154,7 +4140,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
RROutputSetPhysicalSize
(
output
,
0
,
0
);
RROutputSetPhysicalSize
(
output
,
0
,
0
);
}
}
for
(
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
{
for
(
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
{
Bool
disable_output
=
FALSE
;
Bool
disable_output
=
FALSE
;
RRModePtr
mymode
=
NULL
,
prevmode
=
NULL
;
RRModePtr
mymode
=
NULL
,
prevmode
=
NULL
;
int
new_x
=
0
;
int
new_x
=
0
;
...
@@ -4181,16 +4168,20 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4181,16 +4168,20 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
/* save previous mode */
/* save previous mode */
prevmode
=
pScrPriv
->
crtcs
[
i
]
->
mode
;
prevmode
=
pScrPriv
->
crtcs
[
i
]
->
mode
;
#ifdef DEBUG
#ifdef DEBUG
if
(
prevmode
)
{
if
(
prevmode
)
{
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: output [%d] name [%s]: prevmode [%s] ([%p]) refcnt [%d]
\n
"
,
i
,
pScrPriv
->
outputs
[
i
]
->
name
,
prevmode
->
name
,
(
void
*
)
prevmode
,
prevmode
->
refcnt
);
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: output [%d] name [%s]: prevmode [%s] ([%p]) refcnt [%d]
\n
"
,
i
,
pScrPriv
->
outputs
[
i
]
->
name
,
prevmode
->
name
,
(
void
*
)
prevmode
,
prevmode
->
refcnt
);
}
else
{
}
else
{
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: output [%d] name [%s]: no prevmode
\n
"
,
i
,
pScrPriv
->
outputs
[
i
]
->
name
);
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: output [%d] name [%s]: no prevmode
\n
"
,
i
,
pScrPriv
->
outputs
[
i
]
->
name
);
}
}
#endif
#endif
RROutputSetCrtcs
(
pScrPriv
->
outputs
[
i
],
&
(
pScrPriv
->
crtcs
[
i
]),
1
);
RROutputSetCrtcs
(
pScrPriv
->
outputs
[
i
],
&
(
pScrPriv
->
crtcs
[
i
]),
1
);
if
(
disable_output
)
{
if
(
disable_output
)
{
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: output [%d] name [%s]: no (valid) intersection - disconnecting
\n
"
,
i
,
pScrPriv
->
outputs
[
i
]
->
name
);
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: output [%d] name [%s]: no (valid) intersection - disconnecting
\n
"
,
i
,
pScrPriv
->
outputs
[
i
]
->
name
);
#endif
#endif
...
@@ -4205,7 +4196,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4205,7 +4196,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
* mode of the output's crtc. This also leads to xinerama not
* mode of the output's crtc. This also leads to xinerama not
* showing the disconnected head anymore.
* showing the disconnected head anymore.
*/
*/
if
(
prevmode
)
{
if
(
prevmode
)
{
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: removing mode from output [%d] name [%s]
\n
"
,
i
,
pScrPriv
->
outputs
[
i
]
->
name
);
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: removing mode from output [%d] name [%s]
\n
"
,
i
,
pScrPriv
->
outputs
[
i
]
->
name
);
#endif
#endif
...
@@ -4247,7 +4239,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4247,7 +4239,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
mymode
=
RRModeGet
(
&
modeInfo
,
name
);
mymode
=
RRModeGet
(
&
modeInfo
,
name
);
#ifdef DEBUG
#ifdef DEBUG
if
(
mymode
)
{
if
(
mymode
)
{
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: output [%d] name [%s]: mode [%s] ([%p]) created/received, refcnt [%d]
\n
"
,
i
,
pScrPriv
->
outputs
[
i
]
->
name
,
name
,
(
void
*
)
mymode
,
mymode
->
refcnt
);
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: output [%d] name [%s]: mode [%s] ([%p]) created/received, refcnt [%d]
\n
"
,
i
,
pScrPriv
->
outputs
[
i
]
->
name
,
name
,
(
void
*
)
mymode
,
mymode
->
refcnt
);
}
}
else
else
...
@@ -4256,7 +4249,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4256,7 +4249,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: output [%d] name [%s]: mode [%s] creation failed!
\n
"
,
i
,
pScrPriv
->
outputs
[
i
]
->
name
,
name
);
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: output [%d] name [%s]: mode [%s] creation failed!
\n
"
,
i
,
pScrPriv
->
outputs
[
i
]
->
name
,
name
);
}
}
#endif
#endif
if
(
prevmode
&&
mymode
==
prevmode
)
{
if
(
prevmode
&&
mymode
==
prevmode
)
{
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: mymode [%s] ([%p]) == prevmode [%s] ([%p])
\n
"
,
mymode
->
name
,
(
void
*
)
mymode
,
prevmode
->
name
,
(
void
*
)
prevmode
);
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: mymode [%s] ([%p]) == prevmode [%s] ([%p])
\n
"
,
mymode
->
name
,
(
void
*
)
mymode
,
prevmode
->
name
,
(
void
*
)
prevmode
);
#endif
#endif
...
@@ -4283,7 +4277,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4283,7 +4277,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
/* throw away the mode if otherwise unused. We do not need it
/* throw away the mode if otherwise unused. We do not need it
anymore. We call FreeResource() to ensure the system will not
anymore. We call FreeResource() to ensure the system will not
try to free it again on shutdown */
try to free it again on shutdown */
if
(
prevmode
&&
prevmode
->
refcnt
==
1
)
{
if
(
prevmode
&&
prevmode
->
refcnt
==
1
)
{
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: destroying prevmode [%s]
\n
"
,
prevmode
->
name
);
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: destroying prevmode [%s]
\n
"
,
prevmode
->
name
);
#endif
#endif
...
@@ -4298,7 +4293,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4298,7 +4293,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
SAFE_free
(
screeninfo
);
SAFE_free
(
screeninfo
);
#ifdef DEBUG
#ifdef DEBUG
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
{
for
(
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
{
RRModePtr
mode
=
pScrPriv
->
crtcs
[
i
]
->
mode
;
RRModePtr
mode
=
pScrPriv
->
crtcs
[
i
]
->
mode
;
if
(
mode
)
{
if
(
mode
)
{
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: crtc [%d] ([%p]) has mode [%s] ([%p]), refcnt [%d] and [%d] outputs:
\n
"
,
i
,
(
void
*
)
pScrPriv
->
crtcs
[
i
],
pScrPriv
->
crtcs
[
i
]
->
mode
->
name
,
(
void
*
)
pScrPriv
->
crtcs
[
i
]
->
mode
,
pScrPriv
->
crtcs
[
i
]
->
mode
->
refcnt
,
pScrPriv
->
crtcs
[
i
]
->
numOutputs
);
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: crtc [%d] ([%p]) has mode [%s] ([%p]), refcnt [%d] and [%d] outputs:
\n
"
,
i
,
(
void
*
)
pScrPriv
->
crtcs
[
i
],
pScrPriv
->
crtcs
[
i
]
->
mode
->
name
,
(
void
*
)
pScrPriv
->
crtcs
[
i
]
->
mode
,
pScrPriv
->
crtcs
[
i
]
->
mode
->
refcnt
,
pScrPriv
->
crtcs
[
i
]
->
numOutputs
);
...
@@ -4338,24 +4334,13 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4338,24 +4334,13 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
void
nxagentSaveAreas
(
PixmapPtr
pPixmap
,
RegionPtr
prgnSave
,
int
xorg
,
int
yorg
,
WindowPtr
pWin
)
void
nxagentSaveAreas
(
PixmapPtr
pPixmap
,
RegionPtr
prgnSave
,
int
xorg
,
int
yorg
,
WindowPtr
pWin
)
{
{
PixmapPtr
pVirtualPixmap
;
XGCValues
values
=
{
0
};
nxagentPrivPixmapPtr
pPrivPixmap
;
XlibGC
gc
;
XGCValues
values
;
int
i
;
int
xSrc
,
ySrc
,
xDst
,
yDst
,
w
,
h
;
int
nRects
;
int
size
;
BoxPtr
pBox
;
XRectangle
*
pRects
;
BoxRec
extents
;
RegionRec
cleanRegion
;
miBSWindowPtr
pBackingStore
=
(
miBSWindowPtr
)
pWin
->
backStorage
;
miBSWindowPtr
pBackingStore
=
(
miBSWindowPtr
)
pWin
->
backStorage
;
pVirtualPixmap
=
nxagentVirtualPixmap
(
pPixmap
);
PixmapPtr
pVirtualPixmap
=
nxagentVirtualPixmap
(
pPixmap
);
pPrivPixmap
=
nxagentPixmapPriv
(
pPixmap
);
nxagentPrivPixmapPtr
pPrivPixmap
=
nxagentPixmapPriv
(
pPixmap
);
pPrivPixmap
->
isBackingPixmap
=
1
;
pPrivPixmap
->
isBackingPixmap
=
1
;
...
@@ -4364,13 +4349,14 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
...
@@ -4364,13 +4349,14 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
values
.
subwindow_mode
=
IncludeInferiors
;
values
.
subwindow_mode
=
IncludeInferiors
;
gc
=
XCreateGC
(
nxagentDisplay
,
nxagentWindow
(
screenInfo
.
screens
[
0
]
->
root
),
GCSubwindowMode
,
&
values
);
XlibGC
gc
=
XCreateGC
(
nxagentDisplay
,
nxagentWindow
(
screenInfo
.
screens
[
0
]
->
root
),
GCSubwindowMode
,
&
values
);
/*
/*
* Initialize to the corrupted region.
* Initialize to the corrupted region.
* Coordinates are relative to the window.
* Coordinates are relative to the window.
*/
*/
RegionRec
cleanRegion
;
RegionInit
(
&
cleanRegion
,
NullBox
,
1
);
RegionInit
(
&
cleanRegion
,
NullBox
,
1
);
RegionCopy
(
&
cleanRegion
,
nxagentCorruptedRegion
((
DrawablePtr
)
pWin
));
RegionCopy
(
&
cleanRegion
,
nxagentCorruptedRegion
((
DrawablePtr
)
pWin
));
...
@@ -4395,12 +4381,12 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
...
@@ -4395,12 +4381,12 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
RegionSubtract
(
&
cleanRegion
,
prgnSave
,
&
cleanRegion
);
RegionSubtract
(
&
cleanRegion
,
prgnSave
,
&
cleanRegion
);
nRects
=
RegionNumRects
(
&
cleanRegion
);
int
nRects
=
RegionNumRects
(
&
cleanRegion
);
size
=
nRects
*
sizeof
(
*
pRects
);
int
size
=
nRects
*
sizeof
(
XRectangle
);
pRects
=
(
XRectangle
*
)
malloc
(
size
);
XRectangle
*
pRects
=
(
XRectangle
*
)
malloc
(
size
);
pBox
=
RegionRects
(
&
cleanRegion
);
BoxPtr
pBox
=
RegionRects
(
&
cleanRegion
);
for
(
i
=
nRects
;
i
--
>
0
;)
for
(
i
nt
i
=
nRects
;
i
--
>
0
;)
{
{
pRects
[
i
].
x
=
pBox
[
i
].
x1
;
pRects
[
i
].
x
=
pBox
[
i
].
x1
;
pRects
[
i
].
y
=
pBox
[
i
].
y1
;
pRects
[
i
].
y
=
pBox
[
i
].
y1
;
...
@@ -4412,12 +4398,12 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
...
@@ -4412,12 +4398,12 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
SAFE_free
(
pRects
);
SAFE_free
(
pRects
);
extents
=
*
RegionExtents
(
&
cleanRegion
);
BoxRec
extents
=
*
RegionExtents
(
&
cleanRegion
);
RegionUninit
(
&
cleanRegion
);
RegionUninit
(
&
cleanRegion
);
xDst
=
extents
.
x1
;
int
xDst
=
extents
.
x1
;
yDst
=
extents
.
y1
;
int
yDst
=
extents
.
y1
;
/*
/*
* Left here the wrong solution. The window could be not
* Left here the wrong solution. The window could be not
...
@@ -4430,11 +4416,11 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
...
@@ -4430,11 +4416,11 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
* ySrc = yDst + yorg - pWin -> drawable.y;
* ySrc = yDst + yorg - pWin -> drawable.y;
*/
*/
xSrc
=
xDst
+
pBackingStore
->
x
;
int
xSrc
=
xDst
+
pBackingStore
->
x
;
ySrc
=
yDst
+
pBackingStore
->
y
;
int
ySrc
=
yDst
+
pBackingStore
->
y
;
w
=
extents
.
x2
-
extents
.
x1
;
int
w
=
extents
.
x2
-
extents
.
x1
;
h
=
extents
.
y2
-
extents
.
y1
;
int
h
=
extents
.
y2
-
extents
.
y1
;
XCopyArea
(
nxagentDisplay
,
nxagentWindow
(
pWin
),
nxagentPixmap
(
pPixmap
),
gc
,
XCopyArea
(
nxagentDisplay
,
nxagentWindow
(
pWin
),
nxagentPixmap
(
pPixmap
),
gc
,
xSrc
,
ySrc
,
w
,
h
,
xDst
,
yDst
);
xSrc
,
ySrc
,
w
,
h
,
xDst
,
yDst
);
...
@@ -4455,18 +4441,7 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
...
@@ -4455,18 +4441,7 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
void
nxagentRestoreAreas
(
PixmapPtr
pPixmap
,
RegionPtr
prgnRestore
,
int
xorg
,
void
nxagentRestoreAreas
(
PixmapPtr
pPixmap
,
RegionPtr
prgnRestore
,
int
xorg
,
int
yorg
,
WindowPtr
pWin
)
int
yorg
,
WindowPtr
pWin
)
{
{
PixmapPtr
pVirtualPixmap
;
XGCValues
values
=
{
0
};
RegionPtr
clipRegion
;
XlibGC
gc
;
XGCValues
values
;
int
i
;
int
xSrc
,
ySrc
,
xDst
,
yDst
,
w
,
h
;
int
nRects
;
int
size
;
BoxPtr
pBox
;
XRectangle
*
pRects
;
BoxRec
extents
;
miBSWindowPtr
pBackingStore
;
/*
/*
* Limit the area to restore to the
* Limit the area to restore to the
...
@@ -4476,16 +4451,16 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
...
@@ -4476,16 +4451,16 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
RegionIntersect
(
prgnRestore
,
prgnRestore
,
RegionIntersect
(
prgnRestore
,
prgnRestore
,
&
pWin
->
drawable
.
pScreen
->
root
->
winSize
);
&
pWin
->
drawable
.
pScreen
->
root
->
winSize
);
pBackingStore
=
(
miBSWindowPtr
)
pWin
->
backStorage
;
miBSWindowPtr
pBackingStore
=
(
miBSWindowPtr
)
pWin
->
backStorage
;
pVirtualPixmap
=
nxagentVirtualPixmap
(
pPixmap
);
PixmapPtr
pVirtualPixmap
=
nxagentVirtualPixmap
(
pPixmap
);
fbCopyWindowProc
(
&
pVirtualPixmap
->
drawable
,
&
pWin
->
drawable
,
0
,
RegionRects
(
prgnRestore
),
fbCopyWindowProc
(
&
pVirtualPixmap
->
drawable
,
&
pWin
->
drawable
,
0
,
RegionRects
(
prgnRestore
),
RegionNumRects
(
prgnRestore
),
-
xorg
,
-
yorg
,
FALSE
,
FALSE
,
0
,
0
);
RegionNumRects
(
prgnRestore
),
-
xorg
,
-
yorg
,
FALSE
,
FALSE
,
0
,
0
);
values
.
subwindow_mode
=
ClipByChildren
;
values
.
subwindow_mode
=
ClipByChildren
;
gc
=
XCreateGC
(
nxagentDisplay
,
nxagentWindow
(
screenInfo
.
screens
[
0
]
->
root
),
GCSubwindowMode
,
&
values
);
XlibGC
gc
=
XCreateGC
(
nxagentDisplay
,
nxagentWindow
(
screenInfo
.
screens
[
0
]
->
root
),
GCSubwindowMode
,
&
values
);
/*
/*
* Translate the reference point to the origin of the window.
* Translate the reference point to the origin of the window.
...
@@ -4495,7 +4470,7 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
...
@@ -4495,7 +4470,7 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
-
pWin
->
drawable
.
x
-
pWin
->
borderWidth
,
-
pWin
->
drawable
.
x
-
pWin
->
borderWidth
,
-
pWin
->
drawable
.
y
-
pWin
->
borderWidth
);
-
pWin
->
drawable
.
y
-
pWin
->
borderWidth
);
clipRegion
=
prgnRestore
;
RegionPtr
clipRegion
=
prgnRestore
;
if
(
nxagentDrawableStatus
((
DrawablePtr
)
pPixmap
)
==
NotSynchronized
)
if
(
nxagentDrawableStatus
((
DrawablePtr
)
pPixmap
)
==
NotSynchronized
)
{
{
...
@@ -4541,12 +4516,12 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
...
@@ -4541,12 +4516,12 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
RegionSubtract
(
clipRegion
,
prgnRestore
,
clipRegion
);
RegionSubtract
(
clipRegion
,
prgnRestore
,
clipRegion
);
}
}
nRects
=
RegionNumRects
(
clipRegion
);
int
nRects
=
RegionNumRects
(
clipRegion
);
size
=
nRects
*
sizeof
(
*
pRects
);
int
size
=
nRects
*
sizeof
(
XRectangle
);
pRects
=
(
XRectangle
*
)
malloc
(
size
);
XRectangle
*
pRects
=
(
XRectangle
*
)
malloc
(
size
);
pBox
=
RegionRects
(
clipRegion
);
BoxPtr
pBox
=
RegionRects
(
clipRegion
);
for
(
i
=
nRects
;
i
--
>
0
;)
for
(
i
nt
i
=
nRects
;
i
--
>
0
;)
{
{
pRects
[
i
].
x
=
pBox
[
i
].
x1
;
pRects
[
i
].
x
=
pBox
[
i
].
x1
;
pRects
[
i
].
y
=
pBox
[
i
].
y1
;
pRects
[
i
].
y
=
pBox
[
i
].
y1
;
...
@@ -4558,16 +4533,16 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
...
@@ -4558,16 +4533,16 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
SAFE_free
(
pRects
);
SAFE_free
(
pRects
);
extents
=
*
RegionExtents
(
clipRegion
);
BoxRec
extents
=
*
RegionExtents
(
clipRegion
);
xDst
=
extents
.
x1
;
int
xDst
=
extents
.
x1
;
yDst
=
extents
.
y1
;
int
yDst
=
extents
.
y1
;
xSrc
=
xDst
-
xorg
+
pWin
->
drawable
.
x
;
int
xSrc
=
xDst
-
xorg
+
pWin
->
drawable
.
x
;
ySrc
=
yDst
-
yorg
+
pWin
->
drawable
.
y
;
int
ySrc
=
yDst
-
yorg
+
pWin
->
drawable
.
y
;
w
=
extents
.
x2
-
extents
.
x1
;
int
w
=
extents
.
x2
-
extents
.
x1
;
h
=
extents
.
y2
-
extents
.
y1
;
int
h
=
extents
.
y2
-
extents
.
y1
;
nxagentFlushConfigureWindow
();
nxagentFlushConfigureWindow
();
...
@@ -4661,11 +4636,7 @@ void nxagentSetWMNormalHintsMaxsize(ScreenPtr pScreen, int maxwidth, int maxheig
...
@@ -4661,11 +4636,7 @@ void nxagentSetWMNormalHintsMaxsize(ScreenPtr pScreen, int maxwidth, int maxheig
void
nxagentShadowAdaptToRatio
(
void
)
void
nxagentShadowAdaptToRatio
(
void
)
{
{
ScreenPtr
pScreen
;
ScreenPtr
pScreen
=
screenInfo
.
screens
[
0
];
RegionRec
region
;
BoxRec
box
;
pScreen
=
screenInfo
.
screens
[
0
];
nxagentShadowSetRatio
(
nxagentOption
(
Width
)
*
1
.
0
/
nxagentShadowWidth
,
nxagentShadowSetRatio
(
nxagentOption
(
Width
)
*
1
.
0
/
nxagentShadowWidth
,
nxagentOption
(
Height
)
*
1
.
0
/
nxagentShadowHeight
);
nxagentOption
(
Height
)
*
1
.
0
/
nxagentShadowHeight
);
...
@@ -4676,10 +4647,14 @@ void nxagentShadowAdaptToRatio(void)
...
@@ -4676,10 +4647,14 @@ void nxagentShadowAdaptToRatio(void)
WidthOfScreen
(
DefaultScreenOfDisplay
(
nxagentDisplay
)),
WidthOfScreen
(
DefaultScreenOfDisplay
(
nxagentDisplay
)),
HeightOfScreen
(
DefaultScreenOfDisplay
(
nxagentDisplay
)));
HeightOfScreen
(
DefaultScreenOfDisplay
(
nxagentDisplay
)));
box
.
x1
=
0
;
BoxRec
box
=
{
box
.
y1
=
0
;
.
x1
=
0
,
box
.
x2
=
nxagentShadowPixmapPtr
->
drawable
.
width
;
.
y1
=
0
,
box
.
y2
=
nxagentShadowPixmapPtr
->
drawable
.
height
;
.
x2
=
nxagentShadowPixmapPtr
->
drawable
.
width
,
.
y2
=
nxagentShadowPixmapPtr
->
drawable
.
height
};
RegionRec
region
;
RegionInit
(
&
region
,
&
box
,
1
);
RegionInit
(
&
region
,
&
box
,
1
);
...
@@ -4690,9 +4665,7 @@ void nxagentShadowAdaptToRatio(void)
...
@@ -4690,9 +4665,7 @@ void nxagentShadowAdaptToRatio(void)
void
nxagentPrintGeometry
(
void
)
void
nxagentPrintGeometry
(
void
)
{
{
int
i
;
for
(
int
i
=
0
;
i
<
screenInfo
.
numScreens
;
i
++
)
for
(
i
=
0
;
i
<
screenInfo
.
numScreens
;
i
++
)
{
{
if
(
nxagentPrintGeometryFlags
&
(
1
<<
i
))
if
(
nxagentPrintGeometryFlags
&
(
1
<<
i
))
{
{
...
@@ -4711,21 +4684,15 @@ void nxagentPrintGeometry(void)
...
@@ -4711,21 +4684,15 @@ void nxagentPrintGeometry(void)
void
nxagentShowPixmap
(
PixmapPtr
pPixmap
,
int
x
,
int
y
,
int
width
,
int
height
)
void
nxagentShowPixmap
(
PixmapPtr
pPixmap
,
int
x
,
int
y
,
int
width
,
int
height
)
{
{
static
int
init
=
1
;
static
int
init
=
1
;
static
Display
*
shadow
;
static
Display
*
shadow
=
NULL
;
static
Window
win
;
static
Window
win
=
0
;
XlibGC
gc
;
XGCValues
value
;
XImage
*
image
;
WindowPtr
pWin
=
screenInfo
.
screens
[
0
]
->
root
;
unsigned
int
format
;
int
depth
,
pixmapWidth
,
pixmapHeight
,
length
;
char
*
data
;
depth
=
pPixmap
->
drawable
.
depth
;
int
depth
=
pPixmap
->
drawable
.
depth
;
pixmapWidth
=
pPixmap
->
drawable
.
width
;
/*
pixmapHeight
=
pPixmap
->
drawable
.
height
;
int pixmapWidth = pPixmap -> drawable.width;
format
=
(
depth
==
1
)
?
XYPixmap
:
ZPixmap
;
int pixmapHeight = pPixmap -> drawable.height;
*/
unsigned
int
format
=
(
depth
==
1
)
?
XYPixmap
:
ZPixmap
;
if
(
init
)
if
(
init
)
{
{
...
@@ -4770,9 +4737,9 @@ void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height)
...
@@ -4770,9 +4737,9 @@ void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height)
XRaiseWindow
(
nxagentDisplay
,
win
);
XRaiseWindow
(
nxagentDisplay
,
win
);
}
}
length
=
nxagentImageLength
(
width
,
height
,
format
,
0
,
depth
);
int
length
=
nxagentImageLength
(
width
,
height
,
format
,
0
,
depth
);
char
*
data
=
malloc
(
length
);
if
(
(
data
=
malloc
(
length
))
==
NULL
)
if
(
data
==
NULL
)
{
{
#ifdef WARNING
#ifdef WARNING
fprintf
(
stderr
,
"nxagentShowPixmap: malloc failed.
\n
"
);
fprintf
(
stderr
,
"nxagentShowPixmap: malloc failed.
\n
"
);
...
@@ -4783,11 +4750,11 @@ void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height)
...
@@ -4783,11 +4750,11 @@ void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height)
/*
/*
FIXME
FIXME
image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), x, y,
XImage *
image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), x, y,
width, height, AllPlanes, format);
width, height, AllPlanes, format);
*/
*/
image
=
XGetImage
(
nxagentDisplay
,
RootWindow
(
nxagentDisplay
,
0
),
0
,
0
,
XImage
*
image
=
XGetImage
(
nxagentDisplay
,
RootWindow
(
nxagentDisplay
,
0
),
0
,
0
,
width
,
height
,
AllPlanes
,
format
);
width
,
height
,
AllPlanes
,
format
);
if
(
image
==
NULL
)
if
(
image
==
NULL
)
...
@@ -4806,12 +4773,14 @@ FIXME
...
@@ -4806,12 +4773,14 @@ FIXME
memcpy
(
image
->
data
,
data
,
length
);
memcpy
(
image
->
data
,
data
,
length
);
value
.
foreground
=
0xffffff
;
XGCValues
value
=
{
value
.
background
=
0x000000
;
.
foreground
=
0xffffff
,
value
.
plane_mask
=
0xffffff
;
.
background
=
0x000000
,
value
.
fill_style
=
FillSolid
;
.
plane_mask
=
0xffffff
,
.
fill_style
=
FillSolid
};
gc
=
XCreateGC
(
shadow
,
win
,
GCBackground
|
XlibGC
gc
=
XCreateGC
(
shadow
,
win
,
GCBackground
|
GCForeground
|
GCFillStyle
|
GCPlaneMask
,
&
value
);
GCForeground
|
GCFillStyle
|
GCPlaneMask
,
&
value
);
XSync
(
shadow
,
0
);
XSync
(
shadow
,
0
);
...
@@ -4843,26 +4812,19 @@ FIXME
...
@@ -4843,26 +4812,19 @@ FIXME
void
nxagentFbRestoreArea
(
PixmapPtr
pPixmap
,
WindowPtr
pWin
,
int
xSrc
,
int
ySrc
,
int
width
,
void
nxagentFbRestoreArea
(
PixmapPtr
pPixmap
,
WindowPtr
pWin
,
int
xSrc
,
int
ySrc
,
int
width
,
int
height
,
int
xDst
,
int
yDst
)
int
height
,
int
xDst
,
int
yDst
)
{
{
Display
*
shadow
;
Display
*
shadow
=
nxagentDisplay
;
XlibGC
gc
;
XGCValues
value
;
XImage
*
image
;
unsigned
int
format
;
int
depth
,
pixmapWidth
,
pixmapHeight
,
length
;
char
*
data
=
NULL
;
Visual
*
pVisual
;
depth
=
pPixmap
->
drawable
.
depth
;
int
depth
=
pPixmap
->
drawable
.
depth
;
pixmapWidth
=
pPixmap
->
drawable
.
width
;
/*
pixmapHeight
=
pPixmap
->
drawable
.
height
;
int pixmapWidth = pPixmap -> drawable.width
;
format
=
(
depth
==
1
)
?
XYPixmap
:
ZPixmap
;
int pixmapHeight = pPixmap -> drawable.height
;
*/
shadow
=
nxagentDisplay
;
unsigned
int
format
=
(
depth
==
1
)
?
XYPixmap
:
ZPixmap
;
length
=
nxagentImageLength
(
width
,
height
,
format
,
0
,
depth
);
int
length
=
nxagentImageLength
(
width
,
height
,
format
,
0
,
depth
);
char
*
data
=
malloc
(
length
);
if
(
(
data
=
malloc
(
length
))
==
NULL
)
if
(
data
==
NULL
)
{
{
#ifdef WARNING
#ifdef WARNING
fprintf
(
stderr
,
"nxagentFbRestoreArea: malloc failed.
\n
"
);
fprintf
(
stderr
,
"nxagentFbRestoreArea: malloc failed.
\n
"
);
...
@@ -4870,8 +4832,10 @@ void nxagentFbRestoreArea(PixmapPtr pPixmap, WindowPtr pWin, int xSrc, int ySrc,
...
@@ -4870,8 +4832,10 @@ void nxagentFbRestoreArea(PixmapPtr pPixmap, WindowPtr pWin, int xSrc, int ySrc,
return
;
return
;
}
}
XImage
*
image
=
NULL
;
/*
/*
image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), xSrc, ySrc,
XImage *
image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), xSrc, ySrc,
width, height, AllPlanes, format);
width, height, AllPlanes, format);
*/
*/
...
@@ -4892,7 +4856,7 @@ void nxagentFbRestoreArea(PixmapPtr pPixmap, WindowPtr pWin, int xSrc, int ySrc,
...
@@ -4892,7 +4856,7 @@ void nxagentFbRestoreArea(PixmapPtr pPixmap, WindowPtr pWin, int xSrc, int ySrc,
/*
/*
FIXME
FIXME
*/
*/
pVisual
=
nxagentImageVisual
((
DrawablePtr
)
pPixmap
,
depth
);
Visual
*
pVisual
=
nxagentImageVisual
((
DrawablePtr
)
pPixmap
,
depth
);
if
(
pVisual
==
NULL
)
if
(
pVisual
==
NULL
)
{
{
...
@@ -4914,13 +4878,15 @@ FIXME
...
@@ -4914,13 +4878,15 @@ FIXME
fprintf
(
stderr
,
"nxagentFbRestoreArea: Cleaning %d bytes of image.
\n
"
,
length
);
fprintf
(
stderr
,
"nxagentFbRestoreArea: Cleaning %d bytes of image.
\n
"
,
length
);
value
.
foreground
=
0xffffff
;
XGCValues
value
=
{
value
.
background
=
0x000000
;
.
foreground
=
0xffffff
,
value
.
plane_mask
=
0xffffff
;
.
background
=
0x000000
,
value
.
fill_style
=
FillSolid
;
.
plane_mask
=
0xffffff
,
value
.
function
=
GXcopy
;
.
fill_style
=
FillSolid
,
.
function
=
GXcopy
};
gc
=
XCreateGC
(
shadow
,
nxagentWindow
(
screenInfo
.
screens
[
0
]
->
root
),
GCBackground
|
XlibGC
gc
=
XCreateGC
(
shadow
,
nxagentWindow
(
screenInfo
.
screens
[
0
]
->
root
),
GCBackground
|
GCForeground
|
GCFillStyle
|
GCPlaneMask
|
GCFunction
,
&
value
);
GCForeground
|
GCFillStyle
|
GCPlaneMask
|
GCFunction
,
&
value
);
NXCleanImage
(
image
);
NXCleanImage
(
image
);
...
...
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