aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Drawable.c
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2012-05-22 00:49:10 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2012-05-22 00:49:10 +0200
commit222a4a22214608b7f89691eee1c57873c2631705 (patch)
tree0b4a1b5d3483d2ba14a21671d8e5f5c2b3e2245d /nx-X11/programs/Xserver/hw/nxagent/Drawable.c
parentc29053f82cbea5f2704d99c4d5e8afe0329e5cbe (diff)
downloadnx-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/Drawable.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Drawable.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c
index 9c167743f..f2225996b 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c
@@ -112,6 +112,27 @@ unsigned long nxagentGetColor(DrawablePtr pDrawable, int xPixel, int yPixel);
unsigned long nxagentGetDrawableColor(DrawablePtr pDrawable);
unsigned long nxagentGetRegionColor(DrawablePtr pDrawable, RegionPtr pRegion);
+int nxagentSkipImage = 0;
+
+static int nxagentTooManyImageData(void)
+{
+ unsigned int r;
+ unsigned int limit;
+
+ limit = nxagentOption(ImageRateLimit);
+
+ r = nxagentGetDataRate() / 1000;
+
+ #ifdef TEST
+ if (r > limit)
+ {
+ fprintf(stderr, "Warning: Current bit rate is: %u kB/s.\n", r);
+ }
+ #endif
+
+ return (r > limit);
+}
+
int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int breakMask, WindowPtr owner)
{
int result;
@@ -1304,6 +1325,18 @@ FIXME: All drawables should be set as synchronized and
never marked as corrupted while the display is
down.
*/
+
+ nxagentSkipImage = nxagentTooManyImageData();
+
+ if (nxagentOption(ImageRateLimit) && nxagentSkipImage)
+ {
+ #ifdef TEST
+ fprintf(stderr, "nxagentSynchronizeDrawable: Skipping due to bit rate limit reached.\n");
+ #endif
+
+ return;
+ }
+
if (NXDisplayError(nxagentDisplay) == 1)
{
#ifdef TEST