From: Matan Ziv-Av (matan@svgalib.org)
Date: Sun 16 Dec 2001 - 21:07:27 IST
Hi, Jay, can you post the program that exhibits this problem? It will be easier to decide where the problem is. > While I'm at it, maybe there's a better way to program a flashing cursor? > Here's what I'm doing: > > 1) Early in the program, I set a timer that runs constantly throughout the > program, even when I'm not usingthe cursor: > > signal(SIGVTALRM, catch_alarm); > interval.it_interval.tv_sec = 0; > interval.it_interval.tv_usec = 200000; > interval.it_value.tv_sec = 0; > interval.it_value.tv_usec = 200000; > setitimer(ITIMER_VIRTUAL, &interval, NULL); ITIMER_VIRTUAL only counts when your program runs, so you only get a signal every .2s that your process is running, which of course mught depend on what other processes are running. See man setitimer. > According to Rus, leaving this running doesn't add much (any?) overhead. > > 2) Then, I have a global variable called "cursor" which can be either 0 or > 1. Every time the timer goes off (5 times a second), I swap the value of > cursor like so: > > void catch_alarm(int vtalrm) > { > cursor = (cursor == 1) ? 0 : 1; > signal(SIGVTALRM, catch_alarm); > } > > 3) If I need the flashing cursor then, I print it or erase it, depending > on the value of "cursor". > > Is there a better way? My flashing cursor is fairly consistent, but > sometimes it gets a little jittery when other processes are running. How > does something like the bash shell cursor remain so fluid & constant? The cursor in text mode is blinks in hardware. -- Matan Ziv-Av. matan@svgalib.org ------------------------------------------------------------------ Unsubscribe: To: listbot@svgalib.org Body: unsubscribe linux-svgalib
This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:24 IST