Open Bug 1055617 Opened 10 years ago Updated 2 years ago

There should be an observer notification sent when the screen available space changes

Categories

(Core :: Widget, defect, P3)

x86
All
defect

Tracking

()

People

(Reporter: florian, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: tpi:+)

In order to fix bug 1041677, we would need a notification when the screen resolution changes.

We are more interested in the screen available area than the screen total area; for example if the task bar is moved to the top of the screen on Windows, that's a relevant change that needs to be taken into account to reposition the global webrtc sharing indicator.
Flags: firefox-backlog+
This will need per platform work in the relevant nsScreenManager implementations, I expect...
Flags: firefox-backlog+
Any thoughts on the difficulty of this, widget-folk?
Flags: needinfo?(smichaud)
Flags: needinfo?(karlt)
Flags: needinfo?(jmathies)
On Windows you can handle WM_DISPLAYCHANGE in widget to send this. Since we share a window procedure, I'd store the current resolution and check to see if the values have changed before firing the observer.

http://msdn.microsoft.com/en-us/library/windows/desktop/dd145210%28v=vs.85%29.aspx.
Flags: needinfo?(jmathies)
On the Mac you should be able to use CGDisplayRegisterReconfigurationCallback() to get this kind of information.  Once you call this method, the callback is called "whenever local displays are reconfigured" -- for example when you change your display's resolution, change what kind of graphics hardware your machine uses (Mac laptops often have two kinds of graphics hardware), or plug in or unplug an external monitor.

https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/Reference/reference.html
Flags: needinfo?(smichaud)
(In reply to Florian Quèze [:florian] [:flo] from comment #0)
> We are more interested in the screen available area than the screen total
> area; for example if the task bar is moved to the top of the screen on
> Windows, that's a relevant change that needs to be taken into account to
> reposition the global webrtc sharing indicator.

I missed the detail here on taskbar changes. For this, WM_SETTINGCHANGE should work, although it looks like the events are restricted to the main display. See SPI_GETWORKAREA.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms725497%28v=vs.85%29.aspx
(Following up comment #4)

On each notification, you'll (of course) need to decide exactly what kind of information you need and whether or not that specific information has changed.  I don't know exactly how you'd compute the "screen available area", but that should be possible, in principle.
(In reply to Florian Quèze [:florian] [:flo] from comment #0)
> In order to fix bug 1041677, we would need a notification when the screen
> resolution changes.

nsScreenManagerGtk listens to the appropriate notifications, ConfigureNotify and _NET_WORKAREA PropertyNotify.

> We are more interested in the screen available area than the screen total
> area; for example if the task bar is moved to the top of the screen on
> Windows, that's a relevant change that needs to be taken into account to
> reposition the global webrtc sharing indicator.

nsScreenGtk::GetAvailRect() will provide this if there is only one monitor.

If there is more than one monitor, then GetAvailRect() currently returns the total monitor area.  This could be improved, but it is complicated by the fact that _NET_WORKAREA is a single rectangle.

GTK+3 intersects _NET_WORKAREA only with the primary monitor dimensions, assuming that the task bar will be on the primary monitor only.

http://standards.freedesktop.org/wm-spec/1.5/ar01s05.html#NETWMSTRUTPARTIAL may be a bit better but it still doesn't properly handle the taskbar on the join between two monitors.
 
It might be safest to imitate GTK+3 because desktop environments will likely need to cope with GTK+3 apps anyway.  GTK+3 uses XRRGetOutputPrimary() to get the primary monitor, but that seems unnecessary as xrandr man page says the primary will be sorted first in Xinerama requests.
Flags: needinfo?(karlt)
Priority: -- → P2
Whiteboard: tpi:+
Moving to p3 because no activity for at least 1 year(s).
See https://github.com/mozilla/bug-handling/blob/master/policy/triage-bugzilla.md#how-do-you-triage for more information
Priority: P2 → P3
Moving to p3 because no activity for at least 1 year(s).
See https://github.com/mozilla/bug-handling/blob/master/policy/triage-bugzilla.md#how-do-you-triage for more information
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.