elementary / wingpanel

Stylish top panel that holds indicators and spawns an application launcher
https://elementary.io
GNU General Public License v3.0
137 stars 46 forks source link

Fix windows below wingpanel for some 3 monitor layouts #295

Closed felix-andreas closed 4 years ago

felix-andreas commented 4 years ago

Fixes https://github.com/elementary/gala/issues/737

cassidyjames commented 4 years ago

And just to confirm, this does not regress the struts issue on multiple-monitor setups? :sweat_smile: I don't have that many displays to properly test this.

felix-andreas commented 4 years ago

@cassidyjames This just fixes a logical error in the has_no_monitor_above function. For the reported layout the has_no_monitor_to_left and has_no_monitor_to_right correctly evaluated to false. But the has_no_monitor_above wrongly evaluated to false, so it was not possible to set structs. This caused the window to go under the wingpanel.

This was no problem for all 2 monitor layouts as the struts could always be set from the left or right side.

With this branch, the wingpanel should now reserve the correct space for all layouts up to 3 monitors.

felix-andreas commented 4 years ago

I made the code more concise by moving the logic into a single loop. Using 3 different function has_no_monitor_above, has_no_monitor_to_left and has_no_monitor_to_right was unnecessary repetitive and was the reason I introduced the bug in the first place. This should be more maintainable and easier to understand.

felix-andreas commented 4 years ago

Isn't there a tool to create "virtual" monitors? Maybe this Xephyr program, which you use to test the greeter, is capable to do this? If so, this could also be useful to test other multi-monitor related issues on a single monitor...

quequotion commented 4 years ago

Not sure if you're interested in dealing with this, but resulting from commit 30d0757d2d140e7da53913b1a9861da0598549a2, when using wingpanel in openbox, windows cannot maximize larger than the right half of the screen (ie, there appears to be a strut occupying 50% of the screen from the left edge).

I built each version before and after to test; the fix for this bug causes another. I know openbox is outside of your purview, but I think there must be a better way to fix that issue that doesn't cause this one.

felix-andreas commented 4 years ago

I am able to reproduce this. To me it seems like OpenBox is ignoring the left_start_y and left_end_y. because If I log them they have the correct values: 0 and 29 on a single FHD Monitor. I assume only the half monitor is blocked because of some maximal struct threshold in OpenBox. But this is just speculation, I did not look at the source code.

A workaround for OpenBox is to swap the order in the if statement:

https://github.com/andreasfelix/wingpanel/blob/f5e048321c69ffec0278b8cbb623928afd6c4f69/src/PanelWindow.vala#L172-L186

So that (if possible) the struts are set from the top. This would make wingpanel work correctly on a single monitor on OpenBox and some other layouts, but for example not for a vertical dual monitor setup. This should have no effect on Gala.