9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: [9fans] draw blanking
Date: Tue, 16 Apr 2013 11:04:21 -0400	[thread overview]
Message-ID: <305121e9f826e8da5ac4c2b5411e194e@ladd.quanstro.net> (raw)

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;



             reply	other threads:[~2013-04-16 15:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-16 15:04 erik quanstrom [this message]
2013-04-16 16:02 ` cinap_lenrek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=305121e9f826e8da5ac4c2b5411e194e@ladd.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).