Root Window Properties

来源:互联网 发布:淘宝收件人姓名怎么改 编辑:程序博客网 时间:2024/06/05 07:58

http://standards.freedesktop.org/wm-spec/1.3/ar01s03.html

翻译者:openxing@hotmail.com。

1.              RootWindow Properties (and Related Messages)

http://standards.freedesktop.org/wm-spec/1.3/ar01s03.html

 

本章涉及的“给根窗口发送消息”是指:客户端使用指定的内容和下述参数创建ClientMessage发送SendEvent请求给根窗口:

destination     root

propagate       False

event-mask      (SubstructureNotify|SubstructureRedirect)

event           the specified ClientMessage

1.1           _NET_SUPPORTED

_NET_SUPPORTED,ATOM[]/32

窗口管理器必须设置这个属性来指示其支持哪些HINTS。例如,原子_NET_WM_STATE和其支持的状态(状态有_NET_WM_STATE_MODAL,_NET_WM_STATE_STICKY)。

 

1.2           _NET_CLIENT_LIST

_NET_CLIENT_LIST,WINDOW[]/32

_NET_CLIENT_LIST_STACKING,WINDOW[]/32

枚举窗口管理器管理的所有X窗口。_NET_CLIENT_LIST初始化时是从最老的窗口开始的。而_NET_CLIENT_LIST_STACKING则是bottom-to-top的栈序。窗口管理器应该设置并更新这两个原子。

1.3           _NET_NUMBER_OF_DESKTOPS

_NET_NUMBER_OF_DESKTOPS,CARDINAL/32

窗口管理器必须设置并更新该属性。通过该属性,可以获得其支持的虚拟桌面的数目。

Pager(应该是虚拟桌面里的当前桌面)可以给根窗口发送_NET_NUMBER_OF_DESKTOPS消息来修改该虚拟桌面的数目:

_NET_NUMBER_OF_DESKTOPS

  message_type = _NET_NUMBER_OF_DESKTOPS

  format = 32

  data.l[0] = new_number_of_desktops

  other data.l[] elements = 0

窗口管理器可以允许或者拒绝该修改。如果允许了,则_NET_NUMBER_OF_DESKTOPS会被设置为新的虚拟桌面的数目。_NET_VIRTUAL_ROOTS MUST也需要设置。虚拟的根窗口ID_NET_DESKTOP_VIEWPORT_NET_WORKAREA也需要同步修改。_NET_DESKTOP_NAMES则有可能保持不变的。

如果桌面的数目变少了并且_NET_CURRENT_DESKTOP指向的桌面不在可以使用的桌面范围内,那么_NET_CURRENT_DESKTOP需要被设置为可访问桌面中的最后一个。原来桌面上可用的Clients如果不在新的可用桌面范围内,则应该将其转移到新的集合中最后一个桌面。最后,_NET_WM_DESKTOP也需要更新。

 

1.4           _NET_DESKTOP_GEOMETRY

_NET_DESKTOP_GEOMETRYwidth, height, CARDINAL[2]/32

两个cardinals数组定义了所有桌面的大小(如果窗口管理器不支持大桌面,则其大小就是屏幕大小,否则是虚拟桌面的大小)。窗口管理器必须设置该属性。

Pager可以给根窗口发送_NET_DESKTOP_GEOMETRY来修改桌面坐标:

_NET_DESKTOP_GEOMETRY

  message_type = _NET_DESKTOP_GEOMETRY

  format = 32

  data.l[0] = new_width

  data.l[1] = new_height

  other data.l[] elements = 0

 

窗口管理器可以不处理该消息,如果不处理的话_NET_DESKTOP_GEOMETRY属性是不变的。

1.5           _NET_DESKTOP_VIEWPORT

_NET_DESKTOP_VIEWPORTx, y, CARDINAL[][2]/32

pairsof cardinals数组定义了每个桌面的左上角的视角。如果窗口管理器不支持该属性,则左上角通常被设置为(0,0)

Pager可以给根窗口发送_NET_DESKTOP_VIEWPORT来修改该属性:

_NET_DESKTOP_VIEWPORT

  message_type = _NET_DESKTOP_VIEWPORT

  format = 32

  data.l[0] = new_vx

  data.l[1] = new_vy

  other data.l[] elements = 0

窗口管理器可以忽略该属性。

