aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Display.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Display.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Display.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c
index c60718d36..9031c25c7 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Display.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c
@@ -746,8 +746,19 @@ static void nxagentDisplayWriteHandler(Display *display, int length)
}
}
+static CARD32 nxagentRateTime = 5000;
+static CARD32 nxagentLastTime;
+static unsigned int nxagentRate = 0;
+
+int nxagentGetDataRate(void)
+{
+ return nxagentRate;
+}
+
static void nxagentDisplayFlushHandler(Display *display, int length)
{
+ CARD32 time;
+
if (nxagentDisplay != NULL)
{
#ifdef TEST
@@ -765,6 +776,22 @@ static void nxagentDisplayFlushHandler(Display *display, int length)
if (nxagentOption(LinkType) != LINK_TYPE_NONE)
{
nxagentFlush = GetTimeInMillis();
+
+ time = nxagentFlush;
+
+ time = time - nxagentLastTime;
+
+ if (time < nxagentRateTime)
+ {
+ nxagentRate = ((nxagentRate * (nxagentRateTime - time) +
+ length) * 1000) / nxagentRateTime;
+ }
+ else
+ {
+ nxagentRate = (length * 1000) / nxagentRateTime;
+ }
+
+ nxagentLastTime = nxagentFlush;
}
}
}
@@ -1482,10 +1509,6 @@ void nxagentSetDefaultVisual(void)
int i;
- nxagentDefaultVisualIndex = 3;
-
- return;
-
if (nxagentUserDefaultClass || nxagentUserDefaultDepth)
{
nxagentDefaultVisualIndex = UNDEFINED;