c - Hiding Cursor in Xterm Tektronix 4014 Mode -


i wrote following program test xterm tektronix 4014 mode:

#define _bsd_source #include <stdio.h> #include <assert.h> #include <unistd.h>  #define gs ((char)0x1d) #define esc ((char)0x1b) #define ff ((char)0x0c)  static void xy (int x,  int y, char* restrict xy) {   xy[3] = (x % 32) + 64; // x low   xy[2] = (x >> 5) + 32; // x high   xy[1] = (y % 32) + 96; // y low   xy[0] = (y >> 5) + 32; // y high   assert (x == 32 * (xy[2] - 32) + xy[3] - 64);   assert (y == 32 * (xy[0] - 32) + xy[1] - 96); }  static void enter_graphic () {   printf("%c", gs); }  static void leave_graphic () {   printf("\n"); }   static char pt[] = { esc, 0, 0, 0, 0, 0, 0 };  /* function not threadsafe! (but why should ...) */ static void line_to (int x, int y, char pattern) {   pt[1] = pattern ? pattern : '`';   xy(x, y, pt + 2);   printf("%s", pt); }  static void clear () {   printf("%c%c", esc, ff); }  static void randgrph (int dx, int dy) {   int x, y;   enter_graphic ();    (int = 0; < 10; ++i) {     (int j = 0; j < 10; ++j) {       x = (x + 7) % 200;       y = (y + 39) % 200;       line_to(x + dx, y + dy, 'b');     }   }    leave_graphic(); }  int main (void) {   int i, j;   (i = 0; < 200; ++i) {     (j = 0; j < 200; ++j) {       clear();       randgrph(i, j);       usleep(1000000/25);     }   } } 

this seems work fine. xy creates coordinate pair, , line_to draws line. clear screen, draw dotted lines, in loop. @ least on xterm, looks "animated" (i'd guess real tektronix not fast enough, it's testing).

however: shows textcursor. how can stop doing so? not find tek control sequence hide text cursor, there possibilities hide graphic cursor, not shown in xterm anyway.

the solution control terminal needs set not echoing input. can done noecho() libncurses.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -