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
203891d1
Commit
203891d1
authored
Dec 28, 2019
by
Ulrich Sibiller
Committed by
Mike Gabriel
Jan 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Screen.c: code simplification/scope
parent
a6335cf3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
158 additions
and
239 deletions
+158
-239
Screen.c
nx-X11/programs/Xserver/hw/nxagent/Screen.c
+158
-239
No files found.
nx-X11/programs/Xserver/hw/nxagent/Screen.c
View file @
203891d1
...
@@ -2192,19 +2192,17 @@ Bool nxagentCloseScreen(ScreenPtr pScreen)
...
@@ -2192,19 +2192,17 @@ Bool nxagentCloseScreen(ScreenPtr pScreen)
static
void
nxagentSetRootClip
(
ScreenPtr
pScreen
,
Bool
enable
)
static
void
nxagentSetRootClip
(
ScreenPtr
pScreen
,
Bool
enable
)
{
{
WindowPtr
pWin
=
pScreen
->
root
;
WindowPtr
pWin
=
pScreen
->
root
;
WindowPtr
pChild
;
Bool
WasViewable
=
(
Bool
)(
pWin
->
viewable
);
Bool
WasViewable
=
(
Bool
)(
pWin
->
viewable
);
Bool
anyMarked
=
FALSE
;
Bool
anyMarked
=
FALSE
;
RegionPtr
pOldClip
=
NULL
,
bsExposed
;
RegionPtr
pOldClip
=
NULL
;
#ifdef DO_SAVE_UNDERS
#ifdef DO_SAVE_UNDERS
Bool
dosave
=
FALSE
;
Bool
dosave
=
FALSE
;
#endif
#endif
WindowPtr
pLayerWin
;
WindowPtr
pLayerWin
;
BoxRec
box
;
if
(
WasViewable
)
if
(
WasViewable
)
{
{
for
(
pChild
=
pWin
->
firstChild
;
pChild
;
pChild
=
pChild
->
nextSib
)
for
(
WindowPtr
pChild
=
pWin
->
firstChild
;
pChild
;
pChild
=
pChild
->
nextSib
)
{
{
(
void
)
(
*
pScreen
->
MarkOverlappedWindows
)(
pChild
,
(
void
)
(
*
pScreen
->
MarkOverlappedWindows
)(
pChild
,
pChild
,
pChild
,
...
@@ -2216,9 +2214,7 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable)
...
@@ -2216,9 +2214,7 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable)
{
{
if
(
HasBorder
(
pWin
))
if
(
HasBorder
(
pWin
))
{
{
RegionPtr
borderVisible
;
RegionPtr
borderVisible
=
RegionCreate
(
NullBox
,
1
);
borderVisible
=
RegionCreate
(
NullBox
,
1
);
RegionSubtract
(
borderVisible
,
RegionSubtract
(
borderVisible
,
&
pWin
->
borderClip
,
&
pWin
->
winSize
);
&
pWin
->
borderClip
,
&
pWin
->
winSize
);
pWin
->
valdata
->
before
.
borderVisible
=
borderVisible
;
pWin
->
valdata
->
before
.
borderVisible
=
borderVisible
;
...
@@ -2229,15 +2225,12 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable)
...
@@ -2229,15 +2225,12 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable)
/*
/*
* Use REGION_BREAK to avoid optimizations in ValidateTree
* Use REGION_BREAK to avoid optimizations in ValidateTree
* that assume the root borderClip can't change
w
ell, normally
* that assume the root borderClip can't change
. W
ell, normally
* it doesn't...)
* it doesn't...)
*/
*/
if
(
enable
)
if
(
enable
)
{
{
box
.
x1
=
0
;
BoxRec
box
=
{.
x1
=
0
,
.
y1
=
0
,
.
x2
=
pScreen
->
width
,
.
y2
=
pScreen
->
height
};
box
.
y1
=
0
;
box
.
x2
=
pScreen
->
width
;
box
.
y2
=
pScreen
->
height
;
RegionInit
(
&
pWin
->
winSize
,
&
box
,
1
);
RegionInit
(
&
pWin
->
winSize
,
&
box
,
1
);
RegionInit
(
&
pWin
->
borderSize
,
&
box
,
1
);
RegionInit
(
&
pWin
->
borderSize
,
&
box
,
1
);
if
(
WasViewable
)
if
(
WasViewable
)
...
@@ -2290,7 +2283,7 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable)
...
@@ -2290,7 +2283,7 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable)
{
{
if
(
!
WasViewable
)
if
(
!
WasViewable
)
pOldClip
=
&
pWin
->
clipList
;
/* a convenient empty region */
pOldClip
=
&
pWin
->
clipList
;
/* a convenient empty region */
bsExposed
=
(
*
pScreen
->
TranslateBackingStore
)
RegionPtr
bsExposed
=
(
*
pScreen
->
TranslateBackingStore
)
(
pWin
,
0
,
0
,
pOldClip
,
(
pWin
,
0
,
0
,
pOldClip
,
pWin
->
drawable
.
x
,
pWin
->
drawable
.
y
);
pWin
->
drawable
.
x
,
pWin
->
drawable
.
y
);
if
(
WasViewable
)
if
(
WasViewable
)
...
@@ -2326,15 +2319,6 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable)
...
@@ -2326,15 +2319,6 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable)
Bool
nxagentResizeScreen
(
ScreenPtr
pScreen
,
int
width
,
int
height
,
Bool
nxagentResizeScreen
(
ScreenPtr
pScreen
,
int
width
,
int
height
,
int
mmWidth
,
int
mmHeight
)
int
mmWidth
,
int
mmHeight
)
{
{
BoxRec
box
;
PixmapPtr
pPixmap
;
char
*
fbBits
;
int
oldWidth
;
int
oldHeight
;
int
oldMmWidth
;
int
oldMmHeight
;
#ifdef TEST
#ifdef TEST
nxagentPrintAgentGeometry
(
"Before Resize Screen"
,
"nxagentResizeScreen:"
);
nxagentPrintAgentGeometry
(
"Before Resize Screen"
,
"nxagentResizeScreen:"
);
#endif
#endif
...
@@ -2343,10 +2327,10 @@ Bool nxagentResizeScreen(ScreenPtr pScreen, int width, int height,
...
@@ -2343,10 +2327,10 @@ Bool nxagentResizeScreen(ScreenPtr pScreen, int width, int height,
* Change screen properties.
* Change screen properties.
*/
*/
oldWidth
=
pScreen
->
width
;
int
oldWidth
=
pScreen
->
width
;
oldHeight
=
pScreen
->
height
;
int
oldHeight
=
pScreen
->
height
;
oldMmWidth
=
pScreen
->
mmWidth
;
int
oldMmWidth
=
pScreen
->
mmWidth
;
oldMmHeight
=
pScreen
->
mmHeight
;
int
oldMmHeight
=
pScreen
->
mmHeight
;
pScreen
->
width
=
width
;
pScreen
->
width
=
width
;
pScreen
->
height
=
height
;
pScreen
->
height
=
height
;
...
@@ -2396,10 +2380,11 @@ Bool nxagentResizeScreen(ScreenPtr pScreen, int width, int height,
...
@@ -2396,10 +2380,11 @@ Bool nxagentResizeScreen(ScreenPtr pScreen, int width, int height,
pScreen
->
mmWidth
=
mmWidth
;
pScreen
->
mmWidth
=
mmWidth
;
pScreen
->
mmHeight
=
mmHeight
;
pScreen
->
mmHeight
=
mmHeight
;
pPixmap
=
fbGetScreenPixmap
(
pScreen
);
PixmapPtr
pPixmap
=
fbGetScreenPixmap
(
pScreen
);
if
((
fbBits
=
realloc
(
pPixmap
->
devPrivate
.
ptr
,
PixmapBytePad
(
width
,
pScreen
->
rootDepth
)
*
char
*
fbBits
=
realloc
(
pPixmap
->
devPrivate
.
ptr
,
PixmapBytePad
(
width
,
pScreen
->
rootDepth
)
*
height
*
BitsPerPixel
(
pScreen
->
rootDepth
)
/
8
))
==
NULL
)
height
*
BitsPerPixel
(
pScreen
->
rootDepth
)
/
8
);
if
(
fbBits
==
NULL
)
{
{
pScreen
->
width
=
oldWidth
;
pScreen
->
width
=
oldWidth
;
pScreen
->
height
=
oldHeight
;
pScreen
->
height
=
oldHeight
;
...
@@ -2466,10 +2451,7 @@ FIXME: We should try to restore the previously
...
@@ -2466,10 +2451,7 @@ FIXME: We should try to restore the previously
* Set properties for the agent root window.
* Set properties for the agent root window.
*/
*/
box
.
x1
=
0
;
BoxRec
box
=
{.
x1
=
0
,
.
y1
=
0
,
.
x2
=
width
,
.
y2
=
height
};
box
.
y1
=
0
;
box
.
x2
=
width
;
box
.
y2
=
height
;
pScreen
->
root
->
drawable
.
width
=
width
;
pScreen
->
root
->
drawable
.
width
=
width
;
pScreen
->
root
->
drawable
.
height
=
height
;
pScreen
->
root
->
drawable
.
height
=
height
;
...
@@ -2511,9 +2493,6 @@ nxagentResizeScreenError:
...
@@ -2511,9 +2493,6 @@ nxagentResizeScreenError:
void
nxagentShadowSetRatio
(
float
floatXRatio
,
float
floatYRatio
)
void
nxagentShadowSetRatio
(
float
floatXRatio
,
float
floatYRatio
)
{
{
int
intXRatio
;
int
intYRatio
;
if
(
floatXRatio
==
0
)
if
(
floatXRatio
==
0
)
{
{
floatXRatio
=
1
.
0
;
floatXRatio
=
1
.
0
;
...
@@ -2524,8 +2503,8 @@ void nxagentShadowSetRatio(float floatXRatio, float floatYRatio)
...
@@ -2524,8 +2503,8 @@ void nxagentShadowSetRatio(float floatXRatio, float floatYRatio)
floatYRatio
=
1
.
0
;
floatYRatio
=
1
.
0
;
}
}
intXRatio
=
floatXRatio
*
(
1
<<
PRECISION
);
int
int
XRatio
=
floatXRatio
*
(
1
<<
PRECISION
);
intYRatio
=
floatYRatio
*
(
1
<<
PRECISION
);
int
int
YRatio
=
floatYRatio
*
(
1
<<
PRECISION
);
nxagentChangeOption
(
FloatXRatio
,
floatXRatio
);
nxagentChangeOption
(
FloatXRatio
,
floatXRatio
);
nxagentChangeOption
(
FloatYRatio
,
floatYRatio
);
nxagentChangeOption
(
FloatYRatio
,
floatYRatio
);
...
@@ -2563,8 +2542,6 @@ void nxagentShadowSetWindowOptions(void)
...
@@ -2563,8 +2542,6 @@ void nxagentShadowSetWindowOptions(void)
int
nxagentShadowInit
(
ScreenPtr
pScreen
,
WindowPtr
pWin
)
int
nxagentShadowInit
(
ScreenPtr
pScreen
,
WindowPtr
pWin
)
{
{
char
*
layout
=
NULL
;
char
*
layout
=
NULL
;
XlibGC
gc
;
XGCValues
value
;
#ifdef TEST
#ifdef TEST
fprintf
(
stderr
,
"Info: Init shadow session. nxagentDisplayName [%s] "
fprintf
(
stderr
,
"Info: Init shadow session. nxagentDisplayName [%s] "
...
@@ -2677,36 +2654,12 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
...
@@ -2677,36 +2654,12 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
switch
(
DefaultVisualOfScreen
(
DefaultScreenOfDisplay
(
nxagentShadowDisplay
))
->
class
)
switch
(
DefaultVisualOfScreen
(
DefaultScreenOfDisplay
(
nxagentShadowDisplay
))
->
class
)
{
{
case
StaticGray
:
case
StaticGray
:
{
className
=
"StaticGray"
;
break
;
}
{
case
StaticColor
:
{
className
=
"StaticColor"
;
break
;
}
className
=
"StaticGray"
;
case
PseudoColor
:
{
className
=
"PseudoColor"
;
break
;
}
break
;
case
DirectColor
:
{
className
=
"DirectColor"
;
break
;
}
}
case
GrayScale
:
{
className
=
"GrayScale"
;
break
;
}
case
StaticColor
:
default:
{
className
=
""
;
break
;
}
{
className
=
"StaticColor"
;
break
;
}
case
PseudoColor
:
{
className
=
"PseudoColor"
;
break
;
}
case
DirectColor
:
{
className
=
"DirectColor"
;
break
;
}
case
GrayScale
:
{
className
=
"GrayScale"
;
break
;
}
default:
{
className
=
""
;
break
;
}
}
}
fprintf
(
stderr
,
"nxagentShadowInit: PANIC! Cannot shadow the display. "
fprintf
(
stderr
,
"nxagentShadowInit: PANIC! Cannot shadow the display. "
...
@@ -2844,12 +2797,14 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
...
@@ -2844,12 +2797,14 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
* Clean up the main window.
* Clean up the main window.
*/
*/
value
.
foreground
=
0x00000000
;
XGCValues
value
=
{
value
.
background
=
0x00000000
;
.
foreground
=
0x00000000
,
value
.
plane_mask
=
0xffffffff
;
.
background
=
0x00000000
,
value
.
fill_style
=
FillSolid
;
.
plane_mask
=
0xffffffff
,
.
fill_style
=
FillSolid
,
};
gc
=
XCreateGC
(
nxagentDisplay
,
nxagentPixmap
(
nxagentShadowPixmapPtr
),
GCBackground
|
XlibGC
gc
=
XCreateGC
(
nxagentDisplay
,
nxagentPixmap
(
nxagentShadowPixmapPtr
),
GCBackground
|
GCForeground
|
GCFillStyle
|
GCPlaneMask
,
&
value
);
GCForeground
|
GCFillStyle
|
GCPlaneMask
,
&
value
);
XFillRectangle
(
nxagentDisplay
,
nxagentPixmap
(
nxagentShadowPixmapPtr
),
gc
,
0
,
0
,
XFillRectangle
(
nxagentDisplay
,
nxagentPixmap
(
nxagentShadowPixmapPtr
),
gc
,
0
,
0
,
...
@@ -2864,12 +2819,6 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
...
@@ -2864,12 +2819,6 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
int
nxagentShadowCreateMainWindow
(
ScreenPtr
pScreen
,
WindowPtr
pWin
,
int
width
,
int
height
)
int
nxagentShadowCreateMainWindow
(
ScreenPtr
pScreen
,
WindowPtr
pWin
,
int
width
,
int
height
)
{
{
XWindowChanges
changes
;
Mask
mask
,
maskb
;
XID
values
[
4
],
*
vlist
;
int
error
;
XID
xid
;
nxagentShadowWidth
=
width
;
nxagentShadowWidth
=
width
;
nxagentShadowHeight
=
height
;
nxagentShadowHeight
=
height
;
...
@@ -2915,7 +2864,7 @@ int nxagentShadowCreateMainWindow(ScreenPtr pScreen, WindowPtr pWin, int width,
...
@@ -2915,7 +2864,7 @@ int nxagentShadowCreateMainWindow(ScreenPtr pScreen, WindowPtr pWin, int width,
XFreePixmap
(
nxagentDisplay
,
nxagentPixmap
(
nxagentVirtualPixmap
(
nxagentShadowPixmapPtr
)));
XFreePixmap
(
nxagentDisplay
,
nxagentPixmap
(
nxagentVirtualPixmap
(
nxagentShadowPixmapPtr
)));
xid
=
XCreatePixmap
(
nxagentDisplay
,
nxagentDefaultWindows
[
0
],
XID
xid
=
XCreatePixmap
(
nxagentDisplay
,
nxagentDefaultWindows
[
0
],
nxagentScale
(
nxagentShadowWidth
,
nxagentOption
(
XRatio
)),
nxagentScale
(
nxagentShadowWidth
,
nxagentOption
(
XRatio
)),
nxagentScale
(
nxagentShadowHeight
,
nxagentOption
(
YRatio
)),
nxagentShadowDepth
);
nxagentScale
(
nxagentShadowHeight
,
nxagentOption
(
YRatio
)),
nxagentShadowDepth
);
...
@@ -2946,24 +2895,27 @@ int nxagentShadowCreateMainWindow(ScreenPtr pScreen, WindowPtr pWin, int width,
...
@@ -2946,24 +2895,27 @@ int nxagentShadowCreateMainWindow(ScreenPtr pScreen, WindowPtr pWin, int width,
#endif
#endif
}
}
mask
=
CWBackPixmap
|
CWEventMask
|
CWCursor
;
Mask
mask
=
CWBackPixmap
|
CWEventMask
|
CWCursor
;
Mask
maskb
=
nxagentGetDefaultEventMask
()
|
ResizeRedirectMask
|
ExposureMask
;
maskb
=
nxagentGetDefaultEventMask
();
maskb
|=
ResizeRedirectMask
|
ExposureMask
;
vlist
=
values
;
XID
values
[
4
];
XID
*
vlist
=
values
;
*
vlist
++
=
(
XID
)
nxagentShadowPixmapPtr
->
drawable
.
id
;
*
vlist
++
=
(
XID
)
nxagentShadowPixmapPtr
->
drawable
.
id
;
*
vlist
++
=
(
XID
)
maskb
;
*
vlist
++
=
(
XID
)
maskb
;
*
vlist
=
(
XID
)
None
;
*
vlist
=
(
XID
)
None
;
int
error
;
nxagentShadowWindowPtr
=
CreateWindow
(
accessWindowID
,
pWin
,
0
,
0
,
nxagentShadowWidth
,
nxagentShadowWindowPtr
=
CreateWindow
(
accessWindowID
,
pWin
,
0
,
0
,
nxagentShadowWidth
,
nxagentShadowHeight
,
0
,
InputOutput
,
mask
,
(
XID
*
)
values
,
nxagentShadowHeight
,
0
,
InputOutput
,
mask
,
(
XID
*
)
values
,
nxagentShadowDepth
,
serverClient
,
CopyFromParent
,
&
error
);
nxagentShadowDepth
,
serverClient
,
CopyFromParent
,
&
error
);
mask
=
CWWidth
|
CWHeight
;
mask
=
CWWidth
|
CWHeight
;
changes
.
width
=
nxagentScale
(
nxagentShadowWidth
,
nxagentOption
(
XRatio
));
XWindowChanges
changes
=
{
changes
.
height
=
nxagentScale
(
nxagentShadowHeight
,
nxagentOption
(
YRatio
));
.
width
=
nxagentScale
(
nxagentShadowWidth
,
nxagentOption
(
XRatio
)),
.
height
=
nxagentScale
(
nxagentShadowHeight
,
nxagentOption
(
YRatio
))
};
XConfigureWindow
(
nxagentDisplay
,
nxagentWindow
(
nxagentShadowWindowPtr
),
mask
,
&
changes
);
XConfigureWindow
(
nxagentDisplay
,
nxagentWindow
(
nxagentShadowWindowPtr
),
mask
,
&
changes
);
...
@@ -3027,21 +2979,10 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
...
@@ -3027,21 +2979,10 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
unsigned
char
nxagentShadowDepth
,
int
nxagentShadowWidth
,
unsigned
char
nxagentShadowDepth
,
int
nxagentShadowWidth
,
int
nxagentShadowHeight
,
char
*
nxagentShadowBuffer
,
int
*
changed
,
int
*
suspended
)
int
nxagentShadowHeight
,
char
*
nxagentShadowBuffer
,
int
*
changed
,
int
*
suspended
)
{
{
int
x
,
y
,
y2
,
n
,
c
,
line
;
int
result
;
long
numRects
;
unsigned
int
width
,
height
,
length
;
char
*
tBuffer
=
NULL
;
char
*
iBuffer
,
*
ptBox
;
BoxRec
*
pBox
;
RegionRec
updateRegion
;
RegionRec
updateRegion
;
RegionRec
tempRegion
;
RegionRec
tempRegion
;
BoxRec
box
;
int
overlap
;
RegionNull
(
&
updateRegion
);
RegionNull
(
&
updateRegion
);
RegionNull
(
&
tempRegion
);
RegionNull
(
&
tempRegion
);
#ifdef __CYGWIN32__
#ifdef __CYGWIN32__
...
@@ -3056,22 +2997,27 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
...
@@ -3056,22 +2997,27 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
#endif
#endif
result
=
NXShadowHasChanged
(
nxagentUserInput
,
NULL
,
suspended
);
int
result
=
NXShadowHasChanged
(
nxagentUserInput
,
NULL
,
suspended
);
*
changed
=
result
;
*
changed
=
result
;
if
(
result
==
1
)
if
(
result
==
1
)
{
{
char
*
tBuffer
=
NULL
;
char
*
iBuffer
,
*
ptBox
;
nxagentRemoveSplashWindow
();
nxagentRemoveSplashWindow
();
long
numRects
;
NXShadowExportChanges
(
&
numRects
,
&
ptBox
);
NXShadowExportChanges
(
&
numRects
,
&
ptBox
);
pBox
=
(
BoxRec
*
)
ptBox
;
BoxRec
*
pBox
=
(
BoxRec
*
)
ptBox
;
#ifdef TEST
#ifdef TEST
fprintf
(
stderr
,
"nxagentShadowPoll: nRects[%ld], pBox[%p] depth[%d].
\n
"
,
numRects
,
(
void
*
)
pBox
,
nxagentShadowDepth
);
fprintf
(
stderr
,
"nxagentShadowPoll: nRects[%ld], pBox[%p] depth[%d].
\n
"
,
numRects
,
(
void
*
)
pBox
,
nxagentShadowDepth
);
#endif
#endif
for
(
n
=
0
;
n
<
numRects
;
n
++
)
for
(
int
n
=
0
;
n
<
numRects
;
n
++
)
{
{
/*
/*
* The BoxRec struct defined in the Xserver has a different
* The BoxRec struct defined in the Xserver has a different
...
@@ -3079,11 +3025,11 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
...
@@ -3079,11 +3025,11 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
* the second and third field are inverted.
* the second and third field are inverted.
*/
*/
x
=
pBox
[
n
].
x1
;
int
x
=
pBox
[
n
].
x1
;
y
=
pBox
[
n
].
x2
;
int
y
=
pBox
[
n
].
x2
;
y2
=
pBox
[
n
].
y2
;
int
y2
=
pBox
[
n
].
y2
;
width
=
pBox
[
n
].
y1
-
pBox
[
n
].
x1
;
/* y1 = x2 */
unsigned
int
width
=
pBox
[
n
].
y1
-
pBox
[
n
].
x1
;
/* y1 = x2 */
height
=
y2
-
pBox
[
n
].
x2
;
/* x2 = y1 */
unsigned
int
height
=
y2
-
pBox
[
n
].
x2
;
/* x2 = y1 */
if
((
x
+
width
)
>
nxagentShadowWidth
||
(
y
+
height
)
>
nxagentShadowHeight
)
if
((
x
+
width
)
>
nxagentShadowWidth
||
(
y
+
height
)
>
nxagentShadowHeight
)
{
{
...
@@ -3094,13 +3040,13 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
...
@@ -3094,13 +3040,13 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
continue
;
continue
;
}
}
line
=
PixmapBytePad
(
width
,
nxagentMasterDepth
);
int
line
=
PixmapBytePad
(
width
,
nxagentMasterDepth
);
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentShadowPoll: Rectangle Number[%d] - x[%d]y[%d]W[%u]H[%u].
\n
"
,
n
+
1
,
x
,
y
,
width
,
height
);
fprintf
(
stderr
,
"nxagentShadowPoll: Rectangle Number[%d] - x[%d]y[%d]W[%u]H[%u].
\n
"
,
n
+
1
,
x
,
y
,
width
,
height
);
#endif
#endif
length
=
nxagentImageLength
(
width
,
height
,
ZPixmap
,
0
,
nxagentMasterDepth
);
unsigned
int
length
=
nxagentImageLength
(
width
,
height
,
ZPixmap
,
0
,
nxagentMasterDepth
);
SAFE_free
(
tBuffer
);
SAFE_free
(
tBuffer
);
...
@@ -3117,7 +3063,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
...
@@ -3117,7 +3063,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
iBuffer
=
tBuffer
;
iBuffer
=
tBuffer
;
for
(
c
=
0
;
c
+
y
<
y2
;
c
++
)
for
(
int
c
=
0
;
c
+
y
<
y2
;
c
++
)
{
{
memcpy
(
tBuffer
,
nxagentShadowBuffer
+
x
*
nxagentBppMaster
+
memcpy
(
tBuffer
,
nxagentShadowBuffer
+
x
*
nxagentBppMaster
+
(
y
+
c
)
*
nxagentShadowWidth
*
nxagentBppMaster
,
line
);
(
y
+
c
)
*
nxagentShadowWidth
*
nxagentBppMaster
,
line
);
...
@@ -3143,10 +3089,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
...
@@ -3143,10 +3089,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
fbPutImage
(
nxagentVirtualDrawable
((
DrawablePtr
)
nxagentShadowPixmapPtr
),
nxagentShadowGCPtr
,
fbPutImage
(
nxagentVirtualDrawable
((
DrawablePtr
)
nxagentShadowPixmapPtr
),
nxagentShadowGCPtr
,
nxagentShadowDepth
,
x
,
y
,
width
,
height
,
0
,
ZPixmap
,
tBuffer
);
nxagentShadowDepth
,
x
,
y
,
width
,
height
,
0
,
ZPixmap
,
tBuffer
);
box
.
x1
=
x
;
BoxRec
box
=
{.
x1
=
x
,
.
x2
=
x
+
width
,
.
y1
=
y
,
.
y2
=
y
+
height
};
box
.
x2
=
x
+
width
;
box
.
y1
=
y
;
box
.
y2
=
y
+
height
;
RegionInit
(
&
tempRegion
,
&
box
,
1
);
RegionInit
(
&
tempRegion
,
&
box
,
1
);
...
@@ -3154,6 +3097,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
...
@@ -3154,6 +3097,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
RegionUninit
(
&
tempRegion
);
RegionUninit
(
&
tempRegion
);
int
overlap
;
RegionValidate
(
&
updateRegion
,
&
overlap
);
RegionValidate
(
&
updateRegion
,
&
overlap
);
RegionUnion
(
&
nxagentShadowUpdateRegion
,
&
nxagentShadowUpdateRegion
,
&
updateRegion
);
RegionUnion
(
&
nxagentShadowUpdateRegion
,
&
nxagentShadowUpdateRegion
,
&
updateRegion
);
...
@@ -3387,32 +3331,29 @@ unsigned char fromHexNibble(char c)
...
@@ -3387,32 +3331,29 @@ unsigned char fromHexNibble(char c)
void
nxagentPropagateArtsdProperties
(
ScreenPtr
pScreen
,
char
*
port
)
void
nxagentPropagateArtsdProperties
(
ScreenPtr
pScreen
,
char
*
port
)
{
{
Window
rootWin
;
XlibAtom
atomReturnType
;
XlibAtom
propAtom
;
int
iReturnFormat
;
unsigned
long
ulReturnItems
;
unsigned
long
ulReturnBytesLeft
;
unsigned
char
*
pszReturnData
=
NULL
;
int
iReturn
;
char
tchar
[]
=
" "
;
char
tchar
[]
=
" "
;
/*
/*
FIXME: The port information is not used at the moment and produces a
FIXME: The port information is not used at the moment and produces a
warning on recent gcc versions. Do we need such information
warning on recent gcc versions. Do we need such information
to run the audio for
aw
rding?
to run the audio for
wa
rding?
char *chport;
char *chport;
char hex[] = "0123456789abcdef";
char hex[] = "0123456789abcdef";
*/
*/
rootWin
=
DefaultRootWindow
(
nxagentDisplay
);
Window
rootWin
=
DefaultRootWindow
(
nxagentDisplay
);
propAtom
=
nxagentAtoms
[
4
];
/* MCOPGLOBALS */
XlibAtom
propAtom
=
nxagentAtoms
[
4
];
/* MCOPGLOBALS */
XlibAtom
atomReturnType
;
int
iReturnFormat
;
unsigned
long
ulReturnItems
;
unsigned
long
ulReturnBytesLeft
;
unsigned
char
*
pszReturnData
=
NULL
;
/*
/*
* Get at most 64KB of data.
* Get at most 64KB of data.
*/
*/
iReturn
=
XGetWindowProperty
(
nxagentDisplay
,
i
nt
i
Return
=
XGetWindowProperty
(
nxagentDisplay
,
rootWin
,
rootWin
,
propAtom
,
propAtom
,
0
,
0
,
...
@@ -3451,72 +3392,69 @@ FIXME: The port information is not used at the moment and produces a
...
@@ -3451,72 +3392,69 @@ FIXME: The port information is not used at the moment and produces a
int
i
,
in
;
int
i
,
in
;
for
(
i
=
0
,
in
=
0
;
pszReturnData
[
i
]
!=
'\0'
;
i
++
)
for
(
i
=
0
,
in
=
0
;
pszReturnData
[
i
]
!=
'\0'
;
i
++
)
{
{
local_buf
[
in
]
=
pszReturnData
[
i
];
local_buf
[
in
]
=
pszReturnData
[
i
];
if
(
pszReturnData
[
i
]
==
':'
)
if
(
pszReturnData
[
i
]
==
':'
)
{
{
i
++
;
i
++
;
while
(
pszReturnData
[
i
]
!=
'\n'
)
while
(
pszReturnData
[
i
]
!=
'\n'
)
{
{
unsigned
char
h
;
unsigned
char
h
=
fromHexNibble
(
pszReturnData
[
i
]);
unsigned
char
l
;
h
=
fromHexNibble
(
pszReturnData
[
i
]);
i
++
;
i
++
;
if
(
pszReturnData
[
i
]
==
'\0'
)
continue
;
if
(
pszReturnData
[
i
]
==
'\0'
)
l
=
fromHexNibble
(
pszReturnData
[
i
]);
continue
;
unsigned
char
l
=
fromHexNibble
(
pszReturnData
[
i
]);
i
++
;
i
++
;
if
(
h
>=
16
||
l
>=
16
)
continue
;
if
(
h
>=
16
||
l
>=
16
)
continue
;
/*
/*
* FIXME: The array tchar[] was used uninitialized.
* FIXME: The array tchar[] was used uninitialized. It's
* It's not clear to me the original purpose of the
* not clear to me the original purpose of the piece of
* piece of code using it. To be removed in future
* code using it. To be removed in future versions.
* versions.
*/
*/
tchar
[
0
]
=
tchar
[
1
];
tchar
[
0
]
=
tchar
[
1
];
tchar
[
1
]
=
tchar
[
2
];
tchar
[
1
]
=
tchar
[
2
];
tchar
[
2
]
=
tchar
[
3
];
tchar
[
2
]
=
tchar
[
3
];
tchar
[
3
]
=
(
h
<<
4
)
+
l
;
tchar
[
3
]
=
(
h
<<
4
)
+
l
;
tchar
[
4
]
=
'\0'
;
tchar
[
4
]
=
'\0'
;
if
(
strncmp
(
tchar
,
"tcp:"
,
4
)
==
0
)
if
(
strncmp
(
tchar
,
"tcp:"
,
4
)
==
0
)
{
{
local_buf
[
in
-
7
]
=
'1'
;
local_buf
[
in
-
7
]
=
'1'
;
local_buf
[
in
-
6
]
=
strlen
(
port
)
+
47
;
local_buf
[
in
-
6
]
=
strlen
(
port
)
+
47
;
in
++
;
in
++
;
local_buf
[
in
]
=
pszReturnData
[
i
-
2
];
local_buf
[
in
]
=
pszReturnData
[
i
-
2
];
in
++
;
in
++
;
local_buf
[
in
]
=
pszReturnData
[
i
-
1
];
local_buf
[
in
]
=
pszReturnData
[
i
-
1
];
/* "localhost:" */
/* "localhost:" */
strcat
(
local_buf
,
"6c6f63616c686f73743a"
);
strcat
(
local_buf
,
"6c6f63616c686f73743a"
);
in
+=
20
;
in
+=
20
;
/*
/*
FIXME: The port information is not used at the moment and produces a
FIXME: The port information is not used at the moment and produces a
warning on recent gcc versions. Do we need such information
warning on recent gcc versions. Do we need such information
to run the audio forawrding?
to run the audio forawrding?
chport
=
&port[0];
chport
=
&port[0];
while(*chport
!=
'\0')
while(*chport
!=
'\0')
{
{
in++;
in++;
local_buf[in]
=
hex[(*chport >> 4) & 0xf];
local_buf[in]
=
hex[(*chport >> 4) & 0xf];
in++;
in++;
local_buf[in]
=
hex[*chport & 0xf];
local_buf[in]
=
hex[*chport & 0xf];
*chport++;
*chport++;
}
}
*/
*/
strcat
(
local_buf
,
"00"
);
strcat
(
local_buf
,
"00"
);
in
+=
2
;
in
+=
2
;
while
(
pszReturnData
[
i
]
!=
'\n'
)
while
(
pszReturnData
[
i
]
!=
'\n'
)
{
{
i
++
;
i
++
;
}
}
...
@@ -3524,20 +3462,20 @@ FIXME: The port information is not used at the moment and produces a
...
@@ -3524,20 +3462,20 @@ FIXME: The port information is not used at the moment and produces a
else
else
{
{
in
++
;
in
++
;
local_buf
[
in
]
=
pszReturnData
[
i
-
2
];
local_buf
[
in
]
=
pszReturnData
[
i
-
2
];
in
++
;
in
++
;
local_buf
[
in
]
=
pszReturnData
[
i
-
1
];
local_buf
[
in
]
=
pszReturnData
[
i
-
1
];
}
}
}
}
in
++
;
in
++
;
local_buf
[
in
]
=
pszReturnData
[
i
];
local_buf
[
in
]
=
pszReturnData
[
i
];
}
}
in
++
;
in
++
;
}
}
local_buf
[
in
]
=
0
;
local_buf
[
in
]
=
0
;
if
(
strlen
(
local_buf
))
if
(
strlen
(
local_buf
))
{
{
...
@@ -3612,9 +3550,6 @@ Bool intersect(int ax1, int ay1, unsigned int aw, unsigned int ah,
...
@@ -3612,9 +3550,6 @@ Bool intersect(int ax1, int ay1, unsigned int aw, unsigned int ah,
int
bx1
,
int
by1
,
unsigned
int
bw
,
unsigned
int
bh
,
int
bx1
,
int
by1
,
unsigned
int
bw
,
unsigned
int
bh
,
int
*
x
,
int
*
y
,
unsigned
int
*
w
,
unsigned
int
*
h
)
int
*
x
,
int
*
y
,
unsigned
int
*
w
,
unsigned
int
*
h
)
{
{
int
tx1
,
ty1
,
tx2
,
ty2
,
ix
,
iy
;
unsigned
int
iw
,
ih
;
int
ax2
=
ax1
+
aw
;
int
ax2
=
ax1
+
aw
;
int
ay2
=
ay1
+
ah
;
int
ay2
=
ay1
+
ah
;
int
bx2
=
bx1
+
bw
;
int
bx2
=
bx1
+
bw
;
...
@@ -3632,15 +3567,15 @@ Bool intersect(int ax1, int ay1, unsigned int aw, unsigned int ah,
...
@@ -3632,15 +3567,15 @@ Bool intersect(int ax1, int ay1, unsigned int aw, unsigned int ah,
return
FALSE
;
return
FALSE
;
}
}
tx1
=
max
(
ax1
,
bx1
);
int
tx1
=
max
(
ax1
,
bx1
);
ty1
=
max
(
ay1
,
by1
);
int
ty1
=
max
(
ay1
,
by1
);
tx2
=
min
(
ax2
,
bx2
);
int
tx2
=
min
(
ax2
,
bx2
);
ty2
=
min
(
ay2
,
by2
);
int
ty2
=
min
(
ay2
,
by2
);
ix
=
tx1
-
ax1
;
i
nt
i
x
=
tx1
-
ax1
;
iy
=
ty1
-
ay1
;
i
nt
i
y
=
ty1
-
ay1
;
iw
=
tx2
-
tx1
;
unsigned
int
iw
=
tx2
-
tx1
;
ih
=
ty2
-
ty1
;
unsigned
int
ih
=
ty2
-
ty1
;
/* check if the resulting rectangle is feasible */
/* check if the resulting rectangle is feasible */
if
(
iw
<=
0
||
ih
<=
0
)
{
if
(
iw
<=
0
||
ih
<=
0
)
{
...
@@ -3680,34 +3615,31 @@ Bool intersect_bb(int ax1, int ay1, unsigned int aw, unsigned int ah,
...
@@ -3680,34 +3615,31 @@ Bool intersect_bb(int ax1, int ay1, unsigned int aw, unsigned int ah,
Bool
result
=
intersect
(
ax1
,
ay1
,
aw
,
ah
,
bx1
,
by1
,
bw
,
bh
,
x
,
y
,
w
,
h
);
Bool
result
=
intersect
(
ax1
,
ay1
,
aw
,
ah
,
bx1
,
by1
,
bw
,
bh
,
x
,
y
,
w
,
h
);
if
(
result
==
TRUE
)
{
if
(
result
==
TRUE
)
{
/*
/*
* ###### The X-Coordinate ######
* ###### The X-Coordinate ######
*/
*/
/* check if outside-left of bounding box */
/* check if outside-left of bounding box */
if
(
bx1
==
bbx1
&&
ax1
<
bbx1
)
{
if
(
bx1
==
bbx1
&&
ax1
<
bbx1
)
{
*
w
+=
bbx1
-
ax1
;
*
w
+=
bbx1
-
ax1
;
*
x
=
0
;
*
x
=
0
;
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"intersect_bb: session box is outside-left of the bounding box - width gets adapted to [%d]
\n
"
,
*
w
);
fprintf
(
stderr
,
"intersect_bb: session box is outside-left of the bounding box - width gets adapted to [%d]
\n
"
,
*
w
);
#endif
#endif
}
}
/* check if outside-right of bounding box */
/* check if outside-right of bounding box */
if
(
bx1
+
bw
==
bbx2
&&
ax1
+
aw
>
bbx2
)
{
if
(
bx1
+
bw
==
bbx2
&&
ax1
+
aw
>
bbx2
)
{
*
w
+=
ax1
+
aw
-
bbx2
;
*
w
+=
ax1
+
aw
-
bbx2
;
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"intersect_bb: session box is outside-right of the bounding box - width gets adapted to [%d]
\n
"
,
*
w
);
fprintf
(
stderr
,
"intersect_bb: session box is outside-right of the bounding box - width gets adapted to [%d]
\n
"
,
*
w
);
#endif
#endif
}
}
/*
/*
...
@@ -3715,28 +3647,25 @@ Bool intersect_bb(int ax1, int ay1, unsigned int aw, unsigned int ah,
...
@@ -3715,28 +3647,25 @@ Bool intersect_bb(int ax1, int ay1, unsigned int aw, unsigned int ah,
*/
*/
/* check if outside-above of bounding box */
/* check if outside-above of bounding box */
if
(
by1
==
bby1
&&
ay1
<
bby1
)
{
if
(
by1
==
bby1
&&
ay1
<
bby1
)
{
*
h
+=
bby1
-
ay1
;
*
h
+=
bby1
-
ay1
;
*
y
=
0
;
*
y
=
0
;
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"intersect_bb: session box is outside-above of the bounding box - height gets adapted to [%d]
\n
"
,
*
h
);
fprintf
(
stderr
,
"intersect_bb: session box is outside-above of the bounding box - height gets adapted to [%d]
\n
"
,
*
h
);
#endif
#endif
}
}
/* check if outside-below of bounding box */
/* check if outside-below of bounding box */
if
(
by1
+
bh
==
bby2
&&
ay1
+
ah
>
bby2
)
{
if
(
by1
+
bh
==
bby2
&&
ay1
+
ah
>
bby2
)
{
*
h
+=
ay1
+
ah
-
bby2
;
*
h
+=
ay1
+
ah
-
bby2
;
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"intersect_bb: session box is outside-below of the bounding box - height gets adapted to [%d]
\n
"
,
*
h
);
fprintf
(
stderr
,
"intersect_bb: session box is outside-below of the bounding box - height gets adapted to [%d]
\n
"
,
*
h
);
#endif
#endif
}
}
}
}
return
result
;
return
result
;
}
}
...
@@ -3752,38 +3681,36 @@ RRModePtr nxagentRRCustomMode = NULL;
...
@@ -3752,38 +3681,36 @@ RRModePtr nxagentRRCustomMode = NULL;
void
nxagentAdjustCustomMode
(
ScreenPtr
pScreen
)
void
nxagentAdjustCustomMode
(
ScreenPtr
pScreen
)
{
{
rrScrPrivPtr
pScrPriv
=
rrGetScrPriv
(
pScreen
);
rrScrPrivPtr
pScrPriv
=
rrGetScrPriv
(
pScreen
);
RROutputPtr
output
;
if
(
pScrPriv
)
if
(
pScrPriv
)
{
{
output
=
RRFirstOutput
(
pScreen
);
RROutputPtr
output
=
RRFirstOutput
(
pScreen
);
if
(
output
&&
output
->
crtc
)
if
(
output
&&
output
->
crtc
)
{
{
RRCrtcPtr
crtc
;
char
name
[
100
];
xRRModeInfo
modeInfo
;
const
int
refresh
=
60
;
const
int
refresh
=
60
;
int
width
=
nxagentOption
(
Width
);
int
width
=
nxagentOption
(
Width
);
int
height
=
nxagentOption
(
Height
);
int
height
=
nxagentOption
(
Height
);
crtc
=
output
->
crtc
;
RRCrtcPtr
crtc
=
output
->
crtc
;
for
(
int
c
=
0
;
c
<
pScrPriv
->
numCrtcs
;
c
++
)
for
(
int
c
=
0
;
c
<
pScrPriv
->
numCrtcs
;
c
++
)
{
{
RRCrtcSet
(
pScrPriv
->
crtcs
[
c
],
NULL
,
0
,
0
,
RR_Rotate_0
,
0
,
NULL
);
RRCrtcSet
(
pScrPriv
->
crtcs
[
c
],
NULL
,
0
,
0
,
RR_Rotate_0
,
0
,
NULL
);
}
}
memset
(
&
modeInfo
,
'\0'
,
sizeof
(
modeInfo
))
;
char
name
[
100
]
;
sprintf
(
name
,
"%dx%d"
,
width
,
height
);
sprintf
(
name
,
"%dx%d"
,
width
,
height
);
modeInfo
.
width
=
width
;
xRRModeInfo
modeInfo
=
{
modeInfo
.
height
=
height
;
.
width
=
width
,
modeInfo
.
hTotal
=
width
;
.
height
=
height
,
modeInfo
.
vTotal
=
height
;
.
hTotal
=
width
,
modeInfo
.
dotClock
=
((
CARD32
)
width
*
(
CARD32
)
height
*
.
vTotal
=
height
,
(
CARD32
)
refresh
);
.
dotClock
=
((
CARD32
)
width
*
(
CARD32
)
height
*
modeInfo
.
nameLength
=
strlen
(
name
);
(
CARD32
)
refresh
),
.
nameLength
=
strlen
(
name
)
};
if
(
nxagentRRCustomMode
!=
NULL
)
if
(
nxagentRRCustomMode
!=
NULL
)
{
{
...
@@ -3925,19 +3852,13 @@ void nxagentDropOutput(RROutputPtr o)
...
@@ -3925,19 +3852,13 @@ void nxagentDropOutput(RROutputPtr o)
int
nxagentAdjustRandRXinerama
(
ScreenPtr
pScreen
)
int
nxagentAdjustRandRXinerama
(
ScreenPtr
pScreen
)
{
{
rrScrPrivPtr
pScrPriv
;
RROutputPtr
output
;
xRRModeInfo
modeInfo
;
char
name
[
100
];
int
refresh
=
60
;
int
width
=
nxagentOption
(
Width
);
int
width
=
nxagentOption
(
Width
);
int
height
=
nxagentOption
(
Height
);
int
height
=
nxagentOption
(
Height
);
pScrPriv
=
rrGetScrPriv
(
pScreen
);
rrScrPrivPtr
pScrPriv
=
rrGetScrPriv
(
pScreen
);
if
(
pScrPriv
)
if
(
pScrPriv
)
{
{
int
i
;
int
number
=
0
;
int
number
=
0
;
XineramaScreenInfo
*
screeninfo
=
XineramaQueryScreens
(
nxagentDisplay
,
&
number
);
XineramaScreenInfo
*
screeninfo
=
XineramaQueryScreens
(
nxagentDisplay
,
&
number
);
...
@@ -3946,7 +3867,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -3946,7 +3867,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
{
{
#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
...
@@ -3991,15 +3912,13 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -3991,15 +3912,13 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: numCrtcs [%d], numOutputs [%d]
\n
"
,
pScrPriv
->
numCrtcs
,
pScrPriv
->
numOutputs
);
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: numCrtcs [%d], numOutputs [%d]
\n
"
,
pScrPriv
->
numCrtcs
,
pScrPriv
->
numOutputs
);
{
{
Bool
rrgetinfo
;
/*
/*
* Convert old RANDR 1.0 data (if any) to current structure. This
* Convert old RANDR 1.0 data (if any) to current structure. This
* is needed once at the first run of this function. If we don't
* is needed once at the first run of this function. If we don't
* do this here it will be done implicitly later and add mode(s) to
* do this here it will be done implicitly later and add mode(s) to
* our crtc(s)!
* our crtc(s)!
*/
*/
rrgetinfo
=
RRGetInfo
(
pScreen
,
FALSE
);
Bool
rrgetinfo
=
RRGetInfo
(
pScreen
,
FALSE
);
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: RRGetInfo returned [%d]
\n
"
,
rrgetinfo
);
fprintf
(
stderr
,
"nxagentAdjustRandRXinerama: RRGetInfo returned [%d]
\n
"
,
rrgetinfo
);
}
}
...
@@ -4014,7 +3933,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4014,7 +3933,7 @@ 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
nt
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
);
...
@@ -4059,7 +3978,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4059,7 +3978,7 @@ 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
nt
i
=
0
;
i
<
pScrPriv
->
numCrtcs
;
i
++
)
{
{
if
(
pScrPriv
->
crtcs
[
i
]
->
gammaSize
==
0
)
if
(
pScrPriv
->
crtcs
[
i
]
->
gammaSize
==
0
)
{
{
...
@@ -4071,19 +3990,22 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4071,19 +3990,22 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
}
}
/* delete superfluous non-NX outputs */
/* delete superfluous non-NX outputs */
for
(
i
=
pScrPriv
->
numOutputs
-
1
;
i
>=
0
;
i
--
)
for
(
i
nt
i
=
pScrPriv
->
numOutputs
-
1
;
i
>=
0
;
i
--
)
if
(
strncmp
(
pScrPriv
->
outputs
[
i
]
->
name
,
"NX"
,
2
))
if
(
strncmp
(
pScrPriv
->
outputs
[
i
]
->
name
,
"NX"
,
2
))
nxagentDropOutput
(
pScrPriv
->
outputs
[
i
]);
nxagentDropOutput
(
pScrPriv
->
outputs
[
i
]);
/* at this stage only NX outputs are left - we delete the superfluous ones */
/* at this stage only NX outputs are left - we delete the superfluous ones */
for
(
i
=
pScrPriv
->
numOutputs
-
1
;
i
>=
number
;
i
--
)
for
(
i
nt
i
=
pScrPriv
->
numOutputs
-
1
;
i
>=
number
;
i
--
)
nxagentDropOutput
(
pScrPriv
->
outputs
[
i
]);
nxagentDropOutput
(
pScrPriv
->
outputs
[
i
]);
/* add and init outputs */
/* add and init outputs */
for
(
i
=
0
;
i
<
number
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
number
;
i
++
)
{
{
RROutputPtr
output
;
if
(
i
>=
pScrPriv
->
numOutputs
)
if
(
i
>=
pScrPriv
->
numOutputs
)
{
{
char
name
[
100
];
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
...
@@ -4109,10 +4031,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4109,10 +4031,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
RROutputSetPhysicalSize
(
output
,
0
,
0
);
RROutputSetPhysicalSize
(
output
,
0
,
0
);
}
}
for
(
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
pScrPriv
->
numOutputs
;
i
++
)
{
{
Bool
disable_output
=
FALSE
;
RRModePtr
mymode
=
NULL
,
prevmode
=
NULL
;
int
new_x
=
0
;
int
new_x
=
0
;
int
new_y
=
0
;
int
new_y
=
0
;
unsigned
int
new_w
=
0
;
unsigned
int
new_w
=
0
;
...
@@ -4120,13 +4040,13 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4120,13 +4040,13 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
/* if there's no intersection disconnect the output */
/* if there's no intersection disconnect the output */
#ifdef NXAGENT_RANDR_XINERAMA_CLIPPING
#ifdef NXAGENT_RANDR_XINERAMA_CLIPPING
disable_output
=
!
intersect
(
nxagentOption
(
X
),
nxagentOption
(
Y
),
Bool
disable_output
=
!
intersect
(
nxagentOption
(
X
),
nxagentOption
(
Y
),
width
,
height
,
width
,
height
,
screeninfo
[
i
].
x_org
,
screeninfo
[
i
].
y_org
,
screeninfo
[
i
].
x_org
,
screeninfo
[
i
].
y_org
,
screeninfo
[
i
].
width
,
screeninfo
[
i
].
height
,
screeninfo
[
i
].
width
,
screeninfo
[
i
].
height
,
&
new_x
,
&
new_y
,
&
new_w
,
&
new_h
);
&
new_x
,
&
new_y
,
&
new_w
,
&
new_h
);
#else
#else
disable_output
=
!
intersect_bb
(
nxagentOption
(
X
),
nxagentOption
(
Y
),
Bool
disable_output
=
!
intersect_bb
(
nxagentOption
(
X
),
nxagentOption
(
Y
),
width
,
height
,
width
,
height
,
screeninfo
[
i
].
x_org
,
screeninfo
[
i
].
y_org
,
screeninfo
[
i
].
x_org
,
screeninfo
[
i
].
y_org
,
screeninfo
[
i
].
width
,
screeninfo
[
i
].
height
,
screeninfo
[
i
].
width
,
screeninfo
[
i
].
height
,
...
@@ -4135,7 +4055,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4135,7 +4055,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
#endif
#endif
/* save previous mode */
/* save previous mode */
prevmode
=
pScrPriv
->
crtcs
[
i
]
->
mode
;
RRModePtr
prevmode
=
pScrPriv
->
crtcs
[
i
]
->
mode
;
#ifdef DEBUG
#ifdef DEBUG
if
(
prevmode
)
if
(
prevmode
)
{
{
...
@@ -4186,22 +4106,25 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4186,22 +4106,25 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
RROutputSetConnection
(
pScrPriv
->
outputs
[
i
],
RR_Connected
);
RROutputSetConnection
(
pScrPriv
->
outputs
[
i
],
RR_Connected
);
memset
(
&
modeInfo
,
'\0'
,
sizeof
(
modeInfo
));
/* avoid collisions with pre-existing default modes by using a
/* avoid collisions with pre-existing default modes by using a
separate namespace. If we'd simply use XxY we could not
separate namespace. If we'd simply use XxY we could not
distinguish between pre-existing modes which should stay
distinguish between pre-existing modes which should stay
and our own modes that should be removed after use. */
and our own modes that should be removed after use. */
char
name
[
100
];
sprintf
(
name
,
"%s%dx%d"
,
QUOTE
(
NXAGENT_RANDR_MODE_PREFIX
),
new_w
,
new_h
);
sprintf
(
name
,
"%s%dx%d"
,
QUOTE
(
NXAGENT_RANDR_MODE_PREFIX
),
new_w
,
new_h
);
modeInfo
.
width
=
new_w
;
const
int
refresh
=
60
;
modeInfo
.
height
=
new_h
;
modeInfo
.
hTotal
=
new_w
;
xRRModeInfo
modeInfo
=
{
modeInfo
.
vTotal
=
new_h
;
.
width
=
new_w
,
modeInfo
.
dotClock
=
((
CARD32
)
new_w
*
(
CARD32
)
new_h
*
(
CARD32
)
refresh
);
.
height
=
new_h
,
modeInfo
.
nameLength
=
strlen
(
name
);
.
hTotal
=
new_w
,
.
vTotal
=
new_h
,
.
dotClock
=
((
CARD32
)
new_w
*
(
CARD32
)
new_h
*
(
CARD32
)
refresh
),
.
nameLength
=
strlen
(
name
)
};
mymode
=
RRModeGet
(
&
modeInfo
,
name
);
RRModePtr
mymode
=
RRModeGet
(
&
modeInfo
,
name
);
#ifdef DEBUG
#ifdef DEBUG
if
(
mymode
)
if
(
mymode
)
...
@@ -4299,8 +4222,6 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
...
@@ -4299,8 +4222,6 @@ 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
)
{
{
XGCValues
values
=
{
0
};
miBSWindowPtr
pBackingStore
=
(
miBSWindowPtr
)
pWin
->
backStorage
;
miBSWindowPtr
pBackingStore
=
(
miBSWindowPtr
)
pWin
->
backStorage
;
PixmapPtr
pVirtualPixmap
=
nxagentVirtualPixmap
(
pPixmap
);
PixmapPtr
pVirtualPixmap
=
nxagentVirtualPixmap
(
pPixmap
);
...
@@ -4312,7 +4233,7 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
...
@@ -4312,7 +4233,7 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
fbCopyWindowProc
(
&
pWin
->
drawable
,
&
pVirtualPixmap
->
drawable
,
0
,
RegionRects
(
prgnSave
),
fbCopyWindowProc
(
&
pWin
->
drawable
,
&
pVirtualPixmap
->
drawable
,
0
,
RegionRects
(
prgnSave
),
RegionNumRects
(
prgnSave
),
xorg
,
yorg
,
FALSE
,
FALSE
,
0
,
0
);
RegionNumRects
(
prgnSave
),
xorg
,
yorg
,
FALSE
,
FALSE
,
0
,
0
);
values
.
subwindow_mode
=
IncludeInferiors
;
XGCValues
values
=
{.
subwindow_mode
=
IncludeInferiors
}
;
XlibGC
gc
=
XCreateGC
(
nxagentDisplay
,
nxagentWindow
(
screenInfo
.
screens
[
0
]
->
root
),
GCSubwindowMode
,
&
values
);
XlibGC
gc
=
XCreateGC
(
nxagentDisplay
,
nxagentWindow
(
screenInfo
.
screens
[
0
]
->
root
),
GCSubwindowMode
,
&
values
);
...
@@ -4406,8 +4327,6 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
...
@@ -4406,8 +4327,6 @@ 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
)
{
{
XGCValues
values
=
{
0
};
/*
/*
* Limit the area to restore to the
* Limit the area to restore to the
* root window size.
* root window size.
...
@@ -4423,7 +4342,7 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
...
@@ -4423,7 +4342,7 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
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
;
XGCValues
values
=
{.
subwindow_mode
=
ClipByChildren
}
;
XlibGC
gc
=
XCreateGC
(
nxagentDisplay
,
nxagentWindow
(
screenInfo
.
screens
[
0
]
->
root
),
GCSubwindowMode
,
&
values
);
XlibGC
gc
=
XCreateGC
(
nxagentDisplay
,
nxagentWindow
(
screenInfo
.
screens
[
0
]
->
root
),
GCSubwindowMode
,
&
values
);
...
@@ -4586,9 +4505,9 @@ void nxagentSetWMNormalHints(int screen, int width, int height)
...
@@ -4586,9 +4505,9 @@ void nxagentSetWMNormalHints(int screen, int width, int height)
*/
*/
void
nxagentSetWMNormalHintsMaxsize
(
ScreenPtr
pScreen
,
int
maxwidth
,
int
maxheight
)
void
nxagentSetWMNormalHintsMaxsize
(
ScreenPtr
pScreen
,
int
maxwidth
,
int
maxheight
)
{
{
XSizeHints
*
sizeHints
;
XSizeHints
*
sizeHints
=
XAllocSizeHints
()
;
if
(
(
sizeHints
=
XAllocSizeHints
())
)
if
(
sizeHints
)
{
{
sizeHints
->
flags
=
PMaxSize
;
sizeHints
->
flags
=
PMaxSize
;
sizeHints
->
max_width
=
maxwidth
;
sizeHints
->
max_width
=
maxwidth
;
...
...
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