Bug 422894 - [CSS] Setting font on GTK Tree or Table interrupts item selection calculation
Summary: [CSS] Setting font on GTK Tree or Table interrupts item selection calculation
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: PC Linux-GTK
: P3 major (vote)
Target Milestone: 4.4 M7   Edit
Assignee: Daniel Rolka CLA
QA Contact: Francis Upton IV CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-30 13:08 EST by Joe Khan CLA
Modified: 2014-04-30 10:45 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Khan CLA 2013-11-30 13:08:39 EST
We are using multiple instances of commonNavigator. When I click on a tree item of a navigator which is currently unselect, my click doesn't select the item. It only selects the commonNavigator tab. This is happening only on Linux-GTK, Red Hat 6.4. On windows we are having expectied behavior i.e. clicking on an item of unselected commonNavigator selects both the commonNavigator tab and the tree item.
Comment 1 Joe Khan CLA 2013-11-30 14:19:11 EST
Please note that navigator selection on Eclipse IDE works fine on Linux.
Comment 2 Paul Webster CLA 2013-12-02 10:53:05 EST
I was able to click in the Project Explorer (Common Nav) and it both activated the tab and selected what I clicked on.  But I guess that's what you mean by your last comment.

Can you please attach an example project that demonstrates the problem?

PW
Comment 3 Joe Khan CLA 2013-12-08 18:02:56 EST
This issue is only happening in our RCP application. Sorry didn't get a chance to post an example code. Will do that in couple of days.
Comment 4 Brian de Alwis CLA 2014-02-12 16:44:54 EST
I've been working with Joe to track this down.  The problem turns out to be due to a CSS rule that causes a font-change on Tree and Table widgets hosted within an MPart.

  .MPart Tree, .MPart Table {
    font-family: Arial, Liberation Sans, sans-serif;
    font-size: 10px;
  }

These CSS settings are re-applied on every part activation (as part of setting the "active" tag and propagating the change to CSS).

Our CSSPropertyFontSWTHandler#setFont() doesn't check whether the widget's font is already set to the given font.  On GTK, at least, setting the font causes some difference in selection.  Changing setFont() to avoid setting the font unnecessarily avoids the issue:

	private static void setFont(Widget widget, Font font) {
		if (widget instanceof CTabItem) {
		    if(((CTabItem) widget).getFont() != font) {
		        ((CTabItem) widget).setFont(font);
		    }
		} else if (widget instanceof Control) {
		    if(((Control) widget).getFont() != font) {
		        ((Control) widget).setFont(font);
		    }
		}
	}