[Git][wxwidgets/wxwidgets][master] 10 commits: Remove notifier from the old model in generic wxDataViewCtrl

0 views
Skip to first unread message

Vadim Zeitlin (@_VZ_)

unread,
Aug 21, 2025, 7:09:51 PMAug 21
to wx-commi...@googlegroups.com

Vadim Zeitlin pushed to branch master at wxWidgets / wxWidgets

Commits:

  • 0aefcd7e
    by Vadim Zeitlin at 2025-08-18T23:54:10+02:00
    Remove notifier from the old model in generic wxDataViewCtrl
    
    Failure to do so could result in a crash later if the old model was not
    destroyed but continued to exist independently of the control.
    
    This also makes the code more natural and removes the need for the
    comment explaining why we reset the notifier if we don't have any model.
    
    Closes #25686.
    
  • 96653d44
    by Paul Cornett at 2025-08-20T09:08:25-07:00
    Move TLW "map-event" handling to a member function
    
    This will allow access to a private member in a later commit. No real changes.
    
  • a3e96b55
    by Paul Cornett at 2025-08-20T09:21:06-07:00
    Fix TLW size after restoring from fullscreen with X11
    
    See #25708
    
  • 1c6563e2
    by Maarten Bent at 2025-08-21T20:16:23+02:00
    CMake: Fix names of built-in webp libraries
    
    Use the same naming function as used by the other built-in libraries.
    Set the PREFIX property, instead of relying on CMake's default value.
    
    Fixes #25709
    
  • 49c95b84
    by Maarten Bent at 2025-08-21T20:16:25+02:00
    CMake: Revert changes to CMAKE_BUILD_TYPE by webp
    
  • 7b8caba1
    by Maarten Bent at 2025-08-21T20:16:26+02:00
    CMake: Add CMAKE_CONFIGURATION_TYPES to cache
    
    So it shows correctly in cmake-gui.
    And keep the default hints.
    
  • 0dfe37a6
    by Vadim Zeitlin at 2025-08-22T00:43:19+02:00
    Add wxMSW-specific wxBitmapBundle accessors to wxMenuItem
    
    Provide GetBitmapBundle(bool checked) and GetDisabledBitmapBundle() too
    in wxMSW, for consistency with the existing MSW-only member functions
    returning bitmaps.
    
    See #25705.
    
    Closes #25685.
    
  • 9b737195
    by Vadim Zeitlin at 2025-08-22T00:44:08+02:00
    Merge branch 'size-restore-after-fullscreen' of github.com:paulcor/wxWidgets
    
    Fix window size after unmaximizing it XFCE/MATE.
    
    Workaround for Mutter from 9537141500 (Fix handling window total size
    under GNOME with X11, 2025-04-28) broke the well behaving WMs used by
    other desktop environments, such as XFCE, as it resulted in the window
    size being mistakenly adjusted after the decorations size was changed
    due to restoring a previous maximized window.
    
    Prevent this from happening by not adjusting the size after the window
    has been already mapped.
    
    See #25348, #25349.
    
    Closes #25708.
    
    Closes #25711.
    
  • a78df419
    by Vadim Zeitlin at 2025-08-22T00:50:01+02:00
    Merge branch 'cmake-builtin-lib-names' of github.com:MaartenBent/wxWidgets
    
    CMake: Fix names of built-in webp libraries.
    
    And improve dealing with CMAKE_BUILD_TYPE and CMAKE_CONFIGURATION_TYPES
    variables.
    
    See #25715.
    
  • 3fd1c174
    by Maarten Bent at 2025-08-22T00:50:52+02:00
    Update wxAuiToolBar after wxSysColourChangedEvent
    
    The background bitmap of the toolbar is cached and should be recreated
    after the colour change.
    
    Otherwise it will not be updated until a wxSizeEvent is generated.
    
    Closes #25716.
    

10 changed files:

