Bitcoin Forum
May 10, 2024, 06:35:53 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: System tray icon odd behavior  (Read 1761 times)
maxi (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
April 11, 2011, 02:45:42 PM
 #1

Hi,
I compiled bitcoin for Linux from git and found that the System Tray Icon (aka Task Bar Icon) behaves a little odd.

Let me explain this.

Clicking in the system tray icon:
A lot of well-known programs work in this way: a left click in the icon causes the main window to Hide/Show, depending on the current status. I have verified this behavior with (at least) pidgin, clementine, amarok, skype, choqok and kopete.

On the other side, bitcoin does not behave this way.
Poking in the code, I found out that bitcion always does a Restore() (wxWindow.Restore() I guess it is).

Closing the window
The programs that do use the systray, don't close when the user clicks in the "x" of the window. They just hide.

Conclusions
I really think that it would be great that bitcoin had the same behavior as all the other programs I mentioned, for the sake of usability.
This is: click on the systray to show/hide the window and closing the window via "x" button does not close the program.
Note that I have no idea how this should be in Windows/Mac. I am only talking about Linux.

I would like to know what do you think: would it be OK for bitcoin to have this behavior? under what platforms?
I can help with the implementation.

1715322953
Hero Member
*
Offline Offline

Posts: 1715322953

View Profile Personal Message (Offline)

Ignore
1715322953
Reply with quote  #2

1715322953
Report to moderator
1715322953
Hero Member
*
Offline Offline

Posts: 1715322953

View Profile Personal Message (Offline)

Ignore
1715322953
Reply with quote  #2

1715322953
Report to moderator
1715322953
Hero Member
*
Offline Offline

Posts: 1715322953

View Profile Personal Message (Offline)

Ignore
1715322953
Reply with quote  #2

1715322953
Report to moderator
"Bitcoin: the cutting edge of begging technology." -- Giraffe.BTC
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715322953
Hero Member
*
Offline Offline

Posts: 1715322953

View Profile Personal Message (Offline)

Ignore
1715322953
Reply with quote  #2

1715322953
Report to moderator
1715322953
Hero Member
*
Offline Offline

Posts: 1715322953

View Profile Personal Message (Offline)

Ignore
1715322953
Reply with quote  #2

1715322953
Report to moderator
Luke-Jr
Legendary
*
expert
Offline Offline

Activity: 2576
Merit: 1186



View Profile
April 11, 2011, 02:47:30 PM
 #2

FWIW, Spesmilo behaves correctly as you describe.

tcatm
Sr. Member
****
qt
Offline Offline

Activity: 337
Merit: 265


View Profile
April 11, 2011, 02:54:11 PM
 #3

Systray icon behaviour: agreed, sounds logical.

Closing window: As long as the main windows represents the bitcoin program (and not just a view of the transaction list) it should actually close when the user clicks the "x". There's already the minimize button to hide the window instead.
maxi (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
April 12, 2011, 09:21:52 AM
 #4

Systray icon behaviour: agreed, sounds logical.
I attach a patch. Please review.
I copied the behavior of other programs, which is:

1.- If hidden -> show on top
2.- if shown, but not on top -> show on top
3.- it shown on top -> hide

Warning: I have no experience with wxwindows, maybe I am not using the corrects methods here (specially for case 2 above)

The patch also includes compatibility with boost 1.46, since that is what I have in my box, and I think will be useful. I know that this should be in a different patch :$

A big BUT here: even though I have tested this and works OK, it won't reach users until the "fMinimizeToTray" option can be enabled int he GUI. The current code has a comment "// Minimize to tray is just too buggy on Linux" (around line 1655 in ui.cpp) and disables fMinimizeToTray.
For testing purposes, I hardcoded "fMinimizeToTray = true" before "ptaskbaricon->Show(fMinimizeToTray || fClosedToTray);" in CreateMainWindow (around line 2755, ui.cpp) and it worked perfect. I have KDE 4.6.2, Arch Linux.

Quote
Closing window: As long as the main windows represents the bitcoin program (and not just a view of the transaction list) it should actually close when the user clicks the "x". There's already the minimize button to hide the window instead.

This is a little odd: there is an option, "Minimize On Close" (which maps to fClosedToTray, afaik) that can be changed in the GUI. If the user enables this option, the "x" will, indeed, minimize the window, though it remains present in the task bar.

It seems that enabling both options almost produces the "standard" behavior (using the "x" hides the window, clicking in the systray icon hides/shows). The missing thing is that clicking the "x" still shows the icon in the task bar.
maxi (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
April 12, 2011, 09:23:56 AM
 #5


Quote
I attach a patch. Please review.
Ok, after fighting with the attachment (no .patch allowed first... no enough space for a 742 bytes zip file later...), I put the patch in plain text here:

----------------------------------------- PATCH STARTS HERE -------------------------------------------------------
diff --git a/ui.cpp b/ui.cpp
index 9ae19e8..70ce1c1 100644
--- a/ui.cpp
+++ b/ui.cpp
@@ -1581,7 +1581,17 @@ void SetStartOnSystemStartup(bool fAutoStart)
 {
     if (!fAutoStart)
     {
+        // In version 1.46 boost changed the class path.
+        // See http://www.boost.org/doc/libs/1_46_0/libs/filesystem/v3/doc/index.htm
+        // and http://www.boost.org/doc/libs/1_46_0/boost/filesystem/path.hpp
+# if !defined(BOOST_FILESYSTEM_VERSION)
+#   define BOOST_FILESYSTEM_VERSION 3
+# endif
+#if BOOST_FILESYSTEM_VERSION == 3
+        unlink(GetAutostartFilePath().c_str());
+#else       
         unlink(GetAutostartFilePath().native_file_string().c_str());
+#endif       
     }
     else
     {
@@ -2646,7 +2656,22 @@ void CMyTaskBarIcon::Hide()
 
 void CMyTaskBarIcon::OnLeftButtonDClick(wxTaskBarIconEvent& event)
 {
-    Restore();
+   
+    if (pframeMain->IsShown())
+    {
+        if (pframeMain->IsActive())
+        {
+            pframeMain->Show(false);           
+        }
+        else
+        {
+            pframeMain->Raise();
+        }
+    }
+    else
+    {
+        Restore();
+    }
 }
 
 void CMyTaskBarIcon::OnMenuRestore(wxCommandEvent& event)
----------------------------------------- PATCH ENDS HERE -------------------------------------------------------
maxi (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
April 18, 2011, 01:31:11 PM
 #6

Hi!
any news/comment on this patch?
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!