Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The cursor isn't visible on HDR displays #348

Open
zadjii-msft opened this issue Jan 21, 2025 · 7 comments
Open

The cursor isn't visible on HDR displays #348

zadjii-msft opened this issue Jan 21, 2025 · 7 comments

Comments

@zadjii-msft
Copy link
Owner

My primary monitor in the basement is a 3440x1440, 100% display. I'm on dark mode. The cursor in the search box isn't visible there.

@zadjii-msft
Copy link
Owner Author

@crutkas this is what you're seeing with the cursor on light theme too

@niels9001 niels9001 self-assigned this Jan 21, 2025
@zadjii-msft
Copy link
Owner Author

Oh no the snipping tool can't capture this!

I tried messing with the styling here, to see if one of these brushes was getting evaluated weird. Alas, if I opened the snipping tool, the caret changes to the correct one!

Image

Setting the background to something insane did highlight though that in this state, the cursor is dark grey, like the BG of the control. Just gotta figure out which brush is the weird one.

@zadjii-msft
Copy link
Owner Author

Yep okay I think I figured out where the problem is. Not how to solve it, but what the problem is.

Setting the <Setter Property="Background" in TextBox.xaml is what hides this. I think WinUI itself calculates the caret background based on the Background that the cursor is actually going to get displayed on. And it's smart enough to account for everything in the template itself, but nothing outside of the template.

AND MOST IMPORTANTLY - it doesn't know how to do this logic on 100% scaled displays, for whatever reason.

microsoft/microsoft-ui-xaml#8207 is the thread that they dupe issues too, but that's bY dEsIgN

IMO our only option is to adjust the text box styling so that it covers the entire "titlebar" area, with padding for the search/back icon, and give that a semi-transparent background (enough to trick WinUI into giving us a cursor). Since a WinUI fix is probably impossible.

@zadjii-msft
Copy link
Owner Author

Yea, this isn't trivially solvable either. The Rectangle that renders the caret is CompositeMode=DestInvert, and it sets that manually:

https://github.com/microsoft/microsoft-ui-xaml/blob/ffe33f9b7d0e9f5a2ca3330d0ce329f09dff092b/src/dxaml/xcp/core/native/text/Controls/TextBoxView.cpp#L2797-L2798

but why doesn't ElementCompositeMode::DestInvert on a 1dip wide rectangle invert the background on 100% scale, when it does on a 125%?

@zadjii-msft zadjii-msft changed the title The cursor isn't visible on my 100% ultrawide The cursor isn't visible on HDR displays Jan 21, 2025
@zadjii-msft
Copy link
Owner Author

Image

@zadjii-msft
Copy link
Owner Author

MSFT:14726922 looks like the upstream

@crutkas
Copy link
Collaborator

crutkas commented Jan 22, 2025

For me I can see it on dark but not light

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants