MarcBoule / MindMeldModular

Modules for VCV Rack
Other
145 stars 9 forks source link

ShapemasterPro: unable to grab nodes with mouse. #65

Closed zeronoises closed 3 years ago

zeronoises commented 3 years ago

OS: Arch Linux Bought and downloaded (through the library) today. Everything I've checked on so far functions, but I'm unable to grab nodes on the screen to move them. Right clicking on them produces the expected result, but a left click gives me nothing. Experimented with all the Mod keys - shift click works as expected. Re-downloaded. No joy....

Am I missing something obvious?

Torinbob commented 3 years ago

Hi - that does sound odd and unlikely you are missing anything obvious - should just be a left click and drag.

Let’s see what Marc says about it

MarcBoule commented 3 years ago

That's a very strange problem, and so far it doesn't seem to not be reproducible. It works properly on my two different Ubuntu systems, and we've had confirmation that two other Linux users have no problems either (one Ububtu and one Mint).

It will require some back and forth I think to work out the problem, so perhaps we can start with a simple first test:

Do you have any other modules with displays or clickable areas that you can compare with to see if those are working? Here are some examples to test (some are commercial, but I'll list them anyways just in case):

zeronoises commented 3 years ago

I have used Tact and Wave in many patches... BZ Envelope works fine too.

zeronoises commented 3 years ago

BTW - the nodes still react to hovering with the cursor.

MarcBoule commented 3 years ago

Good to know! Just off hand, do you know how to compile Rack plugins?

zeronoises commented 3 years ago

Yep - I have the SDK installed.

MarcBoule commented 3 years ago

Excellent, can you clone this repo please, and try the free version of ShapeMaster?

https://github.com/MarcBoule/MindMeldModular

zeronoises commented 3 years ago

Well, well - the free version works perfectly!

zeronoises commented 3 years ago

And now - mysteriously - it doesn't....

MarcBoule commented 3 years ago

wow, very strange!

MarcBoule commented 3 years ago

when you hover over the node, you should see it get bigger, and then when you left-click (and hold for one second for example) does it stay big or do you see it go smaller again (all the while keeping the mouse directly over the node)?

zeronoises commented 3 years ago

Okay - interesting. The first couple of times I try that the node shrinks again. But on maybe the third click it will hold, and I 'm able to drag the node. I try this on both Pro and free - same. Then I go back and try the same thing again. Failure. I shut down Rack and restart - still failure....

MarcBoule commented 3 years ago

Perhaps it's some weird timing where the sequence of mouse related events (onButton vs onDragStart) are not being triggered in a consistent order. I'm just guessing here, and I don't know how deep you would like to go into this, but we can proceed in two ways from here I think:

a) I can add some debug statements to the mouse code for the display, and we can watch in the console as you make clicks to see if those events are being called in their expected order

b) we can look into perhaps reimbursing your purchase

I can't guarantee that option a) would lead to a solution however, so I prefer to be honnest with you if you don't want to spend more time on this.

zeronoises commented 3 years ago

Perfectly reasonable: I'd like to try a debug version please!

MarcBoule commented 3 years ago

Ok, I have set up a new branch called "zero" with extra event logging statements in the terminal. First you will need to go change branches in the MindMeldModular repo:

git checkout zero

Then make clean and then re-make a fresh version of the plugin.

Then starting from an initialized ShapeMaster module, just try to click-drag the center node like this, and see how those events show up in the terminal upon successful and unsuccessful cases. The expected listing of events should be like this:

image

Small tip, if you want the logging to be compact, onDragMove is called every GUI frame, so it can be useful to temporarily set your refresh rate in Rack to a very low setting (I used 12Hz in my test). Hope this will reveal something!

zeronoises commented 3 years ago

Should I start Rack from the terminal to see these messages - cos that produces no output...

MarcBoule commented 3 years ago

you can yes, or once finished if you close Rack you should see it in the logfile (log.txt I think). But much better to launch Rack from the terminal in debug mode, by typing "make debug" or equivalently "./Rack -d", but then there may be the issue of which plugin location it will use (it uses another I think), so perhaps it's simpler to just look at the log file.

zeronoises commented 3 years ago

log.txt

MarcBoule commented 3 years ago

Ok, so then events were in the correct order, but it appears as if every click that was made was not registering it on a node (since the pt = 270 we see in the log indicates that the background was clicked). so just to make sure I understand:

Now according to my code, it's seems impossible for the node to have been big and for it to not have registered the correct number when it was clicked, since the pt number we see when we click it is the exact same number that is used to tell it to draw a big node.

