Resize a window to exceed the resolution boundary under X

时间:2015-09-01 22:11:25

标签: linux window xlib

I know users can move a window around and make it partially outside of the resolution boundary under X window system. Is it possible to change the size to achieve the same result either programmatically or manually?

enter image description here

Here is my experimental code, but it doesn't work.

        Window w;
        int revert_to;
        XGetInputFocus(m_display, &w, &revert_to);
        if (w == None) {
            printf("can't get focused window");
        }
        else {
            Window top = get_top_window(m_display, w);
            XWindowAttributes xwa;
            XGetWindowAttributes(m_display, top, &xwa);
            XClassHint xch;
            XGetClassHint(m_display, top, &xch);
            printf("focused window name: %s pos: %d, %d size: %d, %d", xch.res_class, xwa.x, xwa.y, xwa.width, xwa.height);
            XResizeWindow(m_display, top, 900, 1900);
        }

get_top_window is some codes from internet

Window get_top_window(Display* d, Window start) {
Window w = start;
Window parent = start;
Window root = None;
Window *children;
unsigned int nchildren;
Status s;

printf("getting top window ... \n");
while (parent != root) {
    w = parent;
    s = XQueryTree(d, w, &root, &parent, &children, &nchildren); // see man

    if (s)
        XFree(children);

    if(xerror) {
        printf("fail\n");
        exit(1);
    }

    printf("  get parent (window: %d)\n", (int)w);
}

printf("success (window: %d)\n", (int)w);

return w;

}

Take terminal as an example, this code could change the inner window but the outline window with titlebar is not affected. is this because the outline window is generated by window manager? And how could I resize it as one unit?

Apart from that, I also can't resize the window out of the resolution boundary. Any solution?

Edit: I use compiz window manager and there is no corresponding setting in Compiz configuration settings manager.

Edit: With the settings in this link, I'm able to resize a window out of the screen resolution by using mouse middle button click and drag trick. But programmatical method is still not working.

0 个答案:

没有答案