[Git][wxwidgets/wxwidgets][master] 7 commits: Document wxSlider labels positioning change in the change log

1 view
Skip to first unread message

Vadim Zeitlin (@_VZ_)

unread,
Jun 2, 2025, 9:58:51 PMJun 2
to wx-commi...@googlegroups.com

Vadim Zeitlin pushed to branch master at wxWidgets / wxWidgets

Commits:

  • 5c1c1a74
    by Vadim Zeitlin at 2025-06-01T19:22:59+02:00
    Document wxSlider labels positioning change in the change log
    
    Also add a comment after the discussion in #25485.
    
    See #24106.
    
  • f2d98670
    by Vadim Zeitlin at 2025-06-02T00:44:14+02:00
    Disable gcc -Wcast-qual in nanosvg header
    
    This warning is not enabled by default, but if it is, disable it before
    including nanosvg.h header which contains some C-style casts discarding
    const.
    
  • 74174e7c
    by Vadim Zeitlin at 2025-06-02T00:55:59+02:00
    Enable extra warnings if wxENABLE_EXTRA_WARNINGS is defined
    
    Doing this in this way instead of just adding -Wextra and other options
    to the compiler command line allows to use more stringent warnings for
    our own code, but not for the third party libraries, that would usually
    be compiled with the same compiler options as it.
    
  • d0fbc265
    by Vadim Zeitlin at 2025-06-02T15:45:33+02:00
    Enable -Wdouble-promotion for wx code too
    
    Disable it for NanoSVG as there are many such warnings in its code and
    we're not really interested in fixing them.
    
  • c1fa7055
    by Blake-Madden at 2025-06-03T03:25:56+02:00
    Fix wxInfoBar buttons regression after custom checkbox addition
    
    Update the functions dealing with buttons to take into account the extra
    sizer added in cd07eabd54 (Add support for "Do not show this again"
    checkbox to wxInfoBar, 2025-05-12) which broke the existing logic.
    
    See #25394, #25461.
    
    Closes #25489.
    
    Closes #25493.
    
  • 509e2500
    by Vadim Zeitlin at 2025-06-03T03:27:25+02:00
    Merge branch 'warn-cast-qual'
    
    Enable more warnings in the CI builds using gcc or clang.
    
    See #25487.
    
  • 8b9f6cb0
    by Vadim Zeitlin at 2025-06-03T03:29:56+02:00
    Don't duplicate LIBS and LDFLAGS in EXTRALIBS
    
    LIBS and LDFLAGS are used in all linker commands anyhow, there is no
    need to add them to EXTRALIBS, especially because this triggers an
    annoying warning about "ignoring duplicate libraries" from macOS ld.
    
    Closes #25054.
    
    Closes #25494.
    

20 changed files:

