Getting screen size from X server

Getting screen size from X server

Post by Chris Penros » Sun, 24 Jan 1999 04:00:00



I have scoured the FAQ and my man pages for the various Xlib functions
and I can't find a way to poll the X server for the total size (not
just a window) of the screen.  How can this be done with Xlib?  Also,
is there an easy way (without coordinate translation) to get the
current mouse coordinates in terms of the screen (again - not in terms
of the current window)?  Thanks for any help.

Christopher

 
 
 

1. Problem in getting screen size when 'rlogin' and 'telnet'

Hi,
        I have a problem in getting screen size using "ioctl" function.

        The following program returns the correct screen size if the term is
by "rlogin" but does return an error if term is by "telnet".

#include<stdio.h>
#include<termios.h>
#include<unistd.h>
extern int errno;
main()
{
   struct winsize ws;

   if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) < 0)
        printf("%d is the errno\n", errno);

   printf("%d is the width\n", ws.ws_col);
   printf("%d is the length\n", ws.ws_row);

The output for the above program from an "rlogin" window is
90 is the width
58 is the length

The output from a "telnet" window is
22 is the errno
0 is the width
0 is the length

Could anybody educate me regarding this?

        Also "stty" behaves differently from "rlogin" window and from a "telnet"
window.
        The command "stty rows 24" works Okay on an "rlogin" terminal
but, on a "telnet" terminal it gives the following error:
        unknown mode: rows

Could anybody help me in this regard? Please send me email.

Thanks

vasant

2. Proxy realaudio requests?

3. Getting screen size programatically

4. Restoring users & passwords after fresh install

5. Screen Size problem on Sony LCD screen

6. threadgroups

7. Virtual screen size and screen resolution

8. Help on adding IDE CD-ROM drive to SCO V5

9. Screen size as reported by X server

10. Need help getting my Millenium card to operate at a depth of 16 or higher and getting my screen to use the whole screen size

11. NS Enterpris server, threads and server size

12. screen: going from split screen to full screen mode