Bug 100196 - X11: top level windows should use NorthWest window gravity
Summary: X11: top level windows should use NorthWest window gravity
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
5.2.0.0.beta1
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-02 18:34 UTC by Keith Packard
Modified: 2019-12-03 19:19 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Patch forcing NorthWest window gravity (3.09 KB, patch)
2016-06-02 18:34 UTC, Keith Packard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Packard 2016-06-02 18:34:11 UTC
Created attachment 125460 [details]
Patch forcing NorthWest window gravity

X11 window gravity affects how windows are repositioned when their parent is resized. Setting a libreoffice top-level window gravity to something other than NorthWest means that the window will move relative to its parent when the parent is resized. 

By default, LibreOffice selects StaticGravity, which means that the application window will not move relative to the screen as the parent is resized. So, resizing the window to the right or down works "correctly", but resizing leftwards or upwards moves the application window within the parent, leaving a gap to the left or top of the application window within the frame.

Some window managers (metacity) smash the application window geometry to NorthWest so that the application follows the window frame as it should. Others do not adjust this value (xfwm4, twm), and so LibreOffice "breaks" in those environments. That's why this problem doesn't appear on every desktop.

I found at least four bug reports about this issue:

http://www.linuxquestions.org/questions/linux-desktop-74/strange-libreoffice-problem-on-debian-with-xfce-4175469847/
https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers/+bug/889212
https://bbs.archlinux.org/viewtopic.php?id=133137
http://forums.debian.net/viewtopic.php?f=6&t=10575

Note that there *is* a useful window gravity value in the WM_NORMAL_HINTS for the application. LibreOffice has a separate parameter for this, and in that case, StaticGravity is a reasonable default as it allows LibreOffice to position toolbars and other contents on the screen without needing to adjust for the window manager frame size.

The patch enclosed forces window gravity to NorthWest for all windows in all cases. I can't imagine where this wouldn't be correct, but I haven't reviewed all of the code using this function.
Comment 1 Buovjaga 2016-06-10 10:47:56 UTC
Keith: please send the patch using gerrit: https://wiki.documentfoundation.org/Development/gerrit
Comment 2 QA Administrators 2017-09-01 11:17:58 UTC Comment hidden (obsolete)
Comment 3 QA Administrators 2019-12-03 13:49:07 UTC Comment hidden (obsolete)
Comment 4 Keith Packard 2019-12-03 19:19:20 UTC
I've tested current debian unstable libreoffice, which says 'Version: 6.3.3.2.0+' and things appear to work for me.