02-23-2009
You can exercise those ioctl's from the command line with the stty command. "stty -a" will display the current values. Then something like "stty rows 50 cols 132" will set new values. You can confirm that the new value were set by doing another "stty -a".
And that is all it does. It stores that values in a place where any process that needs them can access them. Typically a program like vi will read them once at start up. Then if vi gets a SIGWINCH, it would reread them.
The values are typically set by another program like xterm that is managing a text window. If the user asks xterm to change the window size, xterm will do that, set those values, and send the SIGWINCH.
You are trying to reverse the process. Depending on what program is actually controlling that window, there may be some support for that. xterm has escape sequences that can be sent to it for various things like that. Most people are familiar with the escape sequence to change the window title. Some versions of xterm do indeed have an escape sequence to requesta different window size. If xterm grants the request, you process would recieve the SIGWINCH and should then read the new values. But be aware that the user can override this request. And even if it works, the user may simply resize the window back the way he wants it.
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi all.
I need to be able to get image (gif/jpg) height and
widths from the server so I can size pop-up windows to fit the
images. Is there a built in utility that accomplishes this on Unix
or Linux? (1 Reply)
Discussion started by: Jabba
1 Replies
2. Solaris
Is it possible to change the title of a Terminal window on Solaris? For example, for a MS Windows command window, one can simply type "title NameofWindow" to change the title for a command window.
I was looking for similar functionality for terminal windows.
Thanks. (8 Replies)
Discussion started by: here2learn
8 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I hope I'm posting in the correct forum, so here goes. I would like for the mouse right/left click to work in Terminal (OSX) as it does in Putty.
For instance, when I double click 'log' in file.log.gz, only the log part is highlighted (in Terminal), while in Putty the entire file name is... (0 Replies)
Discussion started by: TheChemist
0 Replies
4. Solaris
Hi all,
I was wondering how to change the PS1 to my liking?
I tried changing it using PS1='my choice'
it worked but the subsequent terminals i open will not have it as the default PS1 ,how do i change it?
also i am running as super user, and i need to exec bash, to get the bash environment...... (4 Replies)
Discussion started by: wrapster
4 Replies
5. Programming
I want to get the screen width and cursor positions.
When I used curses, all the screen content was cleared.
So Can I use curses to get the screen size without clearing anything in the window?
Or is there any other alternative???
I can use only C or C++. (0 Replies)
Discussion started by: Sreejesh.S
0 Replies
6. OS X (Apple)
Hello,
I was wondering how to change a user's Long Name through the terminal. I am writing a shell script to change some settings back to the default, and could not find how to do this (or even if you can do this).
I do not want to use applescript. (2 Replies)
Discussion started by: The Reepr
2 Replies
7. Shell Programming and Scripting
Hi all,
I have a shell script which uses "mailx -H" to get the subject of a email in a Linux system.
However, the subject is truncated, and I think it has something to do with the terminal width because it only returns the first 80 characters of each line.
I have tried "stty columns"... (7 Replies)
Discussion started by: mezzo
7 Replies
8. Shell Programming and Scripting
i already have a running and working script for remote connection. is there a way to change the terminal color everytime I ssh remotely to another server? this is to avoid confusion since I will be using only one server to remotely access around 50 servers (solaris, linux,. etc) (2 Replies)
Discussion started by: lhareigh890
2 Replies
9. Programming
I was reading Advanced Programming in the Unix Environment and it says to use ioctl() to get the terminal's width and height. I wrote this program:
// print width and height
#include <stdio.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <termios.h>
int main( int argc, char... (3 Replies)
Discussion started by: Ultrix
3 Replies
10. IP Networking
Hi, guys, I was using an online utility to check wheather or not an email existed, and they gave me three tries. I thought clearing temp and cookies would work, but it looks like they grabbed a hold of my IP. :mad: Now, I'd like to make a shell script that changes my IP. Not bad...yet. I'm using... (7 Replies)
Discussion started by: Ihatewindows
7 Replies
LEARN ABOUT OSX
get_desktop_resolution
get_desktop_resolution(3alleg4) Allegro manual get_desktop_resolution(3alleg4)
NAME
get_desktop_resolution - Finds out the desktop resolution. Allegro game programming library.
SYNOPSIS
#include <allegro.h>
int get_desktop_resolution(int *width, int *height);
DESCRIPTION
Finds out the currently selected desktop resolution. You can use this information to avoid creating windows bigger than the current resolu-
tion. This is especially important for some windowed drivers which are unable to create windows bigger than the desktop. Each parameter is
a pointer to an integer where one dimension of the screen will be stored.
Under some OSes, switching to a full screen graphics mode may automatically change the desktop resolution. You have, therefore, to call
this function before setting any graphics mode in order to retrieve the real desktop resolution. Example:
int width, height;
allegro_init();
...
if (get_desktop_resolution(&width, &height) == 0) {
/* Got the resolution correctly */
}
RETURN VALUE
Returns zero on success, or a negative number if this information is not available or does not apply, in which case the values stored in
the variables you provided for `width' and `height' are undefined.
SEE ALSO
desktop_color_depth(3alleg4), set_gfx_mode(3alleg4)
Allegro version 4.4.2 get_desktop_resolution(3alleg4)