Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » CTabFolder/CTabItems flashing on focus change(CTabFolder redraws every child which is expensive)
CTabFolder/CTabItems flashing on focus change [message #1839690] Thu, 25 March 2021 18:57 Go to next message
Michael Maenz is currently offline Michael MaenzFriend
Messages: 3
Registered: December 2016
Junior Member
Hi,

we are using CTabFolder with several CTabItems, each containing a SWT Canvas with native handle (required!) and an opengl context to draw 3d things.

Everytime the CTabFolder gets or loses focus the whole thing with item children is redrawn which is expensive and results in white flashing. The redraw for the (active/selected) CTabItems is not needed at all.

I already implemented my own TabFolderRenderer but there is no way to tell what is going to be redrawn and to prevent it. I first thought CTabFolder supports SWT.DOUBLE_BUFFERED but it's not derived from Composite (I have overriden StackRenderer.getStyleOverride() to return SWT.DOUBLE_BUFFERED).

CTabFolder can't be extended or overridden in any form. Reimplementing 99% of CTabFolder only to prevent redraw is not a proper solution either.

My question is if there is a way to prevent redrawing of items or any chance to draw to temporary GC and swap after everything is completed?

Edit:
It would be helpful if CTabFolder.onPaint creates a buffer instead of drawing to active gc
Image img = new Image(display, width, height);
GC buffer = new GC(img);
draws everything on that buffer gc and finally
event.gc.drawImage(img, 0, 0);
gc.dispose();
img.dispose();
copies the result to the actual gc.

I'm not sure if this works seamless. I'll give it a try and report back.

Thank you very much!

[Updated on: Thu, 25 March 2021 22:16]

Report message to a moderator

Re: CTabFolder/CTabItems flashing on focus change [message #1839695 is a reply to message #1839690] Thu, 25 March 2021 20:19 Go to previous message
Martin J is currently offline Martin JFriend
Messages: 50
Registered: August 2015
Member
Simple solution is to create buffered Image and redraw the image instead of redrawing computationally expensive 3D objects entirely.
Previous Topic:Strange behavior on Tree element once CSS is applied.
Next Topic:Disabling selection of non-leaf tree nodes in Pane Based Selection Wizard
Goto Forum:
  


Current Time: Sat Apr 20 04:00:27 GMT 2024

Powered by FUDForum. Page generated in 0.03385 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top