View Issue Details

IDProjectCategoryView StatusLast Update
0019547LazarusIDEpublic2012-02-05 13:15
ReporterAmar ŠahinovićAssigned ToMartin Friebe 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version0.9.30Product Build 
Target VersionFixed in Version0.9.31 (SVN) 
Summary0019547: XFCE (gtr2) focus issue - Editor loses focus after autocomplete (single button mode in taskbar)
DescriptionWhen single button mode in taskbar is enabled, editor loses focus after selecting an item from autocomplete list with Enter. Focus is given to the pallete window, and I need to click on the editor to restore focus.
Additional InformationArch Linux 64bit
TagsNo tags attached.
Fixed in Revision35153
LazTarget1.2
WidgetsetGTK 2
Attached Files

Relationships

related to 0017253 closedMartin Friebe GTK2 focus is report wrong 

Activities

Juha Manninen

2011-06-18 17:52

developer   ~0049186

Can you please verify the Lazarus version is 0.9.30 instead of trunk 0.9.31.

Juha Manninen

2011-06-19 10:01

developer   ~0049195

Can't reproduce here. Tested with both 0.9.30 and trunk.
It could be a GTK2 version related issue.

Amar Šahinović

2011-06-19 22:04

reporter   ~0049212

I'm running XFCE, Lazarus is from Arch repo, and this is from Help->About:

Version: 0.9.30
Date: 2011-06-12
FPC Version: 2.4.4
SVN Revision: 29738
x86_64-linux-gtk-2

Juha Manninen

2011-07-24 23:55

developer   ~0050132

Can somebody reproduce this?

Juha Manninen

2011-08-10 12:06

developer   ~0050680

Resolving as "unable to reproduce".

Jean-Philippe Fleury

2011-12-21 06:57

reporter   ~0055192

I too have this bug, and I can always reproduce it. My version is:

Lazarus 0.9.30-2build1 r29738 FPC 2.4.4 i386-linux-gtk 2

I use Lazarus on XFCE 4.8 and Xubuntu 11.10.

chronos

2012-01-14 22:24

reporter   ~0055758

This issue is not solved and should be reopened.

Workaround for this problem is commenting out line 8014 in lazarus/ide/sourceeditor.pp as on revision 34737:
// if PluginFocused and (ActiveEditor<>nil) then
    TSourceEditor(ActiveEditor).FocusEditor;

Probably PluginFocused is not set and then FocusEditor is not done. But fixing this require more knowledge of code context and more digging.

There is some note about bug in Xfce in code. But who knows if it still apply to Xfce 4.8.


procedure TSourceEditorManagerBase.DeactivateCompletionForm;
var
  PluginFocused: Boolean;
begin
  if ActiveCompletionPlugin<>nil then begin
    ActiveCompletionPlugin.Cancel;
    FActiveCompletionPlugin:=nil;
  end;

  if (FDefaultCompletionForm=nil) or
     (FDefaultCompletionForm.CurrentCompletionType = ctNone)
  then
    exit;

  // Do not move focus, if it was moved by user
  PluginFocused := FDefaultCompletionForm.TheForm.Focused;

  // clear the IdentifierList (otherwise it would try to update everytime
  // 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;

  (* Ensure focus *after* the form was closed.
     This is the normal implementation (all but XFCE)
  *)
  if PluginFocused and (ActiveEditor<>nil) then
    TSourceEditor(ActiveEditor).FocusEditor;
end;

Martin Friebe

2012-01-15 13:03

manager   ~0055769

The reason, why
  if PluginFocused and (ActiveEditor<>nil) then
is needed, is that you can leave the autocomplete by clicking on *any* other window. Doing so will cancel the auto-complete. But because the user clicked on an other window, it is expected that whatever window the user clicked will be focused.
For example if the user clicked on the design from, then moving focus back to the editor would be wrong.

Martin Friebe

2012-01-15 13:34

manager   ~0055772

Last edited: 2012-01-15 14:02

Please try with 0.9.31

If still not working to try to get a stack trace at the start of the procedure. It should look like this:

