Mouse trigger reacts to double click

I am writing a small game that should react to mouse click.

I have added a mouse_trigger with input type of MOUSE_BUTTON_1, but I get the on_input event with my action id only on double-click (on my Mac)

When I try to use MOUSE_BUTTON_LEFT it sometimes works with a single click and sometimes only with double click…

What might be the problem?

Have you added a MULTI_TOUCH with the same action perhaps? I think those two will collide.

No, the only biding I have is for mouse_trigger.

I honestly have no idea what could be causing this. Are you using a mouse or trackpad? Could you share your on_input() function and your input bindings?

I am using a macbook pro with a track pad.
Here is the input binding file (text):

mouse_trigger {
    input: MOUSE_BUTTON_LEFT
    action: "mouse_click"
}

Here is my on_input function:

function on_input(self, action_id, action)	
   if action_id == hash("mouse_click") 
   and action.pressed 
   then
      jump(self)     
   end
 end

And I also acquire input of course.
The strange thing is that it happens most of the time I build, but not always…

Ok, and you don’t have any other key bindings for action “mouse_click”?

I found this sometimes happens because the dmengine window is somehow not fully focused. Look at the title bar. Is it grayed out? If yes, cmd-tab to some other app, then cmd-tab back.

Yo are right! it is solved when going to another window and coming back.

Pretty annoying though…

Ah, yes, so the first click will give the window focus, the next click will be detected by the engine. Sounds reasonable and expected I think.

Not really. The first click doesn’t give focus to the engine, that’s the rub. So, subsequent clicks act the same unless you cmd-tab in and out. It’s just weird. Don’t know what might be causing it.

dmengine appears as the current app in macOS’s status bar, but its window is not focused and clicking it doesn’t give it focus.

1 Like

Odd, could you provide the exact steps to reproduce this behavior?

I don’t know how to reproduce. It seems to happen randomly when running the game with Cmd-B. Some more info about my setup if this helps:

I use the following machine in a 2 monitor setup (laptop screen set as secondary + external monitor set as primary display):

Defold and Java versions:

Ok, thanks for the additional info. I have never experienced this myself and I haven’t heard of anyone here at the office either. Do you have some other software that might interfere when new windows are opened?

1 Like

In terms of window management, I use Better Touch Tool and Spectacle on a regular basis. Nothing else that I think might interfere.

I use Spectacle myself and since I haven’t experienced this issue myself I think we can rule out Spectacle at least.

1 Like

I am using a Mac and I am getting the same issue here, I also don’t use either of those programs that dapetcu21 uses so I believe this might be a bug.

Ok, and you have only one input binding, MOUSE_BUTTON_LEFT? Or do you have MOUSE_BUTTON_1? And does it also not happen all of the time for you? Is there anything you can think of in your setup that might cause this? Are you using a trackpad, mouse or some other input device?

I have the same issue. My os:


Any version of Defold (it was all time)

cmd-tab to some other app, then cmd-tab back helps, but the next launch dmengine the same thing.

Ah! This is what is happening, happens to me quite often. A mouse click doesn’t focus it and it makes hotkeys not work as they should.

macOS Sierra
Version 10.12.4

2 Likes

This is really nice to now. I have struggled with this for about 2 hours now. Did not even recognize the the greyed out title bar.

I was really wondering why my single click and then hitting space would trigger that event :smiley:

macOS Sierra
Version 10.12.4

Defold 2 Editor
Version 1.2.105 (2017-05-23T13:13:57.948197