_NET_WORKAREA and multiple monitors

Olivier Fourdan fourdan at gmail.com
Tue Aug 4 14:18:38 CEST 2009


On Mon, Aug 3, 2009 at 11:58 PM, Brian J. Tarricone<brian at tarricone.org> wrote:
> On 08/03/2009 07:47 AM, Olivier Fourdan wrote:
>>
>> 2009/8/3 Olivier Fourdan<fourdan at gmail.com>:
>>>
>>> Hi Brian,
>>>
>>> 2009/7/23 Brian J. Tarricone<brian at tarricone.org>:
>>>>
>>>> Jerome is working on proper positioning of notifications for
>>>> xfce4-notifyd,
>>>> and he's running into a problem with multi-monitor setups.  We want to
>>>> follow _NET_WORKAREA to avoid trying to place notifications over panels
>>>> and
>>>> such (actually, I think Jerome says if he tries to, the WM moves them
>>>> out of
>>>> the panel's strut area, which screws up the rest of our positioning).
>>>>
>>>> However, with multiple monitors, this doesn't work.  Jerome made a
>>>> little
>>>> mockup to illustrate:
>>>>
>>>> http://pocentek.net/~jeromeg/misc/screen.png
>
>>>
>>>
>>> I think this should be more appropriate on the devel mailing list :)
>
> Heh, yeah, good point.  Forwarded...
>
>>>> The two blue rectangles are the actual monitor areas, and the dashed red
>>>> rectangle is what _NET_WORKAREA reports.  Obviously, we lose a bit of
>>>> screen
>>>> space here.  (This is also a problem for xfdesktop's icon placement,
>>>> though
>>>> I'd never had a dual-head setup to test this with).
>>>>
>>>> I can understand how, logically, you wouldn't want _NET_WORKAREA to
>>>> contain
>>>> regions that aren't visible, but in my mind, you most likely eliminate a
>>>> lot
>>>> of 'real' space that way.
>>>>
>>>> I would think the better way would be for _NET_WORKAREA to contain the
>>>> space
>>>> enclosed by both monitors, and then a user of that property would be
>>>> required to check monitor geometry (by using
>>>> gdk_screen_get_monitor_geometry() or whatever) and then only place
>>>> things in
>>>> the intersection of _NET_WORKAREA and the real monitor geom.
>>>>
>>>> I looked at the netwm spec, and it didn't say anything about how
>>>> _NET_WORKAREA should behave with multiple monitors of different
>>>> resolutions,
>>>> so I'm not sure if there's a real "right" and "wrong" here according to
>>>> the
>>>> spec.
>>>>
>>>> What do you think?
>
>>>
>>>
>>> Basically, the spec says:
>>>
>>> "Work area SHOULD be used by desktop applications to place desktop
>>> icons appropriately"
>>>
>>> If you include non visible area, you will end up with icons
>>> potentially being invisible, which defeats the benefits of having
>>> _NET_WORKAREA
>
> Right, but _NET_WORKAREA is then useless on multihead when you have monitors
> with different resolutions if you follow that interpretation. Well, maybe
> not "useless" -- it does serve the purpose of ensuring that you don't place
> things in non-visible areas.  But it also artificially "hides" some
> (potentially large) areas that *are* visible.
>
>>> But then it gets totally confusing, because it's a standard and kwin
>>> and metacity give different results from xfwm4, for example here I
>>> get:
>>>
>>>
>>> xfwm4:
>>> _NET_WORKAREA(CARDINAL) = 0, 0, 2944, 745, 0, 0, 2944, 745, 0, 0,
>>> 2944, 745, 0, 0, 2944, 745
>>>
>>> metacity:
>>> _NET_WORKAREA(CARDINAL) = 1024, 0, 1920, 1200, 1024, 0, 1920, 1200,
>>> 1024, 0, 1920, 1200, 1024, 0, 1920, 1200
>>>
>>> kwin:
>>> _NET_WORKAREA(CARDINAL) = 0, 0, 2944, 1200, 0, 0, 2944, 1200, 0, 0,
>>> 2944, 1200, 0, 0, 2944, 1200
>
> What's your monitor resolution?  (And is that dual head?)  I'm having a hard
> time interpreting that without knowing...

Yes. of course :)

I have two monitors, the laptop 1024x768 on the right and a larger 24"
monitor capable of 1920x1200.

That gives a total square area of 2944x1200. The panel in of the
right, ie on the small laptop monitor.

- xfwm4 restrict the workarea to 2944x745 (ie 1200 -  455,  the struts
from the panel)
- metacity computes the largest square area on all available monitor
and therefore sets the workarea to 1920x1200 (ignoring the laptop
monitor)
- kwin sets the workarea to the square sum of both monitor, ignoring
the panel and its struts.

So, in a nutshell, I think:

- xfwm4 takes to most conventional approach
- metacity tries to be smarter, ymmv
- kwin is wrong and ignores dead areas and goes agaist the spec by not
using the struts of the panel.


[...]
>> The calculation is therefoer correct and in line with the spec (while
>> both metacity and kwin have it wrong IMHO).
>
> Yes, I suppose it is indeed in line with the spec, but... that's still not
> helpful.  It makes _NET_WORKAREA useless for xfce4-notifyd placement[1],
> and, now that I know about it, also useless for xfdesktop icon placement.

If NET_WORKAREA is not good enough, there is no obigation to use it
either I guess and each tool can query the actual multiple monitor
geometries. But then comes the struts, because struts and partial
struts are per window... There is no real simple solution, but I could
adopt an approach similar to what metacity does, at least it would be
two similar implementations (I did not check other EWMH compliant
window managers such as openbox, etc.)

Cheers,
Olivier,



More information about the Xfce4-dev mailing list