motifdeveloper.com
Sponsored by IST Limited
Formerly MW3: Motif on the World Wide Web [MW3 Logo]
Last Updated
November 18, 2002
 


X-Designer - The Leading X/Motif GUI Builder - Click to download a FREE evaluation
 

motifdeveloper.com
Home
About the site
Bulletin Board
News Archive
OpenGroup News
Events
Search
Frequently Asked Questions
The Motif FAQ
X/Motif FAQs
General FAQs
Ask Antony
Latest Q & A
All Q & As
Submit Question
Tips & Pointers
Code Examples
Software
OpenMotif
Widget Sets
GUI Toolkits & Libraries
Motif suppliers
Non-commercial S/W
Commercial Software
Multimedia
Miscellaneous
Organizations
Docs & Pubs
X/Motif Newsgroups
Security
Internationalization
Feedback
Feedback Form
Contributors
 

How do I obtain the dimensions of the display on which my application is running?

27-May-02 10:00 GMT

Question: How do I obtain the dimensions of the display on which my application is running?

You can easily obtain this information by making use of the following Xlib macros (defined in X11/Xlib.h):

    DisplayWidth(dpy, scr)
    DisplayHeight(dpy, scr)

where "dpy" is your display (obtained using XtDisplay) and "scr" is the screen number (obtained by using a combination of XtScreen and XScreenNumberOfScreen).

A simple code example is as follows:

#include <X11/Xlib.h>

show_scr_size()
{
    int disp_width, disp_height;

    disp_width = DisplayWidth(XtDisplay(shell1),
		    XScreenNumberOfScreen(XtScreen(shell1)));

    disp_height = DisplayHeight(XtDisplay(shell1),
		    XScreenNumberOfScreen(XtScreen(shell1)));

    printf ("width=%d, height=%d\n", disp_width, disp_height);
}

 



Sponsored by X-Designer - The Leading X/Motif GUI Builder - Click to download a FREE evaluation

 

Goto top of page

 

[IST Limited]
IST Limited is the
proud sponsor of motifdeveloper.com.
 

Thanks to all the contributors to these pages.

Privacy Policy

 
"Motif" is a registered trademark of The Open Group. All other trademarks are the property of their respective owners.

Some articles/papers here have their own copyright notice. All other information is copyright ©1999-2008 IST Limited

[CommerceOne] MW3 site originally by Ken Sall of Commerce One (formerly Century Computing).