ウィンドウの移動操作

xmove : ターゲットウィンドウ window_id を指定した座標 (x,y) に移動させる。

#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>

int main(int argc, char **argv)
{
    Display *d;
    Window  w;
    int     x, y;

    /* 起動引数処理 */
    if (argc < 4) {
        fprintf(stderr, "usage: xmove window_id x y\n");
        exit(1);
    }
    w = (Window)strtol(argv[1], NULL, 0);
    x = (int)strtol(argv[2], NULL, 0);
    y = (int)strtol(argv[3], NULL, 0);
    printf("window_id = 0x%x\n", w);
    printf("x = %d\n", x);
    printf("y = %d\n", y);

    /* ターゲットウィンドウを移動させる */
    d = XOpenDisplay(NULL);
    XMoveWindow(d, w, x, y);
    XFlush(d);
    XCloseDisplay(d);
    return 0;
}