3.7 Configuring Windows

Xlib provides functions that you can use to move a window, resize a window, move and resize a window, or change a window's border width. To change one of these parameters, set the appropriate member of the XWindowChanges structure and OR in the corresponding value mask in subsequent calls to XConfigureWindow(). The symbols for the value mask bits and the XWindowChanges structure are:
Xlibはウィンドウを移動したり、リサイズしたり、ウィンドウの境界線の 幅を変更したりするのに使う関数を与える。 これらのパラメータの変更のために、 XWindowChanges 構造体の適切なメンバーをセットし、それに続く XConfigureWindow() への呼び出しにおいて有効なマスク値との論理和を取る。 ビットマスクに対するシンボルと XWindowChanges 構造体は以下のようになる。


/* Configure window value mask bits */

#define CWX		(1<<0)
#define CWY		(1<<1)
#define CWWidth		(1<<2)
#define CWHeight	(1<<3)
#define CWBorderWidth	(1<<4)
#define CWSibling	(1<<5)
#define CWStackMode	(1<<6)

/* Values */

typedef struct {
	int x, y;
	int width, height;
	int border_width;
	Window sibling;
	int stack_mode;
} XWindowChanges;
The x and y members are used to set the window's x and y coordinates, which are relative to the parent's origin and indicate the position of the upper-left outer corner of the window. The width and height members are used to set the inside size of the window, not including the border, and must be nonzero, or a BadValue error results. Attempts to configure a root window have no effect.
x, y メンバーはウィンドウの x と y の座標をセットするのに使われる。 その座標は親ウィンドウの原点からの座標であり、 ウィンドウの左上隅の位置を示す。 width, height メンバーはウィンドウの内側のサイズをセットするのに使われる。 そのサイズは境界線を含まず、 ゼロでない値でなければならず、 そうでなければ、エラー BadValue を引き起こす。 ルートウィンドウを設定しようとしても何も起こらない。

The border_width member is used to set the width of the border in pixels. Note that setting just the border width leaves the outer-left corner of the window in a fixed position but moves the absolute position of the window's origin. If you attempt to set the border-width attribute of an InputOnly window nonzero, a BadMatch error results.
boder_width メンバーはピクセル値での境界線の幅をセットするのに使われる。 境界線の幅をセットするのはウィンドウの左上隅をそのままの位置にしておくが ウィンドウの原点の絶対位置が移動する事に注意する。 InputOnly ウィンドウのboder-width属性をセットする時は ゼロでない値でなければならず、 そうでないなら、エラー BadMatch を引き起こす。

The sibling member is used to set the sibling window for stacking operations. The stack_mode member is used to set how the window is to be restacked and can be set to Above, Below, TopIf, BottomIf, or Opposite.
sibling メンバーはスタックを操作するための兄弟ウィンドウをセットするために使われる。 stack_mode メンバーはどのようにウィンドウが再びスタックされるかをセットするために使われる。 そしてそれは Above, Below, TopIf, BottomIf, Opposite のいずれかをセットする。

If the override-redirect flag of the window is False and if some other client has selected SubstructureRedirectMask on the parent, the X server generates a ConfigureRequest event, and no further processing is performed. Otherwise, if some other client has selected ResizeRedirectMask on the window and the inside width or height of the window is being changed, a ResizeRequest event is generated, and the current inside width and height are used instead. Note that the override-redirect flag of the window has no effect on ResizeRedirectMask and that SubstructureRedirectMask on the parent has precedence over ResizeRedirectMask on the window.
ウィンドウの override-redirect フラグが False で他のクライアントの親ウィンドウにおいて SubstructureRedirectMask が選択されているなら、 Xサーバは ConfigureRequest を生成する。 しかしそれ以上の処理は行わない。 そうでなければ、 クライアントのウィンドウにおいて、 ResizeRedirectMask が選択されているなら、 ウィンドウの内側の幅や高さが変化させられる。 ResizeRequest イベントが生成され、現在の内側の幅や高さが変わりに使われる。 ウィンドウの override-redirect フラグは ResizeRedirectMask では何もしない事、 そして親ウィンドウにおける SubstructureRedirectMask がウィンドウにおける ResizeRedirectMask に渡って優先権を持つ事に注意する。

When the geometry of the window is changed as specified, the window is restacked among siblings, and a ConfigureNotify event is generated if the state of the window actually changes. GravityNotify events are generated after ConfigureNotify events. If the inside width or height of the window has actually changed, children of the window are affected as specified.
ウィンドウの位置が指定されたように変更された時、 ウィンドウは兄弟間で再びスタックされる。そしてウィンドウの 状態が実際に変更されると ConfigureNotify イベントが生成される。 GravityNotify イベントは ConfigureNotify イベントの後に生成される。 ウィンドウの内側の幅や高さが実際に変更されると、 そのウィンドウの子ウィンドウは指定されたように変更される。

