diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2012-05-22 00:49:10 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2012-05-22 00:49:10 +0200 |
commit | 222a4a22214608b7f89691eee1c57873c2631705 (patch) | |
tree | 0b4a1b5d3483d2ba14a21671d8e5f5c2b3e2245d /nx-X11/programs/Xserver/hw/nxagent/Display.c | |
parent | c29053f82cbea5f2704d99c4d5e8afe0329e5cbe (diff) | |
download | nx-libs-222a4a22214608b7f89691eee1c57873c2631705.tar.gz nx-libs-222a4a22214608b7f89691eee1c57873c2631705.tar.bz2 nx-libs-222a4a22214608b7f89691eee1c57873c2631705.zip |
Imported nxagent-3.5.0-9.tar.gznxagent
Summary: Imported nxagent-3.5.0-9.tar.gz
Keywords:
Imported nxagent-3.5.0-9.tar.gz
into Git repository
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Display.c')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Display.c | 31 |
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; |