1.6           _NET_CURRENT_DESKTOP

_NET_CURRENT_DESKTOPdesktop, CARDINAL/32

当前桌面的索引。其值通常是0_NET_NUMBER_OF_DESKTOPS– 1。窗口管理器必须设置并更新该值。当一个Pager切换到另一个虚拟的桌面的时候,需要发送_NET_CURRENT_DESKTOP给根窗口:

_NET_CURRENT_DESKTOP

  message_type = _NET_CURRENT_DESKTOP

  format = 32

  data.l[0] = new_index

  data.l[1] = timestamp

  other data.l[] elements = 0

如果客户端使用的是较老版本的协议,则timestamp被设置为0,这个时候窗口管理器会忽略timestamp

1.7           _NET_DESKTOP_NAMES

_NET_DESKTOP_NAMES,UTF8_STRING[]

所有的虚拟桌面的名字,通常是NULL-terminatedUTF-8字符串。Pager和窗口管理器可以随时修改该值。

注意:名字的数目有可能和_NET_NUMBER_OF_DESKTOPS不同。如果小于_NET_NUMBER_OF_DESKTOPS,则数字较大的桌面是未命名的。如果大于_NET_NUMBER_OF_DESKTOPS,则超出_NET_NUMBER_OF_DESKTOPS部分的名字会被保留下来,以备桌面的增加。

其原因是,名字不是虚拟桌面的必须属性。因此名字是否具有名字并不会影响虚拟桌面的功能。用户设置桌面的名字,用户还可能为一组固定的桌面预设名字。当虚拟桌面的数目变化时,修改该名字列表是没有意义的。

 

1.8           _NET_ACTIVE_WINDOW

_NET_ACTIVE_WINDOW,WINDOW/32

当前活动窗口的ID。如果没有任何窗口具有焦点,则是None。这是窗口管理器设置的一个只读属性。如果客户端需要激活另一个窗口,则需要发送_NET_ACTIVE_WINDOW

_NET_ACTIVE_WINDOW

  window = window to activate

  message_type = _NET_ACTIVE_WINDOW

  format = 32

  data.l[0] = source indication

  data.l[1] = timestamp

  data.l[2] = requestor's currently activewindow, 0 if none

  other data.l[] elements = 0

当客户端发送该请求时,Source indication1;如果是Pager发送,则是2;如果客户端使用老版本协议,其值是0Timestamp是客户端客户端发送该请求时的最后一次活动的timestampcurrently active window是客户端的活动顶层窗口(如果有的话)。

窗口管理器可以拒绝该请求。

1.9           _NET_WORKAREA

_NET_WORKAREA,x, y, width, height CARDINAL[][4]/32

当窗口管理器为每个桌面计算桌面区域的时候,必须设置该属性。该属性包括了每个桌面的几何坐标信息。这些坐标信息相对于每个桌面的viewport,并且指明了每个viewport包括的桌面区域。Workarea为桌面程序使用。

 

窗口管理器会计算出该区域的大小。其计算办法是,用当前也页面的大小,减去dock&panel占据的大小。这些大小由客户端的_NET_WM_STRUT or_NET_WM_STRUT_PARTIAL属性指定。

1.10       _NET_SUPPORTING_WM_CHECK

_NET_SUPPORTING_WM_CHECK,WINDOW/32

 

TheWindow Manager MUST set this property on the root window to be the ID of achild window created by himself, to indicate that a compliant window manager isactive. The child window MUST also have the _NET_SUPPORTING_WM_CHECK propertyset to the ID of the child window. The child window MUST also have the _NET_WM_NAMEproperty set to the name of the Window Manager.

 

Rationale:The child window is used to distinguish an active Window Manager from a stale_NET_SUPPORTING_WM_CHECK property that happens to point to another window. Ifthe _NET_SUPPORTING_WM_CHECK window on the client window is missing or notproperly set, clients SHOULD assume that no conforming Window Manager ispresent.

1.11       _NET_VIRTUAL_ROOTS

_NET_VIRTUAL_ROOTS,WINDOW[]/32

 

Toimplement virtual desktops, some Window Managers reparent client windows to achild of the root window. Window Managers using this technique MUST set thisproperty to a list of IDs for windows that are acting as virtual root windows.This property allows background setting programs to work with virtual roots andallows clients to figure out the window manager frame windows of their windows.

 

