Implementation notes

Prev |  | Next

# 7. Implementation notes

## 7.1. Desktop/workspace model

This spec assumes a desktop model that consists of one or more completely independent desktops which may or may not be larger than the screen area. When a desktop is larger than the screen it is left to the window manager if it will implement scrolling or paging.

## 7.2. File Manager desktop

This spec suggests implementing the file manager desktop by mapping a desktop-sized window (no shape) to all desktops, with _NET_WM_WINDOW_TYPE_DESKTOP. This makes the desktop focusable and greatly simplifies implementation of the file manager. It is also faster than managing lots of small shaped windows. The file manager draws the background on this window. There should be a root property with a window handle for use in applications that want to draw the background (xearth).

## 7.3. Implementing enhanced support for application transient windows

If the WM_TRANSIENT_FOR property is set to None or Root window, the window should be treated as a transient for all other windows in the same group. It has been noted that this is a slight ICCCM violation, but as this behaviour is pretty standard for many toolkits and window managers, and is extremely unlikely to break anything, it seems reasonable to document it as standard.

## 7.4. Urgency

Dialog boxes should indicate their urgency level (information or warning) using the urgency bit in the WM_HINTS.flags property, as defined in the ICCCM.

## 7.5. Fixed size windows

Windows can indicate that they are non-resizable by setting minheight = maxheight and minwidth = maxwidth in the ICCCM WM_NORMAL_HINTS property. The Window Manager MAY decorate such windows differently.

## 7.6. Pagers and Taskbars

This specification attempts to make reasonable provisions for WM independent pagers and taskbars. Window Managers that require / desire additional functionality beyond what can be achieved using the mechanisms set out in this specification may choose to implement their own pagers, which communicates with the Window Manager using further, WM-specific hints, or some other means.

Pagers should decide whether to show a miniature version of a window using the following guidelines:

- If either _NET_WM_STATE_SKIP_PAGER or _NET_WM_STATE_HIDDEN are set on a window, then the pager should not show that window.

- The pager may choose not to display windows with certain semantic types; this spec has no recommendations, but common practice is to avoid displaying _NET_WM_WINDOW_TYPE_DOCK for example.

- If the _NET_WM_STATE_SKIP_PAGER and _NET_WM_STATE_HIDDEN hints are not present, and the window manager claims to support _NET_WM_STATE_HIDDEN, then the window should be shown if it's in either NormalState or IconicState.

- For window managers that do not support _NET_WM_STATE_HIDDEN, the pager should not show windows in IconicState. These window managers are probably using an older version of this specification.

## 7.7. Window Movement

Window manager implementors should refer to the ICCCM for definitive specifications of how to handle MapRequest and ConfigureRequest events. However, since these aspects of the ICCCM are easily misread, this document offers the following clarifications:

- Window managers MUST honour the win_gravity field of WM_NORMAL_HINTS for both MapRequest _and_ ConfigureRequest events [1]

- Applications are free to change their win_gravity setting at any time

  If application changes its gravity then Window manager should adjust the reference point, so that client window will not move as the result. For example if client's gravity was NorthWestGravity and reference point was at the top-left corner of the frame window, then after change of gravity to the SouthEast reference point should be adjusted to point to the lower-right corner of the frame.

- When generating synthetic ConfigureNotify events, the position given MUST be the top-left corner of the client window in relation to the origin of the root window (i.e., ignoring win_gravity) [2]

- XMoveWindow(w,x,y) behaviour depends on the window gravity. Upon receiving a request from client application the Window Manager calculates a new reference point, based on the client window's own size, border width and gravity. For given client window dimentions (width, height) and border width (bw), the reference point will be placed at:

  Gravity: | ref_x: | ref_y:
  StaticGravity | x | y
  NorthWestGravity | x-bw | y-bw
  NorthGravity | x+(width/2) | y-bw
  NorthEastGravity | x+width+bw | y-bw
  EastGravity | x+width+bw | y+(height/2)
  SouthEastGravity | x+width+bw | y+height+bw
  SouthGravity | x+(width/2) | y+height+bw
  SouthWestGravity | x-bw | y+height+bw
  WestGravity | x-bw | y+(height/2)
  CenterGravity | x+(width/2) | y+(height/2)

  The Window manager will use the reference point as calculated above, until next XMoveWindow request. The Window Manager will place frame decorations in the following position, based on the window gravity :

  StaticGravity:

  window's left top corner will be placed at (ref_x,ref_y)

  NorthWestGravity:

  window frame's left top corner will be placed at (ref_x,ref_y)

  NorthGravity:

  window frame's top side's center will be placed at (ref_x,ref_y)

  NorthEastGravity:

  window frame's right top corner will be placed at (ref_x,ref_y)

  EastGravity:

  window frame's right side's center will be placed at (ref_x,ref_y)

  SouthWestGravity:

  window frame's left bottom corner will be placed at (ref_x,ref_y)

  SouthGravity:

  window frame's bottom side's center will be placed at (ref_x,ref_y)

  SouthEastGravity:

  window frame's right bottom corner will be placed at (ref_x,ref_y)

  WestGravity:

  window frame's left side's center will be placed at (ref_x,ref_y)

  CenterGravity:

  window frame's center will be placed at (ref_x,ref_y)

- Implementation Note for Application developers:

  When client window is resized - its reference point does not move. So for example if window has SouthEastGravity and it is resized - the bottom-right corner of its frame will not move but instead top-left corner will be adjusted by the difference in size.

- Implementation Note for WM developers :

  when calculating reference point at the time of initial placement - initial window's width should be taken into consideration, as if it was the frame for this window.

[1] ICCCM Version 2.0, §4.1.2.3 and §4.1.5

[2] ICCCM Version 2.0, §4.2.3

## 7.8. Window-in-Window MDI

The authors of this specification acknowledge that there is no standard method to allow the Window Manager to manage windows that are part of a Window-in-Window MDI application. Application authors are advised to use some other form of MDI, or to propose a mechanism to be included in a future revision of this specification.

## 7.9. Killing Hung Processes

If processes fail to respond to the _NET_WM_PING protocol _NET_WM_PID may be used in combination with the ICCCM specified WM_CLIENT_MACHINE to attempt to kill a process.

WM_CLIENT_MACHINE must be set to the fully-qualified domain name of the client's host. This would normally be retrieved using gethostname(2). When gethostname() is not available on the client's platform implementors may use the value of the nodename field of struct utsname as returned by uname(2). An example of how to retrieve a value for WM_CLIENT_MACHINE:

    int net_get_hostname (char *buf, size_t maxlen)
    {
    #ifdef HAVE_GETHOSTNAME
    	if (buf == NULL) return 0;

    	gethostname (buf, maxlen);
    	buf [maxlen - 1] = '\0';

    	return strlen(buf);
    #else
    	struct utsname name;
    	size_t len;

    	if (buf == NULL) return 0;

    	uname (&name);
    	len = strlen (name.nodename);

    	if (len >= maxlen) len = maxlen - 1;
    	strncpy (buf, name.nodename, len);
    	buf[len] = '\0';

    	return len;
    #endif
    }

Prev | Home | Next
Window Manager Protocols |  | References