-
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
Can't see ip address in tray tooltip #666
Comments
@selvanair do we have a message buffer for the whole message which fills up for over-long profile names? |
The total text length allowed in Windows "notifyicon" tooltip is limited to 128 characters so truncation happens when the profile name is too long. As the balloon message has more space (256 characters) and less information, truncation is less likely there. Double click on tray icon to open the status window and see the full IP address.
As space s limited, we do truncate some strings used to build up the tooltip, but in this case the truncation is due to Windows limit. When there are multiple profiles connected, we try to list all connected/connecting profiles truncating both lists at ~100 characters. The total message would still get truncated by Windows to 128. When there is only one profile connected (the case above), we add "IP address" and "connected since" info as well. In the latter case, to avoid truncating the IP, we could truncate the profile name to about 32 characters but that works for v4 addresses only. |
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 f the screen (could be at right, left or top as well), the location of the window is chosen based on the muse 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 OpenVPN#666 Signed-off-by: Selva Nair <[email protected]>
PR #670 proposes a fix to this using a custom tooltip window to show the text. If the text is too long [*], the profile name part is truncated to ensure the IP address and time will be always displayed in full. Tested on Win10 with status bar at bottom, right, top and left. Untested on multiple monitors. [*] I set it at 500 characters but could be made longer. The built-in tooltip is restricted to 128 characters which is too small to show the IP, time and anything more than a short profile name. |
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 OpenVPN#666 Signed-off-by: Selva Nair <[email protected]>
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 OpenVPN#666 Signed-off-by: Selva Nair <[email protected]>
I'm not totally surprised as I had to do a lot of trial and error to get this work on Windows 10. Use of a tooltip window for on demand display at a specified location is not well documented, and is a bit hackish. At the same time using the tooltip class for this window feels compelling
On Windows 10 I had this problem when the added text is empty (only title remains). Adding a as the text fixed it. Win11 is probably more picky.
This is strange --- I'll look for a Win11 machine to test and sort this out. |
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]>
Hi, Looks good on Windows 11. A few nick-picks:
Here is a small patch which makes title part of message to remove boldness and moves tip_msh from global to local scope (why it was in global btw?):
If you think we really need bold then I am fine with it. |
Good suggestion. In fact I had the same thought of including the title as a part of the message. Simplifies fallback to ni.szTip as well. Will push a commit. Positioning a fixed amount above the icon looks tricky as the icon location is not returned in NIN_POPUPOPEN message -- also, even stock icons behave in all manners on Windows 10. I'll leave it like this for now, open to improvement if anyone feels like digging into it.
Will change the patch.
|
Yeah but Anyway, PR is now approved and ready to merge, |
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 #666 Signed-off-by: Selva Nair <[email protected]>
When i connect with https://github.com/zhovner/zaborona_help/blob/master/openvpn-client-config/srv0.zaborona-help-UDP-no-encryption_maxroutes.ovpn profile,
i can't see ip address in tray tooltip.
ps. With other profiles - all ok, win7 x64
The text was updated successfully, but these errors were encountered: