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
f24767b3
You need to sign in or sign up before continuing.
Unverified
Commit
f24767b3
authored
Aug 16, 2019
by
Mike Gabriel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'uli42-pr/improve_wait_events' into 3.6.x
Attributes GH PR #828:
https://github.com/ArcticaProject/nx-libs/pull/828
parents
7f4b50de
62573abf
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
32 additions
and
35 deletions
+32
-35
Client.c
nx-X11/programs/Xserver/hw/nxagent/Client.c
+1
-1
Events.c
nx-X11/programs/Xserver/hw/nxagent/Events.c
+22
-21
Events.h
nx-X11/programs/Xserver/hw/nxagent/Events.h
+1
-1
Handlers.c
nx-X11/programs/Xserver/hw/nxagent/Handlers.c
+1
-1
Screen.c
nx-X11/programs/Xserver/hw/nxagent/Screen.c
+1
-5
Split.c
nx-X11/programs/Xserver/hw/nxagent/Split.c
+1
-1
Window.c
nx-X11/programs/Xserver/hw/nxagent/Window.c
+1
-5
Loop.cpp
nxcomp/src/Loop.cpp
+4
-0
No files found.
nx-X11/programs/Xserver/hw/nxagent/Client.c
View file @
f24767b3
...
@@ -400,7 +400,7 @@ void nxagentWaitWakeupBySplit(ClientPtr client)
...
@@ -400,7 +400,7 @@ void nxagentWaitWakeupBySplit(ClientPtr client)
fprintf
(
stderr
,
"++++++nxagentWaitWakeupBySplit: Yielding control to the NX transport.
\n
"
);
fprintf
(
stderr
,
"++++++nxagentWaitWakeupBySplit: Yielding control to the NX transport.
\n
"
);
#endif
#endif
nxagentWaitEvents
(
nxagentDisplay
,
NULL
);
nxagentWaitEvents
(
nxagentDisplay
,
0
);
}
}
}
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Events.c
View file @
f24767b3
...
@@ -3309,7 +3309,6 @@ int nxagentHandleConfigureNotify(XEvent* X)
...
@@ -3309,7 +3309,6 @@ int nxagentHandleConfigureNotify(XEvent* X)
ScreenPtr
pScreen
=
nxagentScreen
(
X
->
xconfigure
.
window
);
ScreenPtr
pScreen
=
nxagentScreen
(
X
->
xconfigure
.
window
);
Bool
doRandR
=
False
;
Bool
doRandR
=
False
;
struct
timeval
timeout
;
if
(
X
->
xconfigure
.
window
==
nxagentDefaultWindows
[
pScreen
->
myNum
])
if
(
X
->
xconfigure
.
window
==
nxagentDefaultWindows
[
pScreen
->
myNum
])
{
{
...
@@ -3345,10 +3344,7 @@ int nxagentHandleConfigureNotify(XEvent* X)
...
@@ -3345,10 +3344,7 @@ int nxagentHandleConfigureNotify(XEvent* X)
{
{
newEvents
=
False
;
newEvents
=
False
;
timeout
.
tv_sec
=
0
;
nxagentWaitEvents
(
nxagentDisplay
,
500
);
timeout
.
tv_usec
=
500
*
1000
;
nxagentWaitEvents
(
nxagentDisplay
,
&
timeout
);
/*
/*
* This should also flush the NX link for us.
* This should also flush the NX link for us.
...
@@ -3827,7 +3823,7 @@ int nxagentWaitForResource(GetResourceFuncPtr pGetResource, PredicateFuncPtr pPr
...
@@ -3827,7 +3823,7 @@ int nxagentWaitForResource(GetResourceFuncPtr pGetResource, PredicateFuncPtr pPr
while
((
resource
=
(
*
pGetResource
)(
nxagentDisplay
))
==
-
1
)
while
((
resource
=
(
*
pGetResource
)(
nxagentDisplay
))
==
-
1
)
{
{
if
(
nxagentWaitEvents
(
nxagentDisplay
,
NULL
)
==
-
1
)
if
(
nxagentWaitEvents
(
nxagentDisplay
,
0
)
==
-
1
)
{
{
return
-
1
;
return
-
1
;
}
}
...
@@ -4511,14 +4507,11 @@ int nxagentPendingEvents(Display *dpy)
...
@@ -4511,14 +4507,11 @@ int nxagentPendingEvents(Display *dpy)
}
}
/*
/*
* Blocks until an event becomes
* Blocks until an event becomes available.
* available.
*/
*/
int
nxagentWaitEvents
(
Display
*
dpy
,
struct
timeval
*
tm
)
int
nxagentWaitEvents
(
Display
*
dpy
,
useconds_t
msec
)
{
{
XEvent
ev
;
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentWaitEvents called.
\n
"
);
fprintf
(
stderr
,
"nxagentWaitEvents called.
\n
"
);
#endif
#endif
...
@@ -4526,33 +4519,41 @@ int nxagentWaitEvents(Display *dpy, struct timeval *tm)
...
@@ -4526,33 +4519,41 @@ int nxagentWaitEvents(Display *dpy, struct timeval *tm)
NXFlushDisplay
(
dpy
,
NXFlushLink
);
NXFlushDisplay
(
dpy
,
NXFlushLink
);
/*
/*
* If the transport is not running we
* If the transport is not running we have to rely on Xlib to wait
* have to rely on Xlib to wait for an
* for an event. In this case the timeout is ignored.
* event. In this case the timeout is
* ignored.
*/
*/
if
(
NXTransRunning
(
NX_FD_ANY
)
==
1
)
if
(
NXTransRunning
(
NX_FD_ANY
)
==
1
)
{
{
NXTransContinue
(
tm
);
if
(
msec
>
0
)
{
struct
timeval
tm
=
{
.
tv_sec
=
0
,
.
tv_usec
=
msec
*
1000
};
NXTransContinue
(
&
tm
);
}
else
{
NXTransContinue
(
NULL
);
}
}
}
else
else
{
{
XEvent
ev
;
XPeekEvent
(
dpy
,
&
ev
);
XPeekEvent
(
dpy
,
&
ev
);
}
}
/*
/*
* Check if we encountered a display
* Check if we encountered a display error. If we did, wait for the
* error. If we did, wait for the
* time requested by the caller.
* time requested by the caller.
*/
*/
if
(
NXDisplayError
(
dpy
)
==
1
)
if
(
NXDisplayError
(
dpy
)
==
1
)
{
{
if
(
tm
!=
NULL
)
if
(
msec
>
0
)
{
{
usleep
(
tm
->
tv_sec
*
1000
*
1000
+
usleep
(
msec
*
1000
);
tm
->
tv_usec
);
}
}
return
-
1
;
return
-
1
;
...
...
nx-X11/programs/Xserver/hw/nxagent/Events.h
View file @
f24767b3
...
@@ -232,6 +232,6 @@ Bool nxagentPendingEvents(Display *dpy);
...
@@ -232,6 +232,6 @@ Bool nxagentPendingEvents(Display *dpy);
#define nxagentCheckEvents(display, event, predicate, argument) \
#define nxagentCheckEvents(display, event, predicate, argument) \
XCheckIfEventNoFlush((display), (event), (predicate), (argument))
XCheckIfEventNoFlush((display), (event), (predicate), (argument))
int
nxagentWaitEvents
(
Display
*
,
struct
timeval
*
);
int
nxagentWaitEvents
(
Display
*
,
useconds_t
msec
);
#endif
/* __Events_H__ */
#endif
/* __Events_H__ */
nx-X11/programs/Xserver/hw/nxagent/Handlers.c
View file @
f24767b3
...
@@ -1255,7 +1255,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
...
@@ -1255,7 +1255,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
while
(
nxagentTokens
.
pending
==
TOKENS_PENDING_LIMIT
)
while
(
nxagentTokens
.
pending
==
TOKENS_PENDING_LIMIT
)
{
{
if
(
nxagentWaitEvents
(
nxagentDisplay
,
NULL
)
==
-
1
)
if
(
nxagentWaitEvents
(
nxagentDisplay
,
0
)
==
-
1
)
{
{
nxagentTokens
.
pending
=
0
;
nxagentTokens
.
pending
=
0
;
...
...
nx-X11/programs/Xserver/hw/nxagent/Screen.c
View file @
f24767b3
...
@@ -365,7 +365,6 @@ FIXME: We'll check for ReparentNotify and LeaveNotify events after
...
@@ -365,7 +365,6 @@ FIXME: We'll check for ReparentNotify and LeaveNotify events after
for
(
int
i
=
0
;
i
<
100
&&
nxagentWMIsRunning
;
i
++
)
for
(
int
i
=
0
;
i
<
100
&&
nxagentWMIsRunning
;
i
++
)
{
{
struct
timeval
timeout
;
XEvent
e
;
XEvent
e
;
#ifdef TEST
#ifdef TEST
...
@@ -379,10 +378,7 @@ FIXME: We'll check for ReparentNotify and LeaveNotify events after
...
@@ -379,10 +378,7 @@ FIXME: We'll check for ReparentNotify and LeaveNotify events after
XSync
(
nxagentDisplay
,
0
);
XSync
(
nxagentDisplay
,
0
);
timeout
.
tv_sec
=
0
;
nxagentWaitEvents
(
nxagentDisplay
,
50
);
timeout
.
tv_usec
=
50
*
1000
;
nxagentWaitEvents
(
nxagentDisplay
,
&
timeout
);
}
}
}
}
else
else
...
...
nx-X11/programs/Xserver/hw/nxagent/Split.c
View file @
f24767b3
...
@@ -804,7 +804,7 @@ void nxagentWaitDrawable(DrawablePtr pDrawable)
...
@@ -804,7 +804,7 @@ void nxagentWaitDrawable(DrawablePtr pDrawable)
fprintf
(
stderr
,
"nxagentWaitDrawable: Yielding control to the NX transport.
\n
"
);
fprintf
(
stderr
,
"nxagentWaitDrawable: Yielding control to the NX transport.
\n
"
);
#endif
#endif
nxagentWaitEvents
(
nxagentDisplay
,
NULL
);
nxagentWaitEvents
(
nxagentDisplay
,
0
);
}
}
}
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Window.c
View file @
f24767b3
...
@@ -849,7 +849,6 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
...
@@ -849,7 +849,6 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
* Change to fullscreen mode.
* Change to fullscreen mode.
*/
*/
struct
timeval
timeout
;
int
i
;
int
i
;
XEvent
e
;
XEvent
e
;
...
@@ -874,10 +873,7 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
...
@@ -874,10 +873,7 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
XSync
(
nxagentDisplay
,
0
);
XSync
(
nxagentDisplay
,
0
);
timeout
.
tv_sec
=
0
;
nxagentWaitEvents
(
nxagentDisplay
,
50
);
timeout
.
tv_usec
=
50
*
1000
;
nxagentWaitEvents
(
nxagentDisplay
,
&
timeout
);
}
}
if
(
i
<
100
)
if
(
i
<
100
)
...
...
nxcomp/src/Loop.cpp
View file @
f24767b3
...
@@ -1565,6 +1565,10 @@ int NXTransRunning(int fd)
...
@@ -1565,6 +1565,10 @@ int NXTransRunning(int fd)
return
(
control
!=
NULL
);
return
(
control
!=
NULL
);
}
}
//
// FIXME: why timeval? Passing milliseconds would be more convenient,
// the timeval struct/T_timestamp could be built on demand.
//
int
NXTransContinue
(
struct
timeval
*
selectTs
)
int
NXTransContinue
(
struct
timeval
*
selectTs
)
{
{
if
(
control
!=
NULL
)
if
(
control
!=
NULL
)
...
...
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