Bug 566335

Summary: [GTK] Cannot transfer focus back to original Shell after opening a new Shell with SWT.ON_TOP
Product: [Eclipse Project] Platform Reporter: Benjamin Moser <benjamin.moser>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: benjamin.moser, loskutov
Version: 4.7.3   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Minimal working example that illustrates the problem. none

Description Benjamin Moser CLA 2020-08-24 14:45:13 EDT
Created attachment 283957 [details]
Minimal working example that illustrates the problem.

The basic motivation is to have an always-on-top toolbar that appears but does not take focus. Since seemingly, one cannot create a Shell without it receiving focus, one would like to manually transfer focus back to the main (original) Shell.

Steps to reproduce (please also consider the attached example):

1) In some Shell, open() another Shell with the SWT.ON_TOP flag.
2) In some callback that should trigger after the new Shell was openened, call setFocus on an element in the original Shell.

Actual results: The focus is not given back to the original Shell.

Expected results: The focus should be given to the element in the original shell that .setFocus() was called on.

This seems to be specific to GTK and the current version of SWT:

* Works on Linux/GTK and SWT 4.7.3
* Does not work with Linux/GTK and SWT 4.16
* Works on Win10 and SWT 4.7.3
* Works on Win10 and SWT 4.16

A potential workaround for Linux/GTK is using only the SWT.TOOL flag since that seems to provide always-on-top behaviour -- but not on Windows.
Comment 1 Andrey Loskutov CLA 2020-08-24 15:06:29 EDT
Could you please try also with 4.17 M3?
Comment 2 Benjamin Moser CLA 2020-08-25 03:44:19 EDT
(In reply to Andrey Loskutov from comment #1)
> Could you please try also with 4.17 M3?

Also does not work with 4.17M3.
Comment 3 Andrey Loskutov CLA 2020-08-25 03:55:30 EDT
(In reply to Benjamin Moser from comment #2)
> Also does not work with 4.17M3.

Thanks for confirmation. Note: the version field in bugzilla is for the fist version the bug appeared on, not for the last.