Bug 122920 - UI: XMouseListener is not called for top most window
Summary: UI: XMouseListener is not called for top most window
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Samuel Mehrbrodt (allotropia)
URL:
Whiteboard: target:6.3.0
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-24 09:21 UTC by Serge Krot (CIB)
Modified: 2019-10-24 14:05 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Serge Krot (CIB) 2019-01-24 09:21:32 UTC
Registered mouse/key listeners for top window do not receive any mouse/key events while everything is passed only to focused child window where we have no any registered mouse/key listeners.

How to reproduce:
1. get LO main window with
UNO.desktop.getCurrentFrame().getContainerWindow() or
UNO.desktop.getCurrentFrame().getComponentWindow()

2. register XMouseListener:
UNO.desktop.getCurrentFrame().getContainerWindow().addMouseListener(XMouseListener myMouseListener)

3. expectation: MouseEvents will be received

Additional info:
* How to send key events: https://ask.libreoffice.org/en/question/123664/create-a-macro-that-press-enter-automatic-once/
Comment 1 Serge Krot (CIB) 2019-01-24 10:45:39 UTC
Implemented UI unit test:
-    https://gerrit.libreoffice.org/#/c/66856/ - currently it verifies current LO behavior, that top most window doesn't receive any callbacks from focused window
Comment 2 Thorsten Behrens (allotropia) 2019-01-24 14:14:49 UTC
I'd tend to consider that NOTABUG - is there any API or BASIC documentation that claims this should work?
Comment 3 Samuel Mehrbrodt (allotropia) 2019-03-01 16:36:53 UTC
Hm basically every XWindow has a method addMouseListener. So it should be possible to listen for mouse events for any arbitrary window.

In this case, the document container window does not receive any mouse events, even if no other window is open.

So IMO this is a bug.
Comment 4 Commit Notification 2019-03-05 09:31:38 UTC
Serge Krot committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/5723d303a44597cdb2ea242cf3fb0ac0e8c15b83%5E%21

tdf#122920 uitest: XMouseListener is not called for top most window

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Xisco Faulí 2019-04-12 10:23:57 UTC
A polite ping to Serge Krot (CIB):
Is this bug fixed? if so, could you please close it as RESOLVED FIXED ? Otherwise, Could you please explain what's missing?
Thanks
Comment 6 Samuel Mehrbrodt (allotropia) 2019-04-12 12:03:36 UTC
Patch for this bug is here: https://gerrit.libreoffice.org/#/c/70512/
Comment 7 Commit Notification 2019-04-17 06:21:11 UTC
Samuel Mehrbrodt committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/6f43902b12dd36fa2b69401065df198ef9ffdb09%5E%21

tdf#122920 Send UNO mouse events to parent window listeners as well

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2019-05-21 15:29:00 UTC
Samuel Mehrbrodt committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/9e0e97b716ab074d4558c76a62a66bf597f332a5%5E%21

Related tdf#122920 Treat UNO key events the same as mouse events

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.