Bug 59528 - [Workbench] CTabFolder flashes on tab switch
Summary: [Workbench] CTabFolder flashes on tab switch
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Billy Biggs CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-21 17:10 EDT by Billy Biggs CLA
Modified: 2004-05-18 22:12 EDT (History)
4 users (show)

See Also:


Attachments
Test app (1.36 KB, application/gzip)
2004-04-21 17:14 EDT, Billy Biggs CLA
no flags Details
NoBackground hack to Control/StyledText (1.53 KB, patch)
2004-04-28 11:12 EDT, Billy Biggs CLA
no flags Details | Diff
NoBackground hack to PaneFolder's ViewForm (674 bytes, patch)
2004-04-28 11:12 EDT, Billy Biggs CLA
no flags Details | Diff
Patch to change the order of setVisible calls on tab switch (969 bytes, patch)
2004-05-18 14:35 EDT, Billy Biggs CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Billy Biggs CLA 2004-04-21 17:10:14 EDT
I20040420

My system background colour is set to grey.  Java editors in eclipse have a
white background.  When I switch between two editors, I see a flash to the grey
system background colour.  The grey is visible for a fair amount of time during
the switch, and even longer if it is the first time I have accessed the file
either in the current session or after it has been inactive for some time.  The
same behavior can be seen upon switching view tabs (easier to see when the view
is maximized).

A plausible reason for the flash may be that when we show the next widget, X
initially fills the window to the background colour until the widget has a
chance to draw itself.
Comment 1 Billy Biggs CLA 2004-04-21 17:14:17 EDT
Created attachment 9807 [details]
Test app

This archive includes a few test apps that try to mimic how CTabFolder works. 
It's not so conclusive: We get flashes switching pages of a GtkNotebook, but
when I do code that tries to mimic how CTabFolder works, I don't see the
flashes.  I'm updating the test appliaction to draw the background colour
instead of setting the system background colour on each window, and I suspect
that will flash as well.
Comment 2 Alvin Thompson CLA 2004-04-22 14:14:41 EDT
just to add add what may be a red herring, some views are much faster redrawing
themselves and thus this annoying flash is not readily visible. for example, the
new Intro view draws nice and quick, so any flash can't be seen. maybe we should
look at how that view is rendered, and emulate it in others.
Comment 3 Billy Biggs CLA 2004-04-22 14:50:40 EDT
Alvin:
The intro view sets the background of the entire widget (hence its GdkWindow) to
white.  The contents are still cleared to white then drawn to, but since the
background is the same on all pages is white, you don't see a flash to grey. 
You can determine the background colour of the GdkWindows of each widget by
playing with opaque resizing of windows before the contents have a chance to
draw themselves.

I don't know if it's feasible to have the entire editor area set its background
colour to white, maybe there's an easier fix there that would make things that
much smoother.
Comment 4 Billy Biggs CLA 2004-04-22 17:10:13 EDT
Bug 59707 addresses one problem relating to StyledText where the main text
widget does not have the correct background colour.  I hacked a fix here for
this bug which makes alt-tab'ing to an occluded eclipse window look better, but
does not solve the flash on tab switch.

We may be able to fix the flash if we can figure out what widgets contain the
styledtext and see if their background colours should be set differently, or if
there is some reason they get mapped to the screen before the styledtext widget
does.
Comment 5 Billy Biggs CLA 2004-04-28 11:11:40 EDT
I have a hack here that makes switching between editor tabs very smooth.  It
sets the background pixmap on the main StyledText widget to be NULL, and does
the same to the ViewForm widget in PaneFolder in the UI's default presentation.

The ViewForm contains the styledtext widget, and it is clearly visible on a
switch to an inactive tab.  I believe this shows we are hiding the old tab
before showing the next one, which may be something we can fix.  I do not
believe that we can set this to have no background without causing problems, as
it is visible behind view toolbars where the theme background pixmap should be
applied.

However, setting the background of the ViewForm to NULL does not completely
solve the flash.  The StyledText widget takes too long to draw, so its white
background cleared before the text is visible.  Setting the background pixmap on
the styledtext to NULL has no side effects as the area is always completely
drawn.  There may be other widgets which could benefit from a NULL background
pixmap, but as a start I think this may be a very useful fix.
Comment 6 Billy Biggs CLA 2004-04-28 11:12:11 EDT
Created attachment 10058 [details]
NoBackground hack to Control/StyledText
Comment 7 Billy Biggs CLA 2004-04-28 11:12:39 EDT
Created attachment 10059 [details]
NoBackground hack to PaneFolder's ViewForm
Comment 8 Veronika Irvine CLA 2004-04-28 16:50:42 EDT
Adding Silenio and Steve to this discussion.

I have tried the hack and found 

1) That it didn't make that much of a difference - there is still some flash
2) We are relying on the underlying textured background to show through in 
CTabFolder and ViewForm.  Adding gdk_window_set_back_pixmap(window, 0, false) 
causes black to be drawn instead of the desired texture.

We are currently using gtk_rc_style_set_bg_pixmap_name to set the pixmap 
to "<none>" when a background colour is set.  Not sure how this compares with 
gdk_window_set_back_pixmap.

I think we should investigate how the workbench handles the selection of a tab 
since the StyledText widget is not actually a child of the CTabFolder.  
However, it should be noted that for OLE editors, it is mandatory that the old 
editor be deactivated before the new editor be created - in order to get the 
menubar activation correct.  So the order may not be flexible.
Comment 9 Silenio Quarti CLA 2004-05-11 14:35:21 EDT
The SWT.NO_BACKGROUND style is now honoured in GTK. Setting the background
pixmap by calling gtk_rc_style_set_bg_pixmap_name() with "<none>" does not seem
to work because of a bug in GTK. So we reset it by calling
gdk_window_set_back_pixmap() every time it is needed.

Making ViewForm a SWT.NO_BACKGROUND does not seem to be an option because of the
theme manager. So I believe UI needs to change tab switching to show the new tab
first and then hide the old one.
Comment 10 Veronika Irvine CLA 2004-05-11 15:05:02 EDT
I do not understand why editors have a ViewForm inside them anyway.  Is that a 
new requirement?  Does eclipse ever put anything in the top slots of the 
ViewForm?  If not, you could make parent of the editor be a Composite with the 
style SWT.NO_BACKGROUND.  Another advantage of not using a ViewForm here is 
that the ViewForm does not accept any Layout set on it.  Therefore, in order 
to put a layout on the contents, the application has to create yet another 
composite to be the parent.  Instead of catering to the occasional editor that 
may wish to display itself in a ViewForm, why not let the editor choose to 
create a ViewForm if that is what it wants.  I assume most editors do that 
anyway.
Comment 11 Michael Van Meekeren CLA 2004-05-11 16:06:45 EDT
stefan, do we need to use a viewform for editors.... can we push that down?
Comment 12 Billy Biggs CLA 2004-05-18 14:35:26 EDT
Created attachment 10786 [details]
Patch to change the order of setVisible calls on tab switch

This patch changes the order which we make controls visible during a tab
switch.  It fixes the flashing between tab switches.  I think this may be the
correct solution.
Comment 13 Nick Edgar CLA 2004-05-18 16:32:23 EDT
Patch applied.
Comment 14 Billy Biggs CLA 2004-05-18 22:12:35 EDT
I have verified that this problem is fixed in I200405182000.  Tab switching
looks awesome.