Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Sluggish scrolling of Table widget with custom controls (GTK)(Table with a couple of hundred TableItems scrolls unresponsively on Linux)
Sluggish scrolling of Table widget with custom controls (GTK) [message #539239] |
Thu, 10 June 2010 07:08 |
Albert Pikus Messages: 70 Registered: October 2009 |
Member |
|
|
Hi, everybody,
I have noticed that scrolling of Table widget with custom controls (e.g. check buttons) is very unresponsive on Linux. At first I thought that I made some mistake, but this behavior is easy to reproduce with the following snippet:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet126.java?view=co
Just increase the number of table items to, say, 200 (in the original snippet there are only 12 TableItems), and scrolling performance degrades awfully.
This problem appears only on Linux; I was able to reproduce it on Ubuntu 10.04 LTS, with both 32- and 64-bit SWT). On Windows 7 and Mac OS X 10.6 there are no such problems (although it can be noticed, that custom controls on top of TableItems lag a little bit when Table is scrolled).
Any advise or hint how to solve this issue would be greatly appreciated.
Greetings from Slovenia,
Albert
|
|
|
Re: Sluggish scrolling of Table widget with custom controls (GTK) [message #539259 is a reply to message #539239] |
Thu, 10 June 2010 08:12 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Hi,
Using Widgets inside a Table is IMHO a very bad idea you should think of
other solutions presented here.
http://wiki.eclipse.org/Tables_And_Trees_And_NativeControls
a solution for CheckBoxes is available at
http://wiki.eclipse.org/JFaceSnippets#Snippet061FakedNativeC ellEditor
Tom
Am 10.06.10 09:08, schrieb Albert:
> Hi, everybody,
>
> I have noticed that scrolling of Table widget with custom controls (e.g.
> check buttons) is very unresponsive on Linux. At first I thought that I
> made some mistake, but this behavior is easy to reproduce with the
> following snippet:
>
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet126.java?view=co
>
>
> Just increase the number of table items to, say, 200 (in the original
> snippet there are only 12 TableItems), and scrolling performance
> degrades awfully.
>
> This problem appears only on Linux; I was able to reproduce it on Ubuntu
> 10.04 LTS, with both 32- and 64-bit SWT). On Windows 7 and Mac OS X 10.6
> there are no such problems (although it can be noticed, that custom
> controls on top of TableItems lag a little bit when Table is scrolled).
>
> Any advise or hint how to solve this issue would be greatly appreciated.
>
>
> Greetings from Slovenia,
>
> Albert
>
|
|
| |
Re: Sluggish scrolling of Table widget with custom controls (GTK) [message #539626 is a reply to message #539259] |
Fri, 11 June 2010 14:34 |
Albert Pikus Messages: 70 Registered: October 2009 |
Member |
|
|
Hi, Tom,
I tested the snippet you provided with 1000 root items on Linux. When Table is scrolling, performance is good, but there seem to be other Linux-specific issues:
* checkboxes that should appear checked are not drawn at all at snippet startup - they appear only after the area where they are supposed to be drawn is clicked.
* another issue is not related to your snippet specifically, I'm experiencing this problem with SWT-only Table also; when checkbox is clicked, it is surrounded with ugly selection artifacts (a part of selection around the checkbox can be seen). My solution to this problem is more like a hack:
Button dummyButton = new Button(table, SWT.CHECK);
dummyButton.pack();
dummyButton.setVisible(false);
int editorMinimumWidth;
if (runningOnLinux())
{
editorMinimumWidth = dummyButton.getSize().x - 5;
}
else
{
editorMinimumWidth = dummyButton.getSize().x;
}
// ... and later, when creating TableEditor:
TableEditor editor = new TableEditor(table);
editor.minimumWidth = editorMinimumWidth;
This does the trick, but there is no guarantee that it will work with every possible DE for Linux.
This was tested on 32-bit Ubuntu 10.04 LTS with GTK 2.0 and Gnome 2.30.0.
Thanks again for your help, it is much appreciated.
Best regards,
Albert
|
|
| | | |
Re: Sluggish scrolling of Table widget with custom controls (GTK) [message #540145 is a reply to message #540141] |
Tue, 15 June 2010 07:42 |
Albert Pikus Messages: 70 Registered: October 2009 |
Member |
|
|
Hi,
I thought of this too, so I tried the following:
if (JFaceResources.getImageRegistry().getDescriptor(CHECKED_KEY) == null)
{
JFaceResources.getImageRegistry().put(UNCHECK_KEY, makeShot(viewer.getControl(), false));
try
{
Thread.sleep(100);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
JFaceResources.getImageRegistry().put(CHECKED_KEY, makeShot(viewer.getControl(), true));
}
But this sleep seems not to be helpful, no matter what (still reasonable) sleep interval I set. But if i create "helper" shell with the following style bits, button's checked state seems to be captured correctly (at least I haven't yet managed to get wrong checked-state button screenshot):
Shell shell = new Shell(control.getShell(), SWT.NO_TRIM | SWT.APPLICATION_MODAL | SWT.ON_TOP);
There is also another problem: when clicking on the checkbox image (not just inside the cell where this image is hosted, but precisely on the image), element's state inside the method
protected void setValue(Object element, Object value)
{
((File) element).read = ((Boolean) value).booleanValue();
v.update(element, null);
}
just isn't updated. When clicking inside a cell, but outside the checkbox image, method setValue updates element correctly.
EDIT: I'm using 32-bit SWT 3.5.2 for gtk-linux.
I'll take a look at improved version you provided, thank you.
Best regards,
Albert
Quote: |
The only thing I can imaging is that this is a timing issue to when the
screenshot is take.
a) Given an improved version in
https://bugs.eclipse.org/bugs/show_bug.cgi?id=301705 a try
b) somehow way for some milliseconds to take the screenshot to see if
the problem is going a way
What's your version of SWT?
Tom
|
[Updated on: Tue, 15 June 2010 07:52] Report message to a moderator
|
|
| |
Re: Sluggish scrolling of Table widget with custom controls (GTK) [message #540161 is a reply to message #540145] |
Tue, 15 June 2010 08:01 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
You are stopping the display thread which won't help.
Tom
Am 15.06.10 09:42, schrieb Albert:
> Hi,
>
> I thought of this too, so I tried the following:
>
>
>
> if (JFaceResources.getImageRegistry().getDescriptor(CHECKED_KEY ) == null)
> {
> JFaceResources.getImageRegistry().put(UNCHECK_KEY,
> makeShot(viewer.getControl(), false));
> try
> {
> Thread.sleep(100);
> }
> catch (InterruptedException e)
> {
> e.printStackTrace();
> }
> JFaceResources.getImageRegistry().put(CHECKED_KEY,
> makeShot(viewer.getControl(), true));
> }
>
>
>
> But this sleep seems not to be helpful, no matter what (still
> reasonable) sleep interval I set. But if i create "helper" shell with
> the following style bits, captured state seems to be captured correctly
> (at least I haven't yet managed to get wrong checked-state button
> screenshot):
>
>
> Shell shell = new Shell(control.getShell(), SWT.NO_TRIM |
> SWT.APPLICATION_MODAL | SWT.ON_TOP);
>
>
> There are also other problems: when clicking on the checkbox image (not
> just inside the cell where this image is hosted, but precisely on the
> image), element's state inside the method
>
>
> protected void setValue(Object element, Object value)
> {
> ((File) element).read = ((Boolean) value).booleanValue();
> v.update(element, null);
> }
>
>
> just isn't updated. When clicking inside a cell, but outside the
> checkbox image, method setValue updates element correctly.
>
> I'll take a look at improved version you provided, thank you.
>
>
> Best regards,
>
> Albert
>
> Quote:
>> The only thing I can imaging is that this is a timing issue to when the
>> screenshot is take.
>>
>> a) Given an improved version in
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=301705 a try
>> b) somehow way for some milliseconds to take the screenshot to see if
>> the problem is going a way
>>
>> What's your version of SWT?
>>
>> Tom
>
>
|
|
|
Re: Sluggish scrolling of Table widget with custom controls (GTK) [message #540167 is a reply to message #540161] |
Tue, 15 June 2010 08:41 |
Albert Pikus Messages: 70 Registered: October 2009 |
Member |
|
|
You are right, this cannot work. However, as mentioned above, creating helper Shell with
Shell shell = new Shell(control.getShell(), SWT.NO_TRIM | SWT.APPLICATION_MODAL | SWT.ON_TOP);
works.
Best regards,
Albert
Tom Schindl wrote on Tue, 15 June 2010 04:01 | You are stopping the display thread which won't help.
Tom
Am 15.06.10 09:42, schrieb Albert:
> Hi,
>
> I thought of this too, so I tried the following:
>
>
>
> if (JFaceResources.getImageRegistry().getDescriptor(CHECKED_KEY ) == null)
> {
> JFaceResources.getImageRegistry().put(UNCHECK_KEY,
> makeShot(viewer.getControl(), false));
> try
> {
> Thread.sleep(100);
> }
> catch (InterruptedException e)
> {
> e.printStackTrace();
> }
> JFaceResources.getImageRegistry().put(CHECKED_KEY,
> makeShot(viewer.getControl(), true));
> }
>
>
>
> But this sleep seems not to be helpful, no matter what (still
> reasonable) sleep interval I set. But if i create "helper" shell with
> the following style bits, captured state seems to be captured correctly
> (at least I haven't yet managed to get wrong checked-state button
> screenshot):
>
>
> Shell shell = new Shell(control.getShell(), SWT.NO_TRIM |
> SWT.APPLICATION_MODAL | SWT.ON_TOP);
>
>
> There are also other problems: when clicking on the checkbox image (not
> just inside the cell where this image is hosted, but precisely on the
> image), element's state inside the method
>
>
> protected void setValue(Object element, Object value)
> {
> ((File) element).read = ((Boolean) value).booleanValue();
> v.update(element, null);
> }
>
>
> just isn't updated. When clicking inside a cell, but outside the
> checkbox image, method setValue updates element correctly.
>
> I'll take a look at improved version you provided, thank you.
>
>
> Best regards,
>
> Albert
>
> Quote:
>> The only thing I can imaging is that this is a timing issue to when the
>> screenshot is take.
>>
>> a) Given an improved version in
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=301705 a try
>> b) somehow way for some milliseconds to take the screenshot to see if
>> the problem is going a way
>>
>> What's your version of SWT?
>>
>> Tom
>
>
|
|
|
| |
Goto Forum:
Current Time: Fri Apr 26 19:37:48 GMT 2024
Powered by FUDForum. Page generated in 0.03760 seconds
|