From fd4cd3e4b7b46f4d525d6d8b549d45f9dd2a31a0 Mon Sep 17 00:00:00 2001 From: malc Date: Mon, 12 Mar 2012 20:12:50 +0400 Subject: [PATCH] Conserve bandwidth --- wsi.ml | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/wsi.ml b/wsi.ml index 5157c40..eb7a5c4 100644 --- a/wsi.ml +++ b/wsi.ml @@ -60,6 +60,7 @@ type state = ; mutable w : int ; mutable h : int ; mutable fs : fs + ; mutable curcurs : cursor } and fs = | NoFs @@ -85,6 +86,7 @@ let state = ; h = -1 ; fs = NoFs ; stringatom = 31 + ; curcurs = CURSOR_INHERIT } ;; @@ -846,17 +848,20 @@ let settitle s = ;; let setcursor cursor = - let n = - match cursor with - | CURSOR_INHERIT -> -1 - | CURSOR_INFO -> 3 - | CURSOR_CYCLE -> 2 - | CURSOR_CROSSHAIR -> 0 - | CURSOR_TEXT -> 5 - in - let s = s32 (if n = -1 then 0 else state.idbase+2+n) in - let s = changewindowattributesreq state.idbase (*cursor*)0x4000 s in - sendstr s state.sock; + if cursor != state.curcurs + then + let n = + match cursor with + | CURSOR_INHERIT -> -1 + | CURSOR_INFO -> 3 + | CURSOR_CYCLE -> 2 + | CURSOR_CROSSHAIR -> 0 + | CURSOR_TEXT -> 5 + in + let s = s32 (if n = -1 then 0 else state.idbase+2+n) in + let s = changewindowattributesreq state.idbase (*cursor*)0x4000 s in + sendstr s state.sock; + state.curcurs <- cursor; ;; let fullscreen () = -- 2.11.4.GIT