Changes:

  • CMakeLists.txt
    ... ... @@ -13,7 +13,10 @@ if(NOT CMAKE_CONFIGURATION_TYPES)
    13 13
         get_property(HAVE_MULTI_CONFIG_GENERATOR GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
    
    14 14
         # Set default configuration types for multi-config generators
    
    15 15
         if(HAVE_MULTI_CONFIG_GENERATOR)
    
    16
    -        set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
    
    16
    +        string(CONCAT config_hint "Semicolon separated list of supported "
    
    17
    +            "configuration types, only supports Debug, Release, MinSizeRel, "
    
    18
    +            "and RelWithDebInfo, anything else will be ignored.")
    
    19
    +        set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING ${config_hint})
    
    17 20
         endif()
    
    18 21
     endif()
    
    19 22
     
    
    ... ... @@ -21,7 +24,9 @@ endif()
    21 24
     if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
    
    22 25
         set(default_build_type "Debug")
    
    23 26
         message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
    
    24
    -    set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
    
    27
    +    set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING
    
    28
    +        "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel"
    
    29
    +    )
    
    25 30
         # Set the possible values of build type for cmake-gui
    
    26 31
         set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
    
    27 32
     endif()
    

  • build/cmake/functions.cmake
    ... ... @@ -598,8 +598,8 @@ macro(wx_add_dependencies name)
    598 598
         endif()
    
    599 599
     endmacro()
    
    600 600
     
    
    601
    -# Set common properties for a builtin third party library
    
    602
    -function(wx_set_builtin_target_properties target_name)
    
    601
    +# Set output name for a builtin third party library
    
    602
    +macro(wx_set_builtin_target_ouput_name target target_name)
    
    603 603
         set(lib_unicode)
    
    604 604
         if(target_name STREQUAL "wxregex")
    
    605 605
             set(lib_unicode "u")
    
    ... ... @@ -618,10 +618,23 @@ function(wx_set_builtin_target_properties target_name)
    618 618
             set(lib_version "-${wxMAJOR_VERSION}.${wxMINOR_VERSION}")
    
    619 619
         endif()
    
    620 620
     
    
    621
    -    set_target_properties(${target_name} PROPERTIES
    
    621
    +    set(lib_prefix "lib")
    
    622
    +    if(MSVC OR (WIN32 AND wxBUILD_SHARED))
    
    623
    +        set(lib_prefix)
    
    624
    +    elseif (CYGWIN AND wxBUILD_SHARED)
    
    625
    +        set(lib_prefix "cyg")
    
    626
    +    endif()
    
    627
    +
    
    628
    +    set_target_properties(${target} PROPERTIES
    
    622 629
             OUTPUT_NAME       "${target_name}${lib_unicode}${lib_rls}${lib_flavour}${lib_version}"
    
    623 630
             OUTPUT_NAME_DEBUG "${target_name}${lib_unicode}${lib_dbg}${lib_flavour}${lib_version}"
    
    631
    +        PREFIX            "${lib_prefix}"
    
    624 632
         )
    
    633
    +endmacro()
    
    634
    +
    
    635
    +# Set common properties for a builtin third party library
    
    636
    +function(wx_set_builtin_target_properties target_name)
    
    637
    +    wx_set_builtin_target_ouput_name(${target_name} "${target_name}")
    
    625 638
     
    
    626 639
         if(MSVC)
    
    627 640
             # we're not interested in deprecation warnings about the use of
    

  • build/cmake/lib/webp.cmake
    ... ... @@ -28,8 +28,19 @@ if(wxUSE_LIBWEBP STREQUAL "builtin")
    28 28
         set(WEBP_BUILD_WEBP_JS    OFF)
    
    29 29
         set(WEBP_BUILD_FUZZTEST   OFF)
    
    30 30
     
    
    31
    +    # webp sets CMAKE_BUILD_TYPE if it is not defined.
    
    32
    +    # Multi-config generators do not need this, and might even
    
    33
    +    # cause confusion in cmake-gui, so unset it later.
    
    34
    +    if(NOT DEFINED CMAKE_BUILD_TYPE)
    
    35
    +        set(RESET_CMAKE_BUILD_TYPE ON)
    
    36
    +    endif()
    
    37
    +
    
    31 38
         add_subdirectory("${WEBP_ROOT}" "${WEBP_BUILD_ROOT}" EXCLUDE_FROM_ALL)
    
    32 39
     
    
    40
    +    if(RESET_CMAKE_BUILD_TYPE)
    
    41
    +        unset(CMAKE_BUILD_TYPE CACHE)
    
    42
    +    endif()
    
    43
    +
    
    33 44
         mark_as_advanced(WEBP_CHECK_SIMD)
    
    34 45
         mark_as_advanced(WEBP_BITTRACE)
    
    35 46
         mark_as_advanced(WEBP_BUILD_LIBWEBPMUX)
    
    ... ... @@ -43,10 +54,9 @@ if(wxUSE_LIBWEBP STREQUAL "builtin")
    43 54
     
    
    44 55
         get_property(webpTargets DIRECTORY "${WEBP_ROOT}" PROPERTY BUILDSYSTEM_TARGETS)
    
    45 56
         foreach(target_name IN LISTS webpTargets)
    
    57
    +        wx_set_builtin_target_ouput_name(${target_name} "wx${target_name}")
    
    46 58
             set_target_properties(${target_name} PROPERTIES
    
    47 59
                 FOLDER "Third Party Libraries/WebP"
    
    48
    -            PREFIX  ""
    
    49
    -            OUTPUT_NAME "wx${target_name}"
    
    50 60
                 PUBLIC_HEADER ""
    
    51 61
             )
    
    52 62
         endforeach()
    

  • include/wx/gtk/toplevel.h
    ... ... @@ -94,6 +94,7 @@ public:
    94 94
     
    
    95 95
         // GTK callbacks
    
    96 96
         virtual void GTKHandleRealized() override;
    
    97
    +    void GTKHandleMapped();
    
    97 98
     
    
    98 99
         void GTKConfigureEvent(int x, int y);
    
    99 100
     
    

  • include/wx/msw/menuitem.h
    ... ... @@ -83,6 +83,11 @@ public:
    83 83
             DoSetBitmap(bmp, bChecked);
    
    84 84
         }
    
    85 85
     
    
    86
    +    wxBitmapBundle GetBitmapBundle(bool bChecked) const
    
    87
    +    {
    
    88
    +        return bChecked ? m_bitmap : m_bmpUnchecked;
    
    89
    +    }
    
    90
    +
    
    86 91
         wxBitmap GetBitmap(bool bChecked) const;
    
    87 92
     
    
    88 93
     #if wxUSE_OWNER_DRAWN
    
    ... ... @@ -92,6 +97,8 @@ public:
    92 97
             SetOwnerDrawn(true);
    
    93 98
         }
    
    94 99
     
    
    100
    +    wxBitmapBundle GetDisabledBitmapBundle() const { return m_bmpDisabled; }
    
    101
    +
    
    95 102
         wxBitmap GetDisabledBitmap() const;
    
    96 103
     
    
    97 104
         int MeasureAccelWidth() const;
    

  • interface/wx/menuitem.h
    ... ... @@ -179,6 +179,9 @@ public:
    179 179
         /**
    
    180 180
             Returns the checked or unchecked bitmap.
    
    181 181
     
    
    182
    +        Prefer using GetBitmapBundle() overload taking @a checked parameter in
    
    183
    +        the new code.
    
    184
    +
    
    182 185
             This overload only exists in wxMSW, avoid using it in portable code.
    
    183 186
         */
    
    184 187
         wxBitmap GetBitmap(bool checked) const;
    
    ... ... @@ -195,13 +198,34 @@ public:
    195 198
         */
    
    196 199
         wxBitmapBundle GetBitmapBundle() const;
    
    197 200
     
    
    201
    +    /**
    
    202
    +        Returns the bitmap bundle containing the checked or unchecked bitmap
    
    203
    +        for this item.
    
    204
    +
    
    205
    +        @onlyfor{wxmsw}
    
    206
    +
    
    207
    +        @since 3.3.2
    
    208
    +     */
    
    209
    +    wxBitmapBundle GetBitmapBundle(bool checked) const;
    
    210
    +
    
    198 211
         /**
    
    199 212
             Returns the bitmap used for disabled items.
    
    200 213
     
    
    214
    +        @see GetDisabledBitmapBundle()
    
    215
    +
    
    201 216
             @onlyfor{wxmsw}
    
    202 217
         */
    
    203 218
         virtual wxBitmap GetDisabledBitmap() const;
    
    204 219
     
    
    220
    +    /**
    
    221
    +        Returns the bitmap bundle used for disabled items.
    
    222
    +
    
    223
    +        @onlyfor{wxmsw}
    
    224
    +
    
    225
    +        @since 3.3.2
    
    226
    +    */
    
    227
    +    wxBitmap GetDisabledBitmapBundle() const;
    
    228
    +
    
    205 229
         /**
    
    206 230
             Returns the font associated with the menu item.
    
    207 231
     
    

  • src/aui/auibar.cpp
    ... ... @@ -2461,6 +2461,7 @@ void wxAuiToolBar::OnSysColourChanged(wxSysColourChangedEvent& event)
    2461 2461
         event.Skip();
    
    2462 2462
     
    
    2463 2463
         m_art->UpdateColoursFromSystem();
    
    2464
    +    UpdateBackgroundBitmap(GetClientSize());
    
    2464 2465
         Refresh();
    
    2465 2466
     }
    
    2466 2467
     
    

  • src/generic/datavgen.cpp
    ... ... @@ -5889,6 +5889,14 @@ bool wxDataViewCtrl::Enable(bool enable)
    5889 5889
     
    
    5890 5890
     bool wxDataViewCtrl::AssociateModel( wxDataViewModel *model )
    
    5891 5891
     {
    
    5892
    +    if (wxDataViewModel* const oldModel = GetModel())
    
    5893
    +    {
    
    5894
    +        // Remove the notifier from the model before calling the base class
    
    5895
    +        // version which may (or not) delete the model.
    
    5896
    +        oldModel->RemoveNotifier( m_notifier );
    
    5897
    +        m_notifier = nullptr;
    
    5898
    +    }
    
    5899
    +
    
    5892 5900
         if (!wxDataViewCtrlBase::AssociateModel( model ))
    
    5893 5901
             return false;
    
    5894 5902
     
    
    ... ... @@ -5897,14 +5905,6 @@ bool wxDataViewCtrl::AssociateModel( wxDataViewModel *model )
    5897 5905
             m_notifier = new wxGenericDataViewModelNotifier( m_clientArea );
    
    5898 5906
             model->AddNotifier( m_notifier );
    
    5899 5907
         }
    
    5900
    -    else
    
    5901
    -    {
    
    5902
    -        // Our previous notifier has either been already deleted when the
    
    5903
    -        // previous model was DecRef()'d in the base class AssociateModel() or
    
    5904
    -        // is not associated with us any more because if the model is still
    
    5905
    -        // alive, it's not used by this control.
    
    5906
    -        m_notifier = nullptr;
    
    5907
    -    }
    
    5908 5908
     
    
    5909 5909
         m_clientArea->DestroyTree();
    
    5910 5910
     
    

  • src/gtk/toplevel.cpp
    ... ... @@ -477,11 +477,18 @@ gtk_frame_map_callback( GtkWidget*,
    477 477
                             GdkEvent * WXUNUSED(event),
    
    478 478
                             wxTopLevelWindow *win )
    
    479 479
     {
    
    480
    -    wxLogTrace(TRACE_TLWSIZE, "Mapped for %s", wxDumpWindow(win));
    
    480
    +    win->GTKHandleMapped();
    
    481
    +    return false;
    
    482
    +}
    
    483
    +}
    
    484
    +
    
    485
    +void wxTopLevelWindowGTK::GTKHandleMapped()
    
    486
    +{
    
    487
    +    wxLogTrace(TRACE_TLWSIZE, "Mapped for %s", wxDumpWindow(this));
    
    481 488
     
    
    482 489
         // We couldn't set the app ID before, as it only works for mapped windows.
    
    483 490
     #if defined(GDK_WINDOWING_WAYLAND) && GTK_CHECK_VERSION(3,24,22)
    
    484
    -    GdkWindow* const window = gtk_widget_get_window(win->m_widget);
    
    491
    +    GdkWindow* const window = gtk_widget_get_window(m_widget);
    
    485 492
         if (wxGTKImpl::IsWayland(window) && gtk_check_version(3,24,22) == nullptr)
    
    486 493
         {
    
    487 494
             const wxString className(wxTheApp->GetClassName());
    
    ... ... @@ -490,7 +497,7 @@ gtk_frame_map_callback( GtkWidget*,
    490 497
         }
    
    491 498
     #endif
    
    492 499
     
    
    493
    -    const bool wasIconized = win->IsIconized();
    
    500
    +    const bool wasIconized = IsIconized();
    
    494 501
         if (wasIconized)
    
    495 502
         {
    
    496 503
             // Because GetClientSize() returns (0,0) when IsIconized() is true,
    
    ... ... @@ -499,21 +506,21 @@ gtk_frame_map_callback( GtkWidget*,
    499 506
             // tlw that was "rolled up" with some WMs.
    
    500 507
             // Queue a resize rather than sending size event directly to allow
    
    501 508
             // children to be made visible first.
    
    502
    -        win->m_useCachedClientSize = false;
    
    503
    -        win->m_clientWidth = 0;
    
    504
    -        gtk_widget_queue_resize(win->m_wxwindow);
    
    509
    +        m_useCachedClientSize = false;
    
    510
    +        m_clientWidth = 0;
    
    511
    +        gtk_widget_queue_resize(m_wxwindow);
    
    505 512
         }
    
    506 513
         // it is possible for m_isShown to be false here, see bug #9909
    
    507
    -    if (win->wxWindowBase::Show(true))
    
    514
    +    if (wxWindowBase::Show(true))
    
    508 515
         {
    
    509
    -        win->GTKDoAfterShow();
    
    516
    +        GTKDoAfterShow();
    
    510 517
         }
    
    511 518
     
    
    512 519
         // restore focus-on-map setting in case ShowWithoutActivating() was called
    
    513
    -    gtk_window_set_focus_on_map(GTK_WINDOW(win->m_widget), true);
    
    520
    +    gtk_window_set_focus_on_map(GTK_WINDOW(m_widget), true);
    
    514 521
     
    
    515
    -    return false;
    
    516
    -}
    
    522
    +    // Deferred show is no longer possible
    
    523
    +    m_deferShowAllowed = false;
    
    517 524
     }
    
    518 525
     
    
    519 526
     //-----------------------------------------------------------------------------
    
    ... ... @@ -1366,7 +1373,7 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si
    1366 1373
             wxLogTrace(TRACE_TLWSIZE, "Size set for %s (%d, %d) -> (%d, %d)",
    
    1367 1374
                        wxDumpWindow(this), oldSize.x, oldSize.y, m_width, m_height);
    
    1368 1375
     
    
    1369
    -        m_deferShowAllowed = true;
    
    1376
    +        m_deferShowAllowed = !gtk_widget_get_mapped(m_widget);
    
    1370 1377
             m_useCachedClientSize = false;
    
    1371 1378
     
    
    1372 1379
     #ifdef __WXGTK3__
    

  • src/msw/menuitem.cpp
    ... ... @@ -663,7 +663,7 @@ void wxMenuItem::SetItemLabel(const wxString& txt)
    663 663
     
    
    664 664
     wxBitmap wxMenuItem::GetBitmap(bool bChecked) const
    
    665 665
     {
    
    666
    -    wxBitmap bmp = GetBitmapFromBundle(bChecked ? m_bitmap : m_bmpUnchecked);
    
    666
    +    wxBitmap bmp = GetBitmapFromBundle(GetBitmapBundle(bChecked));
    
    667 667
     #if wxUSE_IMAGE
    
    668 668
         if ( bmp.IsOk() )
    
    669 669
         {
    

Reply all
Reply to author
Forward
0 new messages