#0 DEACTIVATECOMPLETIONFORM(0x84109a8) at sourceeditor.pp:8004
0000001 CCCOMPLETE(0x8338160, @0x652f7f4: 0x0, 0x120afff8 'FDefaultCompletionForm', @0x652f7e8: {X = 3, Y = 8005}, @0x652f7e0: {X = 3, Y = 8005}, '', []) at sourceeditor.pp:1722
0000002 VALIDATE(0x8338160, 0xc8151c0, '', []) at syncompletion.pas:1619
0000003 KEYDOWN(0xc8151c0, @0x652fbbc: 13, []) at syncompletion.pas:662
0000004 KEYDOWNBEFOREINTERFACE(0xc8151c0, @0x652fbbc: 13, []) at include\wincontrol.inc:5518
0000005 DOKEYDOWNBEFOREINTERFACE(0xc8151c0, @0x652fbb8: {MSG = 48384, CHARCODE = 13, UNUSED = 43690, KEYDATA = 1835009, RESULT = 0}, false) at include\wincontrol.inc:5687
0000006 CNKEYDOWN(0xc8151c0, @0x652fbb8: {MSG = 48384, CHARCODE = 13, UNUSED = 43690, KEYDATA = 1835009, RESULT = 0}) at include\wincontrol.inc:6974

-----------------
Also try to find which element is focused. Compile the entire IDE (this includes the LCL) with VerboseFocus, VerboseKeys and VerboseIDECompletionBox defined. And attached the log file.

chronos

2012-02-03 21:48

reporter   ~0056299

Problem is that PluginFocused should be set to True but it isn't.
  PluginFocused := FDefaultCompletionForm.TheForm.Focused;
But if completionform is not focused than who is? It could be problem of xfce but something have to have focus.

It is indeed superhuman problem to find how or where VerboseFocus, VerboseKeys and VerboseIDECompletionBox should be set. If lazarus ide project is opened in another lazarus ide than compilation works weird or not at all and I have to run manually make to recompile modifications. And make is not my friend as it is low level, cryptic and hard to configure tool.

Perhaps I can arrange virtual machine with preinstalled xubuntu and nx remote desktop for you and you can try debug problem by yourself. Lazarus compilation and debugging and their low level stuff is really not intuitive.

#0 TSOURCEEDITORMANAGERBASE__DEACTIVATECOMPLETIONFORM(<error reading variable>) at sourceeditor.pp:8042
0000001 TSOURCEEDITCOMPLETION__CCCOMPLETE(0x0, 0x0, {X = 19, Y = 8020}, {X = 19, Y = 8020}, '', [], <error reading variable>) at sourceeditor.pp:1726
0000002 TSYNCOMPLETION__VALIDATE(0xab425140, '', [], <error reading variable>) at syncompletion.pas:1620
0000003 TSYNBASECOMPLETIONFORM__KEYDOWN(13, [], <error reading variable>) at syncompletion.pas:662
0000004 TSYNBASECOMPLETIONFORM__SDKEYDOWN(0xab440560, 13, [], <error reading variable>) at syncompletion.pas:889
0000005 TWINCONTROL__KEYDOWN(13, [], <error reading variable>) at ./include/wincontrol.inc:5510
0000006 TWINCONTROL__KEYDOWNBEFOREINTERFACE(13, [], <error reading variable>) at ./include/wincontrol.inc:5518
0000007 TWINCONTROL__DOKEYDOWNBEFOREINTERFACE({MSG = 48384, CHARCODE = 13, UNUSED = 0, KEYDATA = 2359297, RESULT = 0}, false, <error reading variable>) at ./include/wincontrol.inc:5687
0000008 TWINCONTROL__CNKEYDOWN({MSG = 48384, CHARCODE = 13, UNUSED = 0, KEYDATA = 2359297, RESULT = 0}, <error reading variable>) at ./include/wincontrol.inc:6977
0000009 SYSTEM_TOBJECT_$__DISPATCH$formal at :0
0000010 RAISELOOP(0xbfffed00) at ./include/wincontrol.inc:6886
0000011 TWINCONTROL__WNDPROC({MSG = 48384, WPARAM = 13, LPARAM = 2359297, RESULT = 0, WPARAMLO = 13, WPARAMHI = 0, LPARAMLO = 1, LPARAMHI = 36, RESULTLO = 0, RESULTHI = 0}, <error reading variable>) at ./include/wincontrol.inc:5276
0000012 DELIVERMESSAGE(0xab440560, void) at lclmessageglue.pas:113
0000013 DELIVERMESSAGE(0xab440560, void) at gtk2proc.inc:3555
0000014 DELIVERKEYMESSAGE(0xab440560, void, 0xbfffed20) at gtk2proc.inc:1957
0000015 HANDLEGTKKEYUPDOWN(0x931cd58, 0x933b9e0, 0xab425140, true, true, 0x8944d08 'key-press-event') at gtk2proc.inc:2313
0000016 GTK2KEYDOWN(0x931cd58, 0x933b9e0, 0xab425140) at gtk2widgetset.inc:84
0000017 ?? at :0
0000018 g_closure_invoke at :0
0000019 ?? at :0
0000020 g_signal_emit_valist at :0
0000021 g_signal_emit at :0
0000022 ?? at :0
0000023 gtk_propagate_event at :0
0000024 gtk_main_do_event at :0
0000025 ?? at :0
0000026 g_main_context_dispatch at :0
0000027 ?? at :0
0000028 g_main_context_iteration at :0
0000029 TGTK2WIDGETSET__APPWAITMESSAGE(<error reading variable>) at gtk2widgetset.inc:2513
0000030 TAPPLICATION__IDLE(true, <error reading variable>) at ./include/application.inc:417
0000031 TAPPLICATION__HANDLEMESSAGE(<error reading variable>) at ./include/application.inc:1281
0000032 TAPPLICATION__RUNLOOP(<error reading variable>) at ./include/application.inc:1413
0000033 TWIDGETSET__APPRUN(0x80a1b40 <TAPPLICATION__RUNLOOP>, <error reading variable>) at ./include/interfacebase.inc:60
0000034 TAPPLICATION__RUN(<error reading variable>) at ./include/application.inc:1401
0000035 main at lazarus.pp:119

