The simplest way to create a window (in terms of understanding what is happening) is to use the
xmake
command and specify the properties that you want the window to have. There are other, more
convenient, ways to create windows but they are easier to explain after describing the xmake
command.
xmake name options
creates a window with the name name. Case matters in window names so mywindow
, MYWINDOW
and
MyWindow
are all different.
The following options, which can be abbreviated, are recognized:
-background colour
The default is Black
.
-bg colours
-background
.
-borderwidth
If the window appears to be incorrectly position when a geometry specification of -geometry
-0-0
is used then changing the border width may correct the problem.
-colours number
On a server with a writable colour table, the requested number of colour table entries are reserved for the exclusive use of the window; if there are insufficient free entries in the default colour map, a private colour map is created and the entries allocated from that. On a server with a fixed colour table, entries can be shared between windows and any number up to the maximum supported by the server can be requested.
Examples:
The default depends on the properties of the X server.
-fg colours
-foreground
.
-foreground colour
The default is White
.
-geometry specification
widthxheight+/-xorigin+/-yorigin
(x
is the letter “x” and +/-
is either a plus sign or a minus sign.) All dimensions are in pixels and
the origin is the position of the top left hand corner of the window relative to the top
left hand corner of the screen if the origin specification is a positive number, or the
position of the bottom right corner of the window relative to the bottom right of the
screen if it is negative. All the components of the geometry specification are optional.
Examples:
To position the window in the bottom right corner of the screen:
To position the window in the top right corner:
The default is 780x512
(this leaves it up to the window manager to decide where to place the
window).
The geometry specification is only a hint to the window manager and may be ignored.
-iconic
-interactive
This option is ignored if -iconic
is specified.
-nointeractive
-interactive
. This is the default.
-nooverlay
-ovcolour colour
-overlay
-title title
The default title is “GWM Window - window name”
There are defaults for all these options but they are not necessarily appropriate. You can provide your own defaults by putting them in your “X defaults” file (˜/.Xdefaults) and to have different defaults for different window names. If you edit your X defaults file, the changes won’t have any effect until they have been loaded into the resource database in your X server. This is normally done by the window manager when you first log in to the server but can be done explicitly with the command:
Rather than attempting to explain in detail what is a powerful but quite complicated system here is an example that shows how to control the properties of GWM windows. Suppose your X defaults file contains the following:
then a window created with the name “mono” will have 2 colours allocated to it and windows with any other names will have 128 colours allocated.
When a graphics package creates a window for you this is the only mechanism available for specifying the properties of the window. For example, GKS will create a window if it doesn’t already exist and each of the four available workstation types of X windows can be assigned different properties as follows:
This defines workstation type 3800 as being a small window with only two colours, suitable for black and white line plots, 3801 is a bit bigger and has 8 colours suitable for colour line plots, 3802 is the same size but with more colours for image display applications and 3803 is the same but the window size is set interactively.
A complete list of the resources used and their default values are shown in Table 1.