Reject short reads in wxIPCSocketStreams::ReadData() wxIPCSocketStreams::ReadData() reads a length prefix from the connection and then reads that many bytes into the buffer returned by GetBufferAtLeast, but it never checks how many bytes actually arrived. That buffer is either freshly allocated and so uninitialised or, more commonly, the connection's own buffer reused from an earlier and possibly larger message, so a peer that announces more data than it sends and then drops the link leaves the unread tail untouched and it gets handed to OnExecute/OnPoke/OnAdvise with the full announced size, quietly leaking stale process memory across the connection. The socket reads are done in WAITALL mode so a short read only happens when the peer is broken or hostile, and every caller already treats a null return from ReadData as an error, so the safe thing is to return nullptr when fewer bytes than announced were read instead of using the partially filled buffer. Closes #26628.
Refuse to read 0-sized data packets in wxIPCSocketStream This doesn't make sense and must also indicate a problem with either the connection or the peer. See #26628.
Add debug logging for unexpected input in wxIPCSocketStream It could be useful to get more information in case of a problem, so log unexpected situations.
Initialize wxRibbonBar members in their declarations This ensures that they are always initialized, even when the default ctor is used, which wasn't the case before for m_help_button_hovered which was never set in this case, resulting in UBSAN errors when running the ribbon sample.
Fix appearance of wxRibbon in dark mode ribbon under Linux/KDE Under KDE, the ribbon takes a blue hue because its system gray has a blue tint in it that gets amplified here. This balances this to look more like how dark mode is under macOS and MSW. Closes #26627.
Fix switching plain read-only multiline wxTextCtrl to dark mode For dark mode switching, update the background colour for non-rich read-only multiline wxTextCtrl controls. The foreground colour is already updated. The background colour is controlled by assigning m_backgroundColour rather than calling SetBackgroundColour(). This leaves the m_hasBgCol member untouched so that it distinguishes custom colours set by the user which should not be overwritten, from colours set internally which can be overwritten. Some checks of hasBgCol are changed to m_backgroundColour.IsOK(). When m_backgroundColour.IsOK() is true, there is either a custom colour or an internally set colour that we need to use. Closes #26629.
Fix wxFontPreviewer appearance in dark mode Add dark mode support to wxFontPreviewer: - Replace manually drawn black-on-white border with window border wxBORDER_SIMPLE. - Set text colour to wxSYS_COLOUR_WINDOWTEXT. Closes #26632.
Handle system colour change in wxInfoBarGeneric Move colour settings from Create() into a new function UpdateColours(), which gets called from Create() and also upon system colour change. Closes #26633.
Remove not needed code for dark mode support under Windows 1809 Remove GetDwmSetWindowAttribute() call intended for Windows version which we no longer support with dark mode. Closes #26634.
Fix system colour change for wxVListBox Remove the background colour setting from wxVListBox::Create() so that the control uses the up-to-date background colour in the paint event handler. This way the control responds to system colour changes. The comment about transparent drawing is wrong since 0975a8a (Applied patch [ 1405821 ] wxVListBox double-buffering + fix to a scrolling issue By Jaakko Salli, 2006-01-17). Closes #26636.
Fix wxPropertyGrid dark mode switching Add event.Skip() to wxPropertyGrid::OnSysColourChanged() so that upon switching to or from dark mode, the scroll bar switches modes. Closes #26637.
Add system colour change handler to wxSashWindow Closes #26638.
Fix wxStyledTextCtrl dark mode switching Add event.Skip() to wxStyledTextCtrl::OnSysColourChanged() so that upon switching to or from dark mode, the scroll bar switches modes. Closes #26639.
Really fix wxStyledTextCtrl::GetMarginCount() documentation This was done manually in 9864777203 (Upgrade to Doxygen 1.15.0, 2026-05-05) but the changes were lost after regeneration, so add an override for this function documentation to the generating script itself to ensure that they're preserved. This also has the nice side effect of generating a better comment in the header. See #26431.
| ... | ... | @@ -134,6 +134,8 @@ private: |
| 134 | 134 | |
| 135 | 135 | BarPlacement GetBarPlacement() const;
|
| 136 | 136 | |
| 137 | + void UpdateColours();
|
|
| 138 | + void OnSysColourChanged(wxSysColourChangedEvent& event);
|
|
| 137 | 139 | |
| 138 | 140 | // different controls making up the bar
|
| 139 | 141 | wxStaticBitmap *m_icon = nullptr;
|
| ... | ... | @@ -157,6 +157,7 @@ public: |
| 157 | 157 | |
| 158 | 158 | private:
|
| 159 | 159 | void Init();
|
| 160 | + void OnSysColourChanged(wxSysColourChangedEvent& event);
|
|
| 160 | 161 | |
| 161 | 162 | wxSashEdge m_sashes[4];
|
| 162 | 163 | int m_dragMode;
|
| ... | ... | @@ -152,7 +152,7 @@ enum wxRibbonScrollButtonStyle |
| 152 | 152 | |
| 153 | 153 | wxRIBBON_SCROLL_BTN_DIRECTION_MASK = 3,
|
| 154 | 154 | |
| 155 | - wxRIBBON_SCROLL_BTN_NORMAL = 0,
|
|
| 155 | + wxRIBBON_SCROLL_BTN_NORMAL = 0, // This must have value 0
|
|
| 156 | 156 | wxRIBBON_SCROLL_BTN_HOVERED = 4,
|
| 157 | 157 | wxRIBBON_SCROLL_BTN_ACTIVE = 8,
|
| 158 | 158 |
| ... | ... | @@ -205,24 +205,24 @@ protected: |
| 205 | 205 | wxRect m_tab_scroll_right_button_rect;
|
| 206 | 206 | wxRect m_toggle_button_rect;
|
| 207 | 207 | wxRect m_help_button_rect;
|
| 208 | - long m_flags;
|
|
| 209 | - int m_tabs_total_width_ideal;
|
|
| 210 | - int m_tabs_total_width_minimum;
|
|
| 211 | - int m_tab_margin_left;
|
|
| 212 | - int m_tab_margin_right;
|
|
| 213 | - int m_tab_height;
|
|
| 214 | - int m_tab_scroll_amount;
|
|
| 215 | - int m_current_page;
|
|
| 216 | - int m_current_hovered_page;
|
|
| 217 | - int m_tab_scroll_left_button_state;
|
|
| 218 | - int m_tab_scroll_right_button_state;
|
|
| 219 | - bool m_tab_scroll_buttons_shown;
|
|
| 220 | - bool m_arePanelsShown;
|
|
| 221 | - bool m_bar_hovered;
|
|
| 222 | - bool m_toggle_button_hovered;
|
|
| 223 | - bool m_help_button_hovered;
|
|
| 224 | - |
|
| 225 | - wxRibbonDisplayMode m_ribbon_state;
|
|
| 208 | + long m_flags = 0;
|
|
| 209 | + int m_tabs_total_width_ideal = 0;
|
|
| 210 | + int m_tabs_total_width_minimum = 0;
|
|
| 211 | + int m_tab_margin_left = 0;
|
|
| 212 | + int m_tab_margin_right = 0;
|
|
| 213 | + int m_tab_height = 0;
|
|
| 214 | + int m_tab_scroll_amount = 0;
|
|
| 215 | + int m_current_page = wxNOT_FOUND;
|
|
| 216 | + int m_current_hovered_page = wxNOT_FOUND;
|
|
| 217 | + int m_tab_scroll_left_button_state = 0;
|
|
| 218 | + int m_tab_scroll_right_button_state = 0;
|
|
| 219 | + bool m_tab_scroll_buttons_shown = false;
|
|
| 220 | + bool m_arePanelsShown = true;
|
|
| 221 | + bool m_bar_hovered = false;
|
|
| 222 | + bool m_toggle_button_hovered = false;
|
|
| 223 | + bool m_help_button_hovered = false;
|
|
| 224 | + |
|
| 225 | + wxRibbonDisplayMode m_ribbon_state = wxRIBBON_BAR_PINNED;
|
|
| 226 | 226 | |
| 227 | 227 | wxVector<wxImageList*> m_image_lists;
|
| 228 | 228 |
| ... | ... | @@ -3630,7 +3630,7 @@ public: |
| 3630 | 3630 | // Allocate a non-standard number of margins.
|
| 3631 | 3631 | void SetMarginCount(int margins);
|
| 3632 | 3632 | |
| 3633 | - // How many margins are there?.
|
|
| 3633 | + // Returns the count of margins.
|
|
| 3634 | 3634 | int GetMarginCount() const;
|
| 3635 | 3635 | |
| 3636 | 3636 | // Clear all the styles and make equivalent to the global default style.
|
| ... | ... | @@ -237,11 +237,23 @@ public: |
| 237 | 237 | wxCHECK_MSG( size, nullptr, "null size parameter" );
|
| 238 | 238 | |
| 239 | 239 | *size = Read32();
|
| 240 | + if ( !*size )
|
|
| 241 | + {
|
|
| 242 | + wxLogDebug("IPC: data unexpectedly has zero size");
|
|
| 243 | + return nullptr;
|
|
| 244 | + }
|
|
| 240 | 245 | |
| 241 | 246 | void * const data = conn->GetBufferAtLeast(*size);
|
| 242 | 247 | wxCHECK_MSG( data, nullptr, "IPC buffer allocation failed" );
|
| 243 | 248 | |
| 244 | - m_socketStream.Read(data, *size);
|
|
| 249 | + // We should always read exactly the provided number of bytes,
|
|
| 250 | + // otherwise something is wrong and we must return an error.
|
|
| 251 | + auto const read = m_socketStream.Read(data, *size).LastRead();
|
|
| 252 | + if ( read != *size )
|
|
| 253 | + {
|
|
| 254 | + wxLogDebug("IPC: got %zu bytes (expected %zu)", read, *size);
|
|
| 255 | + return nullptr;
|
|
| 256 | + }
|
|
| 245 | 257 | |
| 246 | 258 | return data;
|
| 247 | 259 | }
|
| ... | ... | @@ -46,7 +46,8 @@ |
| 46 | 46 | class WXDLLEXPORT wxFontPreviewer : public wxWindow
|
| 47 | 47 | {
|
| 48 | 48 | public:
|
| 49 | - wxFontPreviewer(wxWindow *parent, const wxSize& sz = wxDefaultSize) : wxWindow(parent, wxID_ANY, wxDefaultPosition, sz)
|
|
| 49 | + wxFontPreviewer(wxWindow *parent, const wxSize& sz = wxDefaultSize)
|
|
| 50 | + : wxWindow(parent, wxID_ANY, wxDefaultPosition, sz, wxBORDER_SIMPLE)
|
|
| 50 | 51 | {
|
| 51 | 52 | }
|
| 52 | 53 | |
| ... | ... | @@ -66,13 +67,10 @@ void wxFontPreviewer::OnPaint(wxPaintEvent& WXUNUSED(event)) |
| 66 | 67 | wxSize size = GetSize();
|
| 67 | 68 | wxFont font = GetFont();
|
| 68 | 69 | |
| 69 | - dc.SetPen(*wxBLACK_PEN);
|
|
| 70 | - dc.SetBrush(*wxWHITE_BRUSH);
|
|
| 71 | - dc.DrawRectangle(0, 0, size.x, size.y);
|
|
| 72 | - |
|
| 73 | 70 | if ( font.IsOk() )
|
| 74 | 71 | {
|
| 75 | 72 | dc.SetClippingRegion(2, 2, size.x-4, size.y-4);
|
| 73 | + dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
|
| 76 | 74 | dc.DrawText(_("ABCDEFGabcdefg12345"),
|
| 77 | 75 | 10, (size.y - dc.GetTextExtent(wxT("X")).y)/2);
|
| 78 | 76 | dc.DestroyClippingRegion();
|
| ... | ... | @@ -75,36 +75,6 @@ bool wxInfoBarGeneric::Create(wxWindow *parent, wxWindowID winid, long style) |
| 75 | 75 | if ( !wxWindow::Create(parent, winid, wxDefaultPosition, wxDefaultSize, style) )
|
| 76 | 76 | return false;
|
| 77 | 77 | |
| 78 | - // use special, easy to notice, colours
|
|
| 79 | - wxColour colBg, colFg;
|
|
| 80 | - if ( !m_hasBgCol && !m_hasFgCol )
|
|
| 81 | - {
|
|
| 82 | - // We want to use the native infobar colours for consistency with the
|
|
| 83 | - // native implementation under GTK, but only do it for 3.24, as both
|
|
| 84 | - // the CSS structure and the default colour values have changed in this
|
|
| 85 | - // version compared to all the previous ones and it seems safer to keep
|
|
| 86 | - // the old behaviour for the older GTK versions, see #25048.
|
|
| 87 | -#ifdef __WXGTK3__
|
|
| 88 | - if ( wx_is_at_least_gtk3(24) )
|
|
| 89 | - {
|
|
| 90 | - wxGtkStyleContext sc;
|
|
| 91 | - sc.Add(GTK_TYPE_INFO_BAR, "infobar", "info", nullptr);
|
|
| 92 | - sc.Add("revealer");
|
|
| 93 | - sc.Add("box");
|
|
| 94 | - sc.Bg(colBg);
|
|
| 95 | - sc.Fg(colFg);
|
|
| 96 | - }
|
|
| 97 | - else
|
|
| 98 | -#endif // GTK 3
|
|
| 99 | - {
|
|
| 100 | - colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_INFOBK);
|
|
| 101 | - colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_INFOTEXT);
|
|
| 102 | - }
|
|
| 103 | - }
|
|
| 104 | - |
|
| 105 | - if( !m_hasBgCol )
|
|
| 106 | - SetBackgroundColour(colBg);
|
|
| 107 | - |
|
| 108 | 78 | // create the controls: icon, text and the button to dismiss the
|
| 109 | 79 | // message.
|
| 110 | 80 | |
| ... | ... | @@ -115,17 +85,15 @@ bool wxInfoBarGeneric::Create(wxWindow *parent, wxWindowID winid, long style) |
| 115 | 85 | wxDefaultPosition, wxDefaultSize,
|
| 116 | 86 | wxST_ELLIPSIZE_MIDDLE);
|
| 117 | 87 | |
| 118 | - if(!m_hasFgCol)
|
|
| 119 | - m_text->SetForegroundColour(colFg);
|
|
| 120 | - |
|
| 121 | 88 | m_button = wxBitmapButton::NewCloseButton(this, wxID_CLOSE);
|
| 122 | 89 | m_button->SetToolTip(_("Hide this notification message."));
|
| 123 | 90 | |
| 124 | 91 | m_checkbox =
|
| 125 | 92 | new wxCheckBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition,
|
| 126 | 93 | wxDefaultSize, 0, wxGenericValidator(&m_checked));
|
| 127 | - m_checkbox->SetForegroundColour(
|
|
| 128 | - wxSystemSettings::GetColour(wxSYS_COLOUR_INFOTEXT));
|
|
| 94 | + |
|
| 95 | + UpdateColours();
|
|
| 96 | + Bind(wxEVT_SYS_COLOUR_CHANGED, &wxInfoBarGeneric::OnSysColourChanged, this);
|
|
| 129 | 97 | |
| 130 | 98 | // center the text inside the sizer with an icon to the left of it and a
|
| 131 | 99 | // button at the very right
|
| ... | ... | @@ -504,4 +472,51 @@ void wxInfoBarGeneric::ShowCheckBox(const wxString& checkBoxText, bool checked) |
| 504 | 472 | }
|
| 505 | 473 | }
|
| 506 | 474 | |
| 475 | +void wxInfoBarGeneric::UpdateColours()
|
|
| 476 | +{
|
|
| 477 | + // use special, easy to notice, colours
|
|
| 478 | + wxColour colBg, colFg;
|
|
| 479 | + if ( !m_hasBgCol && !m_hasFgCol )
|
|
| 480 | + {
|
|
| 481 | + // We want to use the native infobar colours for consistency with the
|
|
| 482 | + // native implementation under GTK, but only do it for 3.24, as both
|
|
| 483 | + // the CSS structure and the default colour values have changed in this
|
|
| 484 | + // version compared to all the previous ones and it seems safer to keep
|
|
| 485 | + // the old behaviour for the older GTK versions, see #25048.
|
|
| 486 | +#ifdef __WXGTK3__
|
|
| 487 | + if ( wx_is_at_least_gtk3(24) )
|
|
| 488 | + {
|
|
| 489 | + wxGtkStyleContext sc;
|
|
| 490 | + sc.Add(GTK_TYPE_INFO_BAR, "infobar", "info", nullptr);
|
|
| 491 | + sc.Add("revealer");
|
|
| 492 | + sc.Add("box");
|
|
| 493 | + sc.Bg(colBg);
|
|
| 494 | + sc.Fg(colFg);
|
|
| 495 | + }
|
|
| 496 | + else
|
|
| 497 | +#endif // GTK 3
|
|
| 498 | + {
|
|
| 499 | + colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_INFOBK);
|
|
| 500 | + colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_INFOTEXT);
|
|
| 501 | + }
|
|
| 502 | + }
|
|
| 503 | + |
|
| 504 | + if ( !m_hasBgCol )
|
|
| 505 | + m_backgroundColour = colBg;
|
|
| 506 | + |
|
| 507 | + if ( !m_hasFgCol )
|
|
| 508 | + m_text->SetForegroundColour(colFg);
|
|
| 509 | + |
|
| 510 | + m_checkbox->SetForegroundColour(
|
|
| 511 | + wxSystemSettings::GetColour(wxSYS_COLOUR_INFOTEXT));
|
|
| 512 | + |
|
| 513 | + m_button->SetBackgroundColour(GetBackgroundColour());
|
|
| 514 | +}
|
|
| 515 | + |
|
| 516 | +void wxInfoBarGeneric::OnSysColourChanged(wxSysColourChangedEvent& event)
|
|
| 517 | +{
|
|
| 518 | + UpdateColours();
|
|
| 519 | + event.Skip();
|
|
| 520 | +}
|
|
| 521 | + |
|
| 507 | 522 | #endif // wxUSE_INFOBAR |
| ... | ... | @@ -38,6 +38,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxSashEvent, wxCommandEvent); |
| 38 | 38 | wxBEGIN_EVENT_TABLE(wxSashWindow, wxWindow)
|
| 39 | 39 | EVT_PAINT(wxSashWindow::OnPaint)
|
| 40 | 40 | EVT_SIZE(wxSashWindow::OnSize)
|
| 41 | + EVT_SYS_COLOUR_CHANGED(wxSashWindow::OnSysColourChanged)
|
|
| 41 | 42 | EVT_MOUSE_EVENTS(wxSashWindow::OnMouseEvent)
|
| 42 | 43 | #if defined( __WXMSW__ ) || defined( __WXMAC__)
|
| 43 | 44 | EVT_SET_CURSOR(wxSashWindow::OnSetCursor)
|
| ... | ... | @@ -76,7 +77,6 @@ void wxSashWindow::Init() |
| 76 | 77 | m_mouseCaptured = false;
|
| 77 | 78 | m_currentCursor = nullptr;
|
| 78 | 79 | |
| 79 | - // Eventually, we'll respond to colour change messages
|
|
| 80 | 80 | InitColours();
|
| 81 | 81 | }
|
| 82 | 82 | |
| ... | ... | @@ -359,6 +359,12 @@ void wxSashWindow::OnSize(wxSizeEvent& WXUNUSED(event)) |
| 359 | 359 | SizeWindows();
|
| 360 | 360 | }
|
| 361 | 361 | |
| 362 | +void wxSashWindow::OnSysColourChanged(wxSysColourChangedEvent& event)
|
|
| 363 | +{
|
|
| 364 | + InitColours();
|
|
| 365 | + event.Skip();
|
|
| 366 | +}
|
|
| 367 | + |
|
| 362 | 368 | wxSashEdgePosition wxSashWindow::SashHitTest(int x, int y, int WXUNUSED(tolerance))
|
| 363 | 369 | {
|
| 364 | 370 | int cx, cy;
|
| ... | ... | @@ -82,10 +82,6 @@ bool wxVListBox::Create(wxWindow *parent, |
| 82 | 82 | if ( style & wxLB_MULTIPLE )
|
| 83 | 83 | m_selStore = new wxSelectionStore;
|
| 84 | 84 | |
| 85 | - // make sure the native widget has the right colour since we do
|
|
| 86 | - // transparent drawing by default
|
|
| 87 | - SetBackgroundColour(GetBackgroundColour());
|
|
| 88 | - |
|
| 89 | 85 | // leave m_colBgSel in an invalid state: it means for OnDrawBackground()
|
| 90 | 86 | // to use wxRendererNative instead of painting selection bg ourselves
|
| 91 | 87 | m_colBgSel = wxNullColour;
|
| ... | ... | @@ -360,7 +360,7 @@ WXHBRUSH wxControl::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd) |
| 360 | 360 | // finally also set the background colour for text drawing: without this,
|
| 361 | 361 | // the text in an edit control is drawn using the default background even
|
| 362 | 362 | // if we return a valid brush
|
| 363 | - if ( colBg.IsOk() || m_hasBgCol )
|
|
| 363 | + if ( colBg.IsOk() || m_backgroundColour.IsOk() )
|
|
| 364 | 364 | {
|
| 365 | 365 | if ( !colBg.IsOk() )
|
| 366 | 366 | colBg = GetBackgroundColour();
|
| ... | ... | @@ -465,10 +465,6 @@ void ConfigureTLW(HWND hwnd) |
| 465 | 465 | {
|
| 466 | 466 | BOOL useDarkMode = wxMSWImpl::ShouldUseDarkMode();
|
| 467 | 467 | |
| 468 | - // DWMWA_USE_IMMERSIVE_DARK_MODE is 19 for v1809, but is 20 for later
|
|
| 469 | - // versions, so to set title bar black for both v1809 and later versions,
|
|
| 470 | - // we try to call GetDwmSetWindowAttribute() with the current value first,
|
|
| 471 | - // but if it fails, we also retry with the old one.
|
|
| 472 | 468 | HRESULT hr = wxDarkModeModule::GetDwmSetWindowAttribute()
|
| 473 | 469 | (
|
| 474 | 470 | hwnd,
|
| ... | ... | @@ -476,16 +472,6 @@ void ConfigureTLW(HWND hwnd) |
| 476 | 472 | &useDarkMode,
|
| 477 | 473 | sizeof(useDarkMode)
|
| 478 | 474 | );
|
| 479 | - if ( FAILED(hr) )
|
|
| 480 | - {
|
|
| 481 | - hr = wxDarkModeModule::GetDwmSetWindowAttribute()
|
|
| 482 | - (
|
|
| 483 | - hwnd,
|
|
| 484 | - 19,
|
|
| 485 | - &useDarkMode,
|
|
| 486 | - sizeof(useDarkMode)
|
|
| 487 | - );
|
|
| 488 | - }
|
|
| 489 | 475 | if ( FAILED(hr) )
|
| 490 | 476 | wxLogApiError("DwmSetWindowAttribute(USE_IMMERSIVE_DARK_MODE)", hr);
|
| 491 | 477 |
| ... | ... | @@ -723,12 +723,7 @@ bool wxTextCtrl::MSWCreateText(const wxString& value, |
| 723 | 723 | // non-rich read-only multiline controls have grey background by
|
| 724 | 724 | // default under MSW but this is not always appropriate, so forcefully
|
| 725 | 725 | // reset the background colour to normal default
|
| 726 | - //
|
|
| 727 | - // this is not ideal but, after a long discussion on wx-dev (see
|
|
| 728 | - // http://thread.gmane.org/gmane.comp.lib.wxwidgets.devel/116360/) it
|
|
| 729 | - // was finally deemed to be the best behaviour by default (and ideally
|
|
| 730 | - // we'd have a way to change this, see #11521)
|
|
| 731 | - SetBackgroundColour(GetClassDefaultAttributes().colBg);
|
|
| 726 | + m_backgroundColour = GetClassDefaultAttributes().colBg;
|
|
| 732 | 727 | }
|
| 733 | 728 | |
| 734 | 729 | // Without this, if we pass the size in the constructor and then don't change it,
|
| ... | ... | @@ -2931,6 +2926,15 @@ void wxTextCtrl::MSWSetDarkOrLightMode(SetMode setmode) |
| 2931 | 2926 | {
|
| 2932 | 2927 | wxTextCtrlBase::MSWSetDarkOrLightMode(setmode);
|
| 2933 | 2928 | |
| 2929 | + // Update the background for non-rich read-only multiline, unless there
|
|
| 2930 | + // are custom colours. The foreground is updated by
|
|
| 2931 | + // wxControl::DoMSWControlColor().
|
|
| 2932 | + if ( !IsRich() && HasFlag(wxTE_MULTILINE) && HasFlag(wxTE_READONLY) &&
|
|
| 2933 | + !m_hasBgCol && !m_hasFgCol )
|
|
| 2934 | + {
|
|
| 2935 | + m_backgroundColour = GetClassDefaultAttributes().colBg;
|
|
| 2936 | + }
|
|
| 2937 | + |
|
| 2934 | 2938 | #if wxUSE_RICHEDIT
|
| 2935 | 2939 | // The rich edit control does not change colours automatically. We adjust
|
| 2936 | 2940 | // colours only if no custom colours occur. When we leave the control
|
| ... | ... | @@ -5592,9 +5592,10 @@ wxWindowMSW::MSWGetBgBrushForChild(WXHDC hDC, wxWindowMSW *child) |
| 5592 | 5592 | return hbrush;
|
| 5593 | 5593 | }
|
| 5594 | 5594 | |
| 5595 | - // Otherwise see if we have a custom background colour or if we're a TLW,
|
|
| 5596 | - // as nothing else would provide the brush in the latter case.
|
|
| 5597 | - if ( m_hasBgCol || IsTopLevel() )
|
|
| 5595 | + // Otherwise see if we have a background colour (which is only set if we
|
|
| 5596 | + // need to use it) or if we're a TLW (in which case nothing else would
|
|
| 5597 | + // provide the brush, so we have to do it).
|
|
| 5598 | + if ( m_backgroundColour.IsOk() || IsTopLevel() )
|
|
| 5598 | 5599 | {
|
| 5599 | 5600 | wxBrush *
|
| 5600 | 5601 | brush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour());
|
| ... | ... | @@ -1356,12 +1356,13 @@ void wxPropertyGrid::CalculateFontAndBitmapStuff( int vspacing ) |
| 1356 | 1356 | |
| 1357 | 1357 | // -----------------------------------------------------------------------
|
| 1358 | 1358 | |
| 1359 | -void wxPropertyGrid::OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) )
|
|
| 1359 | +void wxPropertyGrid::OnSysColourChanged(wxSysColourChangedEvent& event)
|
|
| 1360 | 1360 | {
|
| 1361 | 1361 | if ((m_iFlags & wxPG_FL_INITIALIZED)!=0) {
|
| 1362 | 1362 | RegainColours();
|
| 1363 | 1363 | Refresh();
|
| 1364 | 1364 | }
|
| 1365 | + event.Skip();
|
|
| 1365 | 1366 | }
|
| 1366 | 1367 | |
| 1367 | 1368 | void wxPropertyGrid::OnDPIChanged(wxDPIChangedEvent &event)
|
| ... | ... | @@ -339,7 +339,9 @@ void wxRibbonMSWArtProvider::SetColourScheme( |
| 339 | 339 | |
| 340 | 340 | // Map primary saturation from [0, 1] to [.25, .75]
|
| 341 | 341 | bool primary_is_gray = false;
|
| 342 | - static const float gray_saturation_threshold = 0.01f;
|
|
| 342 | + // Higher threshold in dark mode prevents near-zero saturation from mapping to a visible hue
|
|
| 343 | + const float gray_saturation_threshold =
|
|
| 344 | + wxSystemSettings::GetAppearance().IsDark() ? 0.05f : 0.01f;
|
|
| 343 | 345 | if(primary_hsl.saturation <= gray_saturation_threshold)
|
| 344 | 346 | primary_is_gray = true;
|
| 345 | 347 | else
|
| ... | ... | @@ -715,24 +715,7 @@ void wxRibbonBar::RecalculateTabSizes() |
| 715 | 715 | }
|
| 716 | 716 | }
|
| 717 | 717 | |
| 718 | -wxRibbonBar::wxRibbonBar()
|
|
| 719 | -{
|
|
| 720 | - m_flags = 0;
|
|
| 721 | - m_tabs_total_width_ideal = 0;
|
|
| 722 | - m_tabs_total_width_minimum = 0;
|
|
| 723 | - m_tab_margin_left = 0;
|
|
| 724 | - m_tab_margin_right = 0;
|
|
| 725 | - m_tab_height = 0;
|
|
| 726 | - m_tab_scroll_amount = 0;
|
|
| 727 | - m_current_page = wxNOT_FOUND;
|
|
| 728 | - m_current_hovered_page = wxNOT_FOUND;
|
|
| 729 | - m_tab_scroll_left_button_state = wxRIBBON_SCROLL_BTN_NORMAL;
|
|
| 730 | - m_tab_scroll_right_button_state = wxRIBBON_SCROLL_BTN_NORMAL;
|
|
| 731 | - m_tab_scroll_buttons_shown = false;
|
|
| 732 | - m_arePanelsShown = true;
|
|
| 733 | - m_help_button_hovered = false;
|
|
| 734 | - |
|
| 735 | -}
|
|
| 718 | +wxRibbonBar::wxRibbonBar() = default;
|
|
| 736 | 719 | |
| 737 | 720 | wxRibbonBar::wxRibbonBar(wxWindow* parent,
|
| 738 | 721 | wxWindowID id,
|
| ... | ... | @@ -773,8 +756,6 @@ void wxRibbonBar::CommonInit(long style) |
| 773 | 756 | SetName("wxRibbonBar");
|
| 774 | 757 | |
| 775 | 758 | m_flags = style;
|
| 776 | - m_tabs_total_width_ideal = 0;
|
|
| 777 | - m_tabs_total_width_minimum = 0;
|
|
| 778 | 759 | m_tab_margin_left = 50;
|
| 779 | 760 | m_tab_margin_right = 20;
|
| 780 | 761 | if ( m_flags & wxRIBBON_BAR_SHOW_TOGGLE_BUTTON )
|
| ... | ... | @@ -782,24 +763,12 @@ void wxRibbonBar::CommonInit(long style) |
| 782 | 763 | if ( m_flags & wxRIBBON_BAR_SHOW_HELP_BUTTON )
|
| 783 | 764 | m_tab_margin_right += 20;
|
| 784 | 765 | m_tab_height = 20; // initial guess
|
| 785 | - m_tab_scroll_amount = 0;
|
|
| 786 | - m_current_page = wxNOT_FOUND;
|
|
| 787 | - m_current_hovered_page = wxNOT_FOUND;
|
|
| 788 | - m_tab_scroll_left_button_state = wxRIBBON_SCROLL_BTN_NORMAL;
|
|
| 789 | - m_tab_scroll_right_button_state = wxRIBBON_SCROLL_BTN_NORMAL;
|
|
| 790 | - m_tab_scroll_buttons_shown = false;
|
|
| 791 | - m_arePanelsShown = true;
|
|
| 792 | 766 | |
| 793 | 767 | if(m_art == nullptr)
|
| 794 | 768 | {
|
| 795 | 769 | SetArtProvider(new wxRibbonDefaultArtProvider);
|
| 796 | 770 | }
|
| 797 | 771 | SetBackgroundStyle(wxBG_STYLE_PAINT);
|
| 798 | - |
|
| 799 | - m_toggle_button_hovered = false;
|
|
| 800 | - m_bar_hovered = false;
|
|
| 801 | - |
|
| 802 | - m_ribbon_state = wxRIBBON_BAR_PINNED;
|
|
| 803 | 772 | }
|
| 804 | 773 | |
| 805 | 774 | wxImageList* wxRibbonBar::GetButtonImageList(wxSize size, int initialCount)
|
| ... | ... | @@ -781,6 +781,8 @@ docOverrides = { |
| 781 | 781 | 'GetText':('Retrieve all the text in the document.',),
|
| 782 | 782 | 'GetTextRange':('Retrieve a range of text.',),
|
| 783 | 783 | |
| 784 | + 'GetMargins':('Returns the count of margins.',),
|
|
| 785 | + |
|
| 784 | 786 | 'GetWordChars':
|
| 785 | 787 | ('Get the set of characters making up words for when moving or selecting by word.',),
|
| 786 | 788 |
| ... | ... | @@ -824,7 +824,7 @@ void wxStyledTextCtrl::SetMarginCount(int margins) |
| 824 | 824 | SendMsg(SCI_SETMARGINS, margins, 0);
|
| 825 | 825 | }
|
| 826 | 826 | |
| 827 | -// How many margins are there?.
|
|
| 827 | +// Returns the count of margins.
|
|
| 828 | 828 | int wxStyledTextCtrl::GetMarginCount() const
|
| 829 | 829 | {
|
| 830 | 830 | return SendMsg(SCI_GETMARGINS, 0, 0);
|
| ... | ... | @@ -5810,8 +5810,10 @@ void wxStyledTextCtrl::OnDPIChanged(wxDPIChangedEvent& evt) { |
| 5810 | 5810 | }
|
| 5811 | 5811 | |
| 5812 | 5812 | |
| 5813 | -void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(evt)) {
|
|
| 5813 | +void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& evt)
|
|
| 5814 | +{
|
|
| 5814 | 5815 | m_swx->DoInvalidateStyleData();
|
| 5816 | + evt.Skip();
|
|
| 5815 | 5817 | }
|
| 5816 | 5818 | |
| 5817 | 5819 |
| ... | ... | @@ -1002,8 +1002,10 @@ void wxStyledTextCtrl::OnDPIChanged(wxDPIChangedEvent& evt) { |
| 1002 | 1002 | }
|
| 1003 | 1003 | |
| 1004 | 1004 | |
| 1005 | -void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(evt)) {
|
|
| 1005 | +void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& evt)
|
|
| 1006 | +{
|
|
| 1006 | 1007 | m_swx->DoInvalidateStyleData();
|
| 1008 | + evt.Skip();
|
|
| 1007 | 1009 | }
|
| 1008 | 1010 | |
| 1009 | 1011 |
—
View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help