Comments (8)
@selvanair do we have a message buffer for the whole message which fills up for over-long profile names?
from openvpn-gui.
When i connect with https://github.com/zhovner/zaborona_help/blob/master/openvpn-client-config/srv0.zaborona-help-UDP-no-encryption_maxroutes.ovpn profile,
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.
@selvanair do we have a message buffer for the whole message which fills up for over-long profile names?
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.
from openvpn-gui.
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.
from openvpn-gui.
Hi,
On Windows 11 there are two issues;
- When there is no connection, there is no tooltip at all. Currently we display
OpenVPN GUI
there. - When there is active connection, tooltip is displayed on top left. Currently we display it next to the tray.
from openvpn-gui.
On Windows 11 there are two issues;
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
- When there is no connection, there is no tooltip at all. Currently we display
OpenVPN GUI
there.
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.
- When there is active connection, tooltip is displayed on top left. Currently we display it next to the tray.
This is strange --- I'll look for a Win11 machine to test and sort this out.
from openvpn-gui.
Hi,
Looks good on Windows 11. A few nick-picks:
- The tooltip is placed next to cursor, and not above the tray area as before. But I am not sure if it worth to fix the placement.
- The title is in bold, unlike before. Is this intended behavior? It looks okayish when we're in connected state and tooltip contains other information, but in the idle state it looks a bit odd, especially when other apps' tooltips are not bold.
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?):
diff --git a/tray.c b/tray.c
index 9e86f53..eed3054 100644
--- a/tray.c
+++ b/tray.c
@@ -50,7 +50,6 @@ HBITMAP hbmpConnecting;
NOTIFYICONDATA ni;
HWND traytip; /* handle of tooltip window for tray icon */
TOOLINFO ti; /* global tool info structure for tool tip of tray icon*/
-WCHAR tip_msg[500]; /* global buffer for tray tip message */
extern options_t o;
@@ -515,9 +514,8 @@ ShowTrayIcon()
ti.uId = (UINT_PTR) traytip;
ti.uFlags = TTF_ABSOLUTE|TTF_TRACK|TTF_IDISHWND;
ti.hwnd = o.hWnd;
- ti.lpszText = L" ";
+ ti.lpszText = _T(PACKAGE_NAME);
SendMessage(traytip, TTM_ADDTOOL, 0, (LPARAM)&ti);
- SendMessage(traytip, TTM_SETTITLE, TTI_NONE, (LPARAM) _T(PACKAGE_NAME));
SendMessage(traytip, TTM_SETMAXTIPWIDTH, 0, (LPARAM) cx);
}
}
@@ -525,6 +523,7 @@ ShowTrayIcon()
void
SetTrayIcon(conn_state_t state)
{
+ TCHAR tip_msg[500] = L"";
TCHAR msg_connected[100];
TCHAR msg_connecting[100];
BOOL first_conn;
@@ -534,7 +533,7 @@ SetTrayIcon(conn_state_t state)
_tcsncpy(msg_connected, LoadLocalizedString(IDS_TIP_CONNECTED), _countof(msg_connected));
_tcsncpy(msg_connecting, LoadLocalizedString(IDS_TIP_CONNECTING), _countof(msg_connecting));
- tip_msg[0] = L'\0';
+ _tcsncpy(tip_msg, _T(PACKAGE_NAME), _countof(_T(PACKAGE_NAME)));
first_conn = TRUE;
for (connection_t *c = o.chead; c; c = c->next)
{
If you think we really need bold then I am fine with it.
from openvpn-gui.
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.
tip_msg has to be global (or a string literal) though. Otherwise ti.lpszText will be dangling once out of this function. This is not well-documented and my first version had this bug and occasional misbehaviour -- learned the hard way :) But kind of obvious as we assign it in one function and use it elsewhere.
Well that's what I thought at the time... Looks like the bug I had was something else and no need for a global. The pointer is referred to only when calling TTM_ADDTOOL and TTM_UPDATETIPTEXT.
Will change the patch.
This was not needed when we used ni.szTip earlier as that is a 128 character buffer in the ni structure.
from openvpn-gui.
. Looks like the bug I had was something else and no need for a global. The pointer is referred to only when calling TTM_ADDTOOL and TTM_UPDATETIPTEXT.
Yeah but SendMessage
is synchronous, so the buffer should only be valid for the duration of the call.
Anyway, PR is now approved and ready to merge,
from openvpn-gui.
Related Issues (20)
- "Could not parse --management option" when using config-auto folder. HOT 4
- Vcpkg error when building from sources HOT 2
- Could not parse --management option HOT 12
- OpenVPN Pre-Logon Access Provider HOT 8
- Textbox for 2fa security code HOT 26
- Tray icon context menu triggers filesystem walk
- Service> OpenThreadToken Access Denied HOT 1
- Tray icon and text not updated in some cases
- Copyright timestamp needs updating to 2024 HOT 1
- PLAP Auto Connection HOT 4
- > Greate Fie for stdout 系统找不到指定的文件 HOT 2
- Add setting to reestablish last VPN connection on application start HOT 1
- Minor Windows GUI flaw: white strip on 125% dpi HOT 2
- OpenVPN GUI (SBL/PLAP) setting doesn't work with Dynamic Challenge HOT 6
- Reintroduce the private key password change feature HOT 2
- Does SAML work with using SBL/PLAP with OpenVPN GUI? HOT 7
- OpenVPN DCO connect error with TCP port on Windows client HOT 8
- i have a I have a problem verifying the certificate
- Move application data to %APPDATA% HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openvpn-gui.