Reset state of shared NSTableHeaderCell before drawing in wxRendererMac (PR #26910)

16 views
Skip to first unread message

Daniel Kulp

unread,
Aug 24, 2026, 4:27:52 PM (3 days ago) Aug 24
to wx-...@googlegroups.com, Subscribed

DrawMacHeaderCell() draws every header cell with a single cached NSTableHeaderCell (see GetTableHeaderCell()), but unlike DrawMacCell() it never sets the cell's state before drawing. Whatever state a previous draw left behind (e.g. from drawing the sort indicator or a pressed column) therefore leaks into subsequent draws, and header cells can end up rendered with the highlighted/selected appearance — visible as wxListCtrl headers drawing highlighted on recent macOS versions.

Explicitly set a neutral state before drawing so all header cells get the standard header background.

🤖 Generated with Claude Code


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

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

Commit Summary

  • e264152 Reset state of shared NSTableHeaderCell before drawing in wxRendererMac

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26910@github.com>

Copilot

unread,
Aug 24, 2026, 4:43:57 PM (3 days ago) Aug 24
to wx-...@googlegroups.com, Subscribed

@Copilot commented on this pull request.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Fixes macOS table header rendering by preventing NSTableHeaderCell state leakage across draws when using a cached header cell.

Changes:

  • Removes a stray blank line in CellDrawHelper().
  • Explicitly sets a header cell state prior to drawing to avoid “stuck” highlighted/pressed appearance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


In src/osx/cocoa/renderer.mm:

>          }
         else
         {
             cell.title = @("");
             cell.alignment = NSTextAlignmentLeft;
         }
 
+        cell.state = NSControlStateValueMixed;

NSControlStateValueMixed is not a neutral/default state; it represents an indeterminate (“mixed”) control state and may itself affect drawing. If the goal is to reset to a standard, non-pressed/non-selected appearance, set the state to a neutral value such as NSControlStateValueOff (or the appropriate default state used elsewhere in this renderer, e.g. in DrawMacCell()). Consider also explicitly clearing any related highlight/pressed flags if those are used on this code path.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

VZ

unread,
Aug 26, 2026, 10:58:21 AM (20 hours ago) Aug 26
to wx-...@googlegroups.com, Subscribed

@vadz commented on this pull request.

@csomor Maybe you know which value is better to use here?

I agree that we need to set the state explicitly, but I don't know to which one...


In src/osx/cocoa/renderer.mm:

>          }
         else
         {
             cell.title = @("");
             cell.alignment = NSTextAlignmentLeft;
         }
 
+        cell.state = NSControlStateValueMixed;

Is this wrong? No idea which one of 2 LLMs is correct...


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Daniel Kulp

unread,
Aug 26, 2026, 11:39:45 AM (19 hours ago) Aug 26
to wx-...@googlegroups.com, Push

@dkulp pushed 1 commit.

  • 6d5bdce Set explicit state on the NSTableHeaderCell used by wxRendererMac


View it on GitHub or unsubscribe.


Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26910/before/e2641520ca76caa4d6e62a1b8094c0b3210aae37/after/6d5bdcec2f41d28f5def2c9c8389aaa58f890a8c@github.com>

Daniel Kulp

unread,
Aug 26, 2026, 11:45:21 AM (19 hours ago) Aug 26
to wx-...@googlegroups.com, Subscribed

@dkulp commented on this pull request.


In src/osx/cocoa/renderer.mm:

>          }
         else
         {
             cell.title = @("");
             cell.alignment = NSTextAlignmentLeft;
         }
 
+        cell.state = NSControlStateValueMixed;

I measured this on macOS 26 rather than guessing, by rendering the cell through wx's drawing path (wxGCDC over a bitmap, real NSView passed to drawWithFrame:inView:) for every state, in both appearances, and comparing full-bitmap hashes, plus capturing a real wxListCtrl before/after (capture attached in the PR comment below):

  • state unset (what master does today) and NSControlStateValueOff render identically: the cell paints an opaque plate behind the label — pure white in light mode, pure black in dark mode. That plate is the bug: it doesn't match the standard header background at all (glaring in dark mode).
  • NSControlStateValueMixed and NSControlStateValueOn also render identically to each other: the standard header background (242,242,242 light / 26,26,26 dark), matching what a native NSTableView header shows.

So "off" isn't a neutral value here — it's exactly the current broken rendering. Between mixed and on, which draw the same today, I kept mixed since "on" is the value AppKit associates with a selected/sorted column and could plausibly diverge again on a future macOS; mixed has also been shipping in xLights for a while.

I've updated the commit and PR description accordingly (the original "state leaks between draws" theory was wrong — the state never changes, the default is simply wrong for plain headers).


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Daniel Kulp

