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
7860401b
Commit
7860401b
authored
Oct 22, 2019
by
Ulrich Sibiller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display.c: shorten code
scope improvements, designated initializers
parent
44138137
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
58 deletions
+32
-58
Display.c
nx-X11/programs/Xserver/hw/nxagent/Display.c
+32
-58
No files found.
nx-X11/programs/Xserver/hw/nxagent/Display.c
View file @
7860401b
...
...
@@ -371,13 +371,12 @@ static void nxagentSigchldHandler(int signal)
{
int
pid
=
0
;
int
status
;
int
options
;
#ifdef TEST
fprintf
(
stderr
,
"nxagentSigchldHandler: Going to check the children processes.
\n
"
);
#endif
options
=
WNOHANG
|
WUNTRACED
;
int
options
=
WNOHANG
|
WUNTRACED
;
/*
* Try with the pid of the dialog process.
...
...
@@ -732,8 +731,6 @@ int nxagentGetDataRate(void)
static
void
nxagentDisplayFlushHandler
(
Display
*
display
,
int
length
)
{
CARD32
time
;
if
(
nxagentDisplay
!=
NULL
)
{
#ifdef TEST
...
...
@@ -752,9 +749,7 @@ static void nxagentDisplayFlushHandler(Display *display, int length)
{
nxagentFlush
=
GetTimeInMillis
();
time
=
nxagentFlush
;
time
=
time
-
nxagentLastTime
;
CARD32
time
=
nxagentFlush
-
nxagentLastTime
;
if
(
time
<
nxagentRateTime
)
{
...
...
@@ -1126,9 +1121,8 @@ void nxagentResetSignalHandlers(void)
void
nxagentOpenDisplay
(
int
argc
,
char
*
argv
[])
{
int
i
;
if
(
!
nxagentDoFullGeneration
)
return
;
if
(
!
nxagentDoFullGeneration
)
return
;
#ifdef NXAGENT_TIMESTAMP
...
...
@@ -1230,7 +1224,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
nxagentDefaultColormaps
=
(
Colormap
*
)
malloc
(
nxagentNumDefaultColormaps
*
sizeof
(
Colormap
));
for
(
i
=
0
;
i
<
nxagentNumDefaultColormaps
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
nxagentNumDefaultColormaps
;
i
++
)
{
nxagentDefaultColormaps
[
i
]
=
XCreateColormap
(
nxagentDisplay
,
DefaultRootWindow
(
nxagentDisplay
),
...
...
@@ -1491,20 +1485,17 @@ void nxagentSetDefaultVisual(void)
void
nxagentInitVisuals
(
void
)
{
XVisualInfo
vi
;
XVisualInfo
*
viList
=
NULL
;
long
mask
;
int
i
,
viNumList
;
mask
=
VisualScreenMask
;
vi
.
screen
=
DefaultScreen
(
nxagentDisplay
);
vi
.
depth
=
DefaultDepth
(
nxagentDisplay
,
DefaultScreen
(
nxagentDisplay
));
viList
=
XGetVisualInfo
(
nxagentDisplay
,
mask
,
&
vi
,
&
viNumList
);
long
mask
=
VisualScreenMask
;
XVisualInfo
vi
=
{
.
screen
=
DefaultScreen
(
nxagentDisplay
),
.
depth
=
DefaultDepth
(
nxagentDisplay
,
DefaultScreen
(
nxagentDisplay
))
};
int
viNumList
;
XVisualInfo
*
viList
=
XGetVisualInfo
(
nxagentDisplay
,
mask
,
&
vi
,
&
viNumList
);
nxagentVisuals
=
(
XVisualInfo
*
)
malloc
(
viNumList
*
sizeof
(
XVisualInfo
));
nxagentNumVisuals
=
0
;
for
(
i
=
0
;
i
<
viNumList
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
viNumList
;
i
++
)
{
if
(
viList
[
i
].
depth
==
vi
.
depth
)
{
...
...
@@ -1547,10 +1538,6 @@ void nxagentInitVisuals(void)
void
nxagentInitDepths
(
void
)
{
#ifdef TEST
int
i
;
#endif
nxagentDepths
=
XListDepths
(
nxagentDisplay
,
DefaultScreen
(
nxagentDisplay
),
&
nxagentNumDepths
);
...
...
@@ -1568,7 +1555,7 @@ void nxagentInitDepths(void)
fprintf
(
stderr
,
"nxagentInitDepths: Got [%d] available depths:
\n
"
,
nxagentNumDepths
);
for
(
i
=
0
;
i
<
nxagentNumDepths
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
nxagentNumDepths
;
i
++
)
{
fprintf
(
stderr
,
" [%d]"
,
nxagentDepths
[
i
]);
}
...
...
@@ -1580,9 +1567,6 @@ void nxagentInitDepths(void)
void
nxagentInitPixmapFormats
(
void
)
{
int
i
,
j
;
int
depth
;
/*
* Formats are created with no care of which are supported
* on the real display. Creating only formats supported
...
...
@@ -1598,9 +1582,9 @@ XXX: Some X server doesn't list 1 among available depths...
nxagentPixmapFormats
=
malloc
((
nxagentNumDepths
+
1
)
*
sizeof
(
XPixmapFormatValues
));
for
(
i
=
1
;
i
<=
MAXDEPTH
;
i
++
)
for
(
i
nt
i
=
1
;
i
<=
MAXDEPTH
;
i
++
)
{
depth
=
0
;
int
depth
=
0
;
if
(
i
==
1
)
{
...
...
@@ -1608,7 +1592,7 @@ XXX: Some X server doesn't list 1 among available depths...
}
else
{
for
(
j
=
0
;
j
<
nxagentNumDepths
;
j
++
)
for
(
int
j
=
0
;
j
<
nxagentNumDepths
;
j
++
)
{
if
(
nxagentDepths
[
j
]
==
i
)
{
...
...
@@ -1667,14 +1651,12 @@ XXX: Some X server doesn't list 1 among available depths...
void
nxagentSetDefaultDrawables
(
void
)
{
int
i
,
j
;
for
(
i
=
0
;
i
<=
MAXDEPTH
;
i
++
)
for
(
int
i
=
0
;
i
<=
MAXDEPTH
;
i
++
)
{
nxagentDefaultDrawables
[
i
]
=
None
;
}
for
(
i
=
0
;
i
<
nxagentNumPixmapFormats
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
nxagentNumPixmapFormats
;
i
++
)
{
#ifdef TEST
fprintf
(
stderr
,
"nxagentSetDefaultDrawables: Checking remote pixmap format [%d] with depth [%d] "
...
...
@@ -1695,7 +1677,7 @@ void nxagentSetDefaultDrawables(void)
}
}
for
(
j
=
0
;
j
<
nxagentNumDepths
;
j
++
)
for
(
int
j
=
0
;
j
<
nxagentNumDepths
;
j
++
)
{
#ifdef TEST
fprintf
(
stderr
,
"nxagentSetDefaultDrawables: Checking depth at index [%d] with pixmap depth [%d] "
...
...
@@ -1778,7 +1760,6 @@ FIXME: Is this needed?
if
(
nxagentDisplay
!=
NULL
)
{
NXFreeCache
(
nxagentDisplay
);
NXResetDisplay
(
nxagentDisplay
);
}
...
...
@@ -1982,9 +1963,7 @@ static int nxagentCheckForDefaultDepthCompatibility(void)
* deactivated. This is probably a very bad idea.
*/
int
dDepth
;
dDepth
=
DefaultDepth
(
nxagentDisplay
,
DefaultScreen
(
nxagentDisplay
));
int
dDepth
=
DefaultDepth
(
nxagentDisplay
,
DefaultScreen
(
nxagentDisplay
));
const
unsigned
int
tolerance
=
nxagentOption
(
ReconnectTolerance
);
...
...
@@ -2327,28 +2306,24 @@ static int nxagentCheckForPixmapFormatsCompatibility(void)
static
int
nxagentInitAndCheckVisuals
(
int
flexibility
)
{
/* FIXME: does this also need work? */
XVisualInfo
viTemplate
;
XVisualInfo
*
viList
;
XVisualInfo
*
newVisuals
;
long
viMask
;
int
i
,
n
;
bool
matched
;
bool
compatible
=
true
;
int
viNumList
;
viMask
=
VisualScreenMask
;
viTemplate
.
screen
=
DefaultScreen
(
nxagentDisplay
);
viTemplate
.
depth
=
DefaultDepth
(
nxagentDisplay
,
DefaultScreen
(
nxagentDisplay
));
viList
=
XGetVisualInfo
(
nxagentDisplay
,
viMask
,
&
viTemplate
,
&
viNumList
);
long
viMask
=
VisualScreenMask
;
XVisualInfo
viTemplate
=
{
.
screen
=
DefaultScreen
(
nxagentDisplay
),
.
depth
=
DefaultDepth
(
nxagentDisplay
,
DefaultScreen
(
nxagentDisplay
))
};
int
viNumList
;
XVisualInfo
*
viList
=
XGetVisualInfo
(
nxagentDisplay
,
viMask
,
&
viTemplate
,
&
viNumList
);
newVisuals
=
malloc
(
sizeof
(
XVisualInfo
)
*
nxagentNumVisuals
);
XVisualInfo
*
newVisuals
=
malloc
(
sizeof
(
XVisualInfo
)
*
nxagentNumVisuals
);
for
(
i
=
0
;
i
<
nxagentNumVisuals
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
nxagentNumVisuals
;
i
++
)
{
matched
=
false
;
for
(
n
=
0
;
n
<
viNumList
;
n
++
)
for
(
int
n
=
0
;
n
<
viNumList
;
n
++
)
{
if
(
nxagentCompareVisuals
(
nxagentVisuals
[
i
],
viList
[
n
])
==
1
)
{
...
...
@@ -2458,7 +2433,6 @@ static int nxagentCheckForColormapsCompatibility(int flexibility)
Bool
nxagentReconnectDisplay
(
void
*
p0
)
{
int
i
;
int
flexibility
=
*
(
int
*
)
p0
;
#if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_DISPLAY_DEBUG)
...
...
@@ -2569,7 +2543,7 @@ Bool nxagentReconnectDisplay(void *p0)
reconnectDisplayState
=
ALLOC_DEF_COLORMAP
;
for
(
i
=
0
;
i
<
nxagentNumDefaultColormaps
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
nxagentNumDefaultColormaps
;
i
++
)
{
if
(
nxagentVisualHasBeenIgnored
[
i
])
{
...
...
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