Bug 473093 - [Gtk 3.14] Selection of items in lists need focus on view first
Summary: [Gtk 3.14] Selection of items in lists need focus on view first
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.5   Edit
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 507081 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-07-20 11:58 EDT by Alexander Hofbauer CLA
Modified: 2020-08-01 22:33 EDT (History)
11 users (show)

See Also:


Attachments
Selection of an item in a list needs focus on its view first (673.70 KB, video/webm)
2015-07-20 11:58 EDT, Alexander Hofbauer CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Hofbauer CLA 2015-07-20 11:58:53 EDT
Created attachment 255303 [details]
Selection of an item in a list needs focus on its view first

System: Gnome 3.16, Adwaita dark, default Eclipse dark theme.


A click doesn't seem to reach the item in a list, i.e. set selection on it. It only focuses its view. This results in having to first focus the view and then click on an entry to get it selected.

Double-clicking on an Navigator item while having focus on an editor window opens the currently selected entry, no matter what item was actually double-clicked.

Right clicks are also affected, e.g. showing properties for the currently selected file instead of the clicked one.

This confuses me a lot. ;)


Double-clicks on folders in the Navigator are not affected, although the focus is never set to the double clicked entry. Folding / expanding arrows work as well without updating selection.
Comment 1 Alexander Hofbauer CLA 2015-07-20 12:00:56 EDT
This bug sort of references bug 312568, comment 66
Comment 2 Leo Ufimtsev CLA 2015-07-21 14:14:37 EDT
After some more experiments, I'm able to reproduce this bug now. 

It seems specific to the Eclipse Dark theme. I.e, it doesn't occur when the regular theme is activated. 
It doesn't occur if you manually switch on adwaina from GtkInspector, only if you change theme in the Eclipse PlatformUI switcher.

This is the first time I see that a theme makes a functional difference.

I'll investigate if it's related to bug 312568.
Comment 3 Leo Ufimtsev CLA 2015-07-21 16:20:11 EDT
I checkout SWT before bug 312568 (Double click patch). The issue described in this bug still occurs (with double-clicking not moving the cursor to the editor anymore). As such, the issues don't appear to be directly related to each other. (But it did look very related at first I must say).
Comment 4 Leo Ufimtsev CLA 2015-07-21 16:35:10 EDT
I tested with native SWT snippets by calling OS.setDarkThemePreferred(true);, but the issue doesn't occur.

It may be some stray listener in Platform U.I.

Does this issue occur on Win32/Cocoa? (Would anyone be able to test?)
Comment 5 Nobody - feel free to take it CLA 2015-07-22 07:36:07 EDT
Can you guys point me to the buildId of the Eclipse you've reproduced this on along with the OS ?
Comment 6 Alexander Hofbauer CLA 2015-07-22 07:39:01 EDT
*) Debian/unstable
*) Gnome 3.16
*) default Eclipse dark theme
*) Eclipse: Version = Mars Release (4.5.0), Build id = 20150621-1200
Comment 7 Nobody - feel free to take it CLA 2015-07-22 07:49:40 EDT
(In reply to Alexander Hofbauer from comment #6)
> *) Debian/unstable
> *) Gnome 3.16
> *) default Eclipse dark theme
> *) Eclipse: Version = Mars Release (4.5.0), Build id = 20150621-1200

Can you confirm that you can not reproduce this for the package explorer? Only for Navigator?
Comment 8 Alexander Hofbauer CLA 2015-07-22 07:53:53 EDT
Sorry, this was vague. I only took the Navigator as an example, in fact I can also reproduce this e.g. with explorers or the breakpoints view.
Comment 9 Leo Ufimtsev CLA 2015-07-22 10:34:57 EDT
Yes, I can reproduce on package explorer also. 

My test env:  Eclipse:   Version: Neon (4.6)  Build id: N20150719-2000      Fedora 22. Gtk 3.16.5

I did some more testing across different Gtk versions and observed that this issue only starts to appear in Gtk 3.14

