-
Notifications
You must be signed in to change notification settings - Fork 405
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
Use a custom tooltip window for the tray icon #670
Conversation
I like the idea, but do not feel qualified today to ACK or NAK the code. @lstipakov something for you? |
0c84fc1
to
46421d8
Compare
linking to my comment #666 (comment) |
Built-in tray notification icon has a tip text length limit of 128 characters which is often limited for showing the connected profile name, connected since time and IP addresses. If the profile name is long the IP numbers could get truncated. Fix by using a custom tooltip window and display it when mouse hovers over the icon. As the status bar need not be at the bottom of the screen (could be at right, left or top as well), the location of the window is chosen based on the mouse co-ordinates that trigger the hover event. In case of errors while setting up the tooltip window, fall back to the current behaviour. If the message is too long to include time and IP, truncate the profile name part of the message. v2: Do not use wParam in NIN_POPUOPEN message as it does not seem to work on Windows 11. Instead use GetCursorPos() for mouse location. Fixes issue OpenVPN#666 Signed-off-by: Selva Nair <[email protected]>
46421d8
to
22839ea
Compare
Force pushed with changes:
|
(Moving this to the right place) On Win11 the tip window should probably have more rounded corners, but will leave it at that. |
Also change scope of tip_msgi[] to local Co-authored-by: Lev Stipakov <[email protected]> Signed-off-by: Selva Nair <[email protected]>
Use Shell_NotifyGetRect to find the icon location and place the tip window a fixed distance above/below it. It appears GUID_NULL used for above is not pulled in by shellapi.h. Define locally when absent. Also add TTF_RTLREADING for RTL languages. How to right justify as well in this case is unclear. Signed-off-by: Selva Nair <[email protected]>
021cb54
to
1209028
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on Windows 11. Both tooltip and code look good.
Built-in tray notification icon has a tip text length limit of 128 characters which is often limited for showing the connected profile name, connected since time and IP addresses. If the profile name is long the IP numbers could get truncated.
Fix by using a custom tooltip window and display it when mouse hovers over the icon. As the status bar need not be at the bottom of the screen (could be at right, left or top as well), the location of the window is chosen based on the mouse co-ordinates that trigger the hover event.
In case of errors while setting up the tooltip window, fall back to the current behaviour.
If the message is too long to include time and IP, truncate the profile name part of the message.
Fixes issue #666
Edit: force pushed after fixing some typos in commit message and buggy text truncation logic.
old
new