Bug 120620 - setPosSize does not work properly
Summary: setPosSize does not work properly
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
5.4.7.2 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-15 14:57 UTC by tim
Modified: 2024-02-24 10:39 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Demo database (13.76 KB, application/vnd.oasis.opendocument.database)
2018-10-15 14:57 UTC, tim
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tim 2018-10-15 14:57:09 UTC
Created attachment 145731 [details]
Demo database

Following on from #112590 (gtk3 and window size) I have tried to set the size and position of forms in code.

Ignoring ubuntu ppa versions and gtk3 for now, and using:

Version: 6.1.4.0.0+
Build ID: 7ea7b86e7731f8cc1366ea632653fecc97267378
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: gtk2; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:libreoffice-6-1, Time: 2018-10-13_04:47:20
Locale: en-GB (en_GB.UTF-8); Calc: group threaded


Open Table1 form.  On my system it shows on the top line, inset a little to the right.

The setPosSize function is called when the table is opened, and contains:

Sub FormSize()
	Wait 150
	oFrame = StarDesktop.getCurrentFrame()
	oWin = oFrame.getContainerWindow()
	oWin.setPosSize(100,150,500,400,15)
End Sub

The y position 150 seems to be ignored completely.  I've tried and failed to position and size forms to precisely what and where I want them, with many variations of sizes and positions.

The Wait function seems to be needed otherwise the function runs against the main window, not the form (I guess a different way of getting the Frame and Window might work better), but this isn't the issue at hand.

The only environment that works on my ubuntu system is without gtk2 or gtk3, where setPosSize works perfectly every time, so I'm running:

Version: 6.1.3.1
Build ID: 1:6.1.3~rc1-0ubuntu0.18.04.1
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: x11; 
Locale: en-GB (en_GB.UTF-8); Calc: group threaded

I'd much prefer it if Base forms would preserve the size (and hopefully position) when edited and saved, but using setPosSize on the forms I use most has alleviated the problem somewhat, even if the x11 rendering is not too nice.  

The setPosSize solution does, of course, fail when I run the application on a different system, where other sizes are needed, and I really don't want to have to modify code every time I move apps around (whereas opening, reshaping and saving each form would be much, much easier).

My memory still tells me that LO used to remember form sizes, once upon a time.
Comment 1 tim 2018-10-15 15:13:51 UTC
I tried under Windows 10 and the setPosSize seems to work OK, so may be just ubuntu, or gnome.
Comment 2 tim 2018-10-15 17:02:11 UTC
Just in case someone wonders why I don't try the ubuntu ppa gtk3, this version:

Version: 6.1.3.1
Build ID: 1:6.1.3~rc1-0ubuntu0.18.04.1
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: en-GB (en_GB.UTF-8); Calc: group threaded

also gets the positions wrong.
Comment 3 Drew Jensen 2018-10-15 19:53:45 UTC
Testing with Ubuntu 18.04 LibreOffice 6.2Alpha1 also 6.0.7 and 5.4.7
Tried with OpenGL enabled and disabled and with GTK2 and GTK3 (where I could).

The problem is persistent across all the different setups, and requires the following to manifest. 

First how to make it work every time. If you open the form for editing before you do anything else the macro does correctly resize and position the form window. Close the form without saving it. Now if you open the form in data entry mode you notice that it initally opens full screen and then it is properly resized and positioned.

How to make it fail. Open the form for editing or data entry mode again, then maximize the form, now close it and again answer no if/when asked to save it. Now when the form is opened for data entry it starts out at full screen and stays at full screen.

NOTE: 5.4 has the worst problems as it does not position the form properly but 6.0 and 6.2Alpha do. I didn't check 6.1 but I doubt it would be different.
Comment 4 tim 2018-10-16 08:22:17 UTC
On my system I never get it to set the y position properly with gtk2 or gtk3.

With X11 it's fine, but I did find I needed to add

oWin.IsMaximized = false

