Toggle main window hide on tray icon click
- converted openBictoinAction to toggleHideAction
- put GUIUtil functions into a namespace instead of a class
- put window-related functions together in optionsdialog
Reasoning:
- toggle is more typical behaviour
- it's more functional
- better UX
The typical issue with toggling visibility is that when a window
is obscured by other windows but in the 'shown' state, hiding it
isn't what you want. I've added an 'isObscured' function to GUIUtil
that checks several pixels in the window to see if they are visible
on the desktop so that an obscured but shown window can be raised.
Toggle hide #855
pull sje397 wants to merge 1 commits into bitcoin:master from sje397:ToggleHide changing 5 files +89 −43-
sje397 commented at 2:40 PM on February 17, 2012: contributor
-
laanwj commented at 11:13 AM on February 18, 2012: member
Is toggling more typical behaviour? I haven't seen that many applications that toggle when the tray icon is clicked, most just appear the window (and bring it to the foreground in some cases).
Then again, this may be a Windows thing mainly.
-
sje397 commented at 11:30 AM on February 18, 2012: contributor
You might be right. I just checked a couple of apps on my wife's windows machine - skype, utorrent - neither toggle. Maybe it was more common a while back. I think it's more common for tools like instant messaging apps that are often used and live on the desktop but need to also get out of the way for a large percentage of time.
I'd still argue that it's better than the click doing nothing and the icon simply wasting space there. Also it's better UX - you can click the tray icon for a quick glance at your wallet and easily click again without moving the mouse to get back to what you were doing.
One final point - this patch also fixes the issue whereby if the bitcoin window is oscured by another window, currently clicking the taskbar icon does nothing. It can be annoying when you wonder if it's broken before you notice the task bar item. It should at least raise the window to the front. That part of the patch could be implemented without the toggle.
-
in src/qt/bitcoingui.cpp:None in d1047c0954 outdated
422 | @@ -422,6 +423,16 @@ void BitcoinGUI::showNormal() 423 | QMainWindow::showNormal(); 424 | } 425 | 426 | +void BitcoinGUI::toggleHidden() 427 | +{ 428 | + if(isHidden() || isMinimized() || GUIUtil::isObscured(this)) { 429 | + showNormal();
laanwj commented at 11:45 AM on February 18, 2012:This showNormal will also unmaximize a maximized window-- better to use showNormalIfMinimized from https://github.com/laanwj/bitcoin/blob/2012_02_altminimizetray/src/qt/bitcoingui.cpp#L792
sje397 commented at 11:56 AM on February 18, 2012:Yep ok. With the flakiness of window systems in this respect, perhaps it would be good (and a little more efficient) to make it a little independent, e.g.
if(isHidden()) show(); else if(isMinimized()) showNormal(); else if(isObscured()) raise(); activateWindow(); // this (sometimes) helps with keyboard focus on Windows
laanwj commented at 11:58 AM on February 18, 2012:Yes, that'd be better.
laanwj commented at 11:56 AM on February 18, 2012: memberSeems like useful features, if we can manage to make them work (or, at least not get in the way) on all OSes/permutations.
Let's first get the #853 working everywhere.
BTW I agree with changing GUIUtil to a namespace. This would allow splitting it into multiple files when it gets too large.
sje397 commented at 11:59 AM on February 18, 2012: contributorSounds like a good plan to me. I have tested this on KDE and Windows.
sje397 commented at 12:35 PM on February 27, 2012: contributorI changed that 'toggleHide' method as per our discussion.
luke-jr commented at 8:59 PM on February 27, 2012: memberThis needs to be rebased :(
sje397 commented at 10:27 AM on February 28, 2012: contributorRebased.
luke-jr commented at 3:11 AM on March 14, 2012: memberThis definitely feels more intuitive to me.
luke-jr commented at 4:02 PM on March 20, 2012: memberBug report...
- Minimize Bitcoin-Qt (with Minimize to Tray enabled)
- Click tray icon
Actual: Bitcoin-Qt appears and disappears instantly
Expected: Bitcoin-Qt appears, and remains
laanwj commented at 4:11 PM on March 20, 2012: memberOk, that's it, I'm going to remove minimize to tray.
Diapolo commented at 4:18 PM on March 20, 2012: noneClose to tray remains?
laanwj commented at 4:19 PM on March 20, 2012: memberYes. That always worked fine.
Diapolo commented at 5:10 PM on March 20, 2012: noneOkay then, I guess it would be bad style to leave it in on Windows? Only problem I observed there is, that after a minimize to tray and a window restore, the title-bar looks smaller and only has a close icon instead of the normal minimze, maximize and close icons. Is that indended?
Diapolo commented at 6:02 PM on March 20, 2012: noneACK for removing it, coding time can be better invested for sure!
luke-jr commented at 5:42 AM on March 21, 2012: memberMy aforementioned bug might not be related to this. I am unable to reproduce it with today's next-test... :/
Diapolo commented at 6:21 AM on March 21, 2012: noneHow is the general developer policy? Does it really make sense to report these kind of bugs with unofficial client versions? If I'm right you were using a self compiled version of your next-test branch.
luke-jr commented at 6:33 AM on March 21, 2012: memberPart of the point of pull requests is to test the proposed change... so yes.
laanwj commented at 6:39 AM on March 21, 2012: member@diapolo it makes sense when you're testing a certain pull request to post about your experiences with it (as in this case). But of course not to make a new issue about something that isn't in master yet.
I, at first, didn't notice luke-jr was posting to an existing pull request instead of a new issue, hence the confusion with another commit.
Diapolo commented at 6:42 AM on March 21, 2012: noneAs you perhaps observed I'm trying to help out here and there and to learn how you guys work, I have to ask some "weird questions" from time to time :).
luke-jr commented at 1:32 PM on April 10, 2012: memberRebasing required.
sje397 commented at 1:42 PM on April 10, 2012: contributorI did that once already.
luke-jr commented at 1:53 PM on April 10, 2012: memberUnfortunately, I can't rebase others' stuff or I would. It's pretty trivial in this case.
sje397 commented at 1:56 PM on April 10, 2012: contributorYep, I'm doing it now. I'm just suggesting that perhaps you might not want to request a rebase too often, or maybe wait until there are a few people ready to review? It's a waste of time otherwise.
86d5634941Toggle main window hide on tray icon click
- converted openBictoinAction to toggleHideAction - put GUIUtil functions into a namespace instead of a class - put window-related functions together in optionsdialog Reasoning: - toggle is more typical behaviour - it's more functional - better UX The typical issue with toggling visibility is that when a window is obscured by other windows but in the 'shown' state, hiding it isn't what you want. I've added an 'isObscured' function to GUIUtil that checks several pixels in the window to see if they are visible on the desktop so that an obscured but shown window can be raised. Conflicts: src/qt/guiutil.cpp src/qt/guiutil.h
laanwj commented at 6:57 PM on April 11, 2012: memberI've tested it, it works for me (on Linux). Code is also OK with me.
ACK
luke-jr commented at 7:03 PM on April 11, 2012: memberACK here too, been using this for months now.
laanwj referenced this in commit 4ac24cf59e on Apr 12, 2012laanwj merged this on Apr 12, 2012laanwj closed this on Apr 12, 2012coblee referenced this in commit 827620a22e on Jul 17, 2012destenson referenced this in commit 284e2c41cc on Jun 26, 2016dexX7 referenced this in commit 5ecff7a9a2 on Jan 28, 2019DrahtBot locked this on Sep 8, 2021
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 18:16 UTC
More mirrored repositories can be found on mirror.b10c.me