Dark theme on: 
- Gtk 2.24    # Double click Issue does not occur, although right click impaired
- Gtk 3.10    # Double click Issue does not occur, although right click impaired
- Gtk 3.12   # Double click Issue does not occur, although right click impaired    (Tested with/without OS CSS).
- Gtk 3.12    # Double click Issue does not occur, although right click impaired
- Gtk 3.14  # Problem starts to occur with double click as well as right click
- Gtk 3.16  # Problem ..... 
  
So the issue is in two parts.
1) Right click does not work on dark theme (in any version of gtk, including Gtk2.24)
2) Double click does not initiate focus on Package explorer, (This issue starts to occur Gtk3.14 and onwards)  


Bug (1) may be some Platform U.I issue. Perhaps we should pursue this in a separate bug.
Bug (2) seems to be burrowed in SWT.   The difficulty is to reproduce the issue on SWT level now.
I tested with the double-click snippet from bug 312568, but could not reproduce the issue. 
If someone has ideas / snippet on how to reproduce this on SWT level, it would be great.
Comment 10 Nobody - feel free to take it CLA 2015-07-22 11:15:08 EDT
This was a fun one. So it turns out the issue is with this line in the dark css: 

https://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree//bundles/org.eclipse.ui.themes/css/e4-dark.css#n139

If you remove that line everything works fine. Now I'm no css expert but it smells like the engine, while activating, is trying to set this background color and for some reason it is failing and giving up on the activation.

