Gource icon indicating copy to clipboard operation
Gource copied to clipboard

Click to pan graph makes the entire graph disappear

Open 0jrp0 opened this issue 5 years ago • 5 comments

When I click to pan the graph, everything disappears. When I turn on the debug info, I observe that the X, Y position values have been scaled to some huge negative values. The effect is that the graph goes off screen to the extreme upper left.

If it's helpful, I'm using a Chrome Remote Desktop to a remote Linux machine. I wonder if the X windows coordinates for the mouse are off or something weird..

0jrp0 avatar Sep 21 '20 04:09 0jrp0

Does it happen consistently, or only say if you've just moved the cursor over the window? What if you click and drag with the right mouse button (to rotate) and THEN try to click with the left to drag after.

I wonder if because you're using remote desktop, the first mouse event it sees if for the click, and xrel/yrel event coordinates aren't relative but instead absolute, so they're bigger than normal.

acaudwell avatar Oct 01 '20 02:10 acaudwell

Right click rotate works fine. I can left click on file bubbles. However, if I click to pan the thing, it goes ape. X and Y keep incrementing massively and no matter how I pan, the values just keep increasing. Here's a snapshot of X,Y,Z from debug info: image

I tested using xev and xinput test, both reported reasonable X,Y values for the mouse pointer over the remote desktop. Could it be a GL over a remote desktop thing?

Is there a GL hello world I could compile where I can do a xev style test for mouse events / coordinates? Perhaps I could augment this? https://github.com/mrotaru/OpenGL-linux/blob/master/wk1_linux.cpp

0jrp0 avatar Oct 01 '20 05:10 0jrp0

OK, I found the reason. Chrome Remote Desktop by default sends absolute mouse position. There is an option to send relative mouse position and it works with Gource. I cannot find a good help page that describes this for CRD, but this VMware doc describes the mechanics for another product.

My preference would be for absolute mouse position support because if I set "send relative mouse position", the mouse cursor is 5 times slower and mousewheel event is buggy.

$ sdl2-config --version
2.0.12

Looking at the code here: https://github.com/acaudwell/Gource/blob/9354ebfec4766ffe314e95eb08c3f9d396cd4b44/src/gource.cpp#L345

It's critical that SDL_MouseMotionEvent has some kind of relative X,Y. If not, it just keeps adding up in: https://github.com/acaudwell/Gource/blob/9354ebfec4766ffe314e95eb08c3f9d396cd4b44/src/gource.cpp#L363

I noticed this call here: https://github.com/acaudwell/Gource/blob/9354ebfec4766ffe314e95eb08c3f9d396cd4b44/src/gource.cpp#L303

Maybe SDL_GetRelativeMouseMode() is goofing up in CRD. I can try some print statements to see what it does.

0jrp0 avatar Oct 01 '20 06:10 0jrp0

I set fprintf(stderr, "") statements next to SDL_GetRelativeMouseMode() and observe the following:

  1. On left click, it prints set relative mouse mode to TRUE to stderr.
  2. On release, it prints set relative mouse mode to FALSE to stderr.

So I hacked the code to set it to false here: https://github.com/acaudwell/Gource/blob/9354ebfec4766ffe314e95eb08c3f9d396cd4b44/src/gource.cpp#L303

Effectively forcing it never to set relative mouse mode. Now it works. But, I'm not sure how to fix this in a non-hacky way so that we could sense something in the environment and just not set it?

0jrp0 avatar Oct 01 '20 06:10 0jrp0

Note that this hack also grabs the mouse away from everything else and makes it exclusive to Gource. You have to hit ESC to quit Gource to give the mouse back to other windows on the desktop.

0jrp0 avatar Oct 01 '20 06:10 0jrp0