to the macro, otherwise it's sometimes full screen.
Comment 5 tim 2018-10-23 11:57:20 UTC
(In reply to Drew Jensen from comment #3)
> Testing with Ubuntu 18.04 LibreOffice 6.2Alpha1 also 6.0.7 and 5.4.7
> Tried with OpenGL enabled and disabled and with GTK2 and GTK3 (where I
> could).
> 
> The problem is persistent across all the different setups, and requires the
> following to manifest. 
> 
> First how to make it work every time. If you open the form for editing
> before you do anything else the macro does correctly resize and position the
> form window. Close the form without saving it. Now if you open the form in
> data entry mode you notice that it initally opens full screen and then it is
> properly resized and positioned.
> 
> How to make it fail. Open the form for editing or data entry mode again,
> then maximize the form, now close it and again answer no if/when asked to
> save it. Now when the form is opened for data entry it starts out at full
> screen and stays at full screen.
> 
> NOTE: 5.4 has the worst problems as it does not position the form properly
> but 6.0 and 6.2Alpha do. I didn't check 6.1 but I doubt it would be
> different.
I've tried again. On my system it never sets x and y correctly, even using your first 'works every time' suggestion.
Comment 6 tim 2019-08-05 16:50:24 UTC
I'm now on Version: 6.2.6.1
Build ID: 1:6.2.6~rc1-0ubuntu0.19.04.1~lo1
CPU threads: 8; OS: Linux 5.0; UI render: default; VCL: x11; 
Locale: en-GB (en_GB.UTF-8); UI-Language: en-GB
Calc: threaded

The gtk2/3 problem remains as it was.  The setpos statements do not work properly.  The dimensions are OK, but the positions are not. 

I know this may seem trivial, and I do have a work around that makes the forms ugly (by not using gtk2/3) but it's a niggling bug none the less.
Comment 7 QA Administrators 2021-08-05 03:51:27 UTC Comment hidden (obsolete)
Comment 8 tim 2021-08-05 07:22:52 UTC
I am still having to avoid the gnome and gtk3 versions because of this bug.  So I am running:

Version: 7.1.5.2 / LibreOffice Community
Build ID: 10(Build:2)
CPU threads: 8; OS: Linux 5.11; UI render: default; VCL: x11
Locale: en-GB (en_GB.UTF-8); UI: en-GB
Ubuntu package version: 1:7.1.5~rc2-0ubuntu0.21.04.1~lo1
Calc: threaded

If I add libreoffice-gnome and gtk3 back in the problem remains.  The look of libreoffice is much better, but I still cannot position windows.  I have rechecked that the problem remains with:

Version: 7.1.5.2 / LibreOffice Community
Build ID: 10(Build:2)
CPU threads: 8; OS: Linux 5.11; UI render: default; VCL: gtk3
Locale: en-GB (en_GB.UTF-8); UI: en-GB
Ubuntu package version: 1:7.1.5~rc2-0ubuntu0.21.04.1~lo1
Calc: threaded
Comment 9 TISSENDIER Pierre 2022-11-01 15:06:49 UTC
Confirmed in
Version: 7.4.2.3 / LibreOffice Community
Build ID: 382eef1f22670f7f4118c8c2dd222ec7ad009daf
CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded
Comment 10 TISSENDIER Pierre 2023-08-03 05:46:32 UTC
Confirmed in 

Version: 7.5.4.2 (X86_64) / LibreOffice Community
Build ID: 36ccfdc35048b057fd9854c757a8b67ec53977b6
CPU threads: 4; OS: Linux 5.19; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded
Comment 11 TISSENDIER Pierre 2023-10-20 15:47:29 UTC
When will this bug be solved !!!!
Comment 12 TISSENDIER Pierre 2023-11-21 09:26:02 UTC
Version: 7.6.2.1 (X86_64) / LibreOffice Community
Build ID: 56f7684011345957bbf33a7ee678afaf4d2ba333
CPU threads: 4; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded

Confirmed for ME with ubuntu 23.10 under Wayland and under Xorg
But my graphic card (Intel® HD Graphics 4000 (IVB GT2)) is perhaps too old

No problem under windows 10 with recent computer.
Comment 13 TISSENDIER Pierre 2024-02-24 10:39:52 UTC
Confirmed in
Version: 24.2.0.3 (X86_64) / LibreOffice Community
Build ID: da48488a73ddd66ea24cf16bbc4f7b9c08e9bea1
CPU threads: 4; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded

I looked a lot, because even my programs in Python for QT do not work.
I found this:
https://github.com/gotk3/gotk3/issues/397
I leave a comment here if someone run in the same issue.
After talking with gnome team in irc, they said that wayland doesn't let an application move its windows.

So Wayland is involved.

Is it too difficult to find a solution at Libre Office?

Thank a lot