Just in case, here is a picture of what a node looks like when it is hovered over with the mouse and it gets bigger: (the node on the right has the mouse over it, but we can't see the mouse because of the screen capture)

image

So if you are clicking a big (hovered-over) node, and it's registering 270 (in the log file), I'm very much puzzled.Do you see if the node momentarily gets small again when the click happens, and does it stay big if you click and hold the button and mouse over the node? (if you prefer showing with a video instead of all these questions, please feel free to do so). I've really never come across this behavior, and we now have a few hundred people using the module... so strange!

zeronoises commented 3 years ago

When I hover the node enlarges. When I click the node shrinks - and stays shrunk as long as I hold down the mouse button. On release the node enlarges again. If I mouse-over it enlarges as I pass over - but not if the button is down.

Torinbob commented 3 years ago

From what you describe, it sounds to me like your mouse is registering a different position when it is clicking than when it is hovering. So you can be hovered over a node, and it enlarges, but the act of clicking moves the mouses registered position somehow so it is no longer over the node (and the node therefore shrinks because your mouse is now registering as being over the background, not the node.

You don't happen to have another mouse you can try with do you?

zeronoises commented 3 years ago

Plugged in a spare mouse - same result, although I did manage an initial successful drag, as has sometimes happened before. The log file shows one series of 'onDragMove, left, pt = 1' before reverting to 'pt = 270' again. Don't think it's the mouse.

MarcBoule commented 3 years ago

I'll go over the mouse code again in a few hours to see if I can spot anything that could explain this behavior, it might have to do with screen coordinates and resolution, dpi, that sort of stuff, since there are internally two methods to get the mouse position. I think we are narrowing in on something, Steve's diagnosis seems to be very relevant.

zeronoises commented 3 years ago

Okay. Thanks for putting in the time on this. I'm afraid I won't be up much longer though - talk to to you tomorrow.

zeronoises commented 3 years ago

Could my WM be of consequence? It's Spectrwm by the way.

Torinbob commented 3 years ago

Sure - Marc's gone to have some dinner now anyway but he will be taking a look at the code again a bit later tonight.

Fingers crossed that we (he :) ) can find a solution to your problem - at least we have an idea of what seems to be happening now.

Sorry I'm not sure I followed your last comment at all - what's WM?

Torinbob commented 3 years ago

I'd also imagine that if you click around the node, close to it but not over it, you might find a place where it does grab it every time - as it sounds like there is some kind of position offset happening when the mouse button is clicked. For example you might find if you click off the node at say 7 o'clock or 3 o'clock or whatever, it grabs it.

Given that your grabs are occasionally successful, this offset may be very small (such that occasionally you are clicking slightly off centre of the node in just the right direction)

MarcBoule commented 3 years ago

Could my WM be of consequence? It's Spectrwm by the way.

Not really sure, I'll try some things on my end before. EDIT: original message redacted (see next comment below)

@Torinbob WM : https://wiki.archlinux.org/index.php/window_manager

MarcBoule commented 3 years ago

Ok, I tried a different internal method of handling mouse dragging, and if you could pull the "zero" branch, rebuild and try it now, I'd be very curious to see if that did the trick. Thanks also for your patience with this, it's very much appreciated!

zeronoises commented 3 years ago

I'm afraid that behaves exactly as before - and the log file has no debug entries now.

MarcBoule commented 3 years ago

This one is really challenging! I removed the debug entries since I didn't think we would need them, but I think I'll bring them back and add some mouse position information, so we can see how the cursor is being read.

In this current version, the code is very similar to the one in Stoermelder's Arena module, if you have that installed, are you able to drag those nodes?

zeronoises commented 3 years ago

Arena works perfectly well for me...

MarcBoule commented 3 years ago

ok, great to know, I'll try more changes, but to avoid bothering you with all this, I'm installing Arch Linux on one of my laptops, so if I can reproduce it here, it will be less trouble for you. I'm installing version 2021.04.01 and I will use the same WM as you, so hopefully it will do the bug on my setup also :-)

zeronoises commented 3 years ago

Just a thought - I'm using the git version of spectrwm from the AUR....

MarcBoule commented 3 years ago

Ok, so to continue this long thread :-) installing Arch Linux has proven to be much above my Linux skills unfortunately, after 3 hours I was still not getting it to boot, so I think I will revert to making more changes to the module and preparing a version with lots of tests for you. It will take a bit more time though, my vaccine is giving me some fever and it's not easy to be in front of the computer. I guess that means the vaccine is working, haha! Stay tuned :-)

zeronoises commented 3 years ago

No worries - take as much time as you need.

MarcBoule commented 3 years ago

I did a major overhaul to the code, I'd be curious to see if you're still having the problem now (it's still in the "zero" branch). I also added some more detailed debug logging, so if the problem is still there, we should have more to work with. Fingers crossed!

zeronoises commented 3 years ago

Complete success! Log file attached: log.txt

MarcBoule commented 3 years ago

Excellent!! Glad we got it :-) I'll send you a new build of ShapeMaster Pro when the debug code gets removed and the fix is copied over to the Pro version also.

MarcBoule commented 3 years ago

If you're on the VCV forum or FB for VCV Rack, can you send me your email in private please (or post here if ever you don't mind it being public)? I would need the one that is tied to you VCV Rack account.

zeronoises commented 3 years ago

I'm fine with it being here: zeroliberationarmy at gmail dot com

MarcBoule commented 3 years ago

Excellent, I just sent the build. I'll close the issue, but feel free to follow up if ever there's a problem.