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:50:51 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2012-05-22 00:50:51 +0200
commitfdaa240434e4b5022f2bc6b6aa7f590c0dcdc794 (patch)
tree316ac30721a364e72b4fddf9e3a21ceb81ef7547 /nx-X11/programs/Xserver/hw/nxagent/Drawable.c
parentfe72988fb668ad97fc4fcb2ee3862613324d9516 (diff)
parent222a4a22214608b7f89691eee1c57873c2631705 (diff)
downloadnx-libs-fdaa240434e4b5022f2bc6b6aa7f590c0dcdc794.tar.gz
nx-libs-fdaa240434e4b5022f2bc6b6aa7f590c0dcdc794.tar.bz2
nx-libs-fdaa240434e4b5022f2bc6b6aa7f590c0dcdc794.zip
Merge branch 'nxagent'
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