From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Tue, 16 Apr 2013 11:04:21 -0400 To: 9fans@9fans.net Message-ID: <305121e9f826e8da5ac4c2b5411e194e@ladd.quanstro.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] draw blanking Topicbox-Message-UUID: 428b6fd2-ead8-11e9-9d60-3106f5b1d025 i noticed (and this is fairly obvious from the code), that draw blanking will never happen if the cursor is being redrawn. such as if it is near the tail of catclock. a fix to the proc-style mouse is below. also, i noticed that for non-vga machines, it's not possible to set the blanktime. it seems that a little reorganization would be beneficial. - erik /n/dump/2013/0416/sys/src/9/port/devmouse.c:33,38 - ../port/devmouse.c:33,39 { Lock; Mousestate; + int active; int redraw; /* update cursor on screen */ Rendez redrawr; /* wait for cursor screen updates */ ulong lastcounter; /* value when /dev/mouse read */ /n/dump/2013/0416/sys/src/9/port/devmouse.c:515,527 - ../port/devmouse.c:516,528 while(waserror()) ; for(;;){ + drawactive(mouse.active); + mouse.active = 0; + if(mouse.redraw){ mouse.redraw = 0; cursoroff(); cursoron(); - drawactive(1); - } else { - drawactive(0); } tsleep(&mouse.redrawr, shouldredraw, 0, 20*1000); } /n/dump/2013/0416/sys/src/9/port/devmouse.c:562,568 - ../port/devmouse.c:563,570 void mousetrack(int dx, int dy, int b, int msec) { - int x, y, lastb; + int lastb; + Point xy; if(gscreen==nil) return; /n/dump/2013/0416/sys/src/9/port/devmouse.c:571,590 - ../port/devmouse.c:573,595 dx = scale(dx); dy = scale(dy); } - x = mouse.xy.x + dx; - y = mouse.xy.y + dy; + xy.x = mouse.xy.x + dx; + xy.y = mouse.xy.y + dy; - if(x < gscreen->clipr.min.x) - x = gscreen->clipr.min.x; - if(x >= gscreen->clipr.max.x) - x = gscreen->clipr.max.x; - if(y < gscreen->clipr.min.y) - y = gscreen->clipr.min.y; - if(y >= gscreen->clipr.max.y) - y = gscreen->clipr.max.y; + if(xy.x < gscreen->clipr.min.x) + xy.x = gscreen->clipr.min.x; + if(xy.x >= gscreen->clipr.max.x) + xy.x = gscreen->clipr.max.x; + if(xy.y < gscreen->clipr.min.y) + xy.y = gscreen->clipr.min.y; + if(xy.y >= gscreen->clipr.max.y) + xy.y = gscreen->clipr.max.y; lastb = mouse.buttons; - mouse.xy = Pt(x, y); + if(!eqpt(xy, mouse.xy)){ + mouse.active = 1; + mouse.xy = xy; + } mouse.buttons = b|kbdbuttons; mouse.counter++; mouse.msec = msec; /n/dump/2013/0416/sys/src/9/port/devmouse.c:594,599 - ../port/devmouse.c:599,605 * queue any more events until a reader polls the mouse. */ if(!mouse.qfull && lastb != b) { /* add to ring */ + mouse.active = 1; mouse.queue[mouse.wi] = mouse.Mousestate; if(++mouse.wi == nelem(mouse.queue)) mouse.wi = 0;