Bug 373814 - Mouse pointer is not visible when Kaffeine shows dvd menu
Summary: Mouse pointer is not visible when Kaffeine shows dvd menu
Status: RESOLVED FIXED
Alias: None
Product: kaffeine
Classification: Applications
Component: general (show other bugs)
Version: 2.0.12
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Mauro Carvalho Chehab
URL:
Keywords:
: 400449 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-12-18 12:20 UTC by Patrick Silva
Modified: 2018-11-05 09:40 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
libVLC patch to add support for reporting mouse events (3.53 KB, patch)
2017-02-21 10:53 UTC, Mauro Carvalho Chehab
Details
Kaffeine patch that sends mouse events to libVLC (1.44 KB, patch)
2017-02-21 10:54 UTC, Mauro Carvalho Chehab
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2016-12-18 12:20:37 UTC
It's not possible select the correct dvd menu item because the mouse pointer is not visible.
Comment 1 Kevin Kofler 2016-12-26 00:18:51 UTC
Indeed, clicking on DVD menu items is not working right. I can sometimes see the cursor, sometimes not, but even when it is visible, the click is not registered on the correct coordinates.
Comment 2 Mauro Carvalho Chehab 2017-02-16 12:36:39 UTC
(In reply to Dr. Chapatin from comment #0)
> It's not possible select the correct dvd menu item because the mouse pointer
> is not visible.

What Kaffeine version are you using? 

On Kaffeine 2.x, this is a hard to fix issue, as libVLC auto-hides the cursor at the video display region after 5 seconds. Such behavior cannot be disabled.

So, I had to add a hack on Kaffeine that forces the cursor to be shown again, if moved inside the video display region. I changed its implementation a few times.

(In reply to Kevin Kofler from comment #1)
> Indeed, clicking on DVD menu items is not working right. I can sometimes see
> the cursor, sometimes not, but even when it is visible, the click is not
> registered on the correct coordinates.

On Kaffeine 2.x, the coordinates for DVB menu items are caught directly by libVLC. If it is not getting the right coordinates, it is likely a VLC bug.
Comment 3 Patrick Silva 2017-02-16 14:11:13 UTC
I use Kaffeine 2.0.5.
Comment 4 Kevin Kofler 2017-02-16 14:30:25 UTC
But it works in the standalone VLC application, just not in Kaffeine (2.x, so using libvlc).
Comment 5 Kevin Kofler 2017-02-16 14:32:57 UTC
(kaffeine-2.0.5-2.fc25.x86_64 from RPM Fusion here.)
Comment 6 Mauro Carvalho Chehab 2017-02-17 14:55:29 UTC
Tested today on Fedora 25, with all packages updated.

Indeed, DVD menus work on vlc, but don't work on Kaffeine.
I added a "--verbose 2" parameter to libvlc parameters, and it shows
the following message when something is clicked on Kaffeine:

    [00007ff76c000e88] dvdnav demux debug: buttonUpdate not done b=0 t=0

I suspect that this is an effect of this bug with newer qt5:

   2b9a9a884 Document the issues with the mouse cursor and Qt5/vlc

As reported there:

+  On qt4, the mouse movements were sent to libvlc, but, on qt5.5 and upper,
+  the mouse move is not sent to VLC. That happens because qt5.5 sends the
+  mouse events via Xinput2, but VLC doesn't recognize such events.
+
+  That causes the VLC to auto-ride the mouse. Without the mouse, it is
+  hard to find the right place to click during DVB menus  navigation.
+  A workaround is to disable xinput2 at qt5-qtbase (recompiling it),
+  as explained at the README.
+
+  A fix for this issue would be to use another backend for DVB play, or
+  to fix either VLC or Qt5. I tried to change the VLC backend
+  (backend-vlc/vlcmediawidget.cpp), to add things like:
+       setCursor(QCursor(Qt::OpenHandCursor));
+       setMouseTracking(true);
+       setFocusPolicy(Qt::NoFocus);
+  but the above approach didn't work.
 
This is actually a reflect of this change:
   https://bugreports.qt.io/browse/QTBUG-48472

I remember I tested DVD menus in the past, with qt5.6. Maybe they did some incompatible changes on qt 5.7 or 5.8 that ended by breaking it completely.

I've no idea so far about how to fix it without requiring to recompile qt5 or touch at libvlc code :-(
Comment 7 Kevin Kofler 2017-02-17 15:56:09 UTC
I think fixing (lib)VLC to support XInput2 is really the only way forward.
Comment 8 Mauro Carvalho Chehab 2017-02-20 10:24:47 UTC
(In reply to Kevin Kofler from comment #7)
> I think fixing (lib)VLC to support XInput2 is really the only way forward.

There were a fix there:

https://git.videolan.org/?p=vlc.git;a=commit;h=4e55554c37e7c55586c41a5e9fc50f393167ac0b

But it got reversed on newer versions of libVLC:

https://git.videolan.org/?p=vlc.git;a=commitdiff;h=6e6297e170cd0691f9d8710c9bacc51db946bf11

probably because qt5.7 or 5.8 broke it.

I pinged libVLC developers, and it seems that there's now a way to report mouse events directly, as shown in this commit:

https://git.videolan.org/?p=vlc.git;a=commitdiff;h=30dc60272da1871df722eb1779bb1d21d6b133b5

It is based on a new set of API calls to allow passing to libVLC mouse press/release/move events diretly.

I'll try to implement it on Kaffeine. It probably requires vlc3, with was not officially released yet. It shoud work on Fedora, though, as it seems that it comes with a libVLC version that supports it.
Comment 9 Mauro Carvalho Chehab 2017-02-21 10:53:27 UTC
Created attachment 104143 [details]
libVLC patch to add support for reporting mouse events

While libvlcore supports mouse events, there's no API for reporting them via libvlc. This patch adds experimental support for it, for testing purposes. It still need to be submited to VLC devel ML and validated by libVLC developers.
Comment 10 Mauro Carvalho Chehab 2017-02-21 10:54:49 UTC
Created attachment 104144 [details]
Kaffeine patch that sends mouse events to libVLC

Experimental test patch that report events to libVLC.

TODO:

- handle button release properly
- check mouse visibility issues
- how to compile it on libVLC versions that don't have
  those new API calls?
Comment 11 Mauro Carvalho Chehab 2017-02-21 10:56:36 UTC
(In reply to Mauro Carvalho Chehab from comment #8)
> (In reply to Kevin Kofler from comment #7)

> I'll try to implement it on Kaffeine. It probably requires vlc3, with was
> not officially released yet. It shoud work on Fedora, though, as it seems
> that it comes with a libVLC version that supports it.

Just added two patches for a Proof of Concept (PoC). They're not meant to be applied as-is, but it shows a way that we could possible do to close this bug.
Comment 12 Patrick Silva 2017-07-20 14:49:42 UTC
mouse pointer is visible on kaffeine 2.0.12, but dvd menu is unusable because menu items are not clikcable.
Comment 13 mchehab+kde@kernel.org 2018-02-22 12:28:53 UTC
Git commit 273edb5120fa8ba5390c39fecb6915e5dc378308 by Mauro Carvalho Chehab.
Committed on 22/02/2018 at 12:26.
Pushed by mauroc into branch 'master'.

mediawidget: switch DVD navigate to keyboard

With newer Qt classes and newer libVLC, it is not possible anymore
to navigate a DVD menu with the mouse.

The reason is that Qt libs intercept all Linux input events,
not letting libVLC to receive them.

The solution would be to let Kaffeine to pass mouse events directly
to libVLC. Unfortunately, such API doesn't exist. There was a set
of RFC patches adding support for it:

	http://vlc-devel.videolan.narkive.com/ah5I2Gpy/patch-libvlc-add-api-to-propagate-mouse-move-and-down-up-events

But this was never accepted upstream.

So, while this doesn't work, let's fall back to a different way:
DVD menu navigation should be done via keyboard interaction.

Basically, navigation is done via Up/Down/Left/Right keys. Once the
DVB menu item is selected, pressing <ENTER> will activate the item.

The libVLC provides support for a "Popup" navigate interaction, but
I was unsure how this is used. So, support for it was not implemented.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

M  +2    -0    src/abstractmediawidget.h
M  +25   -3    src/backend-vlc/vlcmediawidget.cpp
M  +1    -0    src/backend-vlc/vlcmediawidget.h
M  +25   -1    src/mediawidget.cpp

https://commits.kde.org/kaffeine/273edb5120fa8ba5390c39fecb6915e5dc378308
Comment 14 Mauro Carvalho Chehab 2018-02-22 12:33:07 UTC
(In reply to Dr. Chapatin from comment #12)
> mouse pointer is visible on kaffeine 2.0.12, but dvd menu is unusable
> because menu items are not clikcable.

I took a different approach to solve this issue. It seems that we won't have anytime soon a way to pass a mouse event to Kaffeine. So, instead, I added support for DVD menu navigation via the keyboard.

Now, when the DVB menu is opened, it will allow navigating though the menu via Up/Down/Left/Right keys. Selecting an item is done with <Enter> key.

Not ideal, but at least it provides a way to interact with it.
Comment 15 Mauro Carvalho Chehab 2018-11-05 09:40:51 UTC
*** Bug 400449 has been marked as a duplicate of this bug. ***