vcl/win/window/salframe.cxx |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 0d5fcb9abdead51a55f1f611d59fd0128ace57a8
Author:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
AuthorDate: Thu Sep 1 14:19:50 2022 +0200
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
CommitDate: Mon Sep 12 08:46:39 2022 +0200

    Fix dropdown mispositioned
    
    Only skip the relative positioning when the window is indeed a dialog.
    
    Follow up fix for a49245e04d45735aa76ad7720657c83530ba9ed8
    
    Change-Id: Idbd8327a943c512f0a617cb0ca72e9caeb2e61e3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139204
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 1335c61ad170..c16a8fd2e8d1 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -1257,13 +1257,16 @@ void WinSalFrame::SetPosSize( tools::Long nX, 
tools::Long nY, tools::Long nWidth
     nWidth  = aWinRect.right - aWinRect.left + 1;
     nHeight = aWinRect.bottom - aWinRect.top + 1;
 
+    HWND hWndParent = ImplGetParentHwnd(mhWnd);
     // For dialogs (WS_POPUP && WS_DLGFRAME), we need to find the "real" 
parent,
     // in case multiple dialogs are stacked on each other
-    // (wo don't want to position the second dialog relative to the first one, 
but relative to the main window)
-    HWND hWndParent = ImplGetParentHwnd(mhWnd);
-    while ( hWndParent && (GetWindowStyle( hWndParent ) & WS_POPUP) &&  
(GetWindowStyle( hWndParent ) & WS_DLGFRAME) )
+    // (we don't want to position the second dialog relative to the first one, 
but relative to the main window)
+    if ( (GetWindowStyle( mhWnd ) & WS_POPUP) &&  (GetWindowStyle( mhWnd ) & 
WS_DLGFRAME) ) // mhWnd is a dialog
     {
-        hWndParent = ::ImplGetParentHwnd( hWndParent );
+        while ( hWndParent && (GetWindowStyle( hWndParent ) & WS_POPUP) &&  
(GetWindowStyle( hWndParent ) & WS_DLGFRAME) )
+        {
+            hWndParent = ::ImplGetParentHwnd( hWndParent );
+        }
     }
 
     if ( !(nPosSize & SWP_NOMOVE) && hWndParent )

Reply via email to