2.4 display

The display resource is used for the allocation of a window to the screen stated in the resource definition or set by the .screen attribute of the display resource. It is meant to be used in multiscreen environments (Motif only). The .screen attribute can be changed dynamically in Rule Language to move a window to another screen. The actually selected screen can be queried via the .real_screen attribute.

Definition

{ export | reexport } display <Identifier> { screen(<number>) } ;

attributes

Attribut

RSD

PSD

Eigenschaft

Kurzbeschreibung

.screen

integer

integer

S,G/-/-

screen number

.real_screen

integer

integer

-,G/-/-

actual screen number

In cases of invalid screen numbers the window is displayed on the default screen (usually, but not necessarily, 0). Valid screen numbers are greater than or equal to 0. This means that e.g. when stating -1, the default screen is used.

Particularities

The .screen attribute can also be implemented dynamically by rule language.

Availability

Multiscreen support is only available with IDM for Motif. Valid screen numbers can be determined with the program xdpyinfo and the .screen[integer] attribute of the setup object.

See also

Chapter “Multiscreen support under Motif” in manual “Programming Techniques”

2.4.1 Example

The dialog shows how two windows can be placed on different screens and how e.g. a single-screen configuration can be handled.

dialog MultiScreen

display DpyDef screen(-1);
display DpyPrim screen(0);
display DpySec screen(1);

default window WINDOW
{
  .width 200;
  .height 100;
 
  on close { exit(); }
}

// primary window on screen#0
// (not necessarily the default screen!)
window WiPrim
{
  .display DpyPrim;
  .title "Primary Window";
 
  statictext StDefScreen { }
}

// secondary window on screen#1
window WiSec
{
  .display DpySec;
  .title "Secondary Window";
 
  listbox LbScreens
  {
    .xauto 0;
    .yauto 0;
 
    // move secondary window to another screen dynamically
    on select
    {
      this.window.display.screen := this.userdata[thisevent.index];
    }
  }
}

on dialog start
{
  variable integer I;
  StDefScreen.text := "Default Screen: " + setup.screen;

  // position second window below primary
  // when running in single-screen configuration
  if (setup.screencount = 1) then
    WiSec.ytop := WiPrim.ytop + WiPrim.real_width + 50;
  endif

  // list available screens
  for I:=1 to setup.screencount do
    LbScreens.content[I] := "Screen#" + setup.screen[I] + "  " +
      setup.screen_width[I] + "x" + setup.screen_height[I];
    LbScreens.userdata[I] := setup.screen[I];
  endfor

  LbScreens.activeitem := LbScreens:find(.userdata, DpySec.real_screen);
}