[Libreoffice-commits] core.git: include/vcl vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Oct 2 19:01:51 UTC 2018


 include/vcl/window.hxx              |    2 +-
 vcl/source/window/accessibility.cxx |    4 ++--
 vcl/source/window/builder.cxx       |    3 +--
 vcl/source/window/dlgctrl.cxx       |    6 +++---
 vcl/source/window/stacking.cxx      |    2 +-
 vcl/source/window/window2.cxx       |    4 ++--
 6 files changed, 10 insertions(+), 11 deletions(-)

New commits:
commit 408dbdd28037917986f6d2cdc290f935ffefc60e
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Mon Oct 1 12:19:12 2018 +0000
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Tue Oct 2 21:01:27 2018 +0200

    tdf#120234 ignore all proxy windows
    
    I thought just border windows can act as proxies, but this bug
    proves me wrong; also floating windows set mpClientWindow and may
    have an additional nested proxy border window.
    Interestingly proxies can have multiple children, which I tested
    with a temporary assertion I added!?
    
    So just ignore all proxy windows until we find a real one, And
    drop the assertion as it doesn't make sense any more.
    
    I'm just wondering why I always read Child instead of Client...
    
    Change-Id: I83a1a5743b434399aae361cb14058993ba60c83c
    Reviewed-on: https://gerrit.libreoffice.org/61196
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index c6e560baeb95..3227d6d6c038 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -555,7 +555,7 @@ public:
     SalFrame*                           ImplGetFrame() const;
     SAL_DLLPRIVATE ImplFrameData*       ImplGetFrameData();
 
-                   vcl::Window*         ImplGetWindow();
+                   vcl::Window*         ImplGetWindow() const; ///< if this is a proxy return the client, otherwise itself
     SAL_DLLPRIVATE ImplWinData*         ImplGetWinData() const;
     SAL_DLLPRIVATE vcl::Window*         ImplGetClientWindow() const;
     SAL_DLLPRIVATE vcl::Window*         ImplGetDlgWindow( sal_uInt16 n, GetDlgWindowType nType, sal_uInt16 nStart = 0, sal_uInt16 nEnd = 0xFFFF, sal_uInt16* pIndex = nullptr );
diff --git a/vcl/source/window/accessibility.cxx b/vcl/source/window/accessibility.cxx
index 947ddd87a7bd..6802b1a604f7 100644
--- a/vcl/source/window/accessibility.cxx
+++ b/vcl/source/window/accessibility.cxx
@@ -397,7 +397,7 @@ sal_uInt16 Window::getDefaultAccessibleRole() const
                 nRole = accessibility::AccessibleRole::FRAME;
             else if( IsScrollable() )
                 nRole = accessibility::AccessibleRole::SCROLL_PANE;
-            else if( const_cast<vcl::Window*>(this)->ImplGetWindow()->IsMenuFloatingWindow() )
+            else if( this->ImplGetWindow()->IsMenuFloatingWindow() )
                 nRole = accessibility::AccessibleRole::WINDOW;      // #106002#, contextmenus are windows (i.e. toplevel)
             else
                 // #104051# WINDOW seems to be a bad default role, use LAYEREDPANE instead
@@ -527,7 +527,7 @@ OUString Window::GetAccessibleDescription() const
     {
         // Special code for help text windows. ZT asks the border window for the
         // description so we have to forward this request to our inner window.
-        const vcl::Window* pWin = const_cast<vcl::Window *>(this)->ImplGetWindow();
+        const vcl::Window* pWin = this->ImplGetWindow();
         if ( pWin->GetType() == WindowType::HELPTEXTWINDOW )
             aAccessibleDescription = pWin->GetHelpText();
         else
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index c61cbc878864..03eee84e4a97 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -3898,8 +3898,7 @@ VclBuilder::PackingData VclBuilder::get_window_packing_data(const vcl::Window *p
     //border windows placed around them which are what you get
     //from GetChild, so scoot up a level if necessary to get the
     //window whose position value we have
-    const vcl::Window *pPropHolder = pWindow->ImplGetWindowImpl()->mpClientWindow ?
-        pWindow->ImplGetWindowImpl()->mpClientWindow : pWindow;
+    const vcl::Window *pPropHolder = pWindow->ImplGetWindow();
 
     for (auto const& child : m_aChildren)
     {
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index 36dcf861c566..bda29cd62c1a 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -94,9 +94,9 @@ static vcl::Window* ImplGetCurTabWindow(const vcl::Window* pWindow)
 
 static vcl::Window* ImplGetSubChildWindow( vcl::Window* pParent, sal_uInt16 n, sal_uInt16& nIndex )
 {
-    // ignore border window
-    pParent = pParent->ImplGetWindow();
-    assert(pParent == pParent->ImplGetWindow());
+    // ignore all windows with mpClientWindow set
+    for (vcl::Window *pNewParent = pParent->ImplGetWindow();
+         pParent != pNewParent; pParent = pNewParent);
 
     vcl::Window* pFoundWindow = nullptr;
     vcl::Window* pWindow = firstLogicalChildOfParent(pParent);
diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx
index 00ea845972a8..b268f14960e0 100644
--- a/vcl/source/window/stacking.cxx
+++ b/vcl/source/window/stacking.cxx
@@ -1078,7 +1078,7 @@ vcl::Window* Window::GetWindow( GetWindowType nType ) const
                 return mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpOverlapWindow;
 
         case GetWindowType::Client:
-            return const_cast<vcl::Window*>(this)->ImplGetWindow();
+            return this->ImplGetWindow();
 
         case GetWindowType::RealParent:
             return ImplGetParent();
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index bce47fc40a00..9c75767561ea 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -825,12 +825,12 @@ OString Window::GetScreenshotId() const
 
 // --------- old inline methods ---------------
 
-vcl::Window* Window::ImplGetWindow()
+vcl::Window* Window::ImplGetWindow() const
 {
     if ( mpWindowImpl->mpClientWindow )
         return mpWindowImpl->mpClientWindow;
     else
-        return this;
+        return const_cast<vcl::Window*>(this);
 }
 
 ImplFrameData* Window::ImplGetFrameData()


More information about the Libreoffice-commits mailing list