Resize a window to exceed the resolution boundary under X

依然范特西╮ 提交于 2019-12-11 11:00:03

问题


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?

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.

来源:https://stackoverflow.com/questions/32341668/resize-a-window-to-exceed-the-resolution-boundary-under-x

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!