AbsoluteTouchEx icon indicating copy to clipboard operation
AbsoluteTouchEx copied to clipboard

Unreachable region near edges of screen

Open frederick99 opened this issue 6 years ago • 20 comments

I tried using it with MS-Paint and it does not work.

Note: I have precision touchpad and the program did work with osu!, however the mapping was wrong. Is there a way to change the input to screen mapping?

frederick99 avatar Apr 27 '19 12:04 frederick99

MS Paint probably doesn't use raw input which is what AbsoluteTouchEx hooks to translate touchpad events. To be honest I literally wrote this for osu! so if it works for other programs that's merely a bonus :-p

(A general rule of thumb is, if the program is using the default system cursor, it doesn't use raw input)

Can you explain what you mean by "the mapping was wrong"? Is it cut off? Flipped?

apsun avatar Apr 27 '19 15:04 apsun

Oh, that makes sense. I'll look for a drawing app that uses raw input.

The problem with osu!: When I switch to absolute mode, I can only move the cursor within a limited area on the screen. To interact with the UI I have to constantly toggle b/w absolute and relative mode. At first, I thought you mapped it to the playing area (maybe...?) but I noticed some circles spawned outside the box inside which I could move around in abs. mode.

It would be nice if the entire screen is mapped to the touchpad. Being able to change the range of pixels that are mapped to the input would be a bonus!!

frederick99 avatar Apr 27 '19 15:04 frederick99

Tbh I don't think there are any non-game programs that use raw input, only real-time programs benefit from it. But maybe you'll find one :-)

The cutoff issue means your touchpad drivers claim the touchpad is physically larger than it actually is. It's not something that's detectable in software; the only option would be to configure it. What I could do is add a "calibration" mode where you drag your finger across the touchpad, and it remembers the minimum/maximum coordinates that it saw and uses that as the touchpad area.

apsun avatar Apr 27 '19 15:04 apsun

Adding that wasn't too hard: https://github.com/apsun/AbsoluteTouchEx/releases/tag/1.1.0

Let me know if you have any issues :-)

(The new binary is built with VS2019 so you might need to install the new C++ redistributable runtime for it to start)

apsun avatar Apr 27 '19 18:04 apsun

On testing it, the first thing I noticed that the playable area was larger (idk if you changed something other than adding calibration, which by the way is working just fine 👍). But there was still a margin of 10-12% on the sides that my cursor cannot reach.

I wanted to try something since now I could map smaller regions to the entire screen. I did that hoping that cursor could go beyond the boundary when my finger moved outside the input region, but it didn't. You definitely did something that made the initial playable area larger even without calibrating. Alas! there is still padding on the sides.

It is definitely much better now though (compared to almost 20% margin earlier) and playable for sure. Thanks!

frederick99 avatar Apr 27 '19 19:04 frederick99

That's weird, are you using more than one monitor or using a weird resolution? The touchpad coordinates are mapped to the entire screen. There shouldn't be any border at all.

The only other thing I can think of is having a super tiny touchpad connected to a huge monitor, that might have some rounding errors (but if that were the case you would have really jittery movement)

apsun avatar Apr 27 '19 19:04 apsun

Both windows and in-game resolutions are set to native (1366x768) and I don't think the screen to touchpad size ratio is very large. It's a standard touchpad that came with the laptop. I have not connected any external monitors either.

It has to be software related because even when I calibrate a tiny region, the cursor does not go outside the borders. It's maybe reading the screen dimensions incorrectly (and magically centering the mapped area?)

frederick99 avatar Apr 27 '19 20:04 frederick99

No that's intentional, the coordinates are capped between 0 and 65535 (where 0 is top/left and 65535 is right/bottom). The calibration is merely intended to let you change where 0 and 65535 physically are located on your touchpad.

Can you post the bit of info that shows up when you start your program with the touch area of your touchpad?

apsun avatar Apr 27 '19 20:04 apsun

