9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] draw blanking
@ 2013-04-16 15:04 erik quanstrom
  2013-04-16 16:02 ` cinap_lenrek
  0 siblings, 1 reply; 2+ messages in thread
From: erik quanstrom @ 2013-04-16 15:04 UTC (permalink / raw)
  To: 9fans

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;



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9fans] draw blanking
  2013-04-16 15:04 [9fans] draw blanking erik quanstrom
@ 2013-04-16 16:02 ` cinap_lenrek
  0 siblings, 0 replies; 2+ messages in thread
From: cinap_lenrek @ 2013-04-16 16:02 UTC (permalink / raw)
  To: 9fans

yes, thats a bug. good find.

--
cinap



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-16 16:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-16 15:04 [9fans] draw blanking erik quanstrom
2013-04-16 16:02 ` cinap_lenrek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).