Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix drawinTitleBar requirement #10

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

sk-1982
Copy link

@sk-1982 sk-1982 commented Feb 20, 2020

Fixes #6
Hooks WM_SIZE instead of WM_NCLBUTTONDOWN to determine if window has been minimized, allowing support for Thunderbird's client area buttons when drawinTitleBar is set to true.

Unfortunately, I haven't found a way to hook the client area close button, meaning the close button will cause Thunderbird to not minimize to tray while drawinTitleBar is true.

The WH_CALLWNDPROC hook has the ability to determine when the window is closing, but cannot prevent the close. The WM_NCLBUTTONDOWN hook doesn't work because the close button is (as far as I can tell) not in the non-client area when drawinTitleBar is true.

@sk-1982 sk-1982 requested a review from sagamusix February 20, 2020 06:19
@sagamusix
Copy link
Owner

Thanks for your contribution! In general the code looks good to me, but I haven't had the time to test the changes yet.

Can you please also update the manual regarding the drawInTitleBar requirement, and in particular mention that the close button won't minimize the application in that case? Thanks!

@sagamusix
Copy link
Owner

Also, if you feel like it and you have a way of testing it, you could check out the old MinTrayR / etc. extensions and see if they work with drawInTitleBar set to true, and if they do, figure out what they do differently. I remember it had a slightly different approach.

@sk-1982
Copy link
Author

sk-1982 commented Feb 20, 2020

I updated the readme about thedrawInTitlebar requirement.

I also checked MinTray Reanimated on Thunderbird 60, it has the same problem where the close button just closes the entire program. A workaround is to install the Minimize on Close extension which uses javascript to minimize instead of close, which will be intercepted by TBTray.

@sk-1982
Copy link
Author

sk-1982 commented Feb 20, 2020

A small issue with the Minimize on Close extension is that, since it replaces the close function with the minimize function, the exit menu option in the tray will not work; Thunderbird has to be exited using the file menu.

A fix for this is to use PostQuitMessage(0) instead of SendMessage(mainHwnd, WM_SYSCOMMAND, SC_CLOSE, 0). This, however, does not exit Thunderbird cleanly, resulting in exit actions such as "Empty Trash on Exit" or "Expunge Inbox on Exit" not running. Therefore, I haven't committed this change due to the potential privacy/security issues.

@sagamusix
Copy link
Owner

Thanks for your detailed research and updating the readme. There's nothing keeping this from being merged apart from still having to test it, which I will do during the weekend.

@jackz314
Copy link

jackz314 commented Apr 2, 2020

Any updates on this? Also, unrelated but can someone add the docs for compilation?

@sagamusix
Copy link
Owner

The docs for compilation are: Open the solution in Visual Studio and compile it. It couldn't be any simpler.

@jackz314
Copy link

jackz314 commented Apr 2, 2020

Yeah I know I actually figured that out minutes after posting my comment. But if someone wasn't familiar with visual studio and how to work with it, then it'll not be as simple as you put it.

Anyways, any updates on the pr? I compiled it myself and everything works fine on my end, not sure if your tests are all passing though.

@sagamusix
Copy link
Owner

I compiled it myself and everything works fine on my end

I highlighted a regression in the code review comments but so far it was not addressed. I won't merge a PR that breaks the code for the only configuration I use (drawInTitleBar=false) and wrote this tool for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

drawinTitleBar requirement
3 participants