Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 321560

Summary: [Palette] Using GTK, resizing palette does not work well and loose keyboard
Product: [Tools] GEF Reporter: Mickael Istria <mistria>
Component: GEF-Legacy GEF (MVC)Assignee: gef-inbox <gef-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: baptiste.mesta, h1055071, hudsonr, nyssen, peter, pwebster
Version: unspecified   
Target Milestone: 3.7.1 (Indigo) M7   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:
Bug Depends on: 342755    
Bug Blocks:    
Attachments:
Description Flags
Monkey patch that fixes the bug at runtime
none
Revised Monkey Patch none

Description Mickael Istria CLA 2010-08-03 05:23:36 EDT
Using our RCP app based on 3.5.2, or Eclipse 3.6, on Ubuntu 10.04, with some GMF editors (one of ours, and the gmfgraph_diagram editor).

When resizing palette, there are some troubles to adjust its size (lag), and some issues with drag'n'drop. (seems that dragging is always activated).
After that, the keyboard is lost on all SWT widgets.
Comment 1 Peter Severin CLA 2010-12-12 22:45:15 EST
I see this too. After some testing I can see that it happens on Linux only. The behavior is quite disturbing and the loss of keyboard input is even more so.
Comment 2 Peter Severin CLA 2010-12-12 23:37:31 EST
A simple workaround is to run the FlyoutPaletteComposite#ResizeAction action inside FlyoutPaletteComposite#Sash#SashDragManager#mouseDown. This way the resize is less visual but it's still very usable. Now if there was a simple hack to do it in the current version...
Comment 3 Peter Severin CLA 2010-12-13 00:03:37 EST
I did more testing. Palette resize still works with Eclipse 3.5.1 but it's broken on Eclipse 3.5.2 and later.
Comment 4 Peter Severin CLA 2010-12-13 00:19:03 EST
Perhaps this bug is caused by the fix for GDK client side windows introduced in 3.5.2: https://bugs.eclipse.org/bugs/show_bug.cgi?id=287307. FlyoutPaletteComposite uses Control#moveAbove method to layout its components.
Comment 5 Randy Hudson CLA 2010-12-13 10:04:46 EST
(In reply to comment #3)
> I did more testing. Palette resize still works with Eclipse 3.5.1 but it's
> broken on Eclipse 3.5.2 and later.

Sounds like a regression in SWT changes between 3.5.2 and 3.5.1
Comment 6 Peter Severin CLA 2010-12-14 22:28:40 EST
Created attachment 185195 [details]
Monkey patch that fixes the bug at runtime

For me waiting for a fix is not an option so I created a monkey patch that can be used in the editor to correct the problem at runtime. The code uses some private utility methods but you can easily guess what they do. Hope someone will find it useful. Eat that Ruby!
Comment 7 CLA 2011-03-01 14:29:16 EST
I've just noticed this bug on our RCP application on the version for Ubuntu (I don't really use Linux that much so haven't come across it until now). Basically, it makes our RCP app useless for Linux as I can't resize the palette properly. Oops. Looks like I have to re-write the app not to use a GEF flyout palette. Not much fun.

Any chance of a fix?
Comment 8 CLA 2011-04-07 11:27:24 EDT
Would it be possible to nail this one for GEF 3.7? Perhaps take some of the code in Comment #6 ?
Comment 9 Alexander Nyßen CLA 2011-04-08 16:20:18 EDT
(In reply to comment #8)
> Would it be possible to nail this one for GEF 3.7? Perhaps take some of the
> code in Comment #6 ?

Well, I would prefer not to put platform-specific workarounds into GEF. We should rather try to track it down to SWT. If its a regression introduced by the fix to bug #287307 we should reopen it, otherwise file a new bug against SWT to keep track. Could you support in identifying the SWT change that caused the regression?
Comment 10 CLA 2011-04-09 16:20:23 EDT
(In reply to comment #9)
> (In reply to comment #8)
> > Would it be possible to nail this one for GEF 3.7? Perhaps take some of the
> > code in Comment #6 ?
> 
> Well, I would prefer not to put platform-specific workarounds into GEF. We
> should rather try to track it down to SWT. If its a regression introduced by
> the fix to bug #287307 we should reopen it, otherwise file a new bug against
> SWT to keep track. Could you support in identifying the SWT change that caused
> the regression?

I wish I had the time and inclination to identify the SWT change that caused this, but I'm tired. I've had enough of chasing the never-ending regressions in Eclipse. It's time to move on. It's a losing battle. I'm done with Eclipse and the illusion of the "write once, run anywhere" Java lie. Life's too short. I'm gone.
Comment 11 CLA 2011-04-12 14:55:17 EDT
And I'm back again (my last comment was made in utter despair).

This is a very serious bug for anyone who uses the GraphicalEditorWithFlyoutPalette since you lose all keyboard input after attempting to resize the palette.

Here's some quick steps to reproduce:

1. On Eclipse Linux 3.6.x (try Ubuntu) create a GEF Shapes Example.
2. Attempt to Resize the Palette in the GEF Shapes Editor.
3. Now try to type on the keyboard in an Editor - no keyboard input.

Sadly, I do not have the right knowledge to track it down to SWT so I'm going to try the "monkey patch" posted above.
Comment 12 Alexander Nyßen CLA 2011-04-12 15:34:45 EDT
(In reply to comment #11)
> And I'm back again (my last comment was made in utter despair).

Good to know. That last comment made me frightened...
> 
> This is a very serious bug for anyone who uses the
> GraphicalEditorWithFlyoutPalette since you lose all keyboard input after
> attempting to resize the palette.
> 
> Here's some quick steps to reproduce:
> 
> 1. On Eclipse Linux 3.6.x (try Ubuntu) create a GEF Shapes Example.
> 2. Attempt to Resize the Palette in the GEF Shapes Editor.
> 3. Now try to type on the keyboard in an Editor - no keyboard input.

I can reproduce it on my Ubunto 10.04 as you describe. 

> 
> Sadly, I do not have the right knowledge to track it down to SWT so I'm going
> to try the "monkey patch" posted above.

I will download a 3.5.1 and 3.5.2 Eclipse and see what can be found...
Comment 13 CLA 2011-04-12 16:52:23 EDT
Created attachment 193095 [details]
Revised Monkey Patch

I took the Monkey Patch from Comment #6 and added the missing Reflection method.

You need to add the code in the patch to any class that extends GraphicalEditorWithFlyoutPalette. I tested it on Ubuntu 10.10 and it works for me. I'll use it for my RCP app.

If the bug only affected the resizing of the palette you could work around it by using the "Resize" command from the context menu on the palette but it makes keyboard input stop working which is pretty serious.
Comment 14 Alexander Nyßen CLA 2011-04-13 15:37:05 EDT
Added dependency to SWT bug#432755, which was opened to keep track of the underlying SWT issue (a regression introduced by bug #290395 rather than bug #287307).
Comment 15 CLA 2011-04-13 15:56:48 EDT
(In reply to comment #14)
> Added dependency to SWT bug#432755, which was opened to keep track of the
> underlying SWT issue (a regression introduced by bug #290395 rather than bug
> #287307).

That should be Bug 342755.

You guys are very clever to track this down!
Comment 16 CLA 2011-04-14 18:23:58 EDT
Just a note - this bug occurs when using the ECore Tools Diagram Editor[1] on GTK Linux. I'm surprised that nobody has noticed it. No GTK users of ECore Tools?


[1] http://www.eclipse.org/modeling/emft/?project=ecoretools
Comment 17 Mickael Istria CLA 2011-04-15 04:32:47 EDT
I was also surprised to notice that nobody in our community of users noticed this issue.
Apparently, people using GTK are not used to resizing palettes...
Comment 18 Alexander Nyßen CLA 2011-04-26 16:38:17 EDT
Confirmed that with Eclipse I20110425 this issue does no longer hold. Resolving as fixed in 3.7M7 though.
Comment 19 CLA 2011-04-26 16:40:56 EDT
(In reply to comment #18)
> Confirmed that with Eclipse I20110425 this issue does no longer hold. Resolving
> as fixed in 3.7M7 though.

However, a comment I made in Bug 342755:

I tested this on build eclipse-SDK-I20110425-1800-linux-gtk.

In GEF Editors it is now possible to drag the palette splitter as detailed in
Bug 321560. The only downside is that there are repaint issues as mentioned
above. Dragging the palette splitter from left to right leaves a trail of slow
repainted image sections.

The "monkey patch" submitted in a comment to Bug 321560 actually works better.
Comment 20 Alexander Nyßen CLA 2011-04-26 17:54:47 EDT
(In reply to comment #19)
> (In reply to comment #18)
> > Confirmed that with Eclipse I20110425 this issue does no longer hold. Resolving
> > as fixed in 3.7M7 though.
> 
> However, a comment I made in Bug 342755:
> 
> I tested this on build eclipse-SDK-I20110425-1800-linux-gtk.
> 
> In GEF Editors it is now possible to drag the palette splitter as detailed in
> Bug 321560. The only downside is that there are repaint issues as mentioned
> above. Dragging the palette splitter from left to right leaves a trail of slow
> repainted image sections.
> 
> The "monkey patch" submitted in a comment to Bug 321560 actually works better.

Yes, I can confirm that there is indeed some "flickering" when resizing, if that is that you are referring to. However, I can reproduce it on Mac OS X as well and I think we should thus open another issue to keep track of it, as this may thus be a GEF problem, not caused by an underlying platform-specific SWT misbehavior.
Comment 21 CLA 2011-04-26 17:58:12 EDT
(In reply to comment #20)
> (In reply to comment #19)
> > (In reply to comment #18)
> > > Confirmed that with Eclipse I20110425 this issue does no longer hold. Resolving
> > > as fixed in 3.7M7 though.
> > 
> > However, a comment I made in Bug 342755:
> > 
> > I tested this on build eclipse-SDK-I20110425-1800-linux-gtk.
> > 
> > In GEF Editors it is now possible to drag the palette splitter as detailed in
> > Bug 321560. The only downside is that there are repaint issues as mentioned
> > above. Dragging the palette splitter from left to right leaves a trail of slow
> > repainted image sections.
> > 
> > The "monkey patch" submitted in a comment to Bug 321560 actually works better.
> 
> Yes, I can confirm that there is indeed some "flickering" when resizing, if
> that is that you are referring to. However, I can reproduce it on Mac OS X as
> well and I think we should thus open another issue to keep track of it, as this
> may thus be a GEF problem, not caused by an underlying platform-specific SWT
> misbehavior.

The flickering on Mac is a separate issue. That's always been there. The Linux redraw problems are what Bogdan describes in that bug report when he says:

"Note that this is not a good final solution as it will introduce considerable performance degradation for Eclipse given that there are many obscured editors and perspectives."
Comment 22 Alexander Nyßen CLA 2011-04-26 18:00:19 EDT
I opened bug #343917 to keep track of the flickering problem.