Generic `wxHeaderCtrl` fixes (PR #26016)

30 views
Skip to first unread message

VZ

unread,
Dec 6, 2025, 2:45:56 PM (6 days ago) Dec 6
to wx-...@googlegroups.com, Subscribed

This is the result of debugging and "fixing" (working around, actually) #26014.

@csomor I wasn't able to understand why isn't the device origin respected in wxRendererMac::DrawMacHeaderCell(). I've checked that it uses the same CGContext for which we had called wxMacCoreGraphicsContext::SetTransform() with the translation transform before, yet somehow it is just not taken into account in this code.


You can view, comment on, or merge this pull request online at:

  https://github.com/wxWidgets/wxWidgets/pull/26016

Commit Summary

  • 9c1117e Don't refresh empty rectangle in generic wxHeaderCtrl
  • 7e7604e Get rid of unused variable in wxHeaderCtrl::OnPaint()
  • 411430b Optimize generic wxHeaderCtrl drawing and work around wxOSX bug

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26016@github.com>

Stefan Csomor

unread,
Dec 6, 2025, 3:19:49 PM (6 days ago) Dec 6
to wx-...@googlegroups.com, Subscribed
csomor left a comment (wxWidgets/wxWidgets#26016)

@vadz I'll look at it if possible tomorrow


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26016/c3621078428@github.com>

VZ

unread,
Dec 6, 2025, 6:09:50 PM (6 days ago) Dec 6
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26016)

Thanks, there is nothing urgent about it and my workaround works fine, but I just wonder if you immediately see something obviously wrong with using wxDC::SetDeviceOrigin() and then using native functions on the underlying graphics context because this could be a source of other bugs elsewhere...


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26016/c3621345492@github.com>

Stefan Csomor

unread,
Dec 7, 2025, 7:40:45 AM (6 days ago) Dec 7
to wx-...@googlegroups.com, Subscribed
csomor left a comment (wxWidgets/wxWidgets#26016)

it's not the offset, but a clipping problem, if you scroll and make the window large enough you see some additional headers being properly drawn, but only as long as they are part of the "original" clipping area


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26016/c3621981612@github.com>

Stefan Csomor

unread,
Dec 7, 2025, 9:02:46 AM (6 days ago) Dec 7
to wx-...@googlegroups.com, Subscribed
csomor left a comment (wxWidgets/wxWidgets#26016)

When I undo the device origin offsetting and instead move the native NSCell drawing frame accordingly, then things are drawn correctly, I'll have to think about this a little more

ie after this CGContextSaveGState(cgContext); in renderer.mm line 763, I added

        wxPoint offset = dc.GetDeviceOrigin();
        CGContextTranslateCTM( cgContext, -offset.x, -offset.y );
        controlRect = NSOffsetRect(controlRect, offset.x, offset.y);


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26016/c3622133727@github.com>

VZ

unread,
Dec 7, 2025, 9:09:14 AM (6 days ago) Dec 7
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26016)

it's not the offset, but a clipping problem,

Ah, I should have realized it (because "I" column was still visible after scrolling), thanks.

As I said, I think we can live with the new version of the code avoiding clipping in wxHeaderCtrl (it's more efficient, too, even if this could be done while still setting the device origin, of course), but it would probably still be good to adjust the clipping region when it the device origin is changed — if this is even possible?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26016/c3622144804@github.com>

Stefan Csomor

unread,
Dec 7, 2025, 10:10:59 AM (6 days ago) Dec 7
to wx-...@googlegroups.com, Subscribed
csomor left a comment (wxWidgets/wxWidgets#26016)

I've written a PR #26018 with this change


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26016/c3622292395@github.com>

VZ

unread,
Dec 7, 2025, 5:40:59 PM (5 days ago) Dec 7
to wx-...@googlegroups.com, Subscribed

Merged #26016 into master.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26016/issue_event/21413201772@github.com>

Reply all
Reply to author
Forward
0 new messages