From 6f521e8b7d0fb60f173be56808559cac2e0c3a14 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Sat, 4 Nov 2017 22:34:09 +0000 Subject: tdf#112770 Filter input on the correct window This filters the input event on the correct window in SalX11Display::Dispatch. I'm not sure there is a point of skipping the filter for input events, which are not on our windows, as we already filter all non-key input events. Has been like that in the initial import, but whi knows what input methods do with different events... After reviewing the original "Unify SalUserEvent handling" commit e310c00709ed4fe0788aeff5142e3581d8b4d319, I found two more places, which now have handled user events wrong and fixed them. Change-Id: I50a60f6dacc3f795e659b6fbfd107548d07a3341 Reviewed-on: https://gerrit.libreoffice.org/44371 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski --- vcl/unx/generic/window/salframe.cxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'vcl/unx/generic/window/salframe.cxx') diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index 03fc70c40676..4e62877f40e0 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -492,14 +492,17 @@ void X11SalFrame::Init( SalFrameStyleFlags nSalFrameStyle, SalX11Screen nXScreen // check if this is really one of our own frames // do not change the input mask in that case + bool bIsReallyOurFrame = false; for (auto pSalFrame : GetDisplay()->getFrames() ) - { if ( static_cast( pSalFrame )->GetWindow() == mhForeignParent ) { - XSelectInput( GetDisplay()->GetDisplay(), mhForeignParent, StructureNotifyMask | FocusChangeMask ); - XSelectInput( GetDisplay()->GetDisplay(), mhShellWindow, StructureNotifyMask | FocusChangeMask ); + bIsReallyOurFrame = true; break; } + if (!bIsReallyOurFrame) + { + XSelectInput( GetDisplay()->GetDisplay(), mhForeignParent, StructureNotifyMask | FocusChangeMask ); + XSelectInput( GetDisplay()->GetDisplay(), mhShellWindow, StructureNotifyMask | FocusChangeMask ); } } else @@ -520,6 +523,7 @@ void X11SalFrame::Init( SalFrameStyleFlags nSalFrameStyle, SalX11Screen nXScreen { // find the last document window (if any) const X11SalFrame* pFrame = nullptr; + bool bIsDocumentWindow = false; for (auto pSalFrame : GetDisplay()->getFrames() ) { pFrame = static_cast< const X11SalFrame* >( pSalFrame ); @@ -530,10 +534,13 @@ void X11SalFrame::Init( SalFrameStyleFlags nSalFrameStyle, SalX11Screen nXScreen || ! pFrame->GetUnmirroredGeometry().nHeight ) ) + { + bIsDocumentWindow = true; break; + } } - if( pFrame ) + if( bIsDocumentWindow ) { // set a document position and size // the first frame gets positioned by the window manager -- cgit