Changes:

  • .github/workflows/ci.yml
    ... ... @@ -274,7 +274,7 @@ jobs:
    274 274
     
    
    275 275
               if [ -z ${{ matrix.allow_warnings }} ]; then
    
    276 276
                 if [ -z ${{ matrix.allow_extra_warnings }} ]; then
    
    277
    -              error_opts="-Wextra ${{ matrix.extra_warnings }}"
    
    277
    +              error_opts="-DwxENABLE_EXTRA_WARNINGS ${{ matrix.extra_warnings }}"
    
    278 278
                 fi
    
    279 279
                 error_opts="$error_opts -Werror $allow_warn_opt"
    
    280 280
                 echo "wxMAKEFILE_ERROR_CXXFLAGS=$error_opts" >> $GITHUB_ENV
    

  • .github/workflows/ci_mac.yml
    ... ... @@ -141,7 +141,7 @@ jobs:
    141 141
                 ;;
    
    142 142
             esac
    
    143 143
             if [ -z ${{ matrix.allow_warnings }} ]; then
    
    144
    -          error_opts="-Werror -Wsuggest-override $allow_warn_opt"
    
    144
    +          error_opts="-DwxENABLE_EXTRA_WARNINGS -Werror -Wsuggest-override $allow_warn_opt"
    
    145 145
               echo "wxMAKEFILE_ERROR_CXXFLAGS=$error_opts" >> $GITHUB_ENV
    
    146 146
               echo "wxMAKEFILE_CXXFLAGS=$wxMAKEFILE_CXXFLAGS $error_opts" >> $GITHUB_ENV
    
    147 147
             fi
    

  • .github/workflows/ci_msw.yml
    ... ... @@ -176,7 +176,7 @@ jobs:
    176 176
               cmake -G "MinGW Makefiles" \
    
    177 177
                     -DCMAKE_C_COMPILER=clang.exe \
    
    178 178
                     -DCMAKE_CXX_COMPILER=clang++.exe \
    
    179
    -                -DCMAKE_CXX_FLAGS="-Werror -Wsuggest-override" \
    
    179
    +                -DCMAKE_CXX_FLAGS="-DwxENABLE_EXTRA_WARNINGS -Werror -Wsuggest-override" \
    
    180 180
                     -DCMAKE_BUILD_TYPE=Release \
    
    181 181
                     -DwxBUILD_SAMPLES=ALL \
    
    182 182
                     -DwxBUILD_TESTS=ALL \
    

  • build/cmake/tests/gui/CMakeLists.txt
    ... ... @@ -48,6 +48,7 @@ set(TEST_GUI_SRC
    48 48
         controls/htmllboxtest.cpp
    
    49 49
         controls/hyperlinkctrltest.cpp
    
    50 50
         controls/itemcontainertest.cpp
    
    51
    +    controls/infobar.cpp
    
    51 52
         controls/label.cpp
    
    52 53
         controls/listbasetest.cpp
    
    53 54
         controls/listbooktest.cpp
    

  • configure
    ... ... @@ -41230,7 +41230,7 @@ if test "$SHARED" = 1; then
    41230 41230
     fi
    
    41231 41231
     
    
    41232 41232
     LIBS=`echo $LIBS`
    
    41233
    -EXTRALIBS="$LDFLAGS $LDFLAGS_VERSIONING $LIBS $PCRE_LINK $DMALLOC_LIBS"
    
    41233
    +EXTRALIBS="$LDFLAGS_VERSIONING $PCRE_LINK $DMALLOC_LIBS"
    
    41234 41234
     EXTRALIBS_XML="$EXPAT_LINK"
    
    41235 41235
     EXTRALIBS_HTML="$MSPACK_LINK"
    
    41236 41236
     EXTRALIBS_MEDIA="$GST_LIBS"
    

  • configure.ac
    ... ... @@ -7795,7 +7795,7 @@ if test "$SHARED" = 1; then
    7795 7795
     fi
    
    7796 7796
     
    
    7797 7797
     LIBS=`echo $LIBS`
    
    7798
    -EXTRALIBS="$LDFLAGS $LDFLAGS_VERSIONING $LIBS $PCRE_LINK $DMALLOC_LIBS"
    
    7798
    +EXTRALIBS="$LDFLAGS_VERSIONING $PCRE_LINK $DMALLOC_LIBS"
    
    7799 7799
     EXTRALIBS_XML="$EXPAT_LINK"
    
    7800 7800
     EXTRALIBS_HTML="$MSPACK_LINK"
    
    7801 7801
     EXTRALIBS_MEDIA="$GST_LIBS"
    

  • docs/changes.txt
    ... ... @@ -401,6 +401,7 @@ wxGTK:
    401 401
     - Implement max length limit for multiline wxTextCtrl (Igor Korot, #24751).
    
    402 402
     - Implement wxTextCtrl::SearchText() (Blake-Madden, #24897).
    
    403 403
     - Improve wxInfoBar appearance when text doesn't fit (#24695).
    
    404
    +- Improve wxSlider min/max labels positioning (#24106).
    
    404 405
     - Limit radius in wxDC::DrawRoundedRectangle() (Alex Shvartzkop, #24327).
    
    405 406
     - Multiple fixes to mouse event generation (#24931, #24932, #24933).
    
    406 407
     
    

  • docs/doxygen/mainpages/const_cpp.h
    ... ... @@ -429,6 +429,12 @@ more details.
    429 429
     @itemdef{wxICON_IS_BITMAP,
    
    430 430
              defined in the ports where wxIcon inherits from wxBitmap (all but
    
    431 431
              wxMSW currently)}
    
    432
    +@itemdef{wxENABLE_EXTRA_WARNINGS,
    
    433
    +         this symbol can be predefined before including wxWidgets headers to
    
    434
    +         enable extra compilers warnings. This is mostly useful for wxWidgets
    
    435
    +         developers, but can also be used by the applications if they want to
    
    436
    +         opt in into getting more help from compiler. Support for this symbol
    
    437
    +         appeared in wxWidgets 3.3.0.}
    
    432 438
     @endDefList
    
    433 439
     
    
    434 440
     */

  • include/wx/defs.h
    ... ... @@ -144,6 +144,15 @@
    144 144
     #   define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name)
    
    145 145
     #endif
    
    146 146
     
    
    147
    +/* Enable some warnings not enabled by default if requested. */
    
    148
    +#ifdef wxENABLE_EXTRA_WARNINGS
    
    149
    +#   ifdef __GNUC__
    
    150
    +#       pragma GCC diagnostic warning "-Wcast-qual"
    
    151
    +#       pragma GCC diagnostic warning "-Wdouble-promotion"
    
    152
    +#       pragma GCC diagnostic warning "-Wextra"
    
    153
    +#   endif
    
    154
    +#endif
    
    155
    +
    
    147 156
     /*
    
    148 157
        Clang Support
    
    149 158
      */
    

  • src/generic/bmpsvg.cpp
    ... ... @@ -51,6 +51,9 @@
    51 51
         #pragma warning(disable:4702)
    
    52 52
     #endif
    
    53 53
     
    
    54
    +wxGCC_WARNING_SUPPRESS(cast-qual)
    
    55
    +wxGCC_WARNING_SUPPRESS(double-promotion)
    
    56
    +
    
    54 57
     #if !wxUSE_NANOSVG_EXTERNAL || defined(wxUSE_NANOSVG_EXTERNAL_ENABLE_IMPL)
    
    55 58
         #define NANOSVG_IMPLEMENTATION
    
    56 59
         #define NANOSVGRAST_IMPLEMENTATION
    
    ... ... @@ -65,6 +68,9 @@
    65 68
         #include "../../3rdparty/nanosvg/src/nanosvgrast.h"
    
    66 69
     #endif
    
    67 70
     
    
    71
    +wxGCC_WARNING_RESTORE(double-promotion)
    
    72
    +wxGCC_WARNING_RESTORE(cast-qual)
    
    73
    +
    
    68 74
     #ifdef __VISUALC__
    
    69 75
         #pragma warning(pop)
    
    70 76
     #endif
    

  • src/generic/infobar.cpp
    ... ... @@ -138,7 +138,6 @@ bool wxInfoBarGeneric::Create(wxWindow *parent, wxWindowID winid, long style)
    138 138
         firstRowSizer->Add(m_icon, wxSizerFlags{}.Centre().Border());
    
    139 139
         firstRowSizer->Add(m_text, wxSizerFlags{}.Proportion(1).Centre());
    
    140 140
         firstRowSizer->AddSpacer(0); // This spacer only exists for compatibility.
    
    141
    -    firstRowSizer->Add(m_button, wxSizerFlags{}.Centre().Border());
    
    142 141
     
    
    143 142
         wxBoxSizer* const secondRowSizer = new wxBoxSizer(wxHORIZONTAL);
    
    144 143
         secondRowSizer->Add(m_checkbox, wxSizerFlags{}.CentreVertical().Border());
    
    ... ... @@ -148,6 +147,7 @@ bool wxInfoBarGeneric::Create(wxWindow *parent, wxWindowID winid, long style)
    148 147
         defaultControlSizer->Show(m_checkbox, !m_checkbox->GetLabel().empty(), true);
    
    149 148
     
    
    150 149
         sizer->Add(defaultControlSizer, wxSizerFlags{ 1 }.Expand());
    
    150
    +    sizer->Add(m_button, wxSizerFlags{}.Centre().Border());
    
    151 151
     
    
    152 152
         SetSizer(sizer);
    
    153 153
     
    
    ... ... @@ -355,9 +355,10 @@ size_t wxInfoBarGeneric::GetButtonCount() const
    355 355
         {
    
    356 356
             const wxSizerItem * const item = node->GetData();
    
    357 357
     
    
    358
    -        // if we reached the spacer separating the buttons from the text
    
    359
    -        // break the for-loop.
    
    360
    -        if ( item->IsSpacer() )
    
    358
    +        // If we reached the spacer separating the buttons from the text
    
    359
    +        // break the for-loop. Same for if we get to the sizer holding
    
    360
    +        // the icon and text.
    
    361
    +        if ( item->IsSpacer() || item->IsSizer() )
    
    361 362
                 break;
    
    362 363
     
    
    363 364
             // if the standard button is shown, there must be no other ones
    
    ... ... @@ -389,12 +390,12 @@ wxWindowID wxInfoBarGeneric::GetButtonId(size_t idx) const
    389 390
         {
    
    390 391
             const wxSizerItem * const item = node->GetData();
    
    391 392
     
    
    392
    -        if ( item->IsSpacer() )
    
    393
    +        if ( item->IsSpacer() || item->IsSizer() )
    
    393 394
                 foundSpacer = true;
    
    394 395
     
    
    395 396
             if ( foundSpacer )
    
    396 397
             {
    
    397
    -            if ( !item->IsSpacer() )
    
    398
    +            if ( !item->IsSpacer() && !item->IsSizer() )
    
    398 399
                 {
    
    399 400
                     if ( count == idx )
    
    400 401
                     {
    
    ... ... @@ -433,7 +434,7 @@ bool wxInfoBarGeneric::HasButtonId(wxWindowID btnid) const
    433 434
     
    
    434 435
             // if we reached the spacer separating the buttons from the text
    
    435 436
             // then the wanted ID is not inside.
    
    436
    -        if ( item->IsSpacer() )
    
    437
    +        if ( item->IsSpacer() || item->IsSizer() )
    
    437 438
                 return false;
    
    438 439
     
    
    439 440
             // check if we found our button
    
    ... ... @@ -462,7 +463,7 @@ void wxInfoBarGeneric::RemoveButton(wxWindowID btnid)
    462 463
             // if we reached the spacer separating the buttons from the text
    
    463 464
             // preceding them without finding our button, it must mean it's not
    
    464 465
             // there at all
    
    465
    -        if ( item->IsSpacer() )
    
    466
    +        if ( item->IsSpacer() || item->IsSizer() )
    
    466 467
             {
    
    467 468
                 wxFAIL_MSG( wxString::Format("button with id %d not found", btnid) );
    
    468 469
                 return;
    

  • src/gtk/slider.cpp
    ... ... @@ -312,6 +312,7 @@ bool wxSlider::Create(wxWindow *parent,
    312 312
             return false;
    
    313 313
         }
    
    314 314
     
    
    315
    +    // Note that wxSL_LEFT or wxSL_RIGHT imply vertical layout too, as in wxMSW.
    
    315 316
         const bool isVertical = (style & (wxSL_LEFT | wxSL_RIGHT | wxSL_VERTICAL)) != 0;
    
    316 317
         m_scale = gtk_scale_new(GtkOrientation(isVertical), nullptr);
    
    317 318
     
    

  • tests/Makefile.in
    ... ... @@ -217,6 +217,7 @@ TEST_GUI_OBJECTS = \
    217 217
     	test_gui_htmllboxtest.o \
    
    218 218
     	test_gui_hyperlinkctrltest.o \
    
    219 219
     	test_gui_itemcontainertest.o \
    
    220
    +	test_gui_infobar.o \
    
    220 221
     	test_gui_label.o \
    
    221 222
     	test_gui_listbasetest.o \
    
    222 223
     	test_gui_listbooktest.o \
    
    ... ... @@ -1068,6 +1069,9 @@ test_gui_hyperlinkctrltest.o: $(srcdir)/controls/hyperlinkctrltest.cpp $(TEST_GU
    1068 1069
     test_gui_itemcontainertest.o: $(srcdir)/controls/itemcontainertest.cpp $(TEST_GUI_ODEP)
    
    1069 1070
     	$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/itemcontainertest.cpp
    
    1070 1071
     
    
    1072
    +test_gui_infobar.o: $(srcdir)/controls/infobar.cpp $(TEST_GUI_ODEP)
    
    1073
    +	$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/infobar.cpp
    
    1074
    +
    
    1071 1075
     test_gui_label.o: $(srcdir)/controls/label.cpp $(TEST_GUI_ODEP)
    
    1072 1076
     	$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/label.cpp
    
    1073 1077
     
    

  • tests/controls/infobar.cpp
    1
    +///////////////////////////////////////////////////////////////////////////////
    
    2
    +// Name:        tests/controls/infobar.cpp
    
    3
    +// Purpose:     wxInfoBar  tests
    
    4
    +// Author:      Blake Madden
    
    5
    +// Created:     2025-6-02
    
    6
    +// Copyright:   (c) 2025 Blake Madden
    
    7
    +///////////////////////////////////////////////////////////////////////////////
    
    8
    +
    
    9
    +// ----------------------------------------------------------------------------
    
    10
    +// headers
    
    11
    +// ----------------------------------------------------------------------------
    
    12
    +
    
    13
    +#include "testprec.h"
    
    14
    +
    
    15
    +#ifndef WX_PRECOMP
    
    16
    +    #include "wx/app.h"
    
    17
    +#endif // WX_PRECOMP
    
    18
    +
    
    19
    +#include "wx/infobar.h"
    
    20
    +
    
    21
    +#include <memory>
    
    22
    +
    
    23
    +TEST_CASE("wxInfoBar::Buttons", "[wxInfoBar]")
    
    24
    +{
    
    25
    +    const std::unique_ptr<wxInfoBar>
    
    26
    +        info(new wxInfoBar(wxTheApp->GetTopWindow(), wxID_ANY, wxINFOBAR_CHECKBOX));
    
    27
    +
    
    28
    +    CHECK(info->GetButtonCount() == 0);
    
    29
    +
    
    30
    +    const int buttonId = wxID_HIGHEST + 1000;
    
    31
    +    info->AddButton(buttonId, "test");
    
    32
    +
    
    33
    +    CHECK(info->GetButtonCount() == 1);
    
    34
    +    CHECK(info->GetButtonId(0) == buttonId);
    
    35
    +    CHECK(info->HasButtonId(buttonId));
    
    36
    +
    
    37
    +    info->RemoveButton(buttonId);
    
    38
    +    CHECK(info->GetButtonCount() == 0);
    
    39
    +}

  • tests/descrip.mms
    ... ... @@ -578,6 +578,9 @@ test_gui_itemcontainertest.obj : [.controls]itemcontainertest.cpp
    578 578
     test_gui_label.obj : [.controls]label.cpp 
    
    579 579
     	$(CXXC) /object=[]$@ $(TEST_GUI_CXXFLAGS) [.controls]label.cpp
    
    580 580
     
    
    581
    +test_gui_infobar.obj : [.controls]infobar.cpp 
    
    582
    +	$(CXXC) /object=[]$@ $(TEST_GUI_CXXFLAGS) [.controls]infobar.cpp
    
    583
    +
    
    581 584
     test_gui_listbasetest.obj : [.controls]listbasetest.cpp 
    
    582 585
     	$(CXXC) /object=[]$@ $(TEST_GUI_CXXFLAGS) [.controls]listbasetest.cpp
    
    583 586
     
    

  • tests/makefile.gcc
    ... ... @@ -1013,6 +1013,9 @@ $(OBJS)\test_gui_hyperlinkctrltest.o: ./controls/hyperlinkctrltest.cpp
    1013 1013
     $(OBJS)\test_gui_itemcontainertest.o: ./controls/itemcontainertest.cpp
    
    1014 1014
     	$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
    
    1015 1015
     
    
    1016
    +$(OBJS)\test_gui_infobar.o: ./controls/infobar.cpp
    
    1017
    +	$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
    
    1018
    +
    
    1016 1019
     $(OBJS)\test_gui_label.o: ./controls/label.cpp
    
    1017 1020
     	$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
    
    1018 1021
     
    

  • tests/makefile.vc
    ... ... @@ -1314,6 +1314,9 @@ $(OBJS)\test_gui_hyperlinkctrltest.obj: .\controls\hyperlinkctrltest.cpp
    1314 1314
     $(OBJS)\test_gui_itemcontainertest.obj: .\controls\itemcontainertest.cpp
    
    1315 1315
     	$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\itemcontainertest.cpp
    
    1316 1316
     
    
    1317
    +$(OBJS)\test_gui_infobar.obj: .\controls\infobar.cpp
    
    1318
    +	$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\infobar.cpp
    
    1319
    +
    
    1317 1320
     $(OBJS)\test_gui_label.obj: .\controls\label.cpp
    
    1318 1321
     	$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\label.cpp
    
    1319 1322
     
    

  • tests/test.bkl
    ... ... @@ -230,6 +230,7 @@
    230 230
                 controls/htmllboxtest.cpp
    
    231 231
                 controls/hyperlinkctrltest.cpp
    
    232 232
                 controls/itemcontainertest.cpp
    
    233
    +            controls/infobar.cpp
    
    233 234
                 controls/label.cpp
    
    234 235
                 controls/listbasetest.cpp
    
    235 236
                 controls/listbooktest.cpp
    

  • tests/test_gui.vcxproj
    ... ... @@ -932,6 +932,7 @@
    932 932
         <ClCompile Include="controls\htmllboxtest.cpp" />
    
    933 933
         <ClCompile Include="controls\hyperlinkctrltest.cpp" />
    
    934 934
         <ClCompile Include="controls\itemcontainertest.cpp" />
    
    935
    +    <ClCompile Include="controls\infobar.cpp" />
    
    935 936
         <ClCompile Include="controls\label.cpp" />
    
    936 937
         <ClCompile Include="controls\listbasetest.cpp" />
    
    937 938
         <ClCompile Include="controls\listbooktest.cpp" />
    

  • tests/test_gui.vcxproj.filters
    ... ... @@ -131,6 +131,9 @@
    131 131
         <ClCompile Include="image\image.cpp">
    
    132 132
           <Filter>Source Files</Filter>
    
    133 133
         </ClCompile>
    
    134
    +    <ClCompile Include="controls\infobar.cpp">
    
    135
    +      <Filter>Source Files</Filter>
    
    136
    +    </ClCompile>
    
    134 137
         <ClCompile Include="controls\itemcontainertest.cpp">
    
    135 138
           <Filter>Source Files</Filter>
    
    136 139
         </ClCompile>
    

Reply all
Reply to author
Forward
0 new messages