Sponsored Content
Top Forums Programming Resize current window with Curses Post 302392423 by Corona688 on Thursday 4th of February 2010 11:50:57 AM
Old 02-04-2010
Quote:
Originally Posted by pogdorica
---------- Post updated at 04:59 PM ---------- Previous update was at 04:26 PM ----------

[/COLOR]Oh !!! I just find this post:

terminal Width/height change

No, I really think you need to call resizeterm(). The ioctl only changes what size is reported, not what size the window is, so isn't very useful. How the terminal is actually resized from the user end is terminal-specific and nothing to do with the kernel, hence part of curses.

What value is resizeterm returning? It may not think your terminal's resizable. Curses also provides the function is_term_resized() to tell if curses thinks the terminal is even capable of resizing. What does 'env | grep TERM' show? If TERM is not xterm it probably won't try to resize it even if the terminal supports it.

---------- Post updated at 10:50 AM ---------- Previous update was at 10:09 AM ----------

(posted from PM with permission)
Quote:
Originally Posted by pogdorica
Hi Corona.

I'm grateful for your time and support. I'm from Madrid-Spain and I'm really sorry if my english isnīt very good. I hope you understand all my post.
Even if it's not as easy as Spanish for you, your english is quite good.
Quote:
Today, itīs the first time that i try to do something with 'curses' library and i would want to know what it is possible to do and not to do with this library. I am studying your link; sure it 's very good.
I really don't know curses. I'm just using google, reading documentation, and suggesting things I do by habit. It certainly seems possible to resize terminals with curses -- both PuTTY and curses support it.

Whenever a function doesn't work, first check its return value. Whether curses believes its succeeded or not will help you figure out what's gone wrong. curses might not even be trying to resize the terminal if it doesn't believe its resizable.

Another thing to check is the manual page, see 'man resizeterm'. That's where I found that resizeterm and resize_term are different functions -- you should be calling resizeterm -- and where I found the mention of is_term_resized.

You might also find Writing Programs with NCURSES useful.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

curses.h

hi i'd like to know how to draw a rectangle using the curses.h library, you know with all the WINDOW *newwin stuff and all thanx!:) (1 Reply)
Discussion started by: chomano
1 Replies

2. Windows & DOS: Issues & Discussions

window 2000 professional not pinging my window 98 system.

Hello, We someone help me resolve this problem. I have window 2000 professional, windows 98 and Unixware 7.0.1 on the network. I was able to establish connection with all. However, l was unable to ping window 98 from window 2000 professional. I was able to ping the window 2000 from the window... (10 Replies)
Discussion started by: kayode
10 Replies

3. Programming

curses & window resize issues

I am writing a program to display a database to the screen(xterm) and want to allow the window resize signal to increase/decrease the amount data that is displayed. I have a signal handler function for catching the SIGWINCH event and calling a function to reallocate the space for the windows... (0 Replies)
Discussion started by: kwaz
0 Replies

4. Solaris

CDE loging window resize?

I was asked to display a banner on the CDE login window and I have successfully accomplished that task. This is what I did: 1) made the directory /etc/dt/config/C 2) cp /usr/dt/config/C/Xresources /etc/dt/config/C 3) I edited /etc/dt/config/C/Xresources and ensured the following lines were... (0 Replies)
Discussion started by: rtoba
0 Replies

5. UNIX for Advanced & Expert Users

CDE loging window resize?

I was asked to display a banner on the CDE login window and I have successfully accomplished that task. This is what I did: 1) made the directory /etc/dt/config/C 2) cp /usr/dt/config/C/Xresources /etc/dt/config/C 3) I edited /etc/dt/config/C/Xresources and ensured the following lines were... (0 Replies)
Discussion started by: rtoba
0 Replies

6. Programming

curses.h

hi all i get a segmentation fault error in the following program. couldn't understand why it happens. can anyone explain what is really happening. s1.c #include<curses.h> main(){ int c; noecho(); cbreak(); c=getch(); printf("%c",(char)c); } I compiled this program as cc s1.c... (2 Replies)
Discussion started by: bankpro
2 Replies

7. UNIX for Advanced & Expert Users

send characters to current window

Before I re-invent the wheel... I have written an on-screen keyboard & handwriting input client in Java (spare me please, I get paid to write Java and it will take some time to get back up to speed in C & X11). In order to concentrate on the other bits, I took advantage of a hack... (0 Replies)
Discussion started by: bcw
0 Replies

8. UNIX Desktop Questions & Answers

Resize the default window size

Hi, How can I resize the terminal window's default size in CDE (Solaris)? Regards, Sharif. (1 Reply)
Discussion started by: sharif
1 Replies

9. UNIX for Dummies Questions & Answers

Preventing the terminal window to resize

I am running Terminal (xterm) on FreeBSD and XFCE. When opening a new terminal window so that an additional tab appears, the window resizes to become taller and partially hiding behind the task bar. I noticed that Xubuntu has fixed this feature and the window does not resize when opening a second... (0 Replies)
Discussion started by: figaro
0 Replies

10. UNIX for Beginners Questions & Answers

Toggle between xterm window and standard terminal window

Is it possible to toggle back and forth between an xterm invoked from one tty, and a shell invoked from a different tty? I am running Centos 7 with KDE and booting in non-graphic mode. After logging in on the default window (/dev/tty1) , I can then use ALT-F2 to access a new window (/dev/tty2),... (1 Reply)
Discussion started by: rhgscty
1 Replies
resizeterm(3X)															    resizeterm(3X)

NAME
is_term_resized, resize_term, resizeterm - change the curses terminal size SYNOPSIS
#include <curses.h> bool is_term_resized(int lines, int columns); int resize_term(int lines, int columns); int resizeterm(int lines, int columns); DESCRIPTION
This is an extension to the curses library. It provides callers with a hook into the ncurses data to resize windows, primarily for use by programs running in an X Window terminal (e.g., xterm). The function resizeterm resizes the standard and current windows to the specified dimensions, and adjusts other bookkeeping data used by the ncurses library that record the window dimensions. Most of the work is done by the inner function resize_term. The outer function resizeterm adds bookkeeping for the SIGWINCH handler. When resizing the windows, resize_term blank-fills the areas that are extended. The calling application should fill in these areas with appro- priate data. The resize_term function attempts to resize all windows. However, due to the calling convention of pads, it is not possible to resize these without additional interaction with the application. A support function is_term_resized is provided so that applications can check if the resize_term function would modify the window struc- tures. It returns TRUE if the windows would be modified, and FALSE otherwise. RETURN VALUE
Except as notes, these function return the integer ERR upon failure and OK on success. They will fail if either of the dimensions are less than or equal to zero, or if an error occurs while (re)allocating memory for the windows. NOTES
While these functions are intended to be used to support a signal handler (i.e., for SIGWINCH), care should be taken to avoid invoking them in a context where malloc or realloc may have been interrupted, since it uses those functions. If ncurses is configured to supply its own SIGWINCH handler, the resizeterm function ungetch's a KEY_RESIZE which will be read on the next call to getch. This is used to alert an application that the screen size has changed, and that it should repaint special features such as pads that cannot be done automatically. If the environment variables LINES or COLUMNS are set, this overrides the library's use of the window size obtained from the operating sys- tem. Thus, even if a SIGWINCH is received, no screen size change may be recorded. In that case, no KEY_RESIZE is queued for the next call to getch; an ERR will be returned instead. SEE ALSO
wresize(3X). AUTHOR
Thomas Dickey (from an equivalent function written in 1988 for BSD curses). resizeterm(3X)
All times are GMT -4. The time now is 11:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy