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

Kivy - SendMouseMoveEvent with modifier not working #574

Open
hoba87 opened this issue May 15, 2020 · 24 comments
Open

Kivy - SendMouseMoveEvent with modifier not working #574

hoba87 opened this issue May 15, 2020 · 24 comments

Comments

@hoba87
Copy link
Contributor

hoba87 commented May 15, 2020

When trying to integrate cefpython into kivy, the SendMouseMoveEvent with the modifier for a pressed MouseButton, e.g. cef.EVENTFLAG_LEFT_MOUSE_BUTTON, is not working for me.

See also the pull request for the updated kivy example #573, which let me run the example on Win10.

For an easy check, the website http://nglviewer.org/ngl/?script=showcase/ferredoxin is good, which allow to rotate and move the structure by a pressed mouse button and mouse move in a webbrowser, but not with the kivy example.

Is there a solution or workaround?

@cztomczak
Copy link
Owner

Are you reporting issue with the kivy_.py example? This example is supported only on Linux.

@hoba87
Copy link
Contributor Author

hoba87 commented May 18, 2020

Yes, I know that it was not intended to support other OS, however with the new pull request commit, it is at least also working on Windows now, except this described issue.
Can you confirm, that this issue is not present on Linux?

@cztomczak
Copy link
Owner

Are you running the kivy_.py example from the PR as is, or did you make any other modifications? What exactly isn't working, dragging?

@hoba87
Copy link
Contributor Author

hoba87 commented May 18, 2020

EDIT:
To open the website mentioned above, I comment out the browser switches:
"disable-gpu": "",
"disable-gpu-compositing": ""

The "touch move" is not working, so moving the mouse while pressing left or right mouse button.
Dragging is also not working.
Or to say what it working: Clicking with the mouse and using the keyboard on Windows.

@cztomczak
Copy link
Owner

Do you need to comment out the browser switches to reproduce the issue?

@hoba87
Copy link
Contributor Author

hoba87 commented May 19, 2020

To open the website from above yes, because it uses WebGL, otherwise I get only the message that WebGL is not supported.
The pywin32.py example works with the website by the way.

@cztomczak
Copy link
Owner

Can you test a different website with SendMouseMoveEvent ? With no modifications to kivy_.py (just as is in PR).

@hoba87
Copy link
Contributor Author

hoba87 commented May 19, 2020

Do you know a website where I can test it? I've googled around but have not find another one.

What I've tried: click on the google logo on google.com and "move" it. It works on MacOS, however it seems to be a drag event. (E.g. dragging an image to google pic search does not work)
On Windows I get an error:

Traceback (most recent call last):
  File "render_handler.pyx", line 263, in cefpython_py36.RenderHandler_StartDragging
  File "C:/cefpython/src/linux/binaries_64bit/kivy_.py", line 964, in StartDragging
    drag_data, x, y, cef.DRAG_OPERATION_EVERY)
  File "browser.pyx", line 788, in cefpython_py36.PyBrowser.DragTargetDragEnter
OverflowError: can't convert negative value to uint32_t

@hoba87
Copy link
Contributor Author

hoba87 commented May 19, 2020

Ah, ok after thinking again I've tried google maps. Yes it is working both on MacOS and Win. So do you have an idea what is the problem about the website from above?

@cztomczak
Copy link
Owner

If you remove the disable-gpu* flags rendering can be much slower. It might be that CPU is overloaded and events are being lost. Try lower frame rate.

I am not sure why WebGL doesn't work. v66 includes swiftshader (unless you've removed the swiftshader/ subdirectory in the cefpython3 package) which provides software rendering for GPU.

@hoba87
Copy link
Contributor Author

hoba87 commented May 19, 2020

Ok, for Windows the website is also loading with disable-gpu* flags, it seems I've tested that only on Mac before.
However the touch move is not working, neither on mac nor on win with soft- or hardware rendering. Lowering the frame rate doesn't help and the cpu is not overloaded.

@cztomczak
Copy link
Owner

So now it's an issue with Kivy's on_touch_move, not with SendMouseMoveEvent?

@hoba87
Copy link
Contributor Author

hoba87 commented May 19, 2020

Well, probably it is not an issue with kivys on_touch_move because it is executed as verified by using google maps (and by adding a print command printing something).
And perhaps also not an issue with SendMouseMoveEvent, also because of google maps test.
The website from above is mainly based on javascript, could there be the issue?

@cztomczak
Copy link
Owner

You will have to debug it to find the cause of the issue.

@cztomczak
Copy link
Owner

See if there are any errors in Developer Tools console.

@hoba87
Copy link
Contributor Author

hoba87 commented May 19, 2020

Arghh, it's a Heisenbug.
When I use the ShowDevTools() function, it is working, both on Win and Mac. It also keeps working if I close the dev tools manually or by CloseDevTools().
The "direct" remote_debugging_port doesn't work (the link is there, but opens an empty site only) and doesn't help.
The DevTools for Node works also like a Heisenbug, when the DevTools are opened, I can rotate the structure.

I'm not familiar with the DevTools but I cannot see any errors.

@cztomczak
Copy link
Owner

cztomczak commented May 19, 2020

Check if message loop work is being called every 10ms or so. Looks like events are lost due to message loop not working correctly. Try enabling external_message_pump on other OSes and see if it makes any difference. When you open devtools in a window that uses windowed rendering it could affect message loop somehow.

Edited.

@hoba87
Copy link
Contributor Author

hoba87 commented May 19, 2020

the _meesage_loop_work function is called about every 5ms. external_message_pump does not make a difference for win.

@cztomczak
Copy link
Owner

5ms would be too often and might cause issues.

@hoba87
Copy link
Contributor Author

hoba87 commented May 19, 2020

changing it to about 10ms by removing the kivy "hack" makes no difference

@hoba87
Copy link
Contributor Author

hoba87 commented May 25, 2020

EDIT:
I've tested the workaround again, it keeps working only on Mac after CloseDevTools(). On Windows it works only with opened dev tools.
Nevertheless, should I add the workaround to the pull request?
Thank you for your help so far, but at the moment I have no clue what to try else.

@cztomczak
Copy link
Owner

What workaround?

@hoba87
Copy link
Contributor Author

hoba87 commented May 25, 2020

using
ShowDevTools()
CloseDevTools()

@cztomczak
Copy link
Owner

cztomczak commented May 25, 2020

No, I don't think so. You can try creating a hidden window on startup and see if that helps. A hidden window using windowed rendering with CEF browser embedded.

Edited.

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

2 participants