unread,
Aug 26, 2026, 11:49:23 AM (19 hours ago) Aug 26
to wx-...@googlegroups.com, Subscribed
dkulp left a comment (wxWidgets/wxWidgets#26910)
Image: wxlistctrl-header-before-after (view on web)


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Stefan Csomor

unread,
Aug 26, 2026, 11:54:33 AM (19 hours ago) Aug 26
to wx-...@googlegroups.com, Subscribed
csomor left a comment (wxWidgets/wxWidgets#26910)

@dkulp thanks for looking at this, i'm not sure yet if this is the best way: if you compare the table to a listview in finder, IMHO in light mode does look closer to the BEFORE than the AFTER state


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Daniel Kulp

unread,
Aug 26, 2026, 11:56:03 AM (19 hours ago) Aug 26
to wx-...@googlegroups.com, Subscribed
dkulp left a comment (wxWidgets/wxWidgets#26910)
Image: Screenshot 2026-08-26 at 11 55 08 AM (view on web)


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Stefan Csomor

unread,
Aug 26, 2026, 11:57:10 AM (19 hours ago) Aug 26
to wx-...@googlegroups.com, Subscribed
csomor left a comment (wxWidgets/wxWidgets#26910)

@dkulp yes, agreed for dark mode, I was just editing this, but for light mode I don't see a gray


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Daniel Kulp

unread,
Aug 26, 2026, 11:59:19 AM (19 hours ago) Aug 26
to wx-...@googlegroups.com, Subscribed
dkulp left a comment (wxWidgets/wxWidgets#26910)

On macOS 27, it's gray:

Image: Screenshot 2026-08-26 at 11 58 08 AM (view on web)


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Stefan Csomor

unread,
Aug 26, 2026, 12:16:17 PM (19 hours ago) Aug 26
to wx-...@googlegroups.com, Subscribed
csomor left a comment (wxWidgets/wxWidgets#26910)

very strange, both macOS 26 and 27 on my machines show the headers in the finder list as #FFFFFF
Image: macOS26 (view on web)
Image: macOS27 (view on web)
Also when using a Swift UI Table the headers show up the same, are there some general preferences or side effects which might interfere with that ?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Stefan Csomor

unread,
Aug 26, 2026, 12:23:33 PM (19 hours ago) Aug 26
to wx-...@googlegroups.com, Subscribed
csomor left a comment (wxWidgets/wxWidgets#26910)
Image: SwiftUITable27 (view on web)


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Daniel Kulp

unread,
Aug 26, 2026, 1:05:32 PM (18 hours ago) Aug 26
to wx-...@googlegroups.com, Push

@dkulp pushed 1 commit.

  • 435e5e4 Only use the mixed header cell state in dark mode


View it on GitHub or unsubscribe.


Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26910/before/6d5bdcec2f41d28f5def2c9c8389aaa58f890a8c/after/435e5e48a1f4635decd4b43152e7b411830b79a6@github.com>

Daniel Kulp

unread,
Aug 26, 2026, 1:06:47 PM (18 hours ago) Aug 26
to wx-...@googlegroups.com, Subscribed
dkulp left a comment (wxWidgets/wxWidgets#26910)

Updated the PR to just set mixed for dark mode, off for light mode. Kind of strange, but visually it better matches the system.

Image: wxlistctrl-header-appearance-conditional (view on web)


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

VZ

unread,
Aug 26, 2026, 1:30:32 PM (18 hours ago) Aug 26
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26910)

@csomor Please let me know if I should merge this or if you prefer to do it yourself.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Stefan Csomor

unread,
Aug 26, 2026, 1:50:45 PM (17 hours ago) Aug 26
to wx-...@googlegroups.com, Subscribed
csomor left a comment (wxWidgets/wxWidgets#26910)

@csomor Please let me know if I should merge this or if you prefer to do it yourself.

please go ahead, @dkulp thanks a lot


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Stefan Csomor

unread,
Aug 26, 2026, 3:15:26 PM (16 hours ago) Aug 26
to wx-...@googlegroups.com, Subscribed
csomor left a comment (wxWidgets/wxWidgets#26910)

Updated the PR to just set mixed for dark mode, off for light mode. Kind of strange, but visually it better matches the system.

I have no idea. I've been debugging the native NSTable rendering in an Obj-C app and it never changes the state, but it renders differently. When I'm changing the cell's background color in wx, it is ignoring that completely, and I don't know why ...


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Stefan Csomor

unread,
Aug 26, 2026, 3:31:32 PM (16 hours ago) Aug 26
to wx-...@googlegroups.com, Subscribed
csomor left a comment (wxWidgets/wxWidgets#26910)

ok, found that reason at least, per default the drawsBackground on the cell is set to NO, that explains this part, but changing it to YES and setting the backgroundColor manually to "headerColor" still results in solid black ...


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

VZ

unread,
Aug 26, 2026, 5:11:08 PM (14 hours ago) Aug 26
to wx-...@googlegroups.com, Subscribed

Closed #26910 via a58b47e.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Reply all
Reply to author
Forward
0 new messages