On 09.09.2015 08:34, Juha Manninen wrote:
On Wed, Sep 9, 2015 at 8:09 AM, patspiper <[email protected]> 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).

Ondrej
Index: ide/desktopmanager.pas
===================================================================
--- ide/desktopmanager.pas      (revision 49788)
+++ ide/desktopmanager.pas      (working copy)
@@ -62,8 +62,11 @@
   end;
 
   TShowDesktopsToolButton = class(TIDEToolButton)
+  private class var
+    DoChangeDesktopName: string;
   private
     procedure ChangeDesktop(Sender: TObject);
+    class procedure DoChangeDesktop({%H-}Data: PtrInt);
     procedure SaveAsDesktop(Sender: TObject);
     procedure MenuOnPopup(Sender: TObject);
 
@@ -143,11 +146,17 @@
 end;
 
 procedure TShowDesktopsToolButton.ChangeDesktop(Sender: TObject);
+begin
+  DoChangeDesktopName := (Sender as TShowDesktopItem).DesktopName;
+  Application.QueueAsyncCall(@DoChangeDesktop, 1);
+end;
+
+class procedure TShowDesktopsToolButton.DoChangeDesktop(Data: PtrInt);
 var
   xDesktopName: string;
   xDesktop: TDesktopOpt;
 begin
-  xDesktopName := (Sender as TShowDesktopItem).DesktopName;
+  xDesktopName := DoChangeDesktopName;
   if xDesktopName = '' then
     Exit;
 
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to