Two mouse pointers on raspberry pi

When I run an OF app on Raspberry Pi, I get two mouse pointers. One pointer shows and registers clicks on the desktop and one lives in the OF app. So when I’m clicking away in my Of app, I’m at the same time also moving files and clicking things on the desktop.

Does anyone know why this happens? And how we could fix this?

thanks!
tim

Are you running inside X11? (i.e. with startx)

Yes, but now that you mention it… the first thing I get when starting the app is:
[notice ] ofAppEGLWindow: init(): X11 is not availble on RPI yet, using a native window instead

Can’t believe I never saw this before… that looks like quite the clue :slight_smile:
I’ll investigate further.

Another clue:
This is what i find at https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworks/app/ofAppEGLWindow.cpp#L355

////////////////
// TODO remove the following ifdef once x11 is accelerated on RPI
#ifdef TARGET_RASPBERRY_PI
if(isUsingX11) {
    isUsingX11 = false;
    ofLogWarning("ofAppEGLWindow") << "init(): X11 not availble on RPI yet, using a native window instead";
}
#endif
////////////////

Are you able to run OF in an X11 window?

So, what’s happening is that Raspberry Pi didn’t have accelerated X11 drivers when I wrote the original ofAppEGLWindow for the Raspberry pi. Instead, we create a raw window directly on the framebuffer (and even draw our own mouse cursor). We manage our own mouse and keyboard events, and don’t rely on X11 for any of that normal windowing stuff. So, generally we recommend that you run your apps from outside of X11 directly on the command line. If you run it inside of X11 it will work, but it will draw it right on top of the X11 window, and you’ll see the X11 mouse AND our custom mouse.

The solution is basically just to run it outside of X11 on the command line. Depending on how you have your PI set up, it may boot into X11. If that is the case, you’ll need to exit out of X11 and get a plain console.

That said, you certainly can run it in X11 if you need to (though X11 will steal some of your performance) and you could just call ofHideCursor … but running from the console without X11 is recommended :smile:

Thanks Christopher! I was assuming the windowing was needed, so always ran from within X. I thought I had broken something by remaking the compile process myself. But this makes sense. I’ll try it immediately when I get to my Pi.

1 Like

ok that fixed it. case closed.
thanks again!

1 Like