Spans both monitors in Twinview - fix included

Bug #910870 reported by octopodrex
22
This bug affects 5 people
Affects Status Importance Assigned to Milestone
OBLogout
New
Undecided
Unassigned

Bug Description

Using Twinview the OBLogout screen spans both monitors, causing half of the menu to be on each monitor.

To fix this problem make the changes below.
Modify the oblogout __init__.py file (e.g. /usr/lib/python2.7/site-packages/oblogout/__init__.py):

remove line 163:
        self.window.resize(gtk.gdk.screen_width(), gtk.gdk.screen_height())

replace the above with the following:
        thescreen = gtk.gdk.screen_get_default()
        if int(thescreen.get_n_monitors()) > 1:
            thegeometry = thescreen.get_monitor_geometry(0)
            thewidth, theheight = thegeometry[2], thegeometry[3]
        else:
            thewidth, theheight = gtk.gdk.screen_width(), gtk.gdk.screen_height()
        self.window.resize(thewidth, theheight)

That change makes the logout menu show up on monitor 0 only (a side-effect is that other monitors are not greyed out and you can still interact with them while the logout menu is up, this tradeoff was acceptable to me).

FYI:
It might even be possible to get rid of the conditional and just use this:
        thescreen = gtk.gdk.screen_get_default()
        thegeometry = thescreen.get_monitor_geometry(0)
        self.window.resize(thegeometry[2], thegeometry[3])

I think that would work too since if you only have one monitor its height and width would equal the screen height and width, though I haven't tested it.

Tags: patch twinview
Revision history for this message
vsm (vonsachermasoch) wrote :

Maybe it is too late (0.3 is final?) but I've had this problem in latest Manjaro (0.8.7) which packs oblogout 0.2, apparently.

Well, the fix above works just fine but has the minor drawback of limiting the size of the window object and, thus, limits the fading of the screen to only 1 screen of the 2.

To solve this, I suggest the following dirty hack:

1) live line 163 alone (or restore it to original)

2) delete line 121 [self.mainpanel.pack_start(gtk.VBox())]

3) add this instead:

        if int(gtk.gdk.screen_get_default().get_n_monitors()) == 2:
            self.mainpanel.set_homogeneous(True)
        else:
            self.mainpanel.pack_start(gtk.VBox())

What this does is it checks if we are on a dual monitor setup. If yes, we do not add the first VBox (line 121 was deleted...) and instead we set "homogeneous" to "true".

By doing this we obtain a 50/50 distribution on the width of both monitors between i) the "self.buttonpanel" (line 122 in the original code) and ii) the remaing "gtk.VBox()" which is later added in the script (line 123 of the original code).

So, the buttonpanel gets the entire monitor 0 while the VBox fills monitor 1. If you like your buttons to be on your other monitor, just invert the buttonpanel and VBox lines.

Else, if we are in a single monitor setup, just add a VBox before the buttonpanel and the next VBox as it was in the original, evenly panning the buttons in the middle.

The conditional checks for "== 2" instead of "> 1" because in the unlikely hypothesis that some lucky guy works on a triple monitor setup, we still want the buttons to appear in the middle.

Hope this helps.

Revision history for this message
Jason Alexander (hollander) wrote :

thanks vsm, exactly what I was looking for.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.