View Issue Details

IDProjectCategoryView StatusLast Update
0035983LazarusLCLpublic2019-10-06 15:49
ReporterMario BonatiAssigned ToJuha Manninen 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionreopened 
PlatformGTKOSLinuxOS Version19.04
Product Version2.1 (SVN)Product BuildLazarus 2.1.0 r61693M FPC 3.0.4 
Target VersionFixed in Version 
Summary0035983: TrayIcon.OnClick fires right click
DescriptionI can reproduce only on Linux. On Windows 10 it seem to be ok.

Run attached project.
When you Left click on TrayIcon, "OnClick" code is non executed, and the relative popup is showed
TagsNo tags attached.
Fixed in Revisionr61758, r61980
LazTarget-
WidgetsetGTK 2
Attached Files
  • ErrTrayIcon.tar.7z (6,600 bytes)
  • 0001-Test-for-KDE.patch (770 bytes)
    From ea713f46d92961e613f0658829a6dd6864287688 Mon Sep 17 00:00:00 2001
    From: juha <juha.manninen62@gmail.com>
    Date: Thu, 3 Oct 2019 05:31:11 +0300
    Subject: [PATCH] Test for KDE
    
    ---
     lcl/interfaces/gtk2/unitywsctrls.pas | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/lcl/interfaces/gtk2/unitywsctrls.pas b/lcl/interfaces/gtk2/unitywsctrls.pas
    index 8627c5338..c6acd3a24 100644
    --- a/lcl/interfaces/gtk2/unitywsctrls.pas
    +++ b/lcl/interfaces/gtk2/unitywsctrls.pas
    @@ -267,7 +267,7 @@ begin
       if Loaded then
         Exit(Initialized);
       Loaded:= True;
    -  if GetEnvironmentVariableUTF8('XDG_CURRENT_DESKTOP') <> 'Unity' then
    +  if GetEnvironmentVariableUTF8('XDG_CURRENT_DESKTOP') = 'KDE' then
       begin
         Initialized := False;
         Exit;
    -- 
    2.23.0
    
    

Relationships

related to 0035723 closedJuha Manninen System Tray Icon must use libappindicator3 

Activities

Mario Bonati

2019-08-19 20:21

reporter  

ErrTrayIcon.tar.7z (6,600 bytes)

Mario Bonati

2019-08-23 19:26

reporter   ~0117809

Problem caused by this patch:
https://bugs.freepascal.org/view.php?id=35723

Juha Manninen

2019-08-25 16:26

developer   ~0117832

You are right, OnClick code does not execute. Before r61621 (related issue) it executed OK with mouse Left click.
Now however the popup menu is shown with mouse Right click. It looks correct to me. Earlier (Before r61621) it never showed which looks wrong to me.
How should it behave? This may be a stupid question but I have not used TrayIcon much myself and apparently did not test the last change enough.
My OS is Manjaro Linux with KDE.

Mario Bonati

2019-08-25 17:39

reporter   ~0117833

Hi,
i am not sure to have understood your question.
I'm working with Ubuntu 19.04 64 bit.
Before r61621, right click showed popup and left click executed "OnClick"

Juha Manninen

2019-08-25 21:16

developer   ~0117834

Interesting. Here the popup menu did not show earlier. It apparently depends on Linux distro and version.

Juha Manninen

2019-08-25 21:55

developer   ~0117835

Last edited: 2019-08-25 21:56

View 2 revisions

Please test with r61758.
For some reason the test for Unity desktop was removed. I added the test and now OnClick works here. Your Ubuntu does not have Unity desktop either I guess.
The test was commented out also before r61621. I wonder how it worked in your system then.

Mario Bonati

2019-08-26 18:27

reporter   ~0117849

Yes, you're right, i'm using Cinnamon, not Unity.
With your patch, now all works fine.

Thanks, Mario

Mario Bonati

2019-08-27 18:09

reporter   ~0117857

Problem solved.

Thanks, Mario

Juha Manninen

2019-10-03 04:37

developer   ~0118264

Uploading a patch to test for KDE instead of Unity. The logic is reversed so that libappindicator3.so is loaded for all desktops except for KDE.
Please test.

Juha Manninen

2019-10-03 04:39

developer  

0001-Test-for-KDE.patch (770 bytes)
From ea713f46d92961e613f0658829a6dd6864287688 Mon Sep 17 00:00:00 2001
From: juha <juha.manninen62@gmail.com>
Date: Thu, 3 Oct 2019 05:31:11 +0300
Subject: [PATCH] Test for KDE

---
 lcl/interfaces/gtk2/unitywsctrls.pas | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lcl/interfaces/gtk2/unitywsctrls.pas b/lcl/interfaces/gtk2/unitywsctrls.pas
index 8627c5338..c6acd3a24 100644
--- a/lcl/interfaces/gtk2/unitywsctrls.pas
+++ b/lcl/interfaces/gtk2/unitywsctrls.pas
@@ -267,7 +267,7 @@ begin
   if Loaded then
     Exit(Initialized);
   Loaded:= True;
