[Git][wxwidgets/wxwidgets][master] 4 commits: Let wxAuiToolBars with stretchable elements stretch

1 view
Skip to first unread message

Vadim Zeitlin (@_VZ_)

unread,
Feb 28, 2026, 9:59:28 AM (9 days ago) Feb 28
to wx-commi...@googlegroups.com

Vadim Zeitlin pushed to branch master at wxWidgets / wxWidgets

Commits:

  • 97050e18
    by Vadim Zeitlin at 2026-02-28T13:24:07+01:00
    Let wxAuiToolBars with stretchable elements stretch
    
    Previously, all fixed panes without a minimum size were forced to have a
    proportion of 0 in wxAUI layout code, which meant that a wxAuiToolBar
    with stretchable elements (typically spaces, but labels and controls
    could be stretchable too) couldn't stretch unless its pane was given
    some non-default minimum size, even if it was just wxSize(-1,1).
    
    This was completely undiscoverable and not intuitive at all, so let
    wxAuiToolBar stretch if it has any stretchable elements, regardless of
    its pane min size instead.
    
    This required adding wxAuiToolBar::CanStretch() and using an ugly
    dynamic cast. We could probably avoid this by using some kind of
    heuristic based on e.g. comparing min and best size, but this is simple
    and guaranteed not to break anything else, so do it like this for now.
    
    See #26252.
    
    Closes #26249.
    
  • 4fdc4be9
    by Maarten Bent at 2026-02-28T14:37:39+01:00
    Fix wxWebViewChromium initialization
    
    Make sure the wxWebViewChromiumModule is available in static builds.
    This got broken by #25911.
    
  • c4222782
    by Vadim Zeitlin at 2026-02-28T15:23:11+01:00
    Fix wrong format specifier in wxGetFrameExtents() debug message
    
    Use "%lu", not "%d", for gulong.
    
  • 3c93711f
    by Vadim Zeitlin at 2026-02-28T15:47:22+01:00
    Don't show the window if it is currently hidden in Raise()
    
    Behaviour of this function when the window was hidden was inconsistent:
    it didn't show the window in wxMSW but did in wxGTK (where doing this
    broke decoration size computation logic, see #25348) and partially did
    (meaning it was broken) in wxOSX.
    
    Fix this in the simplest possible way and don't show the window in all
    ports now, as it seems to be a safer change than starting to show it in
    all of them.
    
    Also document this behaviour.
    
    Closes #18762.
    

15 changed files:

Changes:

  • docs/changes.txt
    ... ... @@ -141,6 +141,10 @@ Changes in behaviour not resulting in compilation errors
    141 141
       as const reference from its own functions, please change the return type of
    
    142 142
       the function to wxString to fix this.
    
    143 143
     
    
    144
    +- wxWindow::Raise() doesn't show the window in all the ports now, just as it
    
    145
    +  already didn't do it in wxMSW. Call Show() explicitly before Raise() if
    
    146
    +  necessary.
    
    147
    +
    
    144 148
     
    
    145 149
     Changes in behaviour which may result in build errors
    
    146 150
     -----------------------------------------------------
    

  • include/wx/aui/auibar.h
    ... ... @@ -636,6 +636,9 @@ public:
    636 636
         // Override to call DoIdleUpdate().
    
    637 637
         virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) override;
    
    638 638
     
    
    639
    +    // This function is for internal use only, don't call it from your code.
    
    640
    +    bool CanStretch() const;
    
    641
    +
    
    639 642
     protected:
    
    640 643
         void Init();
    
    641 644
     
    

  • interface/wx/window.h
    ... ... @@ -3021,6 +3021,10 @@ public:
    3021 3021
             a window requested to be raised in some other way, e.g. by flashing its
    
    3022 3022
             icon if it is minimized.
    
    3023 3023
     
    
    3024
    +        If the window is currently hidden, this function does *not* show it
    
    3025
    +        automatically, it will only appear on top of the other windows when it
    
    3026
    +        is shown.
    
    3027
    +
    
    3024 3028
             @remarks
    
    3025 3029
             This function only works for wxTopLevelWindow-derived classes.
    
    3026 3030
     
    

  • src/aui/auibar.cpp
    ... ... @@ -2207,6 +2207,17 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal)
    2207 2207
         return true;
    
    2208 2208
     }
    
    2209 2209
     
    
    2210
    +bool wxAuiToolBar::CanStretch() const
    
    2211
    +{
    
    2212
    +    for (auto const& item : m_items)
    
    2213
    +    {
    
    2214
    +        if (item.m_proportion)
    
    2215
    +            return true;
    
    2216
    +    }
    
    2217
    +
    
    2218
    +    return false;
    
    2219
    +}
    
    2220
    +
    
    2210 2221
     int wxAuiToolBar::GetOverflowState() const
    
    2211 2222
     {
    
    2212 2223
         return m_overflowState;
    

  • src/aui/framemanager.cpp
    ... ... @@ -2447,7 +2447,13 @@ void wxAuiManager::LayoutAddPane(wxSizer* cont,
    2447 2447
             if (min_size == wxDefaultSize)
    
    2448 2448
             {
    
    2449 2449
                 min_size = pane.best_size;
    
    2450
    -            pane_proportion = 0;
    
    2450
    +
    
    2451
    +            // Toolbars may be fixed, i.e. non-resizable, but still need to
    
    2452
    +            // stretch if they contain stretchable spacers, so we should avoid
    
    2453
    +            // setting their proportion to 0 in this case.
    
    2454
    +            auto* const toolbar = wxDynamicCast(pane.window, wxAuiToolBar);
    
    2455
    +            if (!toolbar || !toolbar->CanStretch())
    
    2456
    +                pane_proportion = 0;
    
    2451 2457
             }
    
    2452 2458
         }
    
    2453 2459
     
    

  • src/common/webview.cpp
    ... ... @@ -15,6 +15,7 @@
    15 15
     #include "wx/webview.h"
    
    16 16
     #include "wx/filesys.h"
    
    17 17
     #include "wx/mstream.h"
    
    18
    +#include "wx/link.h"
    
    18 19
     #include "wx/private/webview.h"
    
    19 20
     
    
    20 21
     #if defined(__WXOSX__)
    
    ... ... @@ -535,4 +536,9 @@ void wxWebView::InitFactoryMap()
    535 536
     #endif
    
    536 537
     }
    
    537 538
     
    
    539
    +// Ensure the wxWebViewChromiumModule is linked in in static builds
    
    540
    +#if wxUSE_WEBVIEW_CHROMIUM
    
    541
    +    wxFORCE_LINK_MODULE(WebViewChromium)
    
    542
    +#endif
    
    543
    +
    
    538 544
     #endif // wxUSE_WEBVIEW

  • src/common/webview_chromium.cpp
    ... ... @@ -19,6 +19,7 @@
    19 19
     #include "wx/app.h"
    
    20 20
     #include "wx/base64.h"
    
    21 21
     #include "wx/module.h"
    
    22
    +#include "wx/link.h"
    
    22 23
     
    
    23 24
     #include "wx/private/init.h"
    
    24 25
     #ifdef __WXMSW__
    
    ... ... @@ -2303,6 +2304,10 @@ private:
    2303 2304
     
    
    2304 2305
     wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewChromiumModule, wxModule);
    
    2305 2306
     
    
    2307
    +// Allow the user code to use wxFORCE_LINK_MODULE() to ensure that this object
    
    2308
    +// file is not discarded by the linker.
    
    2309
    +wxFORCE_LINK_THIS_MODULE(WebViewChromium)
    
    2310
    +
    
    2306 2311
     // ----------------------------------------------------------------------------
    
    2307 2312
     // wxWebViewChromiumEvent
    
    2308 2313
     // ----------------------------------------------------------------------------
    

  • src/dfb/nonownedwnd.cpp
    ... ... @@ -259,6 +259,9 @@ bool wxNonOwnedWindow::Show(bool show)
    259 259
     
    
    260 260
     void wxNonOwnedWindow::Raise()
    
    261 261
     {
    
    262
    +    if ( !IsShown() )
    
    263
    +        return;
    
    264
    +
    
    262 265
         m_dfbwin->RaiseToTop();
    
    263 266
     }
    
    264 267
     
    

  • src/gtk/toplevel.cpp
    ... ... @@ -599,7 +599,7 @@ wxGetFrameExtents(GdkWindow* window, wxTopLevelWindow::DecorSize* decorSize)
    599 599
     
    
    600 600
         if ( !data || nitems != 4 )
    
    601 601
         {
    
    602
    -        wxLogTrace(TRACE_TLWSIZE, "Invalid _NET_FRAME_EXTENTS: %d items",
    
    602
    +        wxLogTrace(TRACE_TLWSIZE, "Invalid _NET_FRAME_EXTENTS: %lu items",
    
    603 603
                        nitems);
    
    604 604
             return false;
    
    605 605
         }
    
    ... ... @@ -1300,6 +1300,12 @@ void wxTopLevelWindowGTK::ShowWithoutActivating()
    1300 1300
     
    
    1301 1301
     void wxTopLevelWindowGTK::Raise()
    
    1302 1302
     {
    
    1303
    +    // Raising the window would show it and we don't want this to happen if
    
    1304
    +    // it's currently hidden and it would also break our deferred show logic,
    
    1305
    +    // so just do nothing in this case.
    
    1306
    +    if (!m_isShown)
    
    1307
    +        return;
    
    1308
    +
    
    1303 1309
         gtk_window_present( GTK_WINDOW( m_widget ) );
    
    1304 1310
     }
    
    1305 1311
     
    

  • src/gtk/window.cpp
    ... ... @@ -5437,6 +5437,9 @@ void wxWindowGTK::Raise()
    5437 5437
     {
    
    5438 5438
         wxCHECK_RET( (m_widget != nullptr), wxT("invalid window") );
    
    5439 5439
     
    
    5440
    +    if (!m_isShown)
    
    5441
    +        return;
    
    5442
    +
    
    5440 5443
         if (auto const window = GTKGetMainWindow())
    
    5441 5444
         {
    
    5442 5445
             gdk_window_raise(window);
    

  • src/msw/toplevel.cpp
    ... ... @@ -649,6 +649,8 @@ bool wxTopLevelWindowMSW::Show(bool show)
    649 649
     
    
    650 650
     void wxTopLevelWindowMSW::Raise()
    
    651 651
     {
    
    652
    +    // Note that this doesn't show the window if it's currently hidden, which
    
    653
    +    // is exactly what this function is documented to do.
    
    652 654
         ::SetForegroundWindow(GetHwnd());
    
    653 655
     }
    
    654 656
     
    

  • src/osx/nonownedwnd_osx.cpp
    ... ... @@ -288,6 +288,9 @@ void wxNonOwnedWindow::SetWindowStyleFlag(long flags)
    288 288
     // Raise the window to the top of the Z order
    
    289 289
     void wxNonOwnedWindow::Raise()
    
    290 290
     {
    
    291
    +    if (!IsShown())
    
    292
    +        return;
    
    293
    +
    
    291 294
         m_nowpeer->Raise();
    
    292 295
     }
    
    293 296
     
    

  • src/osx/window_osx.cpp
    ... ... @@ -1784,6 +1784,9 @@ wxWindow *wxWindowBase::DoFindFocus()
    1784 1784
     // Raise the window to the top of the Z order
    
    1785 1785
     void wxWindowMac::Raise()
    
    1786 1786
     {
    
    1787
    +    if ( !IsShown() )
    
    1788
    +        return;
    
    1789
    +
    
    1787 1790
         GetPeer()->Raise();
    
    1788 1791
     }
    
    1789 1792
     
    

  • src/qt/window.cpp
    ... ... @@ -575,6 +575,9 @@ bool wxWindowQt::Reparent( wxWindowBase *parent )
    575 575
     
    
    576 576
     void wxWindowQt::Raise()
    
    577 577
     {
    
    578
    +    if ( !IsShown() )
    
    579
    +        return;
    
    580
    +
    
    578 581
         GetHandle()->raise();
    
    579 582
     }
    
    580 583
     
    

  • src/x11/window.cpp
    ... ... @@ -515,6 +515,9 @@ bool wxWindowX11::Show(bool show)
    515 515
     // Raise the window to the top of the Z order
    
    516 516
     void wxWindowX11::Raise()
    
    517 517
     {
    
    518
    +    if (!IsShown())
    
    519
    +        return;
    
    520
    +
    
    518 521
         if (m_mainWindow)
    
    519 522
             XRaiseWindow( wxGlobalDisplay(), (Window) m_mainWindow );
    
    520 523
     }
    

Reply all
Reply to author
Forward
0 new messages