<<<<<<<<<<<<<<<<

xscreen(x) Xlib xscreen(x)

NAME

xscreen - an X screen

DESCRIPTION

The xscreen class provides an interface to X screens. When you have an X display, you can have one or more screens.

The connection to the display server is established via an xdis

play class. It opens the display based on a string of the form: hostname:display_server.default_screen (This string is either passed to your xdisplay or specified in your DISPLAY environment variable.) All windows and other X objects will appear on the default screen unless you specify otherwise.

Keep in mind that many of the X objects are only valid on the

screens that they were created for. For example, if you create a window for use on screen 0, you can not later display it on screen 1.

To display X objects on a specific screen, you can use an

xscreen instance. All of the X objects that understand the screen= message are sensitive to an associated screen. If an X object`s screen instance variable is not set, the default screen is used. However, if you set an X object's screen instance variable to the name of an xscreen object, it will be associated with that screen. Note that you often must do this before the object is created.

SUPERCLASS

object

INSTANCE VARIABLES

display is the name of the associated xdisplay object. Note that the xdisplay might specify a default screen which is different from the screen associated with the xscreen instance.

id is a pointer to the X Screen structure. This is usually set by the system when the screen is created using one of the messages described below.

screen number is the number of the screen for the display. Displays can have more than one screen so they number the screens that they have, starting with screen 0.

MESSAGES

black_pixel? returns the black pixel from the default colormap for the screen.

default_colormap? returns a pointer to the default colormap for the screen.

default_depth? returns the default depth of the screen.

display= display_object_name sets the display instance variable.

display? returns the value of the display instance variable on the argument stack.

does_backing_store? returns whether of not the screen does backing store, where the screen can maintain the contents of windows that are not viewable, not visible or partially obscured. Possible values include: WhenMapped (1), NotUseful (0) and Always (2).

does_save_unders? returns whether of not the screen does save unders, where the screen can maintains the contents of windows when they are obscured by popups. Possible values include: True (1) and False (0).

free! frees the xscreen object.

height? returns the height of the window in pixels.

height_mm? returns the height of the window in millimeters

id= screen_pointer sets the id instance variable to the pointer argument, which is an actual X Screen pointer. The screen_number will be updated as well.

id? returns the pointer to the X structure for the screen.

maximum_number_colormaps? returns the maximum number of installed (hardware) colormaps for the screen.

minimum_number_colormaps? returns the minimum number of installed (hardware) colormaps for the screen.

number_cells? returns the number of colormap cells in the default colormap.

number_planes? returns the number of planes in the default colormap.

root_window? returns the id of the root window for the screen.

screen_number= number sets the screen_number instance variable. This number can then be used to retrieve the id of a particular screen.

screen_number? returns the screen_number instance variable. If the id of the screen was set using the

screen_number_from_id? retrieves the screen number based on the current id.

screen_number_from_id! sets the screen_number based on the current id. Not typically used by script writers since the screen_number is updated when the id is updated.

set_id_to_default! sets the id to the default screen of the display. The screen_number will be updated as well.

set_id_using_screen_number! sets the id instance variable using the display, specified by the display instance variable, and the screen number specified by the screen_number instance variable.

white_pixel? returns the white pixel from the default colormap for the screen.

width? returns the width of the window in pixels.

width_mm? returns the width of the window in millimeters.

EXAMPLE

/* Script name: scripts/motif/multi_screens.scr */ /* */ /* This script llustrates how to write a Motif application on a */ /* multiple screen display using the xscreen class and the */ /* motif_top_level_shell class. */ /* The basic idea is to have top_level_shells (that are popups */ /* of motif) that serve as top_level_widgets for the widget */ /* hierarchies on each screen. The screen for each top_level_shell */

/* is retrieved using an xscreen and set using the Screen resource. */

/* Note: You must run this script on a display with two screens!!!! */

<motifinit

/* * open the connection to the default display and tell * motif about it so that motif will share the display connection * with the X classes. */

xdisplay open!;

motif display= xdisplay application="Multiple screens example";

/* * Make sure that the display we are running on has two screens. * If it doesn't have two screens, bail out.... */

scalar new: screen_count = [xdisplay screen_count?]; logic new! greater: ([xdisplay screen_count?], 1) false: `! exiting multi_screens.scr because your display does not have multiple screens.' false: `parser exit!;' ;

/* * Set up main form and its actions */

motif_form new: mainform parent=motif create! ;

motif_push_button new: formButton1 parent=mainform @ "labelString" : "Push to Pop up a Form on screen 0" activate_action=popup_form1 create! ;

motif_push_button new: formButton2 parent=mainform @ "labelString" : "Push to Pop up a Form on screen 1" @ `topAttachment' : XmATTACH_WIDGET @ `topWidget' : [formButton1 id?] activate_action=popup_form2 create!

;

motif_push_button new: exit_button parent=mainform @ "labelString" : "Exit Application" @ `topAttachment' : XmATTACH_WIDGET @ `topWidget' : [formButton2 id?] activate_action=exit create! ;

actions new: popup_form1 tick_actions+ "formshell1 on!;" tick_actions+ " formButton1 @ `labelString' : `Push to remove form on screen 0' activate_action=popdown_form1; " ;

actions new: popdown_form1 tick_actions+ "formshell off!;" tick_actions+ " formButton1 @ `labelString' : `Push to Pop up a FormDialog on screen 0' activate_action=popup_form1; " ;

actions new: popup_form2 tick_actions+ "formshell2 on!;" tick_actions+ " formButton2 @ `labelString' : `Push to remove form on screen 1' activate_action=popdown_form2; " ; actions new: popdown_form2 tick_actions+ "formshell1 off!;" tick_actions+ " formButton2 @ `labelString' : `Push to Pop up a FormDialog on screen 0' activate_action=popup_form2; " ;

actions new: exit tick_actions= `parser exit!' ;

/*********************** code for popup on screen 0 *******************/

xscreen new: screen1 screen_number= 0 set_id_using_screen_number! ;

motif_top_level_shell new: formshell1

parent=motif @ `title' : `Sample Form' @ `screen' : [screen1 id?] @ `depth' : [screen1 default_depth?] @ `colormap' : [screen1 default_colormap?] create! ;

motif_form new: aForm1 parent=formshell1 @ "width" : 200 @ "height" : 200 create! ;

motif_push_button new: abutton1 parent=aForm1 @ "height" : 100 @ "labelString" : "Hello! This is on screen 0" create! ;

/*********************** code for popup on screen 1 *******************/

xscreen new: screen2 screen_number= 1 set_id_using_screen_number! ;

motif_top_level_shell new: formshell2 parent=motif @ `title' : `Sample Form' @ `screen' : [screen2 id?] @ `depth' : [screen2 default_depth?] @ `colormap' : [screen2 default_colormap?] create! ;

motif_form new: aForm2 parent=formshell2 @ "width" : 200 @ "height" : 200 create! ;

motif_push_button new: abutton2 parent=aForm2 @ "height" : 100 @ "labelString" : "Hello! This is on screen 1" create! ;

/*************************** start 'er up! ****************************/

motif on! start!;

SEE ALSO

xdisplay, motif_screen


Last Updated On: Fri Mar 10 15:38:48 1995

Please send comments and suggestions to

its-documentation@rpi.edu

Keyword Search of RPInfo Consulting Pages and NewsCache