[Git][wxwidgets/wxwidgets][3.2] 16 commits: Fix copy/paste in wxGTK when a clipboard manager is running

2 views
Skip to first unread message

Vadim Zeitlin (@_VZ_)

unread,
May 8, 2026, 10:27:08 AM (9 days ago) May 8
to wx-commi...@googlegroups.com

Vadim Zeitlin pushed to branch 3.2 at wxWidgets / wxWidgets

Commits:

  • 1a41892a
    by David Edmundson at 2026-03-19T15:39:22+01:00
    Fix copy/paste in wxGTK when a clipboard manager is running
    
    Simplify clipboard operations in GTK to not clear clipboard before
    changing its contents.
    
    When changing the clipboard contents the current code emits a lot of
    noise on the X11 connection, it clears the contents and verifies it's
    empty before settings the new content.
    
    This non-atomic operation is problematic for desktop environments with
    clipboard managers that try to replace an empty clipboard. It becomes
    racey as to the order of things being set.
    
    See #26265, #26278.
    
    (cherry picked from commit f11053a2d37607f8b776b3707a2dcf408aa318f6)
    
  • 50321551
    by Paul Cornett at 2026-04-01T14:13:00+02:00
    Fix memory leak in wxDataViewChoiceRenderer on GTK
    
    (cherry picked from commit c456ccb28f96f536774896b312aca1aa9ebb5b0a)
    
  • 12754ce4
    by Vadim Zeitlin at 2026-04-04T18:53:44+02:00
    Improve wxListCtrl::GetColumn() documentation
    
    Mention that the index parameter must be valid as it is may not be
    clear.
    
    See #26337.
    
    (cherry picked from commit 2d6aaa14d5a45fc9ac891bf9cf7e521bdbe4b74a)
    
  • d5fbe7fd
    by Florian Larysch at 2026-04-04T18:54:42+02:00
    Fix eglDestroySurface() argument order when using EGL with X11
    
    eglDestroySurface takes the display first and the surface second rather
    than the other way around. Since both EGLDisplay and EGLSurface are just
    typedef'd to void* this doesn't raise a compiler warning. This currently
    doesn't crash at runtime because Mesa validates the display pointer
    against a list of known good values and fails gracefully, but it still
    causes a resource leak.
    
    The wrong call was present since the changes of 23ccdb2 (Improve and
    document wxGLCanvas::CreateSurface(), 2023-03-21), see #23366.
    
    See #26341.
    
    (cherry picked from commit a62b29135380fe46eaa06307ffe3722506f357e1)
    
  • b826d2da
    by Vadim Zeitlin at 2026-04-04T18:55:23+02:00
    Compare EGL surface with EGL_NO_SURFACE for consistency
    
    No real changes because EGL_NO_SURFACE is just 0 anyhow, but write the
    check for the surface being valid in a way consistent with all the other
    ones in this file.
    
    (cherry picked from commit ec1ac0879a09a182ed5e1c087900a5fe9fbb05ca)
    
  • 87a6ca78
    by Vadim Zeitlin at 2026-04-04T18:55:42+02:00
    Fix layout of new page in the notebook sample
    
    Use sizer to position the buttons on the new pages instead of hardcoding
    the buttons positions which, unsurprisingly, didn't work well and
    resulted in buttons overlapping each other in high DPI.
    
    (cherry picked from commit e0321c2ddf9732e5b3e6b6473cb9e49e8c27b013)
    
  • ecc849e6
    by Vadim Zeitlin at 2026-04-04T18:56:28+02:00
    Take default style into account in wxMSW wxTextCtrl::SetValue()
    
    Previously this only worked for plain EDIT controls but not for the
    controls with wxTE_RICH[2] style because WM_SETTEXT ignores the current
    text style for the latter.
    
    Work around this by using EM_REPLACESEL for them instead.
    
    See #26320, #26321.
    
    (cherry picked from commit fba6003bf117efb332f938c9a4a9914d50acfc6c)
    
  • 3f99b5dd
    by Vadim Zeitlin at 2026-04-05T18:34:52+02:00
    Don't impose arbitrary maximum length on picker controls text
    
    This code was there ever since ec376c8fd9 (added
    wx{Colour|File|Dir|Font}PickerCtrl (patch 1472329 by Francesco),
    2006-05-31), but didn't make any sense because it should be possible to
    enter arbitrarily long strings in these controls.
    
    Additionally, the maximum length was increased for wxFilePickerCtrl
    after creation which meant that that its initial contents was not shown
    in it, but the same string could be shown later, which was even more
    confusing.
    
    Just stop imposing any length constraints.
    
    See #7863, #26314.
    
    (cherry picked from commit 932004d7225c3b31f484d452325d74109856048b)
    
  • 6ab2a59f
    by Florian Larysch at 2026-04-05T18:37:15+02:00
    Fix crash with wxGLCanvas using EGL inside wxNotebook
    
    EGL implementation of wxGLCanvas requires its GTKHandleRealized() to be
    called in order to call wxGLCanvasEGL::OnRealized(), but this didn't
    happen when wxGLCanvas was used as a wxNotebook page because such pages
    are already realized by the time wxWindow::PostCreation() is called due
    to the wxNotebook-specific hack in its AddChildGTK() and PostCreation()
    skipped connecting to "realize" signal in this case.
    
    Fix this by always connecting to this signal, as the page can, and will,
    be unrealized and then re-realized later and the window must be notified
    when this happens.
    
    This commit is best viewed ignoring whitespace-only changes.
    
    See #26340.
    
    Co-authored-by: Vadim Zeitlin <va...@wxwidgets.org>
    
    (cherry picked from commit ce69bc9bbe2b9bb22d993c7314a4f9d96363e5b2)
    
  • 2ecb519e
    by AliKet at 2026-04-06T17:55:09+02:00
    Fix wxDC::StretchBlit() when blitting a DIB in RTL under MSW
    
    Use LogicalToDevice() instead of LogicalToDevice{X,Y}() which don't work
    correctly in RTL layout in this branch (they do in 3.3).
    
    See #19344, #26266.
    
  • 45d02633
    by Vadim Zeitlin at 2026-04-07T20:46:07+02:00
    Fix for titlebar showing on Wayland with wxBORDER_NONE and server-side decorations
    
    Removing decorations with gtk_window_set_decorated() is insufficient to disable
    titlebar with some Wayland compositors.
    
    See #26357.
    
    (cherry picked from commit 236e5c2451fa8ddca85f9bdf8778c5c38d0083a2)
    
  • 2acd490c
    by Vadim Zeitlin at 2026-04-15T02:32:58+02:00
    Fix using wxCaret in a scrolled window in non-wxMSW ports
    
    Call PrepareDC() to account for scrolling.
    
    See #26282.
    
    (cherry picked from commit 96fac602e8066544d771f79a7fb8cf295ca47b9a)
    
  • 655b1d27
    by Vadim Zeitlin at 2026-04-29T23:43:11+02:00
    Fix creating wxGLCanvas when using EGL 1.4 with X11
    
    The changes of 602b80d (Support EGL 1.4 instead of previously required
    1.5, 2025-11-23) were wrong for X11 because eglCreateWindowSurface(),
    used as the fallback when newer EGL functions are not available,
    requires passing it the actual X11 Window (i.e. an XID) rather than a
    pointer to it.
    
    Fix this by passing both the XID and a pointer to it to this function
    and calling the different functions with the appropriate parameter.
    
    Note that we still need to pass wl_egl_window pointer to this function
    when using Wayland and we need to pass a pointer to XID when using newer
    EGL functions.
    
    See #26410.
    
    (cherry picked from commit 8a41fd01d1c08e97ef38701d556ed128efd2e53c)
    
  • 70a09d88
    by Vadim Zeitlin at 2026-04-30T00:05:51+02:00
    Use Fedora 43 for Circle CI builds for now
    
    Latest Fedora 44 uses pre-release version of gcc 16 which is
    problematic, keep testing with gcc 15 from the previous Fedora release
    for now.
    
  • 5be3d905
    by Václav Slavík at 2026-04-30T19:16:52+02:00
    Don't crash on unexpected CTFontDescription content
    
    Don't crash in wxNativeFontInfo::InitFromDescriptor() in wxOSX when the
    provided descriptor doesn't contain kCTFontTraitsAttribute.
    
    This can happen e.g. when the descriptor was deserialized from a plist
    dictionary and the corresponding font is not present on the system.
    
    See #26411.
    
    (cherry picked from commit bbdbf45dceb7485fa7cd5e5b5a87a70f5b34a5e6)
    
  • 95bfcbc8
    by Vadim Zeitlin at 2026-04-30T19:16:57+02:00
    Improve wxFont::SetNativeFontInfo() documentation
    
    Explain that it returns true even if the font was not matched exactly.
    
    See #26411.
    
    (cherry picked from commit 52f9219bf4b730d382f7221896f6ff2b76f7ab4f)
    

