! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
[PATCH] Panel moves offscreen when external VGA output unplugged
Status:
RESOLVED: FIXED
Product:
Xfce4-panel

Comments

Description John Lindgren editbugs 2014-08-01 05:00:44 CEST
Created attachment 5573 
Use bounding rectangle of all monitors

I normally connect an external VGA monitor to my laptop in the following setup:

Screen 0: minimum 8 x 8, current 2646 x 1024, maximum 32767 x 32767
LVDS1 connected 1366x768+0+0
VGA1 connected 1280x1024+1366+0

Unplugging the VGA monitor gives the following setup:

Screen 0: minimum 8 x 8, current 2646 x 1024, maximum 32767 x 32767
LVDS1 connected 1366x768+0+0
VGA1 disconnected 1280x1024+1366+0

Note that only the laptop display is connected, but the X11 screen is still larger enough to encompass both monitors.  xfce4-panel currently doesn't handle this situation correctly, and the panel, which is normally at the bottom of the laptop display, moves down to the bottom of the X11 screen, below the edge of the laptop display, and becomes invisible.  The cause of the problem is the "fast path" in panel-window.c that calculates the panel position for only one monitor (or for a panel spanning all monitors).  The current "fast path" code looks only at the X11 screen size, whereas it should be looking at the monitor layout.

