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 03:08  |
Eclipse User |
|
|
|
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 04:12   |
Eclipse User |
|
|
|
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 10:34   |
Eclipse User |
|
|
|
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 03:42   |
Eclipse User |
|
|
|
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 03:52] by Moderator
|
|
| |
Re: Sluggish scrolling of Table widget with custom controls (GTK) [message #540161 is a reply to message #540145] |
Tue, 15 June 2010 04:01   |
Eclipse User |
|
|
|
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 04:41   |
Eclipse User |
|
|
|
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
>
>
|
|
|
|
Re: Sluggish scrolling of Table widget with custom controls (GTK) [message #541082 is a reply to message #540167] |
Fri, 18 June 2010 05:31  |
Eclipse User |
|
|
|
Perhaps I would be able to fix appearance on Linux, when table item is selected (i.e. find a way to hide selection edges around the button image, as can be seen from the above attached screenshots), but I have no idea how to capture selection event and accordingly update element's state (for example, set File's read property to true or false) when image of a button is clicked. I cannot expect from a user to know that clicking on a button image actually does nothing (except for just swapping button image).
Any ideas, anyone?
Greetings,
Albert
|
|
|
Goto Forum:
Current Time: Wed Jul 23 13:58:41 EDT 2025
Powered by FUDForum. Page generated in 0.31229 seconds
|