[Lazarus] IDE CoolBar issue

Ondrej Pokorny lazarus at kluug.net
Wed Sep 9 09:26:08 CEST 2015

On 09.09.2015 08:34, Juha Manninen wrote:
> On Wed, Sep 9, 2015 at 8:09 AM, patspiper <patspiper at gmail.com> wrote:
>> The patch works indeed. I haven't inspected the dektop manager code, but
>> QueueAsync call may be more suited for the task than a timer.
> Another choice in OnIdle handler.
> The benefit would be that also the initial update of the IDE Coolbar
> would be delayed and the IDE would be ready for editing sooner.
> Lazarus still starts a lot slower than many competing advanced
> programmers' editors. There is no good reason for it because we don't
> use virtual machines like Java or .NET based systems do (including
> Delphi now).
> I optimized the Component Palette startup a lot but there is still more to do.
> Juha
Attempt number 2 using QueueAsyncCall and a class variable (I don't like 
global variables for such things but one could be used here as well if 
you like it more).

-------------- next part --------------
Index: ide/desktopmanager.pas
--- ide/desktopmanager.pas	(revision 49788)
+++ ide/desktopmanager.pas	(working copy)
@@ -62,8 +62,11 @@
   TShowDesktopsToolButton = class(TIDEToolButton)
+  private class var
+    DoChangeDesktopName: string;
     procedure ChangeDesktop(Sender: TObject);
+    class procedure DoChangeDesktop({%H-}Data: PtrInt);
     procedure SaveAsDesktop(Sender: TObject);
     procedure MenuOnPopup(Sender: TObject);
@@ -143,11 +146,17 @@
 procedure TShowDesktopsToolButton.ChangeDesktop(Sender: TObject);
+  DoChangeDesktopName := (Sender as TShowDesktopItem).DesktopName;
+  Application.QueueAsyncCall(@DoChangeDesktop, 1);
+class procedure TShowDesktopsToolButton.DoChangeDesktop(Data: PtrInt);
   xDesktopName: string;
   xDesktop: TDesktopOpt;
-  xDesktopName := (Sender as TShowDesktopItem).DesktopName;
+  xDesktopName := DoChangeDesktopName;
   if xDesktopName = '' then

More information about the Lazarus mailing list