Description: When opening a password protected document in LibreOffice Writer, the password dialog is not horizontally centered in the LibreOffice window; it is noticeably to the right of the center. The longer the filename (with path), the more misaligned the dialog is. It is as if the code, to fit the filename, only expands the width of the dialog (to the right), forgetting to also move the position of the dialog to the left by half of the increased dialog width. Steps to Reproduce: 1. Open a password-protected LibreOffice Writer document. 2. Wait for the password dialog to appear. Actual Results: The center of the "Enter Password" dialog is noticeably to the right of the center of the LibreOffice window. The longer the filename (including path), the further misaligned the dialog is. Expected Results: The horizontal center of the dialog should be exactly at the center of the LibreOffice window, no matter the length of the file name (with path) or width of the dialog. Reproducible: Always User Profile Reset: No Additional Info: My screen resolution is 2240 x 1400, and the Windows UI scale is set to 175%. When I set the scale to 100%, it becomes much more difficult to see whether the dialog is still misaligned with the center. But the cause seems simple as explained above: the width of the dialog seems to be increased to make the entire filename (with path) fit, but without changing the position of the dialog accordingly to keep it centered. Help - About LibreOffice: Version: 24.2.1.2 (X86_64) / LibreOffice Community Build ID: db4def46b0453cc22e2d0305797cf981b68ef5ac CPU threads: 12; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win Locale: da-DK (da_DK); UI: da-DK Calc: CL threaded
The issue also is also in the latest stable version, 24.2.2.2, which I just upgraded to.
Created attachment 194045 [details] screenshot of the dialog I confirm it with Version: 24.2.3.2 (X86_64) / LibreOffice Community Build ID: 433d9c2ded56988e8a90e6b2e771ee4e6a5ab2ba CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win Locale: de-DE (de_DE); UI: en-GB Calc: CL threaded
I have not set up the build environment, but I think I located the error: In the file core/uui/source/passworddlg.cxx, line 45 (which I located on the read-only Github mirror because I could search there, at https://github.com/LibreOffice/core/blob/d80dd99db9d8c78fa4b9b4a2be4bc13721df7469/uui/source/passworddlg.cxx#L45), the position of the dialog is set as centered. But after that, the title of the dialog is changed in line 77 and 88: 77 m_xDialog->set_title(aTitle); 88 m_xDialog->set_title(aTitle + " - " + aFileName); So I would think that moving line 44+45 (line 45 including its comment) to after line 88 would solve the problem. Then it would calculate the proper centered x position from the actual title of the dialog. If the x position is calculated before the title is set, the calculation does not take into account the actual dialog title, therefore misplacing the dialog horizontally as if there were no title or just the default title (a long title expands the dialog width). This has not been verified, since I don't have the build environment set up (it's a bit of hazzle to set up in Windows). But maybe someone with the build setup could check this, or at least this bug could be set as a simple task for beginners: Make the suggested change and see if it solves the problem.