On gnome-panel, nvidia twinview, spanning, and multiple screens
If you found this post with a search for those particular keywords, this post may help you figure out what you’re trying to achieve, regardless of what I was trying to achieve, so I wouldn’t automatically dismiss this after I describe my setup.
Here is my configuration:
- Mandriva Linux x86-64
- Gnome desktop
- Two similar nVidia cards with two DVI ports on each: 4 total DVI ports
- Two LCD panels of similar dimensions and a LCD TV: 3 total displays
Here is what I wanted to achieve:
- All displays working at same time, but not necessarily as one large display (no Xinerama necessary)
- Compiz graphics (no Xinerama)
- gnome-panel spanning one display
Now, from a clean install of Mandriva, all I need to do is run nvidia-settings, turn on TwinView for my two matching panels, and everything is perfect… except for the TV. If I attempt to enable the TV as a separate X screen, point #3 fails. It doesn’t make any damn sense, but that’s what happens. Applications sometimes still maximize to separate monitors (and sometimes don’t depending on my configuration – a lot of this is black magic to me).
It turns out that libgdk determines how things maximize and such. Each display has a number of screens, and each screen has a number of monitors. The maximization/panel logic apparently goes off of the monitors.
So what I did is I downloaded the gtk+ source RPM, dug around, and found the init_multihead function. With a little fooling around, I now have hacked the code to look like this:
if(screen_x11->screen_num == 0)
{
screen_x11->n_monitors = 2;
int nWidth = WidthOfScreen(screen_x11->xscreen) / 2;
screen_x11->monitors = g_new0(GdkX11Monitor, 2);
init_monitor_geometry (&screen_x11->monitors[0], 0, 0,
nWidth,
HeightOfScreen (screen_x11->xscreen));
init_monitor_geometry (&screen_x11->monitors[1], nWidth, 0,
nWidth,
HeightOfScreen (screen_x11->xscreen));
}
else
{
/* No multihead support of any kind for this screen */
screen_x11->n_monitors = 1;
screen_x11->monitors = g_new0 (GdkX11Monitor, 1);init_monitor_geometry (screen_x11->monitors, 0, 0,
WidthOfScreen (screen_x11->xscreen),
HeightOfScreen (screen_x11->xscreen));
}
That’s pretty much it. Keep in mind that you need a few dependencies to build GTK, so install the corresponding -devel RPMs. If you’re not using an RPM-based distro, you probably know how to patch stuff already. I didn’t bother building a new RPM, I simply ran ./configure –prefix=/usr and then make, and replaced the original one after making a backup.
A three-monitor TwinView setup will work fine (for GTK apps, at least). To run stuff on the other display, use gnome-terminal –display=:0.1 or run export DISPLAY=:0.1 before running your app. Now I can watch TV without restarting X, hooray!
Filed by xtravar at May 3rd, 2009 under linux, programming