Giter Site home page Giter Site logo

Comments (17)

timothyschoen avatar timothyschoen commented on May 29, 2024

I can't reproduce this in Bitwig or Reaper on Ubuntu 20.04, or on Bitwig on Mac. Does creating new objects with shortcuts work? ("n" for empty object, make sure canvas has keyboard focus)

from plugdata.

ensonic avatar ensonic commented on May 29, 2024

'n' works! Is there is a list of shortcuts?

from plugdata.

timothyschoen avatar timothyschoen commented on May 29, 2024

n = empty
b = bang
t = toggle
m = message
s = vertical slider
i = number box
f = floatatom
c = comment

These are Max/MSP like instead of Pd-like because I find them much easier to memorise, but not every object has a shortcut right now. You can also create any GUI object by just typing its name, like "msg", "tgl", "bng", "hsl", "cnv".

The fact that it works like this and not when clicked from the callout menu suggests that there is somehow no event triggered when the callout menu closes, I'll see if I can find something.

from plugdata.

timothyschoen avatar timothyschoen commented on May 29, 2024

@ensonic I think this was a bug in JUCE, I've updated JUCE to the latest version so it might be fixed now

from plugdata.

ensonic avatar ensonic commented on May 29, 2024

Thanks, I've updated my checkout and rebuild everything, but it does not help. You might have also introduced a bug. When I save a patch, it break it (there is some garbage appended to the pure data file).

from plugdata.

timothyschoen avatar timothyschoen commented on May 29, 2024

Oh no, I'll try that out, thanks for reporting. Unfortunate that the JUCE update doesn't help. Did you update the submodules? I've changed the submodule structure quite a lot so I'd recommend cloning it from scratch.

The new version does add a comment to the pd file, to store extra information to the patch. I've also seen that it sometimes adds a newline at the end of a patch...

Does it completely break, or does it just show an error in the console?

edit: Found and solved the problem, by calling pd's save functions directly instead of getting the canvas content and saving that manually.

from plugdata.

timothyschoen avatar timothyschoen commented on May 29, 2024

@ensonic I wonder if this is still happening?

from plugdata.

ensonic avatar ensonic commented on May 29, 2024

I did not rebuild recently and I am using my distros package (0.3.2+git.13.b8ab75a-7.11). With that one the problem still exists.

from plugdata.

timothyschoen avatar timothyschoen commented on May 29, 2024

Very likely that it's still an issue then... Problem is, it works fine on all my linux installations, making it very hard to solve.

from plugdata.

ensonic avatar ensonic commented on May 29, 2024

I'll rebuild from git. Can you point me to the code for the menu an for the keyboard handling. I can add some log statements to figure what's different from the event to the object creation.

from plugdata.

timothyschoen avatar timothyschoen commented on May 29, 2024

Thanks, that might help!

It happens here:

https://github.com/timothyschoen/PlugData/blob/main/Source/Dialogs/Dialogs.cpp

in "Dialogs::showObjectMenu", the last line spawns the menu. You could place a log statement in the callback function it passes in, I'm curious if that gets called. And if it does, what is the "result" value it passes in?

Then you could add a second log statement here:

https://github.com/timothyschoen/PlugData/blob/main/Source/PluginEditor.cpp

in function "perform", case "CommandIDs::NewObject"

I assume that it never gets to that point, but it'd be nice to confirm that.

from plugdata.

ensonic avatar ensonic commented on May 29, 2024

Done. This is my patch for reference:

diff --git a/Source/Dialogs/Dialogs.cpp b/Source/Dialogs/Dialogs.cpp
index 174dd20..349e3a8 100644
--- a/Source/Dialogs/Dialogs.cpp
+++ b/Source/Dialogs/Dialogs.cpp
@@ -110,11 +110,15 @@ void Dialogs::showObjectMenu(PlugDataPluginEditor* parent, Component* target)
     menu.showMenuAsync(PopupMenu::Options().withMinimumWidth(100).withMaximumNumColumns(1).withTargetComponent(target).withParentComponent(parent),
                        [parent](int result)
                        {
+                           parent->pd.logMessage(String(__FILE__) + ":" + String(__LINE__) + ":" + String(__FUNCTION__) + ":  popup result=" + String(result));
+
                            if (result != 0)
                            {
                                if (auto* cnv = parent->getCurrentCanvas())
                                {
                                    cnv->attachNextObjectToMouse = true;
+                               } else {
+                                   parent->pd.logMessage(String(__FILE__) + ":" + String(__LINE__) + ":" + String(__FUNCTION__) + ": Can't get canvas");
                                }
                            }
                        });
diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp
index 9f707db..b29e0ad 100644
--- a/Source/PluginEditor.cpp
+++ b/Source/PluginEditor.cpp
@@ -781,6 +781,8 @@ void PlugDataPluginEditor::getCommandInfo(const CommandID commandID, Application
 
         case CommandIDs::NewObject:
         {
+            pd.logMessage(String(__FILE__) + ":" + String(__LINE__) + ":" + String(__FUNCTION__) + ":  CommandIDs::NewObject");
+        
             result.setInfo("New Object", "Create new object", "Objects", 0);
             result.addDefaultKeypress(78, ModifierKeys::noModifiers);
             result.setActive(pd.locked == var(false));
@@ -795,6 +797,8 @@ void PlugDataPluginEditor::getCommandInfo(const CommandID commandID, Application
         }
         case CommandIDs::NewBang:
         {
+            pd.logMessage(String(__FILE__) + ":" + String(__LINE__) + ":" + String(__FUNCTION__) + ":  CommandIDs::NewBang");
+
             result.setInfo("New Bang", "Create new bang", "Objects", 0);
             result.addDefaultKeypress(66, ModifierKeys::noModifiers);
             result.setActive(pd.locked == var(false));

When I open the menu, by left or right clicking the +, I see invocations for

  • Source/PluginEditor.cpp:781
  • Source/PluginEditor.cpp:800
  • (and probably all the other rmenu items)

followed by Source/Dialogs/Dialogs.cpp:113 with a popup result of=0 after I left or right clocked the menu item.

I also added some logging to createCommandItem() in Dialogs.cpp and there I get non-zero itemIDs. So I am not sure where the menu item id is lost.

FYI: https://github.com/timothyschoen/PlugData/blob/main/Source/Dialogs/Dialogs.cpp#L72 looks fishy, the if and else branch are the same.

from plugdata.

timothyschoen avatar timothyschoen commented on May 29, 2024

Thanks Stefan!

Nice catch about the if-statement btw, it's a bit of modified JUCE code, I think I changed the thing that made the branches unique at first ;)

createCommandItem is not actually performing the action, it only registers the action and updates the state of the action.
I'd be interesting to see if "pd.locked == var(false)" returns true here, if it doesn't that's obviously a problem.

In function "perform", Source/PluginEditor.cpp:903, the action will get performed. I wonder if you get a log message there, but I assume not.

The fact that it returns 0 in the callback is telling though: almost like clicking the popupmenu makes it lose focus instead of triggering it.

from plugdata.

ensonic avatar ensonic commented on May 29, 2024

I added a

        if (parent->pd.locked == var(false))
        {
          parent->pd.logMessage(String(__FILE__) + ":" + String(__LINE__) + ":" + String(__FUNCTION__) + ": not locked?");
        }

to createCommandItem() in Dialogs.cpp and no warning shows up, which I take as a good sign. I have been searching the net a bit, but can't find anything obvious why result would always be 0. I think your hunch could be right that for some reasons the focus has been lost and juce believes I clicked outside of the menu.

Any idea how we can verify this?

from plugdata.

timothyschoen avatar timothyschoen commented on May 29, 2024

But the the right-click menu on canvas does work right? Odd, because it's the same thing. I could try to make all these menus non-modal, that might help.

What distro are you on btw? I'll install it in a VM to see if I can reproduce it like that.

from plugdata.

ensonic avatar ensonic commented on May 29, 2024

Good point, just tested. I created an object using 'n' key and then used the context menu to try to copy and paste and this does not work either (ctrl-c, ctrl-v works though).

I am using opensuse tumbleweed (https://get.opensuse.org/tumbleweed/) using the default gnome desktop (on wayland). I just tried under X11 and there it works, so it looks like there is a JUCE incompatibility with wayland :/

from plugdata.

timothyschoen avatar timothyschoen commented on May 29, 2024

Thanks for figuring that out, looks like I won't be able to fix this :(

from plugdata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.