I will move this to platform.ui to ask our CSS guys if they have any hint. Thanks for the help so far.
Comment 11 Nobody - feel free to take it CLA 2015-07-22 11:21:28 EDT
Lars any opinion on this issue?
Comment 12 Lars Vogel CLA 2015-08-14 05:42:15 EDT
(In reply to Sopot Cela from comment #11)
> Lars any opinion on this issue?

Brian, could you have a look? You are our CSS expert
Comment 13 Brian de Alwis CLA 2015-08-14 15:55:22 EDT
So I saw similar behaviour with font changes as in bug 422894.  Basically the CSS engine re-applies font and colour choices whenever some conditions change (e.g., focus, activation).  Selecting a part may result in multiple re-applications.  In bug 422894, the font change (on a Tree, I think) caused some kind of interference with the selection event.  Unfortunately the exact details now fails me.

Most but not all SWT widgets ignore calls to set* when they have no change.  Hence our workaround was to endow some Helper classes with setFont/setBackground/setForeground wrappers that first check whether the font / colour change was actually necessary. (CSSSWTFontHelper, CSSSWTColorHelper).

It may be that retrieving the colour or font is now problematic on some versions of GTK 3.x?

It may be that the approach used in bug 435061, disabling redraws, might workaround the issue?

You should probably be able to hack the CSSSWTFontHelper and CSSSWTColorHelper to not short-circuit the font / colour changes.
Comment 14 Brian de Alwis CLA 2015-09-03 13:52:22 EDT
I took a look at this on Fedora 22, and it's the same problem seen on bug 422894 except with the background colour rather than the font.  The problematic section of the CSS is

   .MPartStack.active Tree,
   [. . .] {
      background-color: #262626;

Unfortunately this can't be worked around using the technique from bug 422894 as the e4-dark.css really does specify a different background colour for parts with and without focus.  Deferring redraws as per bug 435061 doesn't help either as the there is no layout in progress.

I wonder if the SWT CSS engine should defer triggering its work with an asyncExec so as to avoid any event interference.
Comment 15 Alexander Hofbauer CLA 2015-09-15 08:01:12 EDT
Excuse my rather unqualified comment, but not applying background colour changes seems to be a fair workaround for me until this issue can be properly addressed.

As it stands now using the dark theme is really frustrating and I couldn't notice the background colour change on focus (or the lack thereof) after commenting out the line.
Comment 16 Brian de Alwis CLA 2015-09-15 16:12:04 EDT
Other developers are hitting similar issues too:

https://www.eclipse.org/forums/index.php/t/1069929/
https://www.eclipse.org/forums/index.php/t/886234/
Comment 17 Dani Megert CLA 2016-02-09 05:45:02 EST
Too late for 4.5.2. Please retarget if you plan to work on this.
Comment 18 Robert Lichtenberger CLA 2016-06-27 04:16:02 EDT
I was unable to find e4-dark.css in the installation folder of Neon Release Candidate 3 (4.6.0RC3):

[rli@rlinux eclipse]$ find . -name e4-dark.css
[rli@rlinux eclipse]$ 

=> Where is the .css file (so that I can remove the problematic lines)?
Comment 19 Pablo Nussembaum CLA 2016-07-11 09:37:28 EDT
I have commented out the css rule(lines 139-143) and the problem goes aways.
The css file is located on: eclipse/plugins/org.eclipse.ui.themes_1.1.100.v20160411-1921/css/e4-dark.css

I'm using Eclipse 4.6 Neon on Ubuntu 16.04
Comment 20 Robert Lichtenberger CLA 2016-07-11 09:58:12 EDT
Using eclipse-installer, I installed eclipse into /usr/local/eclipse/java-neon. 

There is no e4-dark.css in the plugins directory:

[rli@rlinux plugins]$ pwd
/usr/local/eclipse/java-neon/eclipse/plugins
[rli@rlinux plugins]$ ls
org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar

Nor in fact anywhere:
[rli@rlinux eclipse]$ pwd
/usr/local/eclipse/java-neon/eclipse
[rli@rlinux eclipse]$ find . -name e4-dark.css
Comment 21 Pablo Nussembaum CLA 2016-07-14 12:53:18 EDT
I installed eclipse for JEE developer from some this mirrors:
http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/neon/R/eclipse-jee-neon-R-linux-gtk-x86_64.tar.gz
Comment 22 Brian de Alwis CLA 2016-11-17 16:36:55 EST
*** Bug 507081 has been marked as a duplicate of this bug. ***
Comment 23 Brian de Alwis CLA 2016-11-17 16:39:34 EST
Although we've worked around this bug, the underlying cause is still there.
Comment 24 Leo Ufimtsev CLA 2016-11-18 08:11:54 EST
The first comment from Bug 507081 is useful in narrowing this down:

(In reply to Lars Vogel from comment #0)
> If we change our dark theme to style also the active tree, you cannot select
> the tree node with one click.
> 
> .MPartStack.active Tree,
> .MPartStack.active CTabFolder Canvas {
>     background-color: #262626;
>     color: #CCC;
> }
> 
> Test description:
> 
> * Download new(ish) Eclipse 
>   - In my case: Version: Oxygen (4.7) Build id: N20160718-2000. (Gtk3.20)
> * Turn on Dark theme 
> * Restart Eclipse
> * Click on editor
> * click on some project in project explorer
> 
> Expected result
> * Project under mouse is selected
> 
> Actual result
> * Project explorer receives focus, but project (or file etc..) is not
> selected. A second click is required for item to be selected.
> 
> See Bug 499515 for details.
Comment 25 Brian de Alwis CLA 2016-11-18 09:17:48 EST
Leo: see comment 13 and 14.  I'm a bit loathe to use an asyncExec() — more asynchrony is never a good thing.

An alternative approach might be to turn the E4 CSS property handlers to stick in GTK CSS on GTK.
Comment 26 Leo Ufimtsev CLA 2016-11-18 13:19:06 EST
(In reply to Brian de Alwis from comment #25)
> Leo: see comment 13 and 14.  I'm a bit loathe to use an asyncExec() — more
> asynchrony is never a good thing.
> 
> An alternative approach might be to turn the E4 CSS property handlers to
> stick in GTK CSS on GTK.

Adding Eric to CC, as Eric knows more about the CSS business.
I haven't worked much with CSS lateley, I can't give a good approach without some extra research at the moment.
Currently I'm working on the Webkit2 port and after the Wayland port, so it would be a while before I get to theaming issues.
Comment 27 Leo Ufimtsev CLA 2016-11-18 13:19:35 EST
CCing Ian as he did some work on CSS.
Comment 28 Eclipse Genie CLA 2020-08-01 09:20:42 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 29 Andrew Obuchowicz CLA 2020-08-01 22:33:26 EDT
This still seems to be occuring in my E4 application, reopening to investigate