Bitcoin Forum
December 08, 2016, 04:31:11 AM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: System tray icon odd behavior  (Read 1507 times)
maxi
Newbie
*
Offline Offline

Activity: 4


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.

1481171471
Hero Member
*
Offline Offline

Posts: 1481171471

View Profile Personal Message (Offline)

Ignore
1481171471
Reply with quote  #2

1481171471
Report to moderator
1481171471
Hero Member
*
Offline Offline

Posts: 1481171471

View Profile Personal Message (Offline)

Ignore
1481171471
Reply with quote  #2

1481171471
Report to moderator
1481171471
Hero Member
*
Offline Offline

Posts: 1481171471

View Profile Personal Message (Offline)

Ignore
1481171471
Reply with quote  #2

1481171471
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481171471
Hero Member
*
Offline Offline

Posts: 1481171471

View Profile Personal Message (Offline)

Ignore
1481171471
Reply with quote  #2

1481171471
Report to moderator
1481171471
Hero Member
*
Offline Offline

Posts: 1481171471

View Profile Personal Message (Offline)

Ignore
1481171471
Reply with quote  #2

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

Activity: 2086



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


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
Newbie
*
Offline Offline

Activity: 4


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
Newbie
*
Offline Offline

Activity: 4


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
Newbie
*
Offline Offline

Activity: 4


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

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

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!