简体   繁体   English

使用twinview Ubuntu 12.04 C ++在2台显示器上的全屏应用程序

[英]Fullscreen application on 2 monitors using twinview Ubuntu 12.04 c++

I'm having trouble with an application I'm working on. 我正在处理的应用程序遇到问题。 Basically I want it to go full screen but only on one of my two monitors. 基本上,我希望它全屏显示,但只能在两台显示器之一上显示。 I'm using an Nvidia graphics card and running Twinview to extend my desktop over the two monitors. 我正在使用Nvidia图形卡并运行Twinview在两个显示器上扩展我的桌面。 Unfortunately everything I try sees only one large monitor. 不幸的是,我尝试的所有操作都只能看到一台大型显示器。 Is there a way to actually find out about the resolutions of each individual monitor? 有没有一种方法可以真正找出每个监视器的分辨率? I would prefer not to have to use a bunch of external libraries, I am already using Xlib to manage the windows but I haven't found any calls that will see past Twinview. 我希望不必使用大量外部库,我已经在使用Xlib来管理窗口,但是我没有发现任何可以通过Twinview看到的调用。

Unfortunately I am pretty much stuck with Twinview for the moment, I really need to get around it not just switch to something else. 不幸的是,我暂时还停留在Twinview上,我真的需要解决它,而不仅仅是切换到其他东西。

Thanks 谢谢

Edit: I was able to get it to basically work with Xinerama but after more struggles this is the code I ended up with, much more concise and as I understand it Xinerama is deprecated so this is probably better. 编辑:我能够使它基本上与Xinerama一起工作,但是经过更多的努力,这是我最终得到的代码,更加简洁,据我所知,Xinerama已弃用,因此可能更好。

    XEvent xev;
    xev.type = ClientMessage;
    xev.xclient.window = this->window;
    xev.xclient.message_type = XInternAtom(this->display, "_NET_WM_STATE", False);
    xev.xclient.format = 32;
    xev.xclient.data.l[0] = 2; //0 is remove, 1 is add, 2 is toggle
    xev.xclient.data.l[1] = XInternAtom(this->display, "_NET_WM_STATE_FULLSCREEN", False);

Hopefully that will help anyone else having a similar problem, the window manager takes care of everything nicely. 希望这可以帮助其他有类似问题的人,窗口管理器可以很好地处理所有问题。

This option in your xorg.conf should do it: 您的xorg.conf中的此选项应执行以下操作:

Option "NoTwinViewXineramaInfo"

This option turns Xinerama Info off. 此选项将关闭Xinerama Info。 With Xinerama info off the Window Manager believes that the entire MetaMode is the screen and will span everything across both monitors. 关闭Xinerama信息后,Window Manager认为整个MetaMode就是屏幕,并且将跨越两个监视器的所有内容。 When you click Maximize your application will fill both screens, for some applications this is ok for others it's annoying. 当您单击“最大化”时,您的应用程序将同时显示在两个屏幕上,对于某些应用程序,这对于其他应用程序是可以的,这很烦人。 I've tested it both ways and prefer to allow the Window Manager to know there are two displays. 我已经对这两种方式进行了测试,并且更愿意让Window Manager知道有两个显示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM