x11 - how to keep window at fixed position

﹥>﹥吖頭↗ 提交于 2019-12-11 19:58:57

问题


I develop a plugin for Compiz (window manager). A window manager is run by xfce on my test machine. I have two monitors which are set vertically (top 1920x1080+0+0, bottom 1920x1080+0+1080). A bottom monitor is set as a primary monitor. This option (primary monitor) is available for example in nvidia-settings. In my code I can use xlib function XConfigureWindow when I want to set a top left corner of the game window at position [0,0]. This works fine, but when a window is in the fullscreen mode (covers two monitors) and get a focus it sometimes changes a position. Then the new position of the top left corner starts at 0, 1080 and I can only see half of the window. Maybe that behaviour is connected with the primary screen option. What the primary screen mean for x11 window system ? I'm not allowed to change that option. How to keep a window at fixed position ? Is there any xlib function or a flag which I can use ?


回答1:


Window manager will not be able to do anything to a window created with this option.

// Create a window : 
window = XCreateSimpleWindow(dpy, RootWindow(dpy, 0), 
            win_X, win_Y, win_width,
            win_height, 0, 0, 0);

// Set non managed window
XSetWindowAttributes set_attr;
set_attr.override_redirect = True;
XChangeWindowAttributes(dpy, window, CWOverrideRedirect, &set_attr);

// Map the window on screen
XMapWindow(dpy, window);


来源:https://stackoverflow.com/questions/25595936/x11-how-to-keep-window-at-fixed-position

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