Martin Friebe

2012-02-04 22:07

manager   ~0056493

Reproduced

Claudio Romero

2012-02-05 00:21

reporter   ~0056501

Last edited: 2012-02-05 00:22

Can test if this is the problem ?

XFCE has this option (can give the focus to a disabled window)

http://www.lazarus.freepascal.org/index.php/topic,14555.msg77782.html#msg77782

For avoid this.
Menu->Settings->Window Manager->Focus->Raise window when clicking inside application window (unckeck)

Martin Friebe

2012-02-05 13:14

manager   ~0056511

Please test and close if ok

Issue History

Date Modified Username Field Change
2011-06-12 19:43 Amar Šahinović New Issue
2011-06-12 19:43 Amar Šahinović Widgetset => GTK 2
2011-06-18 17:49 Juha Manninen Status new => assigned
2011-06-18 17:49 Juha Manninen Assigned To => Juha Manninen
2011-06-18 17:52 Juha Manninen Note Added: 0049186
2011-06-18 17:53 Juha Manninen LazTarget => -
2011-06-18 17:53 Juha Manninen Status assigned => feedback
2011-06-19 10:01 Juha Manninen Note Added: 0049195
2011-06-19 22:04 Amar Šahinović Note Added: 0049212
2011-07-24 23:55 Juha Manninen Note Added: 0050132
2011-08-10 12:06 Juha Manninen Status feedback => resolved
2011-08-10 12:06 Juha Manninen Resolution open => unable to reproduce
2011-08-10 12:06 Juha Manninen Note Added: 0050680
2011-12-21 06:57 Jean-Philippe Fleury Note Added: 0055192
2012-01-14 22:24 chronos Note Added: 0055758
2012-01-15 09:09 Juha Manninen Status resolved => assigned
2012-01-15 09:09 Juha Manninen Resolution unable to reproduce => reopened
2012-01-15 09:10 Juha Manninen Assigned To Juha Manninen =>
2012-01-15 09:11 Juha Manninen Status assigned => new
2012-01-15 13:03 Martin Friebe Note Added: 0055769
2012-01-15 13:34 Martin Friebe Note Added: 0055772
2012-01-15 13:35 Martin Friebe Status new => feedback
2012-01-15 13:38 Martin Friebe Relationship added related to 0017253
2012-01-15 14:02 Martin Friebe Note Edited: 0055772
2012-02-03 21:48 chronos Note Added: 0056299
2012-02-04 10:53 Zeljan Rikalo LazTarget - => 1.2
2012-02-04 22:07 Martin Friebe Note Added: 0056493
2012-02-04 22:07 Martin Friebe Status feedback => assigned
2012-02-04 22:07 Martin Friebe Summary Editor loses focus after autocomplete (single button mode in taskbar) => XFCE (gtr2) focus issue - Editor loses focus after autocomplete (single button mode in taskbar)
2012-02-05 00:21 Claudio Romero Note Added: 0056501
2012-02-05 00:22 Claudio Romero Note Edited: 0056501
2012-02-05 13:14 Martin Friebe Fixed in Revision => 35153
2012-02-05 13:14 Martin Friebe Status assigned => resolved
2012-02-05 13:14 Martin Friebe Fixed in Version => 0.9.31 (SVN)
2012-02-05 13:14 Martin Friebe Resolution reopened => fixed
2012-02-05 13:14 Martin Friebe Assigned To => Martin Friebe
2012-02-05 13:14 Martin Friebe Note Added: 0056511
2012-02-05 13:15 Martin Friebe Target Version => 0.99.0