简体   繁体   中英

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. 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.

Unfortunately I am pretty much stuck with Twinview for the moment, I really need to get around it not just switch to something else.

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.

    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:

Option "NoTwinViewXineramaInfo"

This option turns Xinerama Info off. With Xinerama info off the Window Manager believes that the entire MetaMode is the screen and will span everything across both monitors. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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