Bug 115227 - UNO API: awt::XTopWindowListener is invoked for color picker popup
Summary: UNO API: awt::XTopWindowListener is invoked for color picker popup
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:6.1.0
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-25 11:12 UTC by Miklos Vajna
Modified: 2018-02-08 08:26 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Sample event listener. (5.33 KB, patch)
2018-01-25 11:12 UTC, Miklos Vajna
Details
Python-only reproducer for bibisect purposes. (2.83 KB, text/x-python)
2018-01-25 13:00 UTC, Miklos Vajna
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Miklos Vajna 2018-01-25 11:12:17 UTC
Created attachment 139358 [details]
Sample event listener.

Steps to reproduce:

1) Apply the attached patch.
2) Start Writer.
3) Go to tools -> customize -> keyboard, and assign the hello world python macro to e.g. F4.
4) Close the dialog and press F4.
5) Switch away to some other window and switch back: notice that there is 1 activate and 1 deactivate hit in the callback, as expected.
6) Change the font color using the toolbar's color picker popup.

Expected result: event listener is not invoked during color selection.

Actual result: event listener gets spurious windowDeactivated/windowActivated events.

Additional info:

- this worked in LO 5.2, bad in LO 5.3. git bisect points out 43bc3031483d172eccd72c3804e2d4fc2ef37de4, but that one just changed Writer to behave the same way as Impress
- why Impress emits focus events is due to accessibility, it was done for https://bz.apache.org/ooo/show_bug.cgi?id=118707

Not emitting the events means it's not possible to select a color with the keyboard (bad for accessibility), emitting the events is bad for UNO API compatibility. A middle ground can be to still change focus, but suppress the invocation of UNO API listeners.
Comment 1 Miklos Vajna 2018-01-25 13:00:59 UTC
Created attachment 139361 [details]
Python-only reproducer for bibisect purposes.

The original patch is backtrace-friendly since the listener is in C++. This version is bibisect-friendly as it's all Python.
Comment 2 Commit Notification 2018-01-25 15:29:15 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=250ad9311a613d9b4e1cf5cf5fdaf33d9b326220

tdf#115227 svtools: suppress UNO notifications for color selectors

It will be available in 6.1.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 3 Commit Notification 2018-02-08 08:23:06 UTC
Maxim Monastirsky committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3ecf542af410536d64d217c71002799bbe48b9c3

Different approach for tdf#115227

It will be available in 6.1.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 4 Miklos Vajna 2018-02-08 08:26:43 UTC
I think this resolves the currently known problems.