Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Opening OS dialog stalls GUI events
Opening OS dialog stalls GUI events [message #465000] |
Fri, 02 December 2005 16:24 |
Joshua Salit Messages: 15 Registered: July 2009 |
Junior Member |
|
|
This is a multi-part message in MIME format.
--------------010003090701050103090408
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Hi,
When you open an operating system supplied dialog, such as
swt.widgets.FileDialog (on Windows, at least, it's provided by a native
function org.eclipse.swt.internal.win32.GetOpenFileNameA()), the event
thread seems to stall until the dialog has closed.
Now, I can sort of understand this would be out of Eclipse's control, as
the Windows dialog is modal and probably just somehow stops the
display's event thread from getting events. But I'll give an example of
an application where this becomes a little annoying - imagine something
like a performance monitor, showing graphs/charts that are constantly
updated. As soon as you open a dialog, these graphs stop updating until
the dialog is closed. Not SO bad, as long as the user realizes this is
happening. But if the user happened to not notice that the charts in
the background were no longer updating, and a critical situation arose
in the charts that they didn't/couldn't see, then this situation becomes
a little worse.
I've attached an example to reproduce this problem...it's a modification
of a few snippets, which starts adding items to a table in a thread, and
then after 25 items have been added, it pops up a FileDialog. The thing
to notice is that while the FileDialog is opened, no more items are
(visibly) added to the table. When the FileDialog is closed, the table
catches up with itself pretty quickly.
Sorry if the code is a bit messy, it's short at least.
Although I'm pretty sure this is currently working-as-designed, it's
causing a bit of a problem for me so I thought I'd ask. I'd appreciate
hearing what others think of this...if there's something obvious I am
missing that would allow me to work around this, or if this is worth
opening a bug report for, etc..
Thank you!
--------------010003090701050103090408
Content-Type: text/plain;
name="TableDialogTest.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="TableDialogTest.java"
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
public class TableDialogTest {
public static void main (String [] args) {
final Display display = new Display ();
final Shell shell = new Shell (display);
GridLayout gl = new GridLayout(1, true);
shell.setLayout(gl);
final Table table = new Table (shell, SWT.MULTI | SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
for (int i=0; i<5; i++) {
TableItem item = new TableItem (table, SWT.NONE);
item.setText("12345678901234567890123456789");
}
Thread thread = new Thread () {
public void run () {
for (int i=0; i<20000; i++) {
if (table.isDisposed ()) return;
display.asyncExec (new Runnable () {
public void run () {
if (table.isDisposed ()) return;
if(table.getItemCount() == 25) {
FileDialog fd = new FileDialog(shell, SWT.OPEN);
fd.open();
}
TableItem item = new TableItem (table, SWT.NONE);
item.setText("12345678901234567890123456789");
}
});
}
}
};
thread.start();
table.setSize(table.computeSize(SWT.DEFAULT, 200));
shell.pack ();
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}
--------------010003090701050103090408--
|
|
|
Re: Opening OS dialog stalls GUI events [message #465004 is a reply to message #465000] |
Fri, 02 December 2005 16:52 |
Gail Jakubowski Messages: 36 Registered: July 2009 |
Member |
|
|
Could this be related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=88958
?
"Joshua Salit" <jrsalit@us.ibm.com> wrote in message
news:dmpsec$u8n$1@news.eclipse.org...
> Hi,
> When you open an operating system supplied dialog, such as
> swt.widgets.FileDialog (on Windows, at least, it's provided by a native
> function org.eclipse.swt.internal.win32.GetOpenFileNameA()), the event
> thread seems to stall until the dialog has closed.
>
> Now, I can sort of understand this would be out of Eclipse's control, as
> the Windows dialog is modal and probably just somehow stops the
> display's event thread from getting events. But I'll give an example of
> an application where this becomes a little annoying - imagine something
> like a performance monitor, showing graphs/charts that are constantly
> updated. As soon as you open a dialog, these graphs stop updating until
> the dialog is closed. Not SO bad, as long as the user realizes this is
> happening. But if the user happened to not notice that the charts in
> the background were no longer updating, and a critical situation arose
> in the charts that they didn't/couldn't see, then this situation becomes
> a little worse.
>
> I've attached an example to reproduce this problem...it's a modification
> of a few snippets, which starts adding items to a table in a thread, and
> then after 25 items have been added, it pops up a FileDialog. The thing
> to notice is that while the FileDialog is opened, no more items are
> (visibly) added to the table. When the FileDialog is closed, the table
> catches up with itself pretty quickly.
>
> Sorry if the code is a bit messy, it's short at least.
>
> Although I'm pretty sure this is currently working-as-designed, it's
> causing a bit of a problem for me so I thought I'd ask. I'd appreciate
> hearing what others think of this...if there's something obvious I am
> missing that would allow me to work around this, or if this is worth
> opening a bug report for, etc..
>
> Thank you!
>
------------------------------------------------------------ --------------------
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.layout.GridData;
> import org.eclipse.swt.layout.GridLayout;
> import org.eclipse.swt.widgets.*;
>
> public class TableDialogTest {
>
> public static void main (String [] args) {
> final Display display = new Display ();
> final Shell shell = new Shell (display);
> GridLayout gl = new GridLayout(1, true);
> shell.setLayout(gl);
> final Table table = new Table (shell, SWT.MULTI | SWT.CHECK | SWT.BORDER |
> SWT.V_SCROLL | SWT.H_SCROLL);
> table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
>
> for (int i=0; i<5; i++) {
> TableItem item = new TableItem (table, SWT.NONE);
> item.setText("12345678901234567890123456789");
> }
>
> Thread thread = new Thread () {
> public void run () {
> for (int i=0; i<20000; i++) {
> if (table.isDisposed ()) return;
> display.asyncExec (new Runnable () {
> public void run () {
> if (table.isDisposed ()) return;
>
> if(table.getItemCount() == 25) {
> FileDialog fd = new FileDialog(shell, SWT.OPEN);
> fd.open();
> }
>
> TableItem item = new TableItem (table, SWT.NONE);
> item.setText("12345678901234567890123456789");
> }
> });
> }
> }
> };
> thread.start();
>
> table.setSize(table.computeSize(SWT.DEFAULT, 200));
> shell.pack ();
> shell.open ();
>
> while (!shell.isDisposed ()) {
> if (!display.readAndDispatch ()) display.sleep ();
> }
> display.dispose ();
> }
> }
|
|
|
Re: Opening OS dialog stalls GUI events [message #465011 is a reply to message #465004] |
Fri, 02 December 2005 17:24 |
Joshua Salit Messages: 15 Registered: July 2009 |
Junior Member |
|
|
Gail,
I'm not sure, it does like part of it. I did notice the CPU spike, and
I figured it was a related problem, but when I move focus to another
application (off of the FileDialog), the CPU goes back to normal, but
the event thread still doesn't seem to be executing (i.e., in my example
code, the items aren't getting added to the table).
When I have a chance I'll download the latest 3.2 stream build and give
it a shot.
Thanks.
Gail Jakubowski wrote:
> Could this be related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=88958
> ?
>
> "Joshua Salit" <jrsalit@us.ibm.com> wrote in message
> news:dmpsec$u8n$1@news.eclipse.org...
>> Hi,
>> When you open an operating system supplied dialog, such as
>> swt.widgets.FileDialog (on Windows, at least, it's provided by a native
>> function org.eclipse.swt.internal.win32.GetOpenFileNameA()), the event
>> thread seems to stall until the dialog has closed.
>>
>> Now, I can sort of understand this would be out of Eclipse's control, as
>> the Windows dialog is modal and probably just somehow stops the
>> display's event thread from getting events. But I'll give an example of
>> an application where this becomes a little annoying - imagine something
>> like a performance monitor, showing graphs/charts that are constantly
>> updated. As soon as you open a dialog, these graphs stop updating until
>> the dialog is closed. Not SO bad, as long as the user realizes this is
>> happening. But if the user happened to not notice that the charts in
>> the background were no longer updating, and a critical situation arose
>> in the charts that they didn't/couldn't see, then this situation becomes
>> a little worse.
>>
>> I've attached an example to reproduce this problem...it's a modification
>> of a few snippets, which starts adding items to a table in a thread, and
>> then after 25 items have been added, it pops up a FileDialog. The thing
>> to notice is that while the FileDialog is opened, no more items are
>> (visibly) added to the table. When the FileDialog is closed, the table
>> catches up with itself pretty quickly.
>>
>> Sorry if the code is a bit messy, it's short at least.
>>
>> Although I'm pretty sure this is currently working-as-designed, it's
>> causing a bit of a problem for me so I thought I'd ask. I'd appreciate
>> hearing what others think of this...if there's something obvious I am
>> missing that would allow me to work around this, or if this is worth
>> opening a bug report for, etc..
>>
>> Thank you!
>>
>
>
> ------------------------------------------------------------ --------------------
>
>
>> import org.eclipse.swt.SWT;
>> import org.eclipse.swt.layout.GridData;
>> import org.eclipse.swt.layout.GridLayout;
>> import org.eclipse.swt.widgets.*;
>>
>> public class TableDialogTest {
>>
>> public static void main (String [] args) {
>> final Display display = new Display ();
>> final Shell shell = new Shell (display);
>> GridLayout gl = new GridLayout(1, true);
>> shell.setLayout(gl);
>> final Table table = new Table (shell, SWT.MULTI | SWT.CHECK | SWT.BORDER |
>> SWT.V_SCROLL | SWT.H_SCROLL);
>> table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
>>
>> for (int i=0; i<5; i++) {
>> TableItem item = new TableItem (table, SWT.NONE);
>> item.setText("12345678901234567890123456789");
>> }
>>
>> Thread thread = new Thread () {
>> public void run () {
>> for (int i=0; i<20000; i++) {
>> if (table.isDisposed ()) return;
>> display.asyncExec (new Runnable () {
>> public void run () {
>> if (table.isDisposed ()) return;
>>
>> if(table.getItemCount() == 25) {
>> FileDialog fd = new FileDialog(shell, SWT.OPEN);
>> fd.open();
>> }
>>
>> TableItem item = new TableItem (table, SWT.NONE);
>> item.setText("12345678901234567890123456789");
>> }
>> });
>> }
>> }
>> };
>> thread.start();
>>
>> table.setSize(table.computeSize(SWT.DEFAULT, 200));
>> shell.pack ();
>> shell.open ();
>>
>> while (!shell.isDisposed ()) {
>> if (!display.readAndDispatch ()) display.sleep ();
>> }
>> display.dispose ();
>> }
>> }
>
>
|
|
|
Re: Opening OS dialog stalls GUI events [message #465019 is a reply to message #465011] |
Fri, 02 December 2005 19:18 |
Joshua Salit Messages: 15 Registered: July 2009 |
Junior Member |
|
|
Ok, I just tried with 3.2M3, and it seems to the issue does indeed seem
to be fixed. Thanks again!
Joshua Salit wrote:
> Gail,
> I'm not sure, it does like part of it. I did notice the CPU spike, and
> I figured it was a related problem, but when I move focus to another
> application (off of the FileDialog), the CPU goes back to normal, but
> the event thread still doesn't seem to be executing (i.e., in my example
> code, the items aren't getting added to the table).
>
> When I have a chance I'll download the latest 3.2 stream build and give
> it a shot.
>
> Thanks.
>
> Gail Jakubowski wrote:
>> Could this be related to
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=88958 ?
>>
>> "Joshua Salit" <jrsalit@us.ibm.com> wrote in message
>> news:dmpsec$u8n$1@news.eclipse.org...
>>> Hi,
>>> When you open an operating system supplied dialog, such as
>>> swt.widgets.FileDialog (on Windows, at least, it's provided by a native
>>> function org.eclipse.swt.internal.win32.GetOpenFileNameA()), the event
>>> thread seems to stall until the dialog has closed.
>>>
>>> Now, I can sort of understand this would be out of Eclipse's control, as
>>> the Windows dialog is modal and probably just somehow stops the
>>> display's event thread from getting events. But I'll give an example of
>>> an application where this becomes a little annoying - imagine something
>>> like a performance monitor, showing graphs/charts that are constantly
>>> updated. As soon as you open a dialog, these graphs stop updating until
>>> the dialog is closed. Not SO bad, as long as the user realizes this is
>>> happening. But if the user happened to not notice that the charts in
>>> the background were no longer updating, and a critical situation arose
>>> in the charts that they didn't/couldn't see, then this situation becomes
>>> a little worse.
>>>
>>> I've attached an example to reproduce this problem...it's a modification
>>> of a few snippets, which starts adding items to a table in a thread, and
>>> then after 25 items have been added, it pops up a FileDialog. The thing
>>> to notice is that while the FileDialog is opened, no more items are
>>> (visibly) added to the table. When the FileDialog is closed, the table
>>> catches up with itself pretty quickly.
>>>
>>> Sorry if the code is a bit messy, it's short at least.
>>>
>>> Although I'm pretty sure this is currently working-as-designed, it's
>>> causing a bit of a problem for me so I thought I'd ask. I'd appreciate
>>> hearing what others think of this...if there's something obvious I am
>>> missing that would allow me to work around this, or if this is worth
>>> opening a bug report for, etc..
>>>
>>> Thank you!
>>>
>>
>>
>> ------------------------------------------------------------ --------------------
>>
>>
>>
>>> import org.eclipse.swt.SWT;
>>> import org.eclipse.swt.layout.GridData;
>>> import org.eclipse.swt.layout.GridLayout;
>>> import org.eclipse.swt.widgets.*;
>>>
>>> public class TableDialogTest {
>>>
>>> public static void main (String [] args) {
>>> final Display display = new Display ();
>>> final Shell shell = new Shell (display);
>>> GridLayout gl = new GridLayout(1, true);
>>> shell.setLayout(gl);
>>> final Table table = new Table (shell, SWT.MULTI | SWT.CHECK |
>>> SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
>>> table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
>>>
>>> for (int i=0; i<5; i++) {
>>> TableItem item = new TableItem (table, SWT.NONE);
>>> item.setText("12345678901234567890123456789");
>>> }
>>>
>>> Thread thread = new Thread () {
>>> public void run () {
>>> for (int i=0; i<20000; i++) {
>>> if (table.isDisposed ()) return;
>>> display.asyncExec (new Runnable () {
>>> public void run () {
>>> if (table.isDisposed ()) return;
>>>
>>> if(table.getItemCount() == 25) {
>>> FileDialog fd = new FileDialog(shell, SWT.OPEN);
>>> fd.open();
>>> }
>>>
>>> TableItem item = new TableItem (table, SWT.NONE);
>>> item.setText("12345678901234567890123456789");
>>> }
>>> });
>>> }
>>> }
>>> };
>>> thread.start();
>>>
>>> table.setSize(table.computeSize(SWT.DEFAULT, 200));
>>> shell.pack ();
>>> shell.open ();
>>>
>>> while (!shell.isDisposed ()) {
>>> if (!display.readAndDispatch ()) display.sleep ();
>>> }
>>> display.dispose ();
>>> }
>>> }
>>
>>
|
|
|
Goto Forum:
Current Time: Mon Dec 09 10:32:02 GMT 2024
Powered by FUDForum. Page generated in 0.05432 seconds
|