17 changed files:

Changes:

  • .circleci/config.yml
    ... ... @@ -4,7 +4,7 @@ version: 2.1
    4 4
     jobs:
    
    5 5
       build-fedora:
    
    6 6
         docker:
    
    7
    -      - image: fedora
    
    7
    +      - image: fedora:43
    
    8 8
         steps:
    
    9 9
           - run:
    
    10 10
               name: Install Git
    

  • docs/changes.txt
    ... ... @@ -253,11 +253,34 @@ Changes in behaviour which may result in build errors
    253 253
     
    
    254 254
     
    
    255 255
     3.2.11: (released 2026-??-??)
    
    256
    +-----------------------------
    
    256 257
     
    
    257 258
     All:
    
    258 259
     
    
    259 260
     - Support defining wxNO_IMPLICIT_WXSTRING_CONV_TO_PTR in wxString (#26307).
    
    260 261
     
    
    262
    +All (GUI):
    
    263
    +
    
    264
    +- Fix wxCaret position in scrolled windows (#26282).
    
    265
    +
    
    266
    +wxGTK:
    
    267
    +
    
    268
    +- Fix copy/paste when a clipboard manager is running (David Edmundson, #26265).
    
    269
    +- Fix crash with EGL-based wxGLCanvas in wxNotebook (Florian Larysch, #26340).
    
    270
    +- Fix memory leak in wxDataViewChoiceRenderer.
    
    271
    +- Fix resource leak when using EGL with X11 (Florian Larysch, #26341).
    
    272
    +- Fix showing title bar under Wayland with wxBORDER_NONE (#26357).
    
    273
    +- Remove wrong maximum text length limitation in "picker" controls (#26314).
    
    274
    +
    
    275
    +wxMSW:
    
    276
    +
    
    277
    +- Fix wxBufferedPaintDC when using RTL layout (AliKet, #26266).
    
    278
    +- Use default style in wxTextCtrl::SetValue() (#26320).
    
    279
    +
    
    280
    +wxOSX:
    
    281
    +
    
    282
    +- Fix possible crash in wxFont::SetNativeFontInfo() (Václav Slavík, #26411).
    
    283
    +
    
    261 284
     
    
    262 285
     3.2.10: (released 2026-03-03)
    
    263 286
     -----------------------------
    

  • include/wx/unix/glegl.h
    ... ... @@ -136,9 +136,26 @@ private:
    136 136
         // fall back on eglCreateWindowSurface() otherwise.
    
    137 137
         //
    
    138 138
         // This function uses m_display and m_config which must be initialized
    
    139
    -    // before using it and should be passed either m_xwindow or m_wlEGLWindow
    
    140
    -    // depending on whether we are using X11 or Wayland.
    
    141
    -    EGLSurface CallCreatePlatformWindowSurface(void *window) const;
    
    139
    +    // before using it.
    
    140
    +    //
    
    141
    +    // Window parameter is passed twice because some of the functions above
    
    142
    +    // take it by value while others take it by pointer and this depends on
    
    143
    +    // whether we use X11 or Wayland. Use wrappers below taking correct window
    
    144
    +    // type instead of calling this function directly.
    
    145
    +    EGLSurface
    
    146
    +    DoCallCreatePlatformWindowSurface(wxUIntPtr windowID, void* windowPtr) const;
    
    147
    +
    
    148
    +    // This one is for X11.
    
    149
    +    EGLSurface CallCreatePlatformWindowSurface(wxUIntPtr xwindow) const
    
    150
    +    {
    
    151
    +        return DoCallCreatePlatformWindowSurface(xwindow, &xwindow);
    
    152
    +    }
    
    153
    +
    
    154
    +    // And this one is for Wayland.
    
    155
    +    EGLSurface CallCreatePlatformWindowSurface(struct wl_egl_window* window) const
    
    156
    +    {
    
    157
    +        return DoCallCreatePlatformWindowSurface(wxPtrToUInt(window), window);
    
    158
    +    }
    
    142 159
     
    
    143 160
     
    
    144 161
         EGLConfig *m_config;
    

  • interface/wx/font.h
    ... ... @@ -1069,11 +1069,18 @@ public:
    1069 1069
             Creates the font corresponding to the given native font description string
    
    1070 1070
             which must have been previously returned by GetNativeFontInfoDesc().
    
    1071 1071
     
    
    1072
    -        If the string is invalid, font is unchanged.
    
    1072
    +        If the string is syntactically invalid, the functions returns @false
    
    1073
    +        and the font is unchanged. Otherwise the function returns @true even if
    
    1074
    +        the created font doesn't exactly match the description (e.g. because
    
    1075
    +        some of the attributes in it are not supported or the font name is not
    
    1076
    +        available on the end-user's system and so a closest match is created
    
    1077
    +        instead).
    
    1078
    +
    
    1073 1079
             This function is typically used for de-serializing a wxFont object
    
    1074 1080
             previously saved in a string-form.
    
    1075 1081
     
    
    1076
    -        @return @true if the creation was successful.
    
    1082
    +        @return @true if the font was initialized from the given string, @false
    
    1083
    +            if the string was invalid and the font was not changed.
    
    1077 1084
     
    
    1078 1085
             @see SetNativeFontInfoUserDesc()
    
    1079 1086
         */
    
    ... ... @@ -1422,7 +1429,7 @@ wxFontList* wxTheFontList;
    1422 1429
         Converts string to a wxFont best represented by the given string. Returns
    
    1423 1430
         @true on success.
    
    1424 1431
     
    
    1425
    -    @see wxToString(const wxFont&)
    
    1432
    +    @see wxToString(const wxFont&), wxFont::SetNativeFontInfo()
    
    1426 1433
     
    
    1427 1434
         @header{wx/font.h}
    
    1428 1435
     */
    
    ... ... @@ -1431,7 +1438,7 @@ bool wxFromString(const wxString& string, wxFont* font);
    1431 1438
     /**
    
    1432 1439
         Converts the given wxFont into a string.
    
    1433 1440
     
    
    1434
    -    @see wxFromString(const wxString&, wxFont*)
    
    1441
    +    @see wxFromString(const wxString&, wxFont*), wxFont::GetNativeFontInfoDesc()
    
    1435 1442
     
    
    1436 1443
         @header{wx/font.h}
    
    1437 1444
     */
    

  • interface/wx/listctrl.h
    ... ... @@ -555,12 +555,20 @@ public:
    555 555
     
    
    556 556
         /**
    
    557 557
             Gets information about this column.
    
    558
    +
    
    558 559
             See SetItem() for more information.
    
    559 560
     
    
    560 561
             @beginWxPerlOnly
    
    561 562
             In wxPerl this method takes only the @a col parameter and
    
    562 563
             returns a @c Wx::ListItem (or @c undef).
    
    563 564
             @endWxPerlOnly
    
    565
    +
    
    566
    +        @param col The column index. It must be valid, i.e. positive or 0 and
    
    567
    +            strictly less than GetColumnCount(). The function asserts if this
    
    568
    +            is not the case.
    
    569
    +        @param item Output parameter filled with the information about the
    
    570
    +            column on successful return.
    
    571
    +        @return Always @true if the column index is valid.
    
    564 572
         */
    
    565 573
         bool GetColumn(int col, wxListItem& item) const;
    
    566 574
     
    

  • samples/notebook/notebook.cpp
    ... ... @@ -638,8 +638,13 @@ wxPanel *MyFrame::CreateNewPage() const
    638 638
         panel->SetHelpText("Panel with \"First\" and \"Second\" buttons");
    
    639 639
     #endif
    
    640 640
     
    
    641
    -    (void) new wxButton(panel, wxID_ANY, "First button", wxPoint(10, 30));
    
    642
    -    (void) new wxButton(panel, wxID_ANY, "Second button", wxPoint(150, 30));
    
    641
    +    wxBoxSizer* const sizer = new wxBoxSizer(wxHORIZONTAL);
    
    642
    +    panel->SetSizer(sizer);
    
    643
    +
    
    644
    +    sizer->Add(new wxButton(panel, wxID_ANY, "First button"),
    
    645
    +               wxSizerFlags().Border());
    
    646
    +    sizer->Add(new wxButton(panel, wxID_ANY, "Second button"),
    
    647
    +               wxSizerFlags().Border());
    
    643 648
     
    
    644 649
         return panel;
    
    645 650
     }
    

  • src/common/filepickercmn.cpp
    ... ... @@ -87,10 +87,6 @@ bool wxFileDirPickerCtrlBase::CreateBase(wxWindow *parent,
    87 87
     
    
    88 88
         DoConnect( m_picker, this );
    
    89 89
     
    
    90
    -    // default's wxPickerBase textctrl limit is too small for this control:
    
    91
    -    // make it bigger
    
    92
    -    if (m_text) m_text->SetMaxLength(512);
    
    93
    -
    
    94 90
         return true;
    
    95 91
     }
    
    96 92
     
    

  • src/common/pickerbase.cpp
    ... ... @@ -78,13 +78,6 @@ bool wxPickerBase::CreateBase(wxWindow *parent,
    78 78
                 return false;
    
    79 79
             }
    
    80 80
     
    
    81
    -        // set the maximum length allowed for this textctrl.
    
    82
    -        // This is very important since any change to it will trigger an update in
    
    83
    -        // the m_picker; for very long strings, this real-time synchronization could
    
    84
    -        // become a CPU-blocker and thus should be avoided.
    
    85
    -        // 32 characters will be more than enough for all common uses.
    
    86
    -        m_text->SetMaxLength(32);
    
    87
    -
    
    88 81
             // set the initial contents of the textctrl
    
    89 82
             m_text->SetValue(text);
    
    90 83
     
    

  • src/generic/caret.cpp
    ... ... @@ -229,6 +229,8 @@ void wxCaret::Blink()
    229 229
     void wxCaret::Refresh()
    
    230 230
     {
    
    231 231
         wxClientDC dcWin(GetWindow());
    
    232
    +    GetWindow()->PrepareDC(dcWin);
    
    233
    +
    
    232 234
         if (m_overlay.IsNative())
    
    233 235
         {
    
    234 236
             wxDCOverlay dcOverlay(m_overlay, &dcWin, m_x, m_y, m_width, m_height);
    

  • src/gtk/clipbrd.cpp
    ... ... @@ -661,8 +661,6 @@ bool wxClipboard::SetData( wxDataObject *data )
    661 661
     
    
    662 662
         wxCHECK_MSG( data, false, wxT("data is invalid") );
    
    663 663
     
    
    664
    -    Clear();
    
    665
    -
    
    666 664
         return AddData( data );
    
    667 665
     }
    
    668 666
     
    
    ... ... @@ -673,9 +671,16 @@ bool wxClipboard::AddData( wxDataObject *data )
    673 671
         wxCHECK_MSG( data, false, wxT("data is invalid") );
    
    674 672
     
    
    675 673
         // we can only store one wxDataObject so clear the old one
    
    676
    -    Clear();
    
    677
    -
    
    678
    -    Data() = data;
    
    674
    +    if ( m_usePrimary )
    
    675
    +    {
    
    676
    +        delete m_dataPrimary;
    
    677
    +        m_dataPrimary = data;
    
    678
    +    }
    
    679
    +    else
    
    680
    +    {
    
    681
    +        delete m_dataClipboard;
    
    682
    +        m_dataClipboard = data;
    
    683
    +    }
    
    679 684
     
    
    680 685
         // get formats from wxDataObjects
    
    681 686
         const size_t count = data->GetFormatCount();
    

  • src/gtk/dataview.cpp
    ... ... @@ -2980,6 +2980,7 @@ wxDataViewChoiceRenderer::wxDataViewChoiceRenderer( const wxArrayString &choices
    2980 2980
                 "text-column", 0,
    
    2981 2981
                 "has-entry", FALSE,
    
    2982 2982
                 NULL);
    
    2983
    +    g_object_unref(store);
    
    2983 2984
     
    
    2984 2985
         bool editable = (mode & wxDATAVIEW_CELL_EDITABLE) != 0;
    
    2985 2986
         g_object_set (m_renderer, "editable", editable, NULL);
    

  • src/gtk/toplevel.cpp
    ... ... @@ -844,14 +844,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
    844 844
     
    
    845 845
             if ( style & wxCAPTION )
    
    846 846
                 m_gdkDecor |= GDK_DECOR_TITLE;
    
    847
    -#if GTK_CHECK_VERSION(3,10,0)
    
    848
    -        else if (
    
    849
    -            wxGTKImpl::IsWayland(display) &&
    
    850
    -            gtk_check_version(3,10,0) == NULL)
    
    851
    -        {
    
    852
    -            gtk_window_set_titlebar(GTK_WINDOW(m_widget), gtk_header_bar_new());
    
    853
    -        }
    
    854
    -#endif
    
    855 847
     
    
    856 848
             if ( style & wxSYSTEM_MENU )
    
    857 849
                 m_gdkDecor |= GDK_DECOR_MENU;
    
    ... ... @@ -868,6 +860,14 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
    868 860
                m_gdkDecor |= GDK_DECOR_RESIZEH;
    
    869 861
             }
    
    870 862
         }
    
    863
    +#if GTK_CHECK_VERSION(3,10,0)
    
    864
    +    if ((m_gdkDecor & GDK_DECOR_TITLE) == 0 &&
    
    865
    +        wxGTKImpl::IsWayland(display) &&
    
    866
    +        wx_is_at_least_gtk3(10))
    
    867
    +    {
    
    868
    +        gtk_window_set_titlebar(GTK_WINDOW(m_widget), gtk_header_bar_new());
    
    869
    +    }
    
    870
    +#endif
    
    871 871
     
    
    872 872
         m_decorSize = GetCachedDecorSize();
    
    873 873
         int w = m_width;
    

  • src/gtk/window.cpp
    ... ... @@ -3071,11 +3071,12 @@ void wxWindowGTK::PostCreation()
    3071 3071
         {
    
    3072 3072
             GTKHandleRealized();
    
    3073 3073
         }
    
    3074
    -    else
    
    3075
    -    {
    
    3076
    -        g_signal_connect (connect_widget, "realize",
    
    3077
    -                          G_CALLBACK (gtk_window_realized_callback), this);
    
    3078
    -    }
    
    3074
    +
    
    3075
    +    // Note that we connect to "realize" even if the widget is already realized
    
    3076
    +    // because we might be unrealized later and then realized again, and we
    
    3077
    +    // must be notified when the widget is re-realized again.
    
    3078
    +    g_signal_connect (connect_widget, "realize",
    
    3079
    +                      G_CALLBACK (gtk_window_realized_callback), this);
    
    3079 3080
         g_signal_connect(connect_widget, "unrealize", G_CALLBACK(unrealize), this);
    
    3080 3081
     
    
    3081 3082
         if (!IsTopLevel())
    

  • src/msw/dc.cpp
    ... ... @@ -2383,7 +2383,9 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest,
    2383 2383
         xdest += XLOG2DEV(0);
    
    2384 2384
         ydest += YLOG2DEV(0);
    
    2385 2385
     
    
    2386
    -    const int xsrcOrig = xsrc;
    
    2386
    +    // Manually adjusted for RTL layout to fix incorrect scrolling of the DIB
    
    2387
    +    // when blitted with ::StretchDIBits() below.
    
    2388
    +    const int xsrcOrig = GetLayoutDirection() == wxLayout_LeftToRight ? xsrc : -xsrc;
    
    2387 2389
         const int ysrcOrig = ysrc;
    
    2388 2390
     
    
    2389 2391
         // This does the same thing as XLOG2DEV() but for the source DC.
    
    ... ... @@ -2603,10 +2605,23 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest,
    2603 2605
                     // automatically as it doesn't even work with the source HDC.
    
    2604 2606
                     // So do this manually to ensure that the coordinates are
    
    2605 2607
                     // interpreted in the same way here as in all the other cases.
    
    2606
    -                xsrc = source->LogicalToDeviceX(xsrcOrig);
    
    2607
    -                ysrc = source->LogicalToDeviceY(ysrcOrig);
    
    2608
    -                srcWidth = source->LogicalToDeviceXRel(srcWidth);
    
    2609
    -                srcHeight = source->LogicalToDeviceYRel(srcHeight);
    
    2608
    +                // Notice that drawings performed on a DIB section are not
    
    2609
    +                // automatically mirrored when SetLayout(LAYOUT_RTL) is called.
    
    2610
    +                // IOW, blitting a DIB using StretchDIBits() will always look
    
    2611
    +                // incorrect in RTL layout, because SetLayout() cannot modify
    
    2612
    +                // drawing directly into the bits of a DIB as documented in MSDN.
    
    2613
    +                // Fixing this RTL issue is by using LogicalToDevice{Rel}() and
    
    2614
    +                // rely on StretchDIBits() to create a mirror image of the bitmap.
    
    2615
    +                // LogicalToDevice[XY]{Rel}() doesn't work correctly in RTL as it
    
    2616
    +                // doesn't account for m_signX (which is always +1 even in RTL).
    
    2617
    +
    
    2618
    +                const wxPoint pt = source->LogicalToDevice(xsrcOrig, ysrcOrig);
    
    2619
    +                const wxSize sz = source->LogicalToDeviceRel(srcWidth, srcHeight);
    
    2620
    +
    
    2621
    +                xsrc = pt.x;
    
    2622
    +                ysrc = pt.y;
    
    2623
    +                srcWidth = sz.x;
    
    2624
    +                srcHeight = sz.y;
    
    2610 2625
     
    
    2611 2626
                     // Figure out what co-ordinate system we're supposed to specify
    
    2612 2627
                     // ysrc in.
    

  • src/msw/textctrl.cpp
    ... ... @@ -1355,7 +1355,24 @@ void wxTextCtrl::DoWriteText(const wxString& value, int flags)
    1355 1355
             if ( !m_defaultStyle.IsDefault() )
    
    1356 1356
             {
    
    1357 1357
                 long start, end;
    
    1358
    -            GetSelection(&start, &end);
    
    1358
    +
    
    1359
    +            // For the selection style to be taken into account, we must use
    
    1360
    +            // EM_REPLACESEL below, WM_SETTEXT ignores the style, so ensure
    
    1361
    +            // that we do, selecting all the text if necessary to do the same
    
    1362
    +            // thing as WM_SETTEXT would do.
    
    1363
    +            if ( !selectionOnly )
    
    1364
    +            {
    
    1365
    +                start = 0;
    
    1366
    +                end = GetLastPosition();
    
    1367
    +                SetSelection(start, end); // Select everything.
    
    1368
    +
    
    1369
    +                selectionOnly = true;
    
    1370
    +            }
    
    1371
    +            else // We're already only overwriting the selection.
    
    1372
    +            {
    
    1373
    +                GetSelection(&start, &end);
    
    1374
    +            }
    
    1375
    +
    
    1359 1376
                 SetStyle(start, end, m_defaultStyle);
    
    1360 1377
             }
    
    1361 1378
     
    

  • src/osx/carbon/font.cpp
    ... ... @@ -892,9 +892,10 @@ void wxNativeFontInfo::InitFromFontDescriptor(CTFontDescriptorRef desc)
    892 892
     
    
    893 893
         // determine approximate family
    
    894 894
     
    
    895
    -    CTFontSymbolicTraits symbolicTraits;
    
    895
    +    CTFontSymbolicTraits symbolicTraits = 0;
    
    896 896
         wxCFDictionaryRef traits((CFDictionaryRef)CTFontDescriptorCopyAttribute(desc, kCTFontTraitsAttribute));
    
    897
    -    traits.GetValue(kCTFontSymbolicTrait).GetValue((int32_t*)&symbolicTraits, 0);
    
    897
    +    if (traits)
    
    898
    +        traits.GetValue(kCTFontSymbolicTrait).GetValue((int32_t*)&symbolicTraits, 0);
    
    898 899
     
    
    899 900
         if (symbolicTraits & kCTFontMonoSpaceTrait)
    
    900 901
             m_family = wxFONTFAMILY_TELETYPE;
    
    ... ... @@ -1031,6 +1032,8 @@ CGFloat wxNativeFontInfo::GetCTWeight(CTFontDescriptorRef descr)
    1031 1032
     {
    
    1032 1033
         CGFloat weight;
    
    1033 1034
         CFTypeRef fonttraitstype = CTFontDescriptorCopyAttribute(descr, kCTFontTraitsAttribute);
    
    1035
    +    if (!fonttraitstype)
    
    1036
    +        return CGFloat(0.0);
    
    1034 1037
         wxCFDictionaryRef traits((CFDictionaryRef)fonttraitstype);
    
    1035 1038
         traits.GetValue(kCTFontWeightTrait).GetValue(&weight, CGFloat(0.0));
    
    1036 1039
         return weight;
    
    ... ... @@ -1040,6 +1043,8 @@ CGFloat wxNativeFontInfo::GetCTwidth(CTFontDescriptorRef descr)
    1040 1043
     {
    
    1041 1044
         CGFloat weight;
    
    1042 1045
         CFTypeRef fonttraitstype = CTFontDescriptorCopyAttribute(descr, kCTFontTraitsAttribute);
    
    1046
    +    if (!fonttraitstype)
    
    1047
    +        return CGFloat(0.0);
    
    1043 1048
         wxCFDictionaryRef traits((CFDictionaryRef)fonttraitstype);
    
    1044 1049
         traits.GetValue(kCTFontWidthTrait).GetValue(&weight, CGFloat(0.0));
    
    1045 1050
         return weight;
    
    ... ... @@ -1049,6 +1054,8 @@ CGFloat wxNativeFontInfo::GetCTSlant(CTFontDescriptorRef descr)
    1049 1054
     {
    
    1050 1055
         CGFloat slant;
    
    1051 1056
         CFTypeRef fonttraitstype = CTFontDescriptorCopyAttribute(descr, kCTFontTraitsAttribute);
    
    1057
    +    if (!fonttraitstype)
    
    1058
    +        return CGFloat(0.0);
    
    1052 1059
         wxCFDictionaryRef traits((CFDictionaryRef)fonttraitstype);
    
    1053 1060
         traits.GetValue(kCTFontSlantTrait).GetValue(&slant, CGFloat(0.0));
    
    1054 1061
         return slant;
    

  • src/unix/glegl.cpp
    ... ... @@ -561,7 +561,9 @@ static void gtk_glcanvas_scale_factor_notify(GtkWidget* widget,
    561 561
     } // extern "C"
    
    562 562
     #endif // GDK_WINDOWING_WAYLAND
    
    563 563
     
    
    564
    -EGLSurface wxGLCanvasEGL::CallCreatePlatformWindowSurface(void *window) const
    
    564
    +EGLSurface
    
    565
    +wxGLCanvasEGL::DoCallCreatePlatformWindowSurface(wxUIntPtr windowID,
    
    566
    +                                                 void* windowPtr) const
    
    565 567
     {
    
    566 568
         // Type of eglCreatePlatformWindowSurface[EXT]().
    
    567 569
         typedef EGLSurface (*CreatePlatformWindowSurface)(EGLDisplay display,
    
    ... ... @@ -585,7 +587,7 @@ EGLSurface wxGLCanvasEGL::CallCreatePlatformWindowSurface(void *window) const
    585 587
             if ( s_eglCreatePlatformWindowSurface )
    
    586 588
             {
    
    587 589
                 return s_eglCreatePlatformWindowSurface(m_display, *m_config,
    
    588
    -                                                    window,
    
    590
    +                                                    windowPtr,
    
    589 591
                                                         NULL);
    
    590 592
             }
    
    591 593
         }
    
    ... ... @@ -607,13 +609,13 @@ EGLSurface wxGLCanvasEGL::CallCreatePlatformWindowSurface(void *window) const
    607 609
         if ( s_eglCreatePlatformWindowSurfaceEXT )
    
    608 610
         {
    
    609 611
             return s_eglCreatePlatformWindowSurfaceEXT(m_display, *m_config,
    
    610
    -                                                   window,
    
    612
    +                                                   windowPtr,
    
    611 613
                                                        NULL);
    
    612 614
         }
    
    613 615
         else
    
    614 616
         {
    
    615 617
             return eglCreateWindowSurface(m_display, *m_config,
    
    616
    -                                      reinterpret_cast<EGLNativeWindowType>(window),
    
    618
    +                                      reinterpret_cast<EGLNativeWindowType>(windowID),
    
    617 619
                                           NULL);
    
    618 620
         }
    
    619 621
     }
    
    ... ... @@ -633,12 +635,12 @@ bool wxGLCanvasEGL::CreateSurface()
    633 635
         {
    
    634 636
             if ( m_surface != EGL_NO_SURFACE )
    
    635 637
             {
    
    636
    -            eglDestroySurface(m_surface, m_display);
    
    638
    +            eglDestroySurface(m_display, m_surface);
    
    637 639
                 m_surface = EGL_NO_SURFACE;
    
    638 640
             }
    
    639 641
     
    
    640 642
             m_xwindow = GDK_WINDOW_XID(window);
    
    641
    -        m_surface = CallCreatePlatformWindowSurface(&m_xwindow);
    
    643
    +        m_surface = CallCreatePlatformWindowSurface(m_xwindow);
    
    642 644
         }
    
    643 645
     #endif
    
    644 646
     #ifdef GDK_WINDOWING_WAYLAND
    
    ... ... @@ -709,7 +711,7 @@ wxGLCanvasEGL::~wxGLCanvasEGL()
    709 711
     {
    
    710 712
         if ( m_config && m_config != ms_glEGLConfig )
    
    711 713
             delete m_config;
    
    712
    -    if ( m_surface )
    
    714
    +    if ( m_surface != EGL_NO_SURFACE )
    
    713 715
             eglDestroySurface(m_display, m_surface);
    
    714 716
     #ifdef GDK_WINDOWING_WAYLAND
    
    715 717
         DestroyWaylandSubsurface();
    

Reply all
Reply to author
Forward
0 new messages