View Issue Details

IDProjectCategoryView StatusLast Update
0036199LazarusLCLpublic2019-10-26 19:14
ReporterDavidAssigned ToJuha Manninen 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinuxOSOS Version
Product Version2.1 (SVN)Product Build 
Target VersionFixed in Version 
Summary0036199: Futher fixes for TrayIcon
DescriptionAnother in long line of reports about the TrayIcon on Linux. Recent release of Ubuntu 19.10 has required another revision as it too is now on the list of disros that must use LibAppIndicator3 with Gnome. Thats bad news as older instances of Ubuntu Gnome don't but we have to assume most Ubuntu users upgrade regularly and its almost certain that the next release, 20.05, the next long term release will be the same.

The good news is the patch actually reduces the size (and cpu effort) in UnityWSCtrl.

Attached is an SVN patch against trunk. Extensivly tested.

Davo
Steps To ReproduceTest the trayIcon on a number of different desktops.
Additional InformationI have tried, a bit to conform to indentation.....
TagsNo tags attached.
Fixed in Revisionr62124
LazTarget-
WidgetsetGTK 2
Attached Files
  • 36199.patch (1,963 bytes)
    Index: lcl/interfaces/gtk2/unitywsctrls.pas
    ===================================================================
    --- lcl/interfaces/gtk2/unitywsctrls.pas	(revision 62093)
    +++ lcl/interfaces/gtk2/unitywsctrls.pas	(working copy)
    @@ -260,41 +260,23 @@
       Initialized: Boolean;
     
     function UnityAppIndicatorInit: Boolean;
    +var
    +  Module: HModule;
    +  UseAppInd : string;
    +
    +  function NeedAppIndicator: boolean;
       var
    -    Module: HModule;
    -    UseAppInd : string;
    +    DeskTop : String;
    +  begin
    +    DeskTop := GetEnvironmentVariableUTF8('XDG_CURRENT_DESKTOP');
    +    // See the wiki for details of what extras these desktops require !!
    +    if (Desktop = 'GNOME')
    +      or (DeskTop = 'Unity')
    +      or (Desktop = 'Enlightenment')
    +      or (Desktop = 'ubuntu:GNOME') then exit(True);
    +    Result := False;
    +  end;
     
    -    function NeedAppIndicator: boolean;
    -    var
    -      DeskTop,  VersionSt : String;
    -      ProcFile: TextFile;
    -    begin
    -      DeskTop := GetEnvironmentVariableUTF8('XDG_CURRENT_DESKTOP');
    -      // See the wiki for details of what extras these desktops require !!
    -      if (DeskTop = 'Unity')
    -         or (Desktop = 'Enlightenment')
    -            then exit(True);
    -      if (DeskTop = 'GNOME') then begin
    -          {$PUSH}
    -          {$IOChecks off}
    -          AssignFile(ProcFile, '/proc/version');
    -          reset(ProcFile);
    -          if IOResult<>0 then exit(false);
    -          {$POP}
    -          readln(ProcFile, VersionSt);
    -          CloseFile(ProcFile);
    -          if ( (pos('mageia', VersionSt) > 0) or
    -            (pos('Debian', VersionSt) > 0) or
    -            (pos('Red Hat', VersionSt) > 0) or
    -            (pos('SUSE', VersionSt) > 0) )
    -            // 19.04 and earlier Ubuntu Gnome does not need LibAppIndicator3
    -            then exit(True);
    -      end;
    -      Result := False;
    -    end;
    -
    -
    -
       function TryLoad(const ProcName: string; var Proc: Pointer): Boolean;
       begin
         Proc := GetProcAddress(Module, ProcName);
    
    36199.patch (1,963 bytes)

Relationships

related to 0035723 closedJuha Manninen System Tray Icon must use libappindicator3 
related to 0036209 resolvedJuha Manninen Patch to make TrayIcon work in GTK3 

Activities

David

2019-10-20 13:29

reporter  

36199.patch (1,963 bytes)
Index: lcl/interfaces/gtk2/unitywsctrls.pas
===================================================================
--- lcl/interfaces/gtk2/unitywsctrls.pas	(revision 62093)
+++ lcl/interfaces/gtk2/unitywsctrls.pas	(working copy)
@@ -260,41 +260,23 @@
   Initialized: Boolean;
 
 function UnityAppIndicatorInit: Boolean;
+var
+  Module: HModule;
+  UseAppInd : string;
+
+  function NeedAppIndicator: boolean;
   var
-    Module: HModule;
-    UseAppInd : string;
+    DeskTop : String;
+  begin
+    DeskTop := GetEnvironmentVariableUTF8('XDG_CURRENT_DESKTOP');
+    // See the wiki for details of what extras these desktops require !!
+    if (Desktop = 'GNOME')
+      or (DeskTop = 'Unity')
+      or (Desktop = 'Enlightenment')
+      or (Desktop = 'ubuntu:GNOME') then exit(True);
+    Result := False;
+  end;
 
-    function NeedAppIndicator: boolean;
-    var
-      DeskTop,  VersionSt : String;
-      ProcFile: TextFile;
-    begin
-      DeskTop := GetEnvironmentVariableUTF8('XDG_CURRENT_DESKTOP');
-      // See the wiki for details of what extras these desktops require !!
-      if (DeskTop = 'Unity')
-         or (Desktop = 'Enlightenment')
-            then exit(True);
-      if (DeskTop = 'GNOME') then begin
-          {$PUSH}
-          {$IOChecks off}
-          AssignFile(ProcFile, '/proc/version');
-          reset(ProcFile);
-          if IOResult<>0 then exit(false);
-          {$POP}
-          readln(ProcFile, VersionSt);
-          CloseFile(ProcFile);
-          if ( (pos('mageia', VersionSt) > 0) or
-            (pos('Debian', VersionSt) > 0) or
-            (pos('Red Hat', VersionSt) > 0) or
-            (pos('SUSE', VersionSt) > 0) )
-            // 19.04 and earlier Ubuntu Gnome does not need LibAppIndicator3
-            then exit(True);
-      end;
-      Result := False;
-    end;
-
-
-
   function TryLoad(const ProcName: string; var Proc: Pointer): Boolean;
   begin
     Proc := GetProcAddress(Module, ProcName);
36199.patch (1,963 bytes)

Juha Manninen

2019-10-26 19:14

developer   ~0118858

Applied, thanks.

Issue History

Date Modified Username Field Change
2019-10-20 13:28 David New Issue
2019-10-20 13:29 David File Added: 36199.patch
2019-10-20 17:29 Juha Manninen Relationship added related to 0035723
2019-10-20 17:29 Juha Manninen Assigned To => Juha Manninen
2019-10-20 17:29 Juha Manninen Status new => assigned
2019-10-24 23:10 Juha Manninen Relationship added related to 0036209
2019-10-26 19:14 Juha Manninen Status assigned => resolved
2019-10-26 19:14 Juha Manninen Resolution open => fixed
2019-10-26 19:14 Juha Manninen Fixed in Revision => r62124
2019-10-26 19:14 Juha Manninen LazTarget => -
2019-10-26 19:14 Juha Manninen Widgetset GTK 2 => GTK 2
2019-10-26 19:14 Juha Manninen Note Added: 0118858