[panel] on a multi monitor setup the panel length appears to be calculated with the screen in focus at the time of execution

Bug #877012 reported by John Bender on 2011-10-18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
unity-2d (Ubuntu)

Bug Description

Description: Ubuntu 11.10
Release: 11.10

  Installed: 4.12.0-0ubuntu1
  Candidate: 4.12.0-0ubuntu1
  Version table:

Expected behavior:
The panel calculates it's width for each monitor on which it is displayed covering the span from left edge to right.

Actual Behavior:
When I log in with an external monitor connected the panel at the top might be in one of two possible configurations. Either the larger screen will have a shortened panel (http://i.imgur.com/vEC8K.png) or the smaller screen will have one that extends past it's viewport (http://i.imgur.com/vWBM1.png). Both are highlighted red in the images.

More importantly when I kill and restart the panel it will size itself to whichever screen has focus. That's how I was able to take screens of both.

Other relevant information:
I use xmonad with the following desktop and xsessions


[GNOME Session]
Name=Xmonad session


[Desktop Entry]
Name=Xmonad GNOME
Comment=Tiling window manager
Exec=gnome-session --session=xmonad

  Installed: 0.9.2-2build1
  Candidate: 0.9.2-2build1
  Version table:

John Bender (johnbender) wrote :
John Bender (johnbender) wrote :

Attached is a working patch for this issue which assigns a screen value to the instantiated Unity2dPanel which is then used to determine the panel's geometry in place of the widget itself.

A few notes:

1. this patch was created against a clean branch from lp:ubuntu/oneiric/unity-2d, so I'm not clear if it will apply cleanly to the latest precise branch/dev. I'm happy to look into it.
2. the default value for m_screen might be better as -1 since the QT docs suggest that the screenGeometry will default in that case ( http://doc.qt.nokia.com/latest/qdesktopwidget.html#screenGeometry )
3. it's only been tested on my desktop setup and not the desktop environment this will most likely be run under ( gnome fallback? )

I've done my best to adhear to the coding guidelines I found in the repository, but any and all feedback is welcome/greatly appreciated.

The attachment "use_screen.patch" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
John Bender (johnbender) wrote :

One additional note with regards to the attached patch. On screen resize it will resize based on the original screen which is only bad if the panel changes screens (I'm not clear if this is a normal use case). It appears, just from the looking at the source that Unity2dPanel::slotWorkAreaResized(int screen) is meant to handle this case and since the screen is passed as an argument and alteration like:

void Unity2dPanel::slotWorkAreaResized(int screen)
    if (x11Info().screen() == screen) {
        d->m_screen = screen; // addition

may well work. On my desktop I can't seem to get that signal to fire though so I'm having a hard time testing it. Sorry for the incomplete implementation in the original patch.

Gerry Boland (gerboland) wrote :

Hey John,
thanks for all your work on this. I hope to get a chance to attack this tomorrow.

Gerry Boland (gerboland) wrote :

Hi John, I've tried but am unable to reproduce this.

I have my laptop with 1280x800 connected to an external monitor 1440x900 with mirroring disabled, and the panel is correctly sized across both screens, no matter what screen I use to log in/kill & start the panel.

Can I enquire as to the resolutions of your screens? Have you tried disabling compositing?
gconftool-2 --set --type bool/apps/metacity/general/compositing_manager false

I've not looked at your patch yet, but if the logic is superior it might be good to add anyway.

John Bender (johnbender) wrote :


Screen resolutions when plugged in are 1920x1200 and 1600x900. As for the compositing manager I'm relatively sure I don't have one running. All the notify-osd popups lack transparency of any kind and I'm using xmonad as my window manager, but I'm far from certain.

I wonder if there's something special about the way the call to screenGeometery works when used in Xmonad as opposed to metacity that might be causing it. Maybe it's reporting the widget location incorrectly because in Xmonad it's instantiated in the focused screen as with all xmonad windows/apps.

When installing the dev QT packages (which I believe were a cmake dep) do they include the debug symbols so I can step into screenGeometery? I tried that briefly but didn't get very far, but I'm unskilled with gdb.

Thanks so much for checking into this!

Gerry Boland (gerboland) wrote :

Hi John,
Coincidentally Alberto has been working on this. If possible, can you check out his branch and see if it helps you:

John Bender (johnbender) wrote :


My sincerest apologies for replying so slowly. I hope to give Alberto's branch a try tonight or this weekend, though I should note that with the most recent update to the panel I don't believe I've seen the same issue (part of the reason for my slow reply).

Either way I'll post back here with my findings.

Gerry Boland (gerboland) wrote :

No problem John, post when is convenient for you :)

John Bender (johnbender) wrote :


With the latest from Oneiric I can't reproduce this issue. The panel resizes properly on both screens in my setup. Fully realizing that's not super helpful in determining what actually resolved this issue for me, you can probably safely close this bug. Thanks for all your help and do let me if I there's anything else I can do to help.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in unity-2d (Ubuntu):
status: New → Confirmed
Cristian Klein (cristiklein) wrote :

I just encountered the same problem. When running an Xmonad/Gnome session with unity-2d-panel, the panel would not choose the correct width on a multi-display system. Using the branch lp:~mardy/unity-2d/geometry/ fixed the issue for me. Now the panel uses the width of the smaller display, which is an acceptable solution for me.

John Bender (johnbender) wrote :

I think I spoke too soon when I said that a recent update had addressed this issue for me. I believe I had symlinked my patched build on the weekend and then did my "test" on Monday without realizing. Upon an actual update it appears that this is still an issue, though I have yet to try the linked branch since my patch works fine for me (great solution I know). Hopefully I'll get some time to try it out.

Gerry Boland (gerboland) wrote :

Hi everyone
I believe the fix for this issue is only available in trunk right now - due to architectural changes our daily PPA is not updating. Does anyone feel brave enough to confirm?

Bryce Harrington (bryce) wrote :

Fwiw, I tried reproducing this on today's Ubuntu Precise with both Unity and Unity 2d, on an Intel gfx laptop with external monitor via docking station.

I recognize the behavior, I'm sure I've seen it in the past on this hardware, but it's definitely not reproducing for me now.

Changed in unity-2d (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → Medium
Bryce Harrington (bryce) wrote :

Is anyone still seeing this? I haven't been able to reproduce it, and with no comments since my last one, I'm concluding the bug is probably resolved now.

Changed in unity-2d (Ubuntu):
status: Triaged → Incomplete

I am actually seeing this problem. I am running unity-2d from the PPA (version 5.2.0+bzr878ubuntu0+inline). The problem is not just on the panel. If I plug my laptop (screen resolution 1440x900) on the docking station (screen resolution 1680x1050), turn off the laptop screen and turn on the external monitor here's what happens:
1) the external monitor resolution is ok
2) the panel length on the external monitor is 1440
3) the wallpaper size on the external monitor is still of size 1440x900 and the empty space is filled up by tiling the wallpaper image
4) when I move windows around it seems like the size of the desktop is equal to the sum of the external and the laptop screen even if the laptop screen is off.

