The dialog box in wineboot has a fixed width but the prefix path string doesn't (which could cause parts of the prefix path to be cut off and made invisible).
This issue got worse in commit 8e1197c92e8c08fb197c8656a07215296d656890 which introduced more accurate word wrap behavior (that no longer wraps strings without spaces and causes space-less paths to be more commonly cut off).
From: Aida Jonikienė aidas957@gmail.com
This makes shrinking the prefix path string easier in the next change. --- programs/wineboot/wineboot.rc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/programs/wineboot/wineboot.rc b/programs/wineboot/wineboot.rc index 898926203db..eecf5ced21c 100644 --- a/programs/wineboot/wineboot.rc +++ b/programs/wineboot/wineboot.rc @@ -42,8 +42,9 @@ CAPTION "Wine" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_WAITICON, 3, 3, 10, 10 - LTEXT "The Wine configuration in %s is being updated, please wait...", - IDC_WAITTEXT, 40, 5, 150, 40, SS_NOPREFIX + LTEXT "The Wine configuration in", IDC_STATIC, 40, 5, 150, 8 + LTEXT "%s", IDC_WAITTEXT, 40, 13, 150, 8, SS_NOPREFIX + LTEXT "is being updated, please wait...", IDC_STATIC, 40, 21, 150, 8 END
/* @makedep: wineboot.manifest */
From: Aida Jonikienė aidas957@gmail.com
This change caps the prefix path to 15 characters from both the start and end with a ellipsis in the middle if the prefix path string doesn't fit in the dialog's test box (this is a hardcoded value).
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56325 --- programs/wineboot/Makefile.in | 2 +- programs/wineboot/wineboot.c | 23 +++++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/programs/wineboot/Makefile.in b/programs/wineboot/Makefile.in index 7c61102c40e..0983420a91f 100644 --- a/programs/wineboot/Makefile.in +++ b/programs/wineboot/Makefile.in @@ -1,6 +1,6 @@ MODULE = wineboot.exe IMPORTS = uuid advapi32 ws2_32 kernelbase -DELAYIMPORTS = shell32 shlwapi version user32 setupapi newdev +DELAYIMPORTS = shell32 shlwapi version user32 gdi32 setupapi newdev
EXTRADLLFLAGS = -mconsole
diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index 1dc3fdb78e7..e0b4e8a074f 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -1411,15 +1411,34 @@ static INT_PTR CALLBACK wait_dlgproc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp { case WM_INITDIALOG: { - DWORD len; + DWORD len, end_len, split_len = 15; + INT fin_len = (split_len * 2) + 3 + 1; WCHAR *buffer, text[1024]; + SIZE text_size; + HWND ctrl_hwnd = GetDlgItem( hwnd, IDC_WAITTEXT ); + RECT ctrl_rect; + FLOAT ctrl_len, text_len; const WCHAR *name = (WCHAR *)lp; HICON icon = LoadImageW( 0, (LPCWSTR)IDI_WINLOGO, IMAGE_ICON, 48, 48, LR_SHARED ); + SendDlgItemMessageW( hwnd, IDC_WAITICON, STM_SETICON, (WPARAM)icon, 0 ); SendDlgItemMessageW( hwnd, IDC_WAITTEXT, WM_GETTEXT, 1024, (LPARAM)text ); len = lstrlenW(text) + lstrlenW(name) + 1; buffer = malloc( len * sizeof(WCHAR) ); - swprintf( buffer, len, text, name ); + + GetTextExtentPoint32W( GetDC(ctrl_hwnd), name, lstrlenW(name), &text_size ); + GetClientRect( ctrl_hwnd, &ctrl_rect ); + ctrl_len = (ctrl_rect.right / 1.5) - 2.0; /* Add some length headroom */ + text_len = ((FLOAT)text_size.cx / (FLOAT)text_size.cy) * 8.0; + if (text_len > ctrl_len && len >= fin_len) + { + WINE_TRACE( "Text length %f exceeds control length %f, shrinking the text to %d characters\n", + text_len, ctrl_len, fin_len ); + end_len = lstrlenW(name) - (split_len + 1); + swprintf( buffer, len, L"%.*s...%s", split_len, name, &name[end_len] ); + } + else swprintf( buffer, len, text, name ); + SendDlgItemMessageW( hwnd, IDC_WAITTEXT, WM_SETTEXT, 0, (LPARAM)buffer ); free( buffer ); }
The test failures here are irrelevant :frog:
Could we use DrawText(DT_PATH_ELLIPSIS) instead of this complexity?
On Fri Sep 6 16:19:27 2024 +0000, Nikolay Sivov wrote:
Could we use DrawText(DT_PATH_ELLIPSIS) instead of this complexity?
I think I tried that PATHELLIPSIS flag but it didn't work properly (that might be because of the Unix-style forward slash paths though)
This merge request was closed by Aida Jonikienė.
Superseded by f47610fa277c8a8d3844377ad047adc557cb87a3