Contact for device 093D0975: link=1, touchArea={0,0,1024,774}
Contact for device 093D0975: link=2, touchArea={0,0,1024,774}
Contact for device 093D0975: link=3, touchArea={0,0,1024,774}
Detected touchpad with handle 093D0975
CreateWindowExW() -> hWnd=00160988
CreateWindowExW() -> hWnd=001209BC
CreateWindowExW() -> hWnd=00050992
CreateWindowExW() -> hWnd=00050994
CreateWindowExW() -> hWnd=000C0982
CreateWindowExW() -> hWnd=02BC0614
CreateWindowExW() -> hWnd=000409A0
CreateWindowExW() -> hWnd=000D0998
CreateWindowExW() -> hWnd=000409A4
CreateWindowExW() -> hWnd=000409A2
CreateWindowExW() -> hWnd=00060990
CreateWindowExW() -> hWnd=02170882
CreateWindowExW() -> hWnd=0004099C
CreateWindowExW() -> hWnd=00FC02B6
CreateWindowExW() -> hWnd=0005098E
CreateWindowExW() -> hWnd=00050980
CreateWindowExW() -> hWnd=00FD02B6
CreateWindowExW() -> hWnd=0006098E
CreateWindowExW() -> hWnd=0007098A
RegisterRawInputDevices(other)
RegisterRawInputDevices(mouse)
CreateWindowExW() -> hWnd=00060994
CreateWindowExW() -> hWnd=00FE02B6
CreateWindowExW() -> hWnd=00060980
CreateWindowExW() -> hWnd=00050954
Calibration mode -> ON
Calibration mode -> OFF
Absolute touch mode -> ON
Absolute touch mode -> OFF

(wow, the touchArea seems off, should it match the screen dimensions? :/ )

frederick99 avatar Apr 27 '19 20:04 frederick99

Uhhhhhh is that a touchpad or a touchscreen? O_o

This smells like a case of crappy drivers to me, at the very least they're not implementing the HID spec correctly as those should be physical units (usually mm or cm), not pixels.

That said it's still weird how the cursor doesn't go all the way to the screen edges. When I get home I can make a binary with some more debugging info that might help.

apsun avatar Apr 27 '19 20:04 apsun

It is a touchpad. ':-D

It could be. I reinstalled windows and don't have the original drivers anymore. It's what came with Windows.

Maybe you'll find this interesting. I reduced osu's resolution so that it'd fit inside the mapped area (800x600). This time however there was still a border inside the even smaller osu window. It looks like the coordinates are mapped relative to the active window rather than the screen. The amount of padding was proportional to the new resolution, that is 1/8th of 800 by 600.

frederick99 avatar Apr 27 '19 20:04 frederick99

Are you running osu in fullscreen or windowed mode? Also, does toggling the "map input to window" option do anything?

apsun avatar Apr 27 '19 23:04 apsun

Fullscreen mode (with letterboxing).

By that are you referring to Shift+F6? Toggling it makes my physical mouse unusable and touchpad works differently, as in I can move to any point on the screen (within the border) instantly by placing my finger somewhere else on the touchpad. Toggling again enables the use of mouse and also returns the touchpad to normal mode. (I think it works as it should lol :D)

frederick99 avatar Apr 28 '19 08:04 frederick99

I meant the osu setting (it's in the mouse input section)

apsun avatar Apr 28 '19 15:04 apsun

It was on by default. Toggling it didn't seem to have any effect though. I even recalibrated every time after changing settings.

Edit: I want to believe it's a driver issue but the fact that the playable area is relative to osu window size and not the screen size makes me feel it's not. On the contrary, it could be something on my end as no one else seems to have this problem.

frederick99 avatar Apr 28 '19 17:04 frederick99

On the contrary, it could be something on my end as no one else seems to have this problem.

It could be, or it could also be that nobody else has bothered reporting it :-)

I'm a bit busy atm, but I'll try to get that debug build later today so we can investigate this further. The thing is that I reverse engineered most of the input handling logic from the OpenTK library that osu! uses, so there might be some assumptions I'm making which aren't universal.

apsun avatar Apr 28 '19 18:04 apsun

Actually, I just realized that debugging info is not necessary. You can just run atloader.exe directly and it will launch the test program which should output the coordinates that AbsoluteTouchEx is generating. Can you play around with it a bit and see what coordinates you're able to get? They should go from 0,0 at the top-left to 65535,65535 at the bottom-right.

apsun avatar Apr 29 '19 04:04 apsun

I am able to generate coordinates from (0, 0) to (65472, 65451).


65141, 65159 64880, 64880 65067, 64956 64782, 64823

These are some of the maximum values I can get after calibrating different areas (not sure why it's not giving the max. possible value, that is 65535.) The minimum is (0, 0) for each.

frederick99 avatar Apr 29 '19 06:04 frederick99

That's close enough (1023/1024 * 63335 == 65471, that's just a side effect of how the coordinates are scaled). I'll dig into OpenTK to see how these values get used.

apsun avatar Apr 29 '19 15:04 apsun

I used a hack to "fix" the problem for now.

But the fact that it works makes it definite that the issue is software related. I'll be on the lookout for an actual fix. Cheers!

frederick99 avatar Apr 29 '19 19:04 frederick99