From 700bc8469b625eec7016cc3c4dfdddb6b18f570c Mon Sep 17 00:00:00 2001 From: martin Date: Sun, 10 Oct 2010 19:29:45 +0000 Subject: [PATCH] IDE, SourceEditor: Workaround for XFCE issue with focus after completion-form. Issue #17533 git-svn-id: trunk@27643 - --- ide/sourceeditor.pp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/ide/sourceeditor.pp b/ide/sourceeditor.pp index 765f8ee728..378f20109b 100644 --- a/ide/sourceeditor.pp +++ b/ide/sourceeditor.pp @@ -7938,16 +7938,25 @@ begin // the codetools are used) CodeToolBoss.IdentifierList.Clear; FDefaultCompletionForm.CurrentCompletionType:=ctNone; + + (* SetFocus and Deactivate will all trigger this proc to be reentered. + Setting "CurrentCompletionType:=ctNone" ensures an immediate exit + *) + + (* Due to a bug under XFCE we must move focus before we close the form + This is relevant if the form is closed by enter/escape key + *) + if PluginFocused and (ActiveEditor<>nil) then + TSourceEditor(ActiveEditor).FocusEditor; + + (* hide/close the form *) FDefaultCompletionForm.Deactivate; - if PluginFocused and (ActiveEditor<>nil) then begin - {$IFDEF LCLQT} - // Need to force the correct form too (QT) + (* Ensure focus *after* the form was closed. + This is the normal implementation (all but XFCE) + *) + if PluginFocused and (ActiveEditor<>nil) then TSourceEditor(ActiveEditor).FocusEditor; - {$ELSE} - TSourceEditor(ActiveEditor).EditorComponent.SetFocus; - {$ENDIF} - end; end; procedure TSourceEditorManagerBase.RegisterCompletionPlugin(