vcl/inc/osx/salsys.h           |    3 +--
 vcl/inc/salsys.hxx             |    6 +-----
 vcl/inc/unx/gensys.h           |    3 +--
 vcl/inc/win/salsys.h           |    3 +--
 vcl/osx/salsys.cxx             |   11 ++---------
 vcl/source/app/svapp.cxx       |    7 +------
 vcl/unx/generic/app/gensys.cxx |    8 ++------
 vcl/win/app/salinfo.cxx        |    9 +++------
 8 files changed, 12 insertions(+), 38 deletions(-)

New commits:
commit dc332bff610ff0c76032927c2115010101a55516
Author:     Michael Weghorn <[email protected]>
AuthorDate: Fri Feb 27 22:27:37 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sat Feb 28 16:33:57 2026 +0100

    vcl: Drop SalSystem::ShowNativeMessageBox return value
    
    The only place where the return value was used is in
    Application::ShowNativeErrorBox, to SAL_WARN if
    the value is not SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK ( = 1).
    
    It remains unclear why a dialog showing an error needs
    to use a custom return value, as the only thing the
    user can usually do is to close it. Given that the
    return value isn't used for anything except a
    console warning, drop it altogether.
    
    Further simplification can happen in upcoming
    commits.
    
    Sample way to trigger the logic:
    
    * apply this diff and rebuild
    
        diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
        index 3023f3d5afc7..e0d0f95eb0be 100644
        --- a/cui/source/dialogs/about.cxx
        +++ b/cui/source/dialogs/about.cxx
        @@ -266,6 +266,8 @@ IMPL_LINK_NOARG(AboutDialog, HandleClick, 
weld::Button&, void)
             css::uno::Reference<css::datatransfer::clipboard::XClipboard> 
xClipboard
                 = m_pVersionLabel->get_clipboard();
    
        +    Application::ShowNativeErrorBox("something is very wrong", 
"something");
        +
             OUString sInfo = "Version: " + m_pVersionLabel->get_label()
                              + "
" // version
                                "Build ID: "
    
    * "Help" -> "About LibreOfficeDev"
    * press the button to copy the version information
    
    This shows a warning dialog for the gtk3 or gen VCL plugins.
    For qt6, nothing happens, because the current implementation
    of QtSystem::ShowNativeDialog simply returns 0 without doing
    anything else.
    
    Change-Id: Iaf2c803071698911f4834070ad00b9ad325374c9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200657
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/inc/osx/salsys.h b/vcl/inc/osx/salsys.h
index 023b4cc18aac..5ece1d8e7380 100644
--- a/vcl/inc/osx/salsys.h
+++ b/vcl/inc/osx/salsys.h
@@ -34,8 +34,7 @@ public:
     virtual unsigned int GetDisplayScreenCount() override;
     virtual AbsoluteScreenPixelRectangle GetDisplayScreenPosSizePixel( 
unsigned int nScreen ) override;
 
-    virtual int ShowNativeMessageBox( const OUString& rTitle,
-                                      const OUString& rMessage) override;
+    virtual void ShowNativeMessageBox(const OUString& rTitle, const OUString& 
rMessage) override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/salsys.hxx b/vcl/inc/salsys.hxx
index f473c58418a4..850b5ecf5502 100644
--- a/vcl/inc/salsys.hxx
+++ b/vcl/inc/salsys.hxx
@@ -64,12 +64,8 @@ public:
 
         @param  rMessage
         The message to be shown by the dialog box.
-
-        @returns the identifier of the button that was pressed by the user.
-        See button identifier above. If the function fails the
-        return value is 0.
     */
-    virtual int ShowNativeMessageBox(const OUString& rTitle, const OUString& 
rMessage) = 0;
+    virtual void ShowNativeMessageBox(const OUString& rTitle, const OUString& 
rMessage) = 0;
 };
 
 VCL_DLLPUBLIC SalSystem* ImplGetSalSystem();
diff --git a/vcl/inc/unx/gensys.h b/vcl/inc/unx/gensys.h
index ab240f05ec0a..2e264096c91f 100644
--- a/vcl/inc/unx/gensys.h
+++ b/vcl/inc/unx/gensys.h
@@ -34,8 +34,7 @@ class VCL_DLLPUBLIC SalGenericSystem : public SalSystem
                                   const OUString& rMessage,
                                   const std::vector< OUString >& rButtons ) = 
0;
 
-    virtual int ShowNativeMessageBox( const OUString& rTitle,
-                                      const OUString& rMessage) override;
+    virtual void ShowNativeMessageBox(const OUString& rTitle, const OUString& 
rMessage) override;
 
 #if !defined(ANDROID) && !defined(IOS)
     // Simple helpers for X11 WM_CLASS hints
diff --git a/vcl/inc/win/salsys.h b/vcl/inc/win/salsys.h
index ae94bb9e1a5d..3d59e7fc1211 100644
--- a/vcl/inc/win/salsys.h
+++ b/vcl/inc/win/salsys.h
@@ -51,8 +51,7 @@ public:
     virtual unsigned int GetDisplayScreenCount() override;
     virtual unsigned int GetDisplayBuiltInScreen() override;
     virtual AbsoluteScreenPixelRectangle GetDisplayScreenPosSizePixel( 
unsigned int nScreen )  override;
-    virtual int ShowNativeMessageBox( const OUString& rTitle,
-                                      const OUString& rMessage)  override;
+    virtual void ShowNativeMessageBox(const OUString& rTitle, const OUString& 
rMessage) override;
     bool initMonitors();
     // discards monitorinfo; used by WM_DISPLAYCHANGED handler
     void clearMonitors();