If a window's size actually changes, the window's subwindows move according to their window gravity. Depending on the window's bit gravity, the contents of the window also may be moved (see "Gravity Attributes").
ウィンドウのサイズが実際に変更されると、 そのウィンドウのサブウィンドウはウィンドウの重みにそって移動する。 ウィンドウのビット重みに依存して、 ウィンドウの内容もまた移動される( "Gravity Attributes" を参照)

If regions of the window were obscured but now are not, exposure processing is performed on these formerly obscured windows, including the window itself and its inferiors. As a result of increasing the width or height, exposure processing is also performed on any new regions of the window and any regions where window contents are lost.
ウィンドウの領域が隠されていたが、今隠される事がなくなったとすると、 描画処理がこれらの前に隠されていたウィンドウ(ウィンドウ自体やその ウィンドウの祖先のウィンドウを含む)で行われる。 幅や高さを増加させる結果として、 描画処理がウィンドウの全ての新しい領域で行われる。 そしてウィンドウのコンテキストの全ての領域が失われる。

The restack check (specifically, the computation for BottomIf, TopIf, and Opposite) is performed with respect to the window's final size and position (as controlled by the other arguments of the request), not its initial position. If a sibling is specified without a stack_mode, a BadMatch error results.
スタックのチェック(特に BottomIf, TopIf, Opposite に対する評価) が(リクエストの他の配置により制御されるように)、 ウィンドウの初期の位置ではなく、 ウィンドウの最後のサイズと位置に対して行われる。 兄弟ウィンドウがstack_modeに指定されていないとエラー BadMatch を引き起こす。

If a sibling and a stack_mode are specified, the window is restacked as follows:
兄弟ウィンドウとstack_modeが指定されると、 ウィンドウは次のようにスタックされる。

Above The window is placed just above the sibling.
ウィンドウは兄弟ウィンドウのちょうど上に置かれる。
Below The window is placed just below the sibling.
ウィンドウは兄弟ウィンドウのちょうど下に置かれる。
TopIf If the sibling occludes the window, the window is placed at the top of the stack.
兄弟ウィンドウがウィンドウに塞がれると、 ウィンドウはスタックの頂上に置かれる。
BottomIf If the window occludes the sibling, the window is placed at the bottom of the stack.
ウィンドウが兄弟ウィンドウに塞がれると、 ウィンドウはスタックの底に置かれる。
Opposite If the sibling occludes the window, the window is placed at the top of the stack. If the window occludes the sibling, the window is placed at the bottom of the stack.
兄弟ウィンドウがウィンドウに塞がれると、 ウィンドウはスタックの頂上に置かれる。 ウィンドウが兄弟ウィンドウに塞がれると、 ウィンドウはスタックの底に置かれる。

If a stack_mode is specified but no sibling is specified, the window is restacked as follows:
stack_modeが指定されていて、 兄弟ウィンドウが指定されていない時、 ウィンドウは次のようにスタックされる。

Above The window is placed at the top of the stack.
ウィンドウはスタックの頂上に置かれる。
Below The window is placed at the bottom of the stack.
ウィンドウはスタックの底に置かれる。
TopIf If any sibling occludes the window, the window is placed at the top of the stack.
全ての兄弟ウィンドウがウィンドウに塞がれると、 ウィンドウはスタックの頂上に置かれる。
BottomIf If the window occludes any sibling, the window is placed at the bottom of the stack.
ウィンドウが全ての兄弟ウィンドウに塞がれると、 ウィンドウはスタックの底に置かれる。
Opposite If any sibling occludes the window, the window is placed at the top of the stack. If the window occludes any sibling, the window is placed at the bottom of the stack.
全ての兄弟ウィンドウがウィンドウに塞がれると、 ウィンドウはスタックの頂上に置かれる。 ウィンドウが全ての兄弟ウィンドウに塞がれると、 ウィンドウはスタックの底に置かれる。

Attempts to configure a root window have no effect.
Attempts to configure a root window have no effect. ルートウィンドウを設定しようとしても、何も起こらない。

To configure a window's size, location, stacking, or border, use XConfigureWindow().
To configure a window's size, location, stacking, or border, use ウィンドウのサイズ、位置、スタック、境界線を設定するには、 XConfigureWindow() を使う。

To move a window without changing its size, use XMoveWindow().
サイズを変える事なしにウィンドウを移動するには、 XMoveWindow() を使う。

To change a window's size without changing the upper-left coordinate, use XResizeWindow().
ウィンドウの左上隅の座標を変える事なしにウィンドウのサイズを変えるには、 XResizeWindow() を使う。

To change the size and location of a window, use XMoveResizeWindow().
ウィンドウのサイズと位置を変えるためには、 XMoveResizeWindow() を使う。

To change the border width of a given window, use XSetWindowBorderWidth().
与えられたウィンドウの幅の太さを変えるには、 XSetWindowBorderWidth() を使う。

Next: Changing Window Stacking Order

Christophe Tronche, ch.tronche@computer.org