The only way to fix this is to restart X.
When I plug the laptop off the docking station things go pretty much the other way around

I hope I managed to explain the problem clearly.

I didn't have these problem with the standard (non PPA) unity-2d version.

Michał Sawicz (saviq) wrote :

Buttari, 5.2.0 is very old. More recent builds should have the initial problem fixed, not sure about your other issue, never experienced it.

Buttari, I assume you're on 11.10? Then there's no newer version available, I'm afraid. It would be good if you could try and test under Precise.

thanks for the quick response. Yes, I'm on 11.10 + unity-2d from the "Daily Builds" PPA (not much "daily" actually since the last build appears to be 6 weeks old). I'll check with Precise ASAP.


Dnia 2012-03-14, śro o godzinie 09:03 +0000, Alfredo Buttari pisze:
> not much "daily" actually since the last build appears to be 6 weeks
> old

Yes, unfortunately at that point we lost compatibility due to new
dependencies that weren't available in 11.10.

Michał Sawicz <email address hidden>
Canonical Services Ltd.

Launchpad Janitor (janitor) wrote :

[Expired for unity-2d (Ubuntu) because there has been no activity for 60 days.]

Changed in unity-2d (Ubuntu):
status: Incomplete → Expired
John Bender (johnbender) wrote :


Sorry to reopen this bug but it still exists in precise. I've attached a simplified patch that has sorted out the issue for me. It's not for inclusion but it's probably good for a quick lead on what a good solution would be. Also this handles both the initial geometry calculation when the panel is instantiated and also the situation when either screen sees a resolution change. I had not mentioned the second part of the problem before.

Changed in unity-2d (Ubuntu):
status: Expired → Confirmed
Changed in unity-2d (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related blueprints

Bug attachments