1.12       _NET_DESKTOP_LAYOUT

_NET_DESKTOP_LAYOUT,orientation, columns, rows, starting_corner CARDINAL[4]/32

 

  #define _NET_WM_ORIENTATION_HORZ 0

  #define _NET_WM_ORIENTATION_VERT 1

 

  #define _NET_WM_TOPLEFT     0

  #define _NET_WM_TOPRIGHT    1

  #define _NET_WM_BOTTOMRIGHT 2

  #define _NET_WM_BOTTOMLEFT  3

 

Thisproperty is set by a Pager, not by the Window Manager. When setting thisproperty, the Pager must own a manager selection (as defined in the ICCCM 2.8).The manager selection is called _NET_DESKTOP_LAYOUT_Sn where n is the screennumber. The purpose of this property is to allow the Window Manager to know thedesktop layout displayed by the Pager.

 

_NET_DESKTOP_LAYOUTdescribes the layout of virtual desktops relative to each other. Morespecifically, it describes the layout used by the owner of the managerselection. The Window Manager may use this layout information or may choose toignore it. The property contains four values: the Pager orientation, the numberof desktops in the X direction, the number in the Y direction, and the startingcorner of the layout, i.e. the corner containing the first desktop.

 

Note:In order to inter-operate with Pagers implementing an earlier draft of thisdocument, Window Managers should accept a _NET_DESKTOP_LAYOUT property oflength 3 and use _NET_WM_TOPLEFT as the starting corner in this case.

 

Thevirtual desktops are arranged in a rectangle with rows rows and columnscolumns. If rows times columns does not match the total number of desktops asspecified by _NET_NUMBER_OF_DESKTOPS, the highest-numbered workspaces areassumed to be nonexistent. Either rows or columns (but not both) may bespecified as 0 in whichcase its actual value will be derived from _NET_NUMBER_OF_DESKTOPS.

 

Whenthe orientation is _NET_WM_ORIENTATION_HORZ the desktops are laid out in rows,with the first desktop in the specified starting corner. So a layout with fourcolumns and three rows starting in the _NET_WM_TOPLEFT corner looks like this:

 

 +--+--+--+--+

 | 0| 1| 2| 3|

 +--+--+--+--+

 | 4| 5| 6| 7|

 +--+--+--+--+

 | 8| 9|10|11|

 +--+--+--+--+

 

Withstarting_corner _NET_WM_BOTTOMRIGHT, it looks like this:

 

 +--+--+--+--+

 |11|10| 9| 8|

 +--+--+--+--+

 | 7| 6| 5| 4|

 +--+--+--+--+

 | 3| 2| 1| 0|

 +--+--+--+--+

 

 

Whenthe orientation is _NET_WM_ORIENTATION_VERT the layout with four columns andthree rows starting in the _NET_WM_TOPLEFT corner looks like:

 

 +--+--+--+--+

 | 0| 3| 6| 9|

 +--+--+--+--+

 | 1| 4| 7|10|

 +--+--+--+--+

 | 2| 5| 8|11|

 +--+--+--+--+

 

Withstarting_corner _NET_WM_TOPRIGHT, it looks like:

 

 +--+--+--+--+

 | 9| 6| 3| 0|

 +--+--+--+--+

 |10| 7| 4| 1|

 +--+--+--+--+

 |11| 8| 5| 2|

 +--+--+--+--+

 

 

Thenumbers here are the desktop numbers, as for _NET_CURRENT_DESKTOP.

 

_NET_SHOWING_DESKTOP

_NET_SHOWING_DESKTOPdesktop, CARDINAL/32

 

SomeWindow Managers have a "showing the desktop" mode in which windowsare hidden, and the desktop background is displayed and focused. If a WindowManager supports the _NET_SHOWING_DESKTOP hint, it MUST set it to a value of 1when the Window Manager is in "showing the desktop" mode, and a valueof zero if the Window Manager is not in this mode.

 

Ifa Pager wants to enter or leave the mode, it MUST send a _NET_SHOWING_DESKTOP clientmessage to the root window requesting the change:

 

_NET_SHOWING_DESKTOP

  message_type = _NET_SHOWING_DESKTOP

  format = 32

  data.l[0] = boolean 0 or 1

  other data.l[] elements = 0

 

The Window Manager may choose to ignore this client message.

原创粉丝点击