Bug ID: 932
Short desc: DPI Scaling issue with profile detection

Last changed byphil 
Reported Byphil 
Reported On2026-06-08 10:17 AM 
ProjectXMBC 
OrganizationDevelopment 
Categorybug 
Priorityhigh 
Assignedphil 
Statusnew 
Target ReleaseNext Release 
VersionCurrent Beta 

comment 5604 posted by phil on 2026-06-08 10:17 AM, 9 days ago

From Discord:

From the_m4jx:

Potential Window Region Area bug:
It looks like the window area is offset, but it's a bit weirder than that (though I think the weirdness is another bug altogether, though maybe related).

Offset:
I noticed this while making profiles for my browser window (Zen) and tested it further on notepad.exe on Windows 10 x64, window maximized on a 3840x2160 display, scaling 2,5 (250%).

I set up 2 profiles, one to do all the testing, another one that covers the entire area without the checkmark to specify an area, as a fallback to make sure that XMBC is "seeing" that the mouse hovering over the application. So when the testing profile isn't triggered, the second profile gets triggered to show me I'm still hovering over the application and nothing else is interfering.

I use MPos to get the current mouse position, it shows Physical, Scaled and Relative coordinates, Physical is what I need here, it correctly shows the coordinates X:0-3839 Y:0-2159 for my 2160p display at all scaling factors.

Using the window finder on a maximized window sets the area the way it's expected:
Top:0 Left:0 Bottom:2160 Right:3840

I test by keeping XMBC Settings open to see if the profile name stays red while moving my mouse (red text means profile gets triggered), the area covers the whole screen so it should stay red everywhere. But it seems like the area stops at coordinate X:3823, it doesn't stay red at any point to the right past X:3823. Same for coordinate Y, it stays red until Y:2143, everything below is not covered by the area.
Both stop 16 pixels short of the edges.

When I increase the area by 1 to Right:3841, it stops at X:3824.
When I increase the area by 1 to Bottom:2161, it stops at Y:2143.
This is expected.

I guessed that Top and Left may also be offset by 16px and it looks like they are.

I tested it like this:
I offset the whole area by 16px, then added 1 to Top/Left and subtracted 1 from Bottom/Right to get a profile that doesn't activate on the first and last pixel rows/columns.
Top:17 Left:17 Bottom:2175 Right:3855
This works as expected, the profile only activates on my screen at X:1-3838 Y:1-2158, leaving a single row of pixels at all sides that don't trigger the profile.

I also tested adding 100/150/200/1000/2000, it triggered the profile at the exact pixel coordinates I was expecting.

So far it seems like just an offset. But the offset does change with different scaling options in windows settings. 
Scaling:
I'm testing with this area again
Top:17 Left:17 Bottom:2175 Right:3855
For 250% scaling it should not trigger on the first pixel row (Row0), but should trigger from Row1 and so on, basically leaving a 1 pixel at the edges out of the area.

If I keep that area and only change my windows scaling, it starts triggering on different pixel rows, the area effectively gets pushed down and to the right the higher my scaling is set.

These are the numbers with that area: (250=1 means it triggers from Row1, 225=3 means it triggers from Row3)

100=9
125=8
150=6
175=5
200=3
225=3
250=1

This basically means at 250% the screen area gets pushed 16px rows/columns, 200% gets pushed 14px, 100% gets pushed 8px.

So if I use the standard 
Top:0 Left:0 Bottom:2160 Right:3840
to cover the entire screen area, the profile will stop triggering at the right and bottom edges of the screen.

250%: Profile stops triggering at Column3824 and Row2144 so those last 16 rows/columns on the right/bottom will not trigger it, fixed by adding 16 to all numbers
100%: Profile stops triggering at Column3832 and Row2152 so those last 8 rows/columns on the right/bottom will not trigger it, fixed by adding 8 to all numbers

This makes it really hard to make accurate areas for my profiles and they would change when scaling changes. For example, I want a profile that only triggers when my cursor is all the way on the left edge of the screen, usually you would simply set "Right" to 1. But for me 1-16 does nothing, I need to set 17 for it to trigger with the first pixel column on the left. 

Now this is where it gets weird.
I think this next thing may be a separate issue.

When I add those 16 pixel rows/columns in to get the full screen to trigger the profile, these numbers should work correctly
Top:16 Left:16 Bottom:2176 Right:3856
When I move my mouse to the edge very slowly, it works, however it doesn't trigger the profile when I move my mouse fast to the edge, even though the coordinates show the cursor is in the correct area.
If I set my cursor speed to 1 in windows, it's much more likely to correctly trigger the profile, I have to move it really, really fast for it to miss the trigger.
But if I set the cursor speed to 10-20, it almost always doesn't trigger the profile even though it should.

This happens less if I give the window area a bigger buffer and if it's a very big buffer it always triggers correctly.
Like if I increase the area by 100px so the area ends 100px rows to the right past my visible screen area, the right edge won't have this problem at all anymore.
Top:16 Left:16 Bottom:2176 Right:3956
Just throwing out a guess, but it feels like there is some kind of virtual screen area outside of the visible screen area where the mouse could technically be moved to, but the cursor gets restricted or pulled back to the visible screen area. XMBC sees where it's supposed to end up (maybe based on movement and cursor speed) and it applies those coordinates when it checks if the profile is in the area, even if it's outside of the visible screen area. 

And while I was testing different scaling factors there was even more weirdness on some scaling factors when I used the numbers that should perfectly fit the area:
So I do the fast mouse movement to get the bug that causes to not trigger the profile. Then I move the mouse back VERY INCREDIBLY slightly and slowly, so slow that the coordinates on MPos don't change at all, but XMBC would suddenly trigger the profile. When I moved the mouse back to the edge, the profile would stop triggering. I could basically get back and forth into the trigger area by moving the mouse less than a pixel, so maybe this is related to rounding errors when converting coordinates, something like that.