x11-如何将窗口保持在固定位置 [英] x11 - how to keep window at fixed position

查看:575
本文介绍了x11-如何将窗口保持在固定位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为Compiz(窗口管理器)开发了一个插件. xfce在我的测试计算机上运行一个窗口管理器.我有两个垂直设置的显示器(顶部1920x1080 + 0 + 0,底部1920x1080 + 0 + 1080).将底部监视器设置为主监视器.例如,在nvidia设置中可以使用此选项(主监视器).在我的代码中,当我想将游戏窗口的左上角设置在位置[0,0]时,可以使用xlib函数XConfigureWindow.这可以正常工作,但是当窗口处于全屏模式(覆盖两个监视器)并获得焦点时,它有时会改变位置.然后,左上角的新位置从0、1080开始,我只能看到一半的窗口.也许该行为与主屏幕选项有关. x11窗口系统的主屏幕意味着什么?我不允许更改该选项.如何将窗户保持在固定位置?有没有可以使用的xlib函数或标志?

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 ?

推荐答案

对于使用此选项创建的窗口,窗口管理器将无法执行任何操作.

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);

这篇关于x11-如何将窗口保持在固定位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