diff --git a/vcl/osx/salsys.cxx b/vcl/osx/salsys.cxx
index 37ad48e7dcbd..494351f80b0a 100644
--- a/vcl/osx/salsys.cxx
+++ b/vcl/osx/salsys.cxx
@@ -89,8 +89,7 @@ static NSString* getStandardString( StandardButtonType 
nButtonId, bool bUseResou
     return aText.isEmpty() ? nil : CreateNSString( aText);
 }
 
-int AquaSalSystem::ShowNativeMessageBox( const OUString& rTitle,
-                                        const OUString& rMessage )
+void AquaSalSystem::ShowNativeMessageBox(const OUString& rTitle, const 
OUString& rMessage)
 {
     NSString* pTitle = CreateNSString( rTitle );
     NSString* pMessage = CreateNSString( rMessage );
@@ -98,7 +97,7 @@ int AquaSalSystem::ShowNativeMessageBox( const OUString& 
rTitle,
     NSString* pDefText = getStandardString( StandardButtonType::OK, 
false/*bUseResources*/ );
 
     SAL_WNODEPRECATED_DECLARATIONS_PUSH //TODO: 10.10 NSRunAlertPanel
-    int nResult = NSRunAlertPanel( pTitle, @"%@", pDefText, nil, nil, pMessage 
);
+    NSRunAlertPanel(pTitle, @"%@", pDefText, nil, nil, pMessage);
     SAL_WNODEPRECATED_DECLARATIONS_POP
 
     if( pTitle )
@@ -107,12 +106,6 @@ int AquaSalSystem::ShowNativeMessageBox( const OUString& 
rTitle,
         [pMessage release];
     if( pDefText )
         [pDefText release];
-
-    int nRet = 0;
-    if( nResult == 1 )
-        nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK;
-
-    return nRet;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index e02926688116..648ffdc02f68 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1639,12 +1639,7 @@ void Application::EnableSafeMode()
 void Application::ShowNativeErrorBox(const OUString& sTitle  ,
                                      const OUString& sMessage)
 {
-    int btn = ImplGetSalSystem()->ShowNativeMessageBox(
-            sTitle,
-            sMessage);
-    if (btn != SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK) {
-        SAL_WARN( "vcl", "ShowNativeMessageBox returned " << btn);
-    }
+    ImplGetSalSystem()->ShowNativeMessageBox(sTitle, sMessage);
 }
 
 const OUString& Application::GetDesktopEnvironment()
diff --git a/vcl/unx/generic/app/gensys.cxx b/vcl/unx/generic/app/gensys.cxx
index c68628194cdd..8fab4a760a34 100644
--- a/vcl/unx/generic/app/gensys.cxx
+++ b/vcl/unx/generic/app/gensys.cxx
@@ -37,18 +37,14 @@ SalGenericSystem::~SalGenericSystem()
 {
 }
 
-int SalGenericSystem::ShowNativeMessageBox( const OUString& rTitle, const 
OUString& rMessage )
+void SalGenericSystem::ShowNativeMessageBox(const OUString& rTitle, const 
OUString& rMessage)
 {
     std::vector< OUString > aButtons;
-    int nButtonIds[5] = {0}, nBut = 0;
 
     ImplHideSplash();
 
     aButtons.push_back( u"OK"_ustr );
-    nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK;
-    int nResult = ShowNativeDialog( rTitle, rMessage, aButtons );
-
-    return nResult != -1 ? nButtonIds[ nResult ] : 0;
+    ShowNativeDialog(rTitle, rMessage, aButtons);
 }
 
 #if !defined(ANDROID) && !defined(IOS)
diff --git a/vcl/win/app/salinfo.cxx b/vcl/win/app/salinfo.cxx
index 23d542d23b84..87547a9b119d 100644
--- a/vcl/win/app/salinfo.cxx
+++ b/vcl/win/app/salinfo.cxx
@@ -164,14 +164,11 @@ AbsoluteScreenPixelRectangle 
WinSalSystem::GetDisplayScreenPosSizePixel( unsigne
     return m_aMonitors[nScreen].m_aArea;
 }
 
-int WinSalSystem::ShowNativeMessageBox(const OUString& rTitle, const OUString& 
rMessage)
+void WinSalSystem::ShowNativeMessageBox(const OUString& rTitle, const 
OUString& rMessage)
 {
     ImplHideSplash();
-    return MessageBoxW(
-        nullptr,
-        o3tl::toW(rMessage.getStr()),
-        o3tl::toW(rTitle.getStr()),
-        MB_TASKMODAL | MB_SETFOREGROUND | MB_ICONWARNING | MB_DEFBUTTON1);
+    MessageBoxW(nullptr, o3tl::toW(rMessage.getStr()), 
o3tl::toW(rTitle.getStr()),
+                MB_TASKMODAL | MB_SETFOREGROUND | MB_ICONWARNING | 
MB_DEFBUTTON1);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to