My patch fixes the problem by calculating the bounding rectangle of all monitors and using that rectangle in place of the X11 screen size.
Comment 1 Olivier Fourdan editbugs 2015-02-23 09:38:56 CET
(In reply to John Lindgren from comment #0)
> I normally connect an external VGA monitor to my laptop in the following
> setup:
> 
> Screen 0: minimum 8 x 8, current 2646 x 1024, maximum 32767 x 32767
> LVDS1 connected 1366x768+0+0
> VGA1 connected 1280x1024+1366+0
> 
> Unplugging the VGA monitor gives the following setup:
> 
> Screen 0: minimum 8 x 8, current 2646 x 1024, maximum 32767 x 32767
> LVDS1 connected 1366x768+0+0
> VGA1 disconnected 1280x1024+1366+0

Can't see any difference between the values before and after.
Comment 2 Olivier Fourdan editbugs 2015-02-23 09:39:25 CET
(In reply to Olivier Fourdan from comment #1)
> Can't see any difference between the values before and after.

(Except it's disconnected of course)
Comment 3 Olivier Fourdan editbugs 2015-02-23 09:40:52 CET
What version of Xorg is this? With which DDX/version as well?

I cannot reproduce the issue.
Comment 4 John Lindgren editbugs 2015-02-23 14:08:25 CET
xorg-server 1.17.1
xf86-video-intel 2.99.917
Comment 5 John Lindgren editbugs 2015-02-23 14:29:30 CET
(In reply to Olivier Fourdan from comment #1)
> Can't see any difference between the values before and after.

It is the same "not normal" case you responded to here:
https://bugzilla.xfce.org/show_bug.cgi?id=5795#c28

To reproduce, it's necessary to get the logical X11 screen size larger than the only remaining connected monitor.  Disconnecting a VGA monitor (and *not* running e.g. xrandr --auto afterwards to adjust the logical screen size) is one way to do this.
Comment 6 Olivier Fourdan editbugs 2015-02-23 14:36:11 CET
(In reply to John Lindgren from comment #5)
> (In reply to Olivier Fourdan from comment #1)
> > Can't see any difference between the values before and after.
> 
> It is the same "not normal" case you responded to here:
> https://bugzilla.xfce.org/show_bug.cgi?id=5795#c28
> 
> To reproduce, it's necessary to get the logical X11 screen size larger than
> the only remaining connected monitor.  Disconnecting a VGA monitor (and
> *not* running e.g. xrandr --auto afterwards to adjust the logical screen
> size) is one way to do this.

As commented in bug 11059, strut is relative to the screen edge, and not the edge of the xinerama monitor so the current behavior seems correct.

The /logical/ screen size should be updated when a monitor is disconnected.
Comment 7 John Lindgren editbugs 2015-02-23 14:43:59 CET
(In reply to Olivier Fourdan from comment #6)
> As commented in bug 11059, strut is relative to the screen edge, and not the
> edge of the xinerama monitor so the current behavior seems correct.

This patch doesn't change the strut calculation.  See https://bugzilla.xfce.org/show_bug.cgi?id=11059#c7.

> The /logical/ screen size should be updated when a monitor is disconnected.

I agree, in theory.  However, in practice this doesn't always happen.
Comment 8 Olivier Fourdan editbugs 2015-02-23 14:56:54 CET
(In reply to John Lindgren from comment #7)
> > The /logical/ screen size should be updated when a monitor is disconnected.
> 
> I agree, in theory.  However, in practice this doesn't always happen.

The question is, are we trying to work around bugs in xorg or intel driver here?
Comment 9 John Lindgren editbugs 2015-02-23 15:09:55 CET
If you think Xorg or the driver should be ensuring that the logical screen size remains consistent with the connected monitors, then I'm willing to report a bug to the relevant component (but I wouldn't know which).

On the other hand, I don't see any problem with coding XFCE a little more carefully so that it doesn't break in this (admittedly abnormal) scenario.

Theoretical questions of what "ought" to happen aside, do you think it's realistic that Xorg will fix a long-standing issue like this (around since at least 2009, according to bug #5795) in a reasonable timeframe?
Comment 10 John Lindgren editbugs 2015-02-23 15:16:45 CET
(In reply to John Lindgren from comment #9)
> On the other hand, I don't see any problem with coding XFCE a little more
> carefully so that it doesn't break in this (admittedly abnormal) scenario.

That came out wrong; I didn't mean to imply that the current code was carelessly coded.  On the whole I'm very impressed with the code.  It's just this unusual case where it happens to break.
Comment 11 Olivier Fourdan editbugs 2015-02-23 16:11:04 CET
No worries, I didn't take it in a wrong way. 

My main (and only) concern here is do make the right choice, if there is a bug in xfce it should be fixed here obviously, but if the bug is elsewhere it should be fixed elsewhere (and not as a workaround here).

What about the opposite operation, what if you don't have the VGA monitor plugged, then you plug it in, what gives "xrandr -query" in this case for the overall screen size vs. each monitor size/position? Is there still any discrepancy?
Comment 12 John Lindgren editbugs 2015-02-23 16:51:55 CET
(In reply to Olivier Fourdan from comment #11)
> What about the opposite operation, what if you don't have the VGA monitor
> plugged, then you plug it in, what gives "xrandr -query" in this case for
> the overall screen size vs. each monitor size/position? Is there still any
> discrepancy?

I will get you the exact xrandr output once I get home tonight, but I believe the VGA monitor remains in standby (no picture) after plugging it in, and the logical screen size remains the same (so it only encompasses the laptop panel).  Then I have to run "xrandr --output VGA1 --auto" to turn the monitor on, which also updates the logical screen size.
Comment 13 John Lindgren editbugs 2015-02-24 00:01:58 CET
Before plugging in VGA cable:

Screen 0: minimum 8 x 8, current 1366 x 768, maximum 32767 x 32767
LVDS1 connected 1366x768+0+0
VGA1 disconnected

After plugging in VGA cable:

Screen 0: minimum 8 x 8, current 1366 x 768, maximum 32767 x 32767
LVDS1 connected 1366x768+0+0
VGA1 connected

After "xrandr --output VGA1 --auto --right-of LVDS1":

Screen 0: minimum 8 x 8, current 2646 x 1024, maximum 32767 x 32767
LVDS1 connected 1366x768+0+0
VGA1 connected 1280x1024+1366+0
Comment 14 Olivier Fourdan editbugs 2015-02-26 22:26:21 CET
I suspect this patch is incomplete, I trust it fixes the panel positioning but the struts are still computed based on the (wrong, in this case) X11 screen size, thus causing bug 11059.
Comment 15 John Lindgren editbugs 2015-02-27 00:36:11 CET
(In reply to Olivier Fourdan from comment #14)
> I suspect this patch is incomplete, I trust it fixes the panel positioning
> but the struts are still computed based on the (wrong, in this case) X11
> screen size, thus causing bug 11059.

That is exactly what the patch does, and it was intentional on my part.  The struts are supposed to be based on the X11 screen size, whether it matches the monitor size or not.

As I said before, if you think it is wrong for the X11 screen size to be larger than the one connected monitor, I am happy to report a bug to Xorg.  But I do not see the problem with making xfce4-panel (and xfwm4) handle that case correctly.
Comment 16 Olivier Fourdan editbugs 2015-02-28 10:10:01 CET
xfwm4 part has been pushed now, means that the stuts may be wrong when unplugging an output until this patch is merged.
Comment 17 Olivier Fourdan editbugs 2015-02-28 10:41:05 CET
Pushed to git, thanks.

Bug #11058

Reported by:
John Lindgren
Reported on: 2014-08-01
Last modified on: 2015-02-28

People

Assignee:
Nick Schermer
CC List:
1 user

Version

Version:
4.10.1

Attachments

Use bounding rectangle of all monitors (964 bytes, patch)
2014-08-01 05:00 CEST , John Lindgren
no flags

Additional information