Mouse +keyboard input in applications

psonice's picture

This is probably something totally stupid and obvious that i've missed, but how do you get the keyboard + mouse input forwarded to the composition when you put it in a window in interface builder?

I'm trying to build a quick test app using my painting composition. I've added the QCView into the window, plus the parameter view, and I've enabled 'forward all events' for the QCView. I run it, and I can see the brush outline following the mouse inside the composition (i.e. it's receiving x/y values from the mouse), but neither mouse clicks nor key presses are registered. Loading it via a patch controller doesn't seem to help either.

Anyone care to point me in the direction of the clue shoppe? :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

franz's picture
same here

well, it is a real problem. normally you just enable "forward all events" on the QCview in IB. BUT, for some reason, when using for instance an app controller (custom) to make your QC view go fullscreen, when NOT in fullscreen mode, you loose the ability to pass those events if you can drag the view around. If the view cannot be dragged around, then it works. It is so strange i don't get it. Same thing if you want to assign "SPACE" as a keyboard shortcut to some button in IB: it works once when the app is freshly compiled, but if you close the app and relaunch it, you loose your "space" shortcut.... .......

it seems you are not alone in the darkness.....

psonice's picture
Not only if the window is moved here!

I'm not getting any mouse or keyboard input at all. Even loading a fresh project, adding the QCView and compiling, all I get is mouse x/y, no button clicks or key presses.

Is there any way around it? Not having any input is pretty show-stopping for a paint tool ;)

cwright's picture

Even using a QCRenderer doesn't magically fix this. It has something to do with how events are handled (i ran into a similar problem with yanomano regarding mouse input in a plugin in another application) -- not sure what to forward to make it work, if anything. In general, controller patches like those aren't supposed to be used as such (which makes them pretty useless to be honest).

Maybe someone can shed some more light on this?

psonice's picture
QC mailing list

I've also asked about it on the apple QC mailing list. I got a message back though with half of the message marked 'unprocessed', and the other half 'ignored'. Guess they don't like me :(

Can anyone on the mailing list tell me if the message came through at all?

cwright's picture
I didn't see it

I've not seen it on the list.

Don't take it personally; I'm sure Pierre has employed his "ignored" stamp more than a few times for some of my mails as well :)

psonice's picture
Tried again, failed again

Just retried and got the same result, so I've filed a bug :) (well, contacted the webmaster.. failing that I'll file a bug ;)

franz's picture
answer on QCdev

thanks from asking on QC dev. i'm posting the answer you had (that solved my problem too),some others might be interested:

call this on awakeFromNib : [qcView setEventForwardingMask :NSAnyEventMask];

psonice's picture
Yet to test it

Between asking about that and getting the answer, I put a load of stuff with GLSL + sampler2d in the vertex shader back into my composition, so it'll now crash the application as soon as it loads :/

I'll dig out an older version without glsl at some point to test it properly, but in the mean time, is it possible to force software CI upon the QCview in an app?

yanomano's picture

Is there any chance this command can be embed in a A QC pluggins ?


cwright's picture
not really

It's an attribute of the user's qcview object. I suppose the qcview's init method could be modified to set this flag, but that's pretty ugly, and may not work (if something later on in the init process clears the flag, for example).

franz's picture
it is working

well, for me it is working nicely...... at least

Just.Jake's picture

You could do a workaround by creating a silent helper app that hears all NSEvents, determine which ones apply to an application running your QC patch, and hand those events off to your patch. Also, look into Nu, a scripting language for/over ObjectiveC. It can help with this sort of thing, I believe.