https://bugs.documentfoundation.org/show_bug.cgi?id=151676

            Bug ID: 151676
           Summary: Odd behavior when setting window position/size with
                    setPosSize
           Product: LibreOffice
           Version: 4.3.7.2 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: [email protected]
          Reporter: [email protected]

I am trying to position documents side by side using a macro. I started by
using Windows 10 snap feature to position two windows and retrieved their
position and size. 

Dim w: w = e.CurrentController.Frame.getContainerWindow()
print "x=" & w.PosSize.X & " y=" & w.PosSize.Y _
             & " w=" & w.PosSize.width & " h=" & w.PosSize.height


Then I tried to use .setPosSize on other windows but it didn't work exactly.
Position was off.


Dim w: w = altDoc.CurrentController.Frame.ContainerWindow
w.setPosSize(961,111,958,968,15)

'Coordinates for left side
'       x=1 y=111 w=958 h=968
'Coordinates for right side
'       x=961 y=111 w=958 h=968

Behavior is the same with v4.3 and latest v7.4.2.3

When snapping a window (sides or corners) and using the following code you can
see the problem,

Sub TestPosSize
  Dim oDoc, oWindow, posSize
  oDoc=ThisComponent
  oWindow=ThisComponent.CurrentController.frame.ContainerWindow
  oWindow.IsMaximized=False
  posSize=oWindow.posSize
  With posSize
    oWindow.setPosSize .X, .Y, .width, .Height, 15 
  End With
End Sub

In Windows10 the above code, 
 - if the window is centered it does nothing. 
 - if snapped it moves it by about 10px
 - if part of the window is outside viewable area (left/right), it moves it
back in + 10px. 
 - If window below bottom it snaps vertically!?! (I have Windows taskbar at the
top should it matter).

In Ubuntu 21 with LO 7.1 
 - if snapped it moves and resizes window
 - if centered, repeated runs makes window smaller


Might this explain why when opening saved documents they never appear at their
exact previous position?

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to