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
Offset in Y coordinate with Windows 7 and Multitouch HID Device #2701
Comments
I was discussing this issue on the #kivy IRC channel with @tshirtman yesterday. I was having difficulty hitting buttons at the bottom of the window in an app I'm prototyping, and he suggested using the touchtracer example to check the behaviour. I can confirm the same issue on a Windows 8.1 Asus laptop with a touchscreen. The behaviour I see is:
I'm happy to do any further investigation that would help - I could really use a fix for this for my application! |
@Vianneyz did you get anywhere with this? I'm building an application for a surface pro 3 and just received a test device, which exhibits the same behaviour (it's only on touch rather than pen input, so that must not use wm_touch). Anyone got a workaround or quick fix? At the moment I'm looking at avoiding controls at the bottom of the screen & increasing control sizes, which is not ideal. |
Hi, There is still a little offset with this but the app become usable in full screen, even if controls are placed in the bottom of the screen. |
Thanks - that works pretty well for me for controls at the bottom of the screen. Unfortunately a control in the very top right is now not reachable, so I'm going to try a dirty if/else on |
@Vianneyz I've found that replacing line 165 with the following solves both the top and bottom edge issues for me on Windows 8.1:
Definitely a bit dirty, but happy with the result! |
@jamiecollinson It does not work for me on Windows 7.1 in fullscreen. I can clearly see the gap when the touch is in the top half of the screen. I had further investigations on the problem and here are my conclusions: x = int(t.screen_x() - win_rect.x) / float(win_rect.w - 1)
y = 1.0 - int(t.screen_y() - win_rect.y) / float(win_rect.h - 1) The integer cast is important to avoid problems such as 1 / 1 =0.999998 or similar. In windowed mode, this is different as we have to substract the size of caption, borders, etc. I don't succeed to use this function, the compiler / interpreter prints strange error "expected LP_RECT instance instead of pointer to RECT"... Maybe someone else will have more chance. I'm not a python developer but have some background in programming languages... |
@Vianneyz Can you share your patch even if it doesn't work? It can be a start for others peoples to contribute / help you to fix it as well |
I'm afraid I was working on a client device and don't have access to it at the moment, so can't confirm @Vianneyz's comments on the problem when windowed. I don't recall spotting that as a problem during testing, but I was focused on how it performed when maximised. I'm also confused by the suggestion to divide both by
|
@jamiecollinson Yes, you're right it's a typo error for the y coordinate. -> I edited my comment. I substract 1 to have the coordinates [0 ; 1]. If we don't the coordinates are [0 ; 1[. @tito I have no free time until January to work on that but I will try to do so. |
A workaround for this issue is to add the following to config.ini. [postproc:calibration] |
A calibration trick won't cut it if you want to have a portable solution, i'm having a look in the same direction as @Vianneyz , but hitting the same error, which is weird, because both fonctions have the same signature according to MS doc (https://msdn.microsoft.com/fr-fr/library/windows/desktop/ms633519(v=vs.85).aspx, https://msdn.microsoft.com/fr-fr/library/windows/desktop/ms633503(v=vs.85).aspx) and both are declared the same way in the module. Digging. edit: the change is as simple as changing |
Hi tshirtman, if I make that change I get this error: File "C:\Users\Kivy\Desktop\Programing\Python\Kivy\Kivy 1.9-32bit\kivy27\kivy\input\providers |
Yes, this is what i get as well, i'm trying to understand what makes one call work and not the other. |
this is getting confusing, seems kivy is doing something that confuses ctypes, because with this test code, the first call doesn't crash (though hwnd is 0, which is weird), but the call when i push the button does.
|
PR up there only fixes the originaly reported issue, that is the constant offset in the whole window when the app is fullscreen, i don't currently have a way to reproduce non-constant and x offset issues, but i think the more general solution would be to use GetClientRect, if i could find why it doesn't work. |
@grmcom @tshirtman I remember having the same error (with GetClientRect) when I tried a few month ago to correct the error but as I have absolutely no knowledge of the kivy structure and I'm not a Python developper, It made it hard for me to solve the issue. |
Hi all,
It seems there is a bug with Windows 7 (not tested on others Windows) and Kivy about the Y position of the cursor. There is a constant offset between the Windows Cursor position and the one Kivy uses. (See attached pictures). Note that the offset is bigger in fullscreen that in windowed mode.
After having a quick look at the code, it seems that this offset is due to the caption size which is substracted to calculate the Y coordinate (line 165 in file wm_touch.py).
I can try to run additional tests if needed.
Regards.
Touchtracer in windowed mode:
Touchtracer in fullscreen mode:
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: