Cursor issue on Raspberry Pi using Erpiam


#1

Hi! I’m new to JUCE and am working on a project for the Raspberry Pi (I have an Rpi 3) using Erpiam by forum user @gbevin. I got everything to cross-compile just fine (eventually since everything is built from source) both using the demo JUCE progam that comes with Erpiam as well as switching that out for my own custom JUCE program.

The problem I am having is that the mouse cursor is not showing up when I run either program on the actual Rpi. The mouse is working because I can see buttons get highlighted when I mouse over them (with my invisible cursor) and I can also click buttons and whatnot. The cursor actually does eventually show up if I mouse over a component that changes the cursor. For example, the demo JUCE program for Erpiam (called erpiam-main) has a large TextEditor component. If I mouse over that the cursor changes to an I-Beam and shows up and after that it stays visible, changing to the standard X cursor if I mouse off of the TextEditor.

Changing cursors in my custom JUCE program either in sub-components or the main window component using “setMouseCursor()” would also never work initially. The cursor would just stay the default cursor for my desktop environment on my PC and an invisible cursor on the Rpi. Eventually, by looking at the erpiam-main code, I was able to determine that by not calling “setResizable(true, true)” in the MainWindow constructor, this caused the cursor changes to start working. This was the case when running my JUCE program both on my PC (Linux) and on the Rpi. It seems like this might be a bug in JUCE, though I have that workaround since I don’t even want my window to be resizable anyway.

However, regardless of what I do, the cursor is never visible on the Rpi when either JUCE program first starts. I have tried a multitude of things including:

  1. Setting the cursor explicitly via the “-fc left_ptr” option to the X command in the script that starts it.

  2. Setting the cursor explicitly using the “xsetroot” command after starting X

  3. Ensuring that the cursor is not being hidden anywhere like with the “-nocursor” argument when starting X, and it’s also not set to hidden in main Erpiam package option “Hide X11 Cursor” in the “make menuconfig”.

  4. In my custom JUCE program in the MainComponent constructor I set the cursor to something else with setMouseCursor. I also tried setting up a timer to change the cursor to something else a few seconds after the program starts (the MainComponent cursor).

Nothing seems to work and the cursor never becomes visible unless I mouse over a Component that has a different cursor set. This isn’t a total show stopper and there might be other hacks I can try, but currently it is very annoying to have to wiggle the mouse around until it happens to go over the right Component when the JUCE program first starts on the Rpi. Oh, I also noticed that if I start xterm at boot instead of a JUCE program then the cursor shows up right away. So I’m not sure whether this is an erpiam/buildroot/TinyX issue or a JUCE issue but it just seems that there is no discernible reason why the cursor should be hidden when the program first starts up.

Has anyone else had this issue or have an idea of things to try? I’m not sure what else to try other than some hacks to work around the issue, but I figured I make a post in the hopes of fixing it the right way first. Thanks!


#2

I was able to fix this with a hack. In my MainComponent constructor I move the cursor to be over a control with and different cursor and then move it back to it’s original location (which I save, and it is apparently the center of the screen). Then the cursor shows up as soon as the GUI pops up. Since in my program I don’t have any controls with a different cursor I have to set one. Then I use a timer to set that control’s cursor back to normal after a second. Strangely if I set the cursor back after doing everything in the constructor, then it doesn’t work and the cursor stays invisible.

The new issue I am having now is that for a few seconds after the JUCE program starts on the Rpi, the cursor doesn’t move when you move the mouse or moves extremely choppy. After a bit it starts moving normally and smooothly. Obviously I couldn’t tell that this was happening when the cursor was invisible and it was always moving smoothly by the time it showed up. This also seems to happen even if you wait like over minute before moving the mouse at all. It always happens the first time you move the mouse, no matter how long I wait.


#3

Can you check your memory consumption and see if the rpi is maybe swapping? I see this sort of behaviour if my RPi starts swapping memory. Then - even if I wait a minute - the first cursor movement probably triggers the kernel to swap in some X11 code/resources and the cursor will move sluggish.


#4

@alspacka I wanted to resurrect this thread. I am currently trying to install Erpiam on my Raspberry Pi 3. I’m currently just waiting for a HiFiBerry DAC+ to arrive in the mail. I had a few different questions that I was hoping either you or anyone else might help answer since I’m a Linux noob:

  1. Is the Erpiam build supposed to fail if the RPI 3 is not connected to a DAC? As of now, my build fails but I’m assuming its because the kernel expects for a DAC to be connected.

  2. How do you switch out the JUCE demo program to your own custom program? Is there somewhere in the folder hierarchy where you put your JUCE source code? Or is it that you have to build and load Erpiam to the Pi and then subsequently build the JUCE project on the Pi?

  3. Would you possible be willing to share your JUCE project? Sounds like you have already made some progress with your hacks that might be helpful.