LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-05-2004, 03:04 AM   #1
dimm_coder
LQ Newbie
 
Registered: Oct 2003
Location: Minsk, Belarus
Distribution: Mandrake, FreeBSD
Posts: 28

Rep: Reputation: 15
curses and some terminals


I have found out that different terminals (GUI mode) deal with curses apllications in different ways.
The problem is that some of them (eterm, gnome term, KDE) restore the view of the window
to the previous state after any curses application has completed. So the user is not able to see any output results. Only xterm doesn't do this.
How can I deal with this? Some terminal option should be set to prevent this?
 
Old 04-06-2004, 12:12 PM   #2
Mohsen
Member
 
Registered: Feb 2003
Location: Iran
Distribution: Solaris 10
Posts: 201

Rep: Reputation: 30
I dont know why, but I think this happens as soon as endwin(). Try to chage terminal properties back to the original one without using endwin(). You may find your answer by reading the source (I coudn't fingure out the code!!)
Code:
#include <curses.priv.h>
#include <term.h>

MODULE_ID("$Id: lib_endwin.c,v 1.19 2000/12/10 02:43:27 tom Exp $")

NCURSES_EXPORT(int)
endwin(void)
{
    T((T_CALLED("endwin()")));

    if (SP) {
	SP->_endwin = TRUE;
	SP->_mouse_wrap(SP);
	_nc_screen_wrap();
	_nc_mvcur_wrap();	/* wrap up cursor addressing */
	returnCode(reset_shell_mode());
    }

    returnCode(ERR);
}
 
Old 04-07-2004, 01:30 AM   #3
dimm_coder
LQ Newbie
 
Registered: Oct 2003
Location: Minsk, Belarus
Distribution: Mandrake, FreeBSD
Posts: 28

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by Mohsen
[B]I dont know why, but I think this happens as soon as endwin(). Try to chage terminal properties back to the original one without using endwin(). You may find your answer by reading the source (I coudn't fingure out the code!!)
Thank U for the answer.
Yes, if I comment out the endwin() call, the screen isn't restoring, but the terminal doesn't get the correct mode after the program ends. I was wondering mostly, because endwin() behavior on some terminals isn't compliant with documentation. Probably, endwin() use some terminal dependent code (set/restore some terminal flags). I'll take a look into sources and try to figure out.

Last edited by dimm_coder; 04-07-2004 at 01:37 AM.
 
Old 04-09-2004, 01:01 AM   #4
Mohsen
Member
 
Registered: Feb 2003
Location: Iran
Distribution: Solaris 10
Posts: 201

Rep: Reputation: 30
You can also ask your question from ncurses maintainer at bug-ncurses@gnu.org
 
Old 04-09-2004, 01:05 AM   #5
Mohsen
Member
 
Registered: Feb 2003
Location: Iran
Distribution: Solaris 10
Posts: 201

Rep: Reputation: 30
Heh, I've just found that you did it before
 
Old 04-09-2004, 02:53 AM   #6
dimm_coder
LQ Newbie
 
Registered: Oct 2003
Location: Minsk, Belarus
Distribution: Mandrake, FreeBSD
Posts: 28

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by Mohsen
Heh, I've just found that you did it before
Yes, I did it
 
Old 05-08-2004, 08:58 PM   #7
arvind_sv
Member
 
Registered: Oct 2002
Location: Bangalore
Distribution: Gentoo Linux
Posts: 96

Rep: Reputation: 16
Hi,

You must have got an answer from the ncurses folks already. It's not a bug.
Look at the xterm man page and search for "titeInhibit".

Also, if you haven't yet found out from them how to get the terminal emulators to do what you want them to, tell me.

Arvind
 
Old 05-10-2004, 02:44 AM   #8
dimm_coder
LQ Newbie
 
Registered: Oct 2003
Location: Minsk, Belarus
Distribution: Mandrake, FreeBSD
Posts: 28

Original Poster
Rep: Reputation: 15
Thanks, arvind, for your answer.
Well, that was a program I had to rewrite in some parts. This program used the ncurses library for achieving a coloring output.
It had some drawbacks: 1) that one with terminals I have pointed above; 2) the program may have a long output and, thus, another problem with scrolling. So I've rewrote it using the screen output with escape sequences, not using ncurses. That solved all problems.
At any rate, thanks for advice.

Last edited by dimm_coder; 05-10-2004 at 02:48 AM.
 
Old 05-10-2004, 02:45 AM   #9
dimm_coder
LQ Newbie
 
Registered: Oct 2003
Location: Minsk, Belarus
Distribution: Mandrake, FreeBSD
Posts: 28

Original Poster
Rep: Reputation: 15
Thanks, arvind, for your answer.
Well, that was a program I had to rewrite in some parts. This program used the ncurses library for achieving a coloring output.
It had some drawbacks: 1) that one with terminals I have pointed above; 2) the program may have a long output and, thus, another problem with scrolling. So I've rewrote it using the screen output with escape sequences, not using ncurses. That solved all problems.
At any rate, thanks for advice.
 
Old 05-10-2004, 11:04 AM   #10
arvind_sv
Member
 
Registered: Oct 2002
Location: Bangalore
Distribution: Gentoo Linux
Posts: 96

Rep: Reputation: 16
You could have used the scrolling functionality of ncurses. I've been wanting to try it out.

Anyhow, glad to know that it worked out,
Arvind
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
do I need curses? jake_01 Programming 1 04-28-2005 06:24 AM
Where is curses.h and semun.h DavidW567 Programming 1 01-13-2005 11:57 AM
Terminals - spying on local terminals with ssh BeatRyder Linux - Software 5 10-21-2004 01:47 AM
curses and iostream irfanhab Programming 3 05-10-2004 10:14 AM
Curses nitinkatageri Linux - General 2 08-18-2003 04:58 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration