CuarzoSoftware / Louvre

C++ library for building Wayland compositors.
MIT License
505 stars 14 forks source link

Double visible mouse pointer #64

Open milisarge opened 2 months ago

milisarge commented 2 months ago

As you see in video after logout from Louvre, when i enter again to my Labwc session, it shows two pointer of a mouse.

ehopperdietzel commented 2 months ago

Hmm it looks like Labwc is not setting the harware cursor plane and is rendering it instead, DRM resources like cursor planes are controlled by the active compositor, since Labwc is not using it, the one set by Louvre remains, so its kinda a Labwc "bug".

To fix this, you could try hiding the cursor before leaving the Louvre session:

Louvre Views Seat.cpp

void Seat::enabledChanged()
{
    if (!enabled()) // When the user switches to another session
    {
        cursor()->setVisible(false);
        return;
    }

   ...
}

If that doesn't work, you could disable the cursor plane for each initialized output:

Louvre Views Output.cpp

void Output::initializeGL()
{
    cursor()->enableHwCompositing(this, false);

   ...
}

This means Louvre will render the cursor using OpenGL which is slower but you should not notice much difference.

milisarge commented 2 months ago

both of ways don't work, still there are two visible pointers

by the way, i reproduces the bug with Wayfire also then it is mostly related with Wlroots

milisarge commented 2 months ago

After discussion with Labwc guys, we noticed that it is Qemu bug for now, i resolved it with -vga virtio -display sdl,show-cursor=off

ehopperdietzel commented 2 months ago

Ok, thanks for letting me know, so does this happen when switching between other compositors as well? And what are you building? It looks interesting

milisarge commented 2 months ago

I am the maintainer of Milis Linux project, so far now, we have been using wlroots based compositors as WM, so have not noticed such a bug in switching between them. Well, we are trying to setup a composition of desktop environment and Louvre is the new base as alternative of Wlroots.

ehopperdietzel commented 2 months ago

Nice! I see it has its own package manager and init system, that must be a lot of work! Can it be tested on real hardware, I mean like a live CD version? And does it support other languages apart from Turkish?

we have been using wlroots based compositors as WM, so have not noticed such a bug in switching between them

There is one last option, maybe setting the SRM_FORCE_LEGACY_API=0 env could fix it. It basically enables the new DRM Atomic API if supported which I guess wlroots compositors may be using.

milisarge commented 2 months ago

Yes, it has been used as daily Linux system since 2016 with different versions, current version is 2.3 and you can test it, Qemu is one of my test environment so i am testing first with it, English the other language option for the present.

SRM_FORCE_LEGACY_API=0 env solved Labwc side so no twice pointer but the pointer disappeared at Louvre side. video

ehopperdietzel commented 2 months ago

Yes, it has been used as daily Linux system since 2016 with different versions, current version is 2.3 and you can test it, Qemu is one of my test environment so i am testing first with it, English the other language option for the present.

Perfect! I'll give it a try and then let you know how it went.

SRM_FORCE_LEGACY_API=0 env solved Labwc side so no twice pointer but the pointer disappeared at Louvre side. video

Hmm, glad you noticed it. That must be an SRM bug, so I definitely need to take a look at that.

ehopperdietzel commented 2 months ago

I tested Milis, and it works perfectly, great work! I only had problems with my Wi-Fi card, but that happens in almost every distro since it requires proprietary drivers. Also, neither Labwc nor Wayfire set the scale factor of HiDPI displays to 2 by default, which is just a small detail and I'm sure it can be easily configured.

Additionally, I think I fixed the cursor issue in SRM. The changes are in the devel branch if you want to test them. I think I wasn't properly handling cases where the first Atomic commit failed.

milisarge commented 2 months ago

you can scale display from settings

i updated the Louvre with SRM-devel, but still pointer disappears at Louvre.

ehopperdietzel commented 2 months ago

you can scale display from settings

Yes, I experimented with that. I just wanted to suggest that from a user perspective, it would be nice if the default scale could be set to 1.75 or 2 on HiDPI displays (e.g. DPI >= 200), as everything appears too small with a scale factor of 1. By the way, I plan to add the same protocol for controlling outputs to Louvre soon so that the panel will also work with Louvre compositors.

i updated the Louvre with SRM-devel, but still pointer disappears at Louvre.

Hmm :( I'll need to check that again. At least on real hardware, it seems to work fine, but I haven't tested it inside Qemu. Thanks, by the way, for testing it.

ehopperdietzel commented 2 months ago

Hi again @milisarge, I attempted to implement hiding cursor planes before session switching. However, it appears that libseat drops DRM permissions to the compositor either before or simultaneously with notifying the TTY switch, preventing Louvre from hiding it. Nonetheless, I have updated SRM so that the cursor should now be restored when using the atomic API (SRM_FORCE_LEGACY_API=0).