-  if GetEnvironmentVariableUTF8('XDG_CURRENT_DESKTOP') <> 'Unity' then
+  if GetEnvironmentVariableUTF8('XDG_CURRENT_DESKTOP') = 'KDE' then
   begin
     Initialized := False;
     Exit;
-- 
2.23.0

Mario Bonati

2019-10-03 18:49

reporter   ~0118285

I have changed
if GetEnvironmentVariableUTF8('XDG_CURRENT_DESKTOP') <> 'Unity' then
in
if GetEnvironmentVariableUTF8('XDG_CURRENT_DESKTOP') = 'KDE' then

Tested with the example attached i have same problem described at the begin of bugtrace.

P.S. the result of GetEnvironmentVariableUTF8('XDG_CURRENT_DESKTOP') in Cinnamon is 'X-Cinnamon'

Thanks, Mario

Juha Manninen

2019-10-03 19:56

developer   ~0118291

Yes. Should we make the same exception with 'X-Cinnamon' as I did with 'KDE'? Does it work in every system then?
Something like:
  DskTop := GetEnvironmentVariableUTF8('XDG_CURRENT_DESKTOP');
  if (DskTop = 'KDE') or (DskTop = 'X-Cinnamon') then
  ...

Mario Bonati

2019-10-04 08:00

reporter   ~0118307

I'm sorry, but I don't have the skills to answer you :(

Juha Manninen

2019-10-04 17:14

developer   ~0118326

I committed the test for KDE and Cinnamon in r61980:
* LCL-GTK2: Do not load LibAppIndicator3 lib for KDE and Cinnamon. Makes TrayIcon.OnClick work in most cases.
Please test.

Mario Bonati

2019-10-04 18:56

reporter   ~0118332

Tested now.
For me is ok.

Thanks, Mario

Juha Manninen

2019-10-05 21:50

developer   ~0118356

Resolving this one. An improved solution can be done later through the related issue.

Issue History

Date Modified Username Field Change
2019-08-19 20:21 Mario Bonati New Issue
2019-08-19 20:21 Mario Bonati File Added: ErrTrayIcon.tar.7z
2019-08-23 19:26 Mario Bonati Note Added: 0117809
2019-08-23 19:39 Juha Manninen Relationship added related to 0035723
2019-08-25 16:19 Juha Manninen Assigned To => Juha Manninen
2019-08-25 16:19 Juha Manninen Status new => assigned
2019-08-25 16:26 Juha Manninen Status assigned => feedback
2019-08-25 16:26 Juha Manninen LazTarget => -
2019-08-25 16:26 Juha Manninen Note Added: 0117832
2019-08-25 17:39 Mario Bonati Note Added: 0117833
2019-08-25 17:39 Mario Bonati Status feedback => assigned
2019-08-25 21:16 Juha Manninen Note Added: 0117834
2019-08-25 21:55 Juha Manninen Status assigned => feedback
2019-08-25 21:55 Juha Manninen Note Added: 0117835
2019-08-25 21:56 Juha Manninen Note Edited: 0117835 View Revisions
2019-08-26 18:27 Mario Bonati Note Added: 0117849
2019-08-26 18:27 Mario Bonati Status feedback => assigned
2019-08-26 21:57 Juha Manninen Status assigned => resolved
2019-08-26 21:57 Juha Manninen Resolution open => fixed
2019-08-26 21:57 Juha Manninen Fixed in Revision => r61758
2019-08-26 21:57 Juha Manninen Widgetset GTK 2 => GTK 2
2019-08-27 18:09 Mario Bonati Status resolved => closed
2019-08-27 18:09 Mario Bonati Note Added: 0117857
2019-10-03 04:37 Juha Manninen Status closed => assigned
2019-10-03 04:37 Juha Manninen Resolution fixed => reopened
2019-10-03 04:37 Juha Manninen Note Added: 0118264
2019-10-03 04:39 Juha Manninen File Added: 0001-Test-for-KDE.patch
2019-10-03 04:39 Juha Manninen Note Added: 0118265
2019-10-03 04:39 Juha Manninen Note Edited: 0118265 View Revisions
2019-10-03 18:49 Mario Bonati Note Added: 0118285
2019-10-03 19:56 Juha Manninen Note Added: 0118291
2019-10-03 19:56 Juha Manninen Status assigned => feedback
2019-10-04 08:00 Mario Bonati Note Added: 0118307
2019-10-04 08:00 Mario Bonati Status feedback => assigned
2019-10-04 17:14 Juha Manninen Note Added: 0118326
2019-10-04 17:14 Juha Manninen Fixed in Revision r61758 => r61758, r61980
2019-10-04 17:14 Juha Manninen Widgetset GTK 2 => GTK 2
2019-10-04 18:56 Mario Bonati Note Added: 0118332
2019-10-05 21:50 Juha Manninen Status assigned => resolved
2019-10-05 21:50 Juha Manninen Widgetset GTK 2 => GTK 2
2019-10-05 21:50 Juha Manninen Note Added: 0118356
2019-10-06 15:49 Mario Bonati Status resolved => closed