Bug 137916 - Screen cheese in Table when using mouse wheel
Summary: Screen cheese in Table when using mouse wheel
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Steve Northover CLA
QA Contact: Felipe Heidrich CLA
URL:
Whiteboard:
Keywords:
: 249861 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-04-21 06:21 EDT by Dani Megert CLA
Modified: 2019-09-06 16:19 EDT (History)
6 users (show)

See Also:


Attachments
Picture with cheese (sorry no Swiss one) (8.74 KB, image/png)
2006-04-21 06:22 EDT, Dani Megert CLA
no flags Details
Screenshot of cheese happening with simple test case (12.23 KB, image/png)
2006-10-05 05:21 EDT, Colin Sharples CLA
no flags Details
Cheese (10.87 KB, image/png)
2007-03-01 02:50 EST, Dani Megert CLA
no flags Details
Cheese (non-classic style) (25.18 KB, image/png)
2007-08-03 03:11 EDT, Dani Megert CLA
no flags Details
Debug variables (11.96 KB, image/png)
2007-08-09 14:41 EDT, Dani Megert CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2006-04-21 06:21:00 EDT
N20060421-0010.

1. install fresh Eclipse SDK
2. start
3. Window > Preferences > Java > Editor > Templates
4. select a row in the table
5. press 'Cancel'
6. Window > Preferences > Java > Editor > Templates
7. use the mouse wheel to scroll the table
==> screen cheese
Comment 1 Dani Megert CLA 2006-04-21 06:22:56 EDT
Created attachment 39154 [details]
Picture with cheese (sorry no Swiss one)
Comment 2 Steve Northover CLA 2006-04-24 12:12:10 EDT
This is working for me (in the ControlExample).  This is a Windows bug that is supposed to have been already worked around (but might be missing for the mouse wheel case).  I noticed in the screen shot that you aren't running with the Window XP theme (or your theme looks a lot like Windows 2000).
Comment 3 Steve Northover CLA 2006-04-24 12:12:41 EDT
Also, I love Swiss cheese the best!
Comment 4 Dani Megert CLA 2006-04-24 12:15:57 EDT
>I noticed in the screen shot that you aren't running with the
>Window XP theme (or your theme looks a lot like Windows 2000).
Correct, I'm a very old-fashioned guy.
Comment 5 Steve Northover CLA 2006-04-25 10:37:40 EDT
Can't make it happen.  Can you make it happen with this code (if not, can you edit this code to make it happen?):


import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;

public class PR_137916 {
	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		Table table = new Table(shell, SWT.MULTI);
		table.setSize(400, 200);
		table.setLinesVisible(true);
		table.setHeaderVisible(true);
		String[] columnTitles = { " ", "C", "!", "Description", "Resource",
				"In Folder", "Location" };
		for (int i = 0; i < columnTitles.length; i++) {
			TableColumn tableColumn = new TableColumn(table, SWT.NULL);
			tableColumn.setText(columnTitles[i]);
		}
		for (int i = 0; i < 128; i++) {
			TableItem item = new TableItem(table, SWT.NULL);
			item.setText(0, "x");
			item.setText(1, "y");
			item.setText(2, "!");
			item.setText(3, "None of this stuff behaves the way I want");
			item.setText(4, "Almost_Everywhere");
			item.setText(5, "Some.darn.folder man");
			item.setText(6, "line " + i + " in Nowhere");
		}
		for (int i = 0; i < columnTitles.length; i++) {
			table.getColumn(i).pack();
		}
		shell.pack ();
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) display.sleep();
		}
		display.dispose();
	}
}
Comment 6 Dani Megert CLA 2006-04-25 11:10:05 EDT
>Can't make it happen.
By following steps from comment 0? Also note that I do not use the manifest.
Comment 7 Steve Northover CLA 2006-04-28 15:26:36 EDT
WORKSFORME following the steps.  When you say in step 4, "select a row in the table", do don't mean double click do you?  Also, in step 6, the window comes back with the focus in another widget.  I need to first click in the table before the mouse wheel works.

Can you make the simple example fail?
Comment 8 Steve Northover CLA 2006-04-28 15:28:33 EDT
In the latest SWT, the manifest is not needed.
Comment 9 Dani Megert CLA 2006-04-28 15:39:53 EDT
>4. select a row in the table
by single-click

>Also, in step 6, the window comes
>back with the focus in another widget.  I need to first click in the table
>before the mouse wheel works.
No, I simply use the scroll wheel and the table scrolls

Just tried again using I20060428-0010.
Comment 10 Steve Northover CLA 2006-04-28 15:44:46 EDT
Where is focus?  Does the simple code fail?
Comment 11 Dani Megert CLA 2006-04-28 15:52:57 EDT
Sorry, I didn't have time yet to try this and guessed that the provided steps would be simple enough to reproduce.

The focus is in the filter text entry field.
Comment 12 Steve Northover CLA 2006-04-28 15:56:11 EDT
It's not a big deal and can wait.  The focus for me is in the text field so the mouse wheel won't scroll the table until I click in it.
Comment 13 Dani Megert CLA 2006-04-28 16:01:07 EDT
I agree, it's not a big deal. Maybe an old vs. XP style issue? I didn't use TweakUI to tweak my mouse.

Really strange: when I manually set the focus on the Preview or the tree the mouse wheel does not work but when I manually set the focus to the filter entry field then the wheel works on the table.

I'll see whether I find time tomorrow to try you snippet.
Comment 14 Dani Megert CLA 2006-04-28 16:03:29 EDT
...and step 3-5 are crucial
Comment 15 Dani Megert CLA 2006-04-30 10:42:35 EDT
The snippet works for me.
Comment 16 Dani Megert CLA 2006-05-16 08:40:28 EDT
Simpler steps showing cheese in Eclipse about info:

1. start fresh workspace
2. select Help > About Eclipse SDK
3. click 'Plug-in Details'
4. select an entry
5. click 'More Info'
6. go back to dialog
7. use mouse wheel
==> cheese
Comment 17 Colin Sharples CLA 2006-10-05 05:19:17 EDT
I also get this problem. I'm developing an RCP application that uses a lot of tables, and I'm seeing the problem using XP theme as well as Classic theme. It also happens for me when running the test case in comment #5.

I think this is a big deal. I'm writing an RCP/Birt app to replace an Access database (which has to be a Good Thing, right?), and if the first thing the users sees is their tables turning to mush just by using the scroll wheel, they are not going to be happy and are going to shout to have their Access db back. Please fix this soon - I'd be happy to help with more test cases etc.
Comment 18 Colin Sharples CLA 2006-10-05 05:21:30 EDT
Created attachment 51457 [details]
Screenshot of cheese happening with simple test case
Comment 19 Steve Northover CLA 2006-10-05 13:38:26 EDT
Colin, can you make the problem happen with SWT from HEAD?
Comment 20 Dani Megert CLA 2006-10-09 05:35:37 EDT
I can reproduce with steps from comment 10
Comment 21 Colin Sharples CLA 2007-02-27 20:47:48 EST
I believe this is fixed in 3.2.1 - I can no longer reproduce the cheese when running my app under 3.2.1. I would be happy to close as fixed.
Comment 22 Dani Megert CLA 2007-02-28 02:56:11 EST
No it is not fixed. Simply use the steps from comment 16 (except that the 'More Info' button has gone - click 'Legal Info' instead).
Comment 23 Steve Northover CLA 2007-02-28 10:25:14 EST
Glad it's fixed for you Colin.  I'll have another go at finding out what is going on for Daniel.  Like I said, it's a Windows bug that I though I had worked around.
Comment 24 Dani Megert CLA 2007-02-28 10:30:18 EST
I use the Windows classic look - just in case that matters.
Comment 25 Colin Sharples CLA 2007-02-28 15:46:57 EST
Daniel, what version are you using?

I am using a fresh install of Eclipse 3.2.1 build M20060921-0945, SWT version 3.2.1.v3235e, running on Windows XP SP2 with Windows Classic theme. I tried the steps in comment 16, and I can't reproduce the problem.
Comment 26 Dani Megert CLA 2007-03-01 02:50:04 EST
Created attachment 60050 [details]
Cheese

I use I20070228-0930 but also see the bug in 3.2.1 and 3.2.2.
Comment 27 ebordin CLA 2007-08-02 08:00:13 EDT
This bug is still alive in Europa:
Version: 3.3.0
Build id: I20070625-1500
I'm using Windows XP with the default XP theme.
Comment 28 Steve Northover CLA 2007-08-02 13:48:40 EDT
> Windows XP with the default XP theme.

Can you attach a screen shot?  There is a theory that it only happens using the classic theme.
Comment 29 Steve Northover CLA 2007-08-02 13:54:56 EDT
Dani, do you need to follow the steps exactly?  Do you need a fresh Eclipse?  Must you select a row and cancel?

FH, you seem to be good at getting cheese on your machine when I can't.  Can you have a quick go at making this happen?
Comment 30 Dani Megert CLA 2007-08-03 02:55:53 EDT
>Dani, do you need to follow the steps exactly?  Do you need a fresh Eclipse? 
>Must you select a row and cancel?
Got it: the really important part is to move the focus away from the table:
Simpler steps showing cheese in Eclipse about info:
1. start *any* workspace
2. select Help > About Eclipse SDK
3. click 'Plug-in Details'
4. move focus to another widget (e.g. 'OK' button by pressing the Tab key)
5. use mouse wheel
==> cheese

Now, with this knowlodge I can also slightly modify your simple snippet from comment 5 by adding these lines after "Shell shell = new Shell(display);":
    shell.setLayout(new FillLayout());
    new Button(shell, SWT.NONE);
1. start snippet (oh - ugly layout - sorry ;-)
2. press Tab to set the focus to the button
3. use mouse wheel
==> cheese

NOTE: I switched to use Windows XP style but same bug (see attached picture). Didn't restart my machine though, just changed it via Display settings.
Comment 31 Dani Megert CLA 2007-08-03 03:11:39 EDT
Created attachment 75299 [details]
Cheese (non-classic style)
Comment 32 Colin Sharples CLA 2007-08-05 16:34:35 EDT
I concur - following the steps in comment #30 I get the cheese using Eclipse 3.3.0. I am still also seeing this in 3.2.1 as well (or at any rate IBM Rational Application Developer v7, which is based on Eclipse 3.2.1 - it uses SWT 3.2.1.v3235e).

Running my app (as mentioned in comment #17) with Eclipse 3.3.0, I now see the cheese again, which wasn't happening in 3.2.1, so I wonder if there has been a regression?
Comment 33 Steve Northover CLA 2007-08-07 15:08:37 EDT
On my machine, the table will not scroll when focus is in the button.  I will work with Felipe to try and recreate it.
Comment 34 Felipe Heidrich CLA 2007-08-07 19:12:02 EDT
(In reply to comment #33)
> On my machine, the table will not scroll when focus is in the button.  I will
> work with Felipe to try and recreate it.

Daniel, the windows default behaviour is to scroll the focus widget with the mouse wheel. Do you have a special mouse software (usually comes with the mouse driver) that allows you to configure windows to always send the events to the widget under the cursor ?
Comment 35 Dani Megert CLA 2007-08-08 02:55:12 EDT
Logitech SetPoint Control Center 2.11.459.

There's no special setting, but yes - it always scrolls the "nearest" scrollable which I think is goodness. I wouldn't expect the button to do some fancy dance for me when I use the scroll wheel while it has focus ;-)
Comment 36 Felipe Heidrich CLA 2007-08-08 11:10:23 EDT
(In reply to comment #35)
> Logitech SetPoint Control Center 2.11.459.

I have Logitech SetPoint installed on my Vista machine, I can follow the steps but I can't reproduce the problem.
On XP, I can't follow the steps cause the table won't scroll if it doesn't have the focus.
Comment 37 Dani Megert CLA 2007-08-08 11:16:16 EDT
Bummer! Can I do something on my machine to help you debug the issue?
Comment 38 Steve Northover CLA 2007-08-08 13:10:48 EDT
Yes, you can help.

The work around code for the drawing bug is in Table.WM_VSCROLL().  On my machine, WM_VSCROLL is not called when the user scrolls with the wheel (I swear it used to be called).  Table.WM_VSCROLL() contains work around code that sees how the table was scrolled and damages the exposed items.

	/*
	* Bug in Windows.  When a table is drawing grid lines and the
	* user scrolls vertically up or down by a line or a page, the
	* table does not redraw the grid lines for newly exposed items.
	* The fix is to invalidate the items.
	*/

In any case, it seems an implementation of Table.WM_MOUSEWHEEL() is needed on some machines that has a similar sort of work around.  

1) Can you tell me whether WM_VSCROLL is called from WM_MOUSEWHEEL on your machine?
2) Can you confirm that the bug happens only happens when the button has focus (or does it happen when the table has focus too)?
Comment 39 Dani Megert CLA 2007-08-09 08:25:05 EDT
>1) Can you tell me whether WM_VSCROLL is called from WM_MOUSEWHEEL on your
>machine?
It is NOT called when the table has focus but when the focus is on the button it gets called:
Thread [main] (Suspended (breakpoint at line 5566 in Table))	
	Table.WM_VSCROLL(int, int) line: 5566	
	Table(Control).windowProc(int, int, int, int) line: 3752	
	Table.windowProc(int, int, int, int) line: 5027	
	Display.windowProc(int, int, int, int) line: 4377	
	OS.DispatchMessageW(MSG) line: not available [native method]	
	OS.DispatchMessage(MSG) line: 2283	
	Display.readAndDispatch() line: 3317	
	AboutPluginsDialog(Window).runEventLoop(Shell) line: 825	
	AboutPluginsDialog(Window).open() line: 801	
	AboutDialog.buttonPressed(int) line: 117	
	Dialog$2.widgetSelected(SelectionEvent) line: 621	
	TypedListener.handleEvent(Event) line: 227	
	EventTable.sendEvent(Event) line: 66	
	Button(Widget).sendEvent(Event) line: 938	
	Display.runDeferredEvents() line: 3708	
	Display.readAndDispatch() line: 3319	
	AboutDialog(Window).runEventLoop(Shell) line: 825	
	AboutDialog(Window).open() line: 801	
	AboutHandler.execute(ExecutionEvent) line: 35	
	HandlerProxy.execute(ExecutionEvent) line: 239	
	Command.executeWithChecks(ExecutionEvent) line: 475	
	ParameterizedCommand.executeWithChecks(Object, Object) line: 429	
	HandlerService.executeCommand(ParameterizedCommand, Event) line: 165	
	SlaveHandlerService.executeCommand(ParameterizedCommand, Event) line: 247	
	ActionFactory$WorkbenchCommandAction(CommandAction).runWithEvent(Event) line: 178	
	ActionContributionItem.handleWidgetSelection(Event, boolean) line: 545	
	ActionContributionItem.access$2(ActionContributionItem, Event, boolean) line: 490	
	ActionContributionItem$5.handleEvent(Event) line: 402	
	EventTable.sendEvent(Event) line: 66	
	MenuItem(Widget).sendEvent(Event) line: 938	
	Display.runDeferredEvents() line: 3708	
	Display.readAndDispatch() line: 3319	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2389	
	Workbench.runUI() line: 2353	
	Workbench.access$4(Workbench) line: 2219	
	Workbench$4.run() line: 466	
	Realm.runWithDefault(Realm, Runnable) line: 289	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 461	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 106	
	EclipseAppHandle.run(Object) line: 169	
	EclipseAppLauncher.runApplication(Object) line: 106	
	EclipseAppLauncher.start(Object) line: 76	
	EclipseStarter.run(Object) line: 363	
	EclipseStarter.run(String[], Runnable) line: 176	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 585	
	Main.invokeFramework(String[], URL[]) line: 508	
	Main.basicRun(String[]) line: 447	
	Main.run(String[]) line: 1173	
	Main.main(String[]) line: 1148	



>2) Can you confirm that the bug happens only happens when the button has focus
>(or does it happen when the table has focus too)?
Definitely: when the table has focus there's no cheese.
Comment 40 Steve Northover CLA 2007-08-09 11:31:03 EDT
Ok, we are getting close.  Please step through the work around code and see whether it is damaging the right area.  You will see the work around in the switch statement that ends up calling OS.InvatidateRect().
Comment 41 Dani Megert CLA 2007-08-09 14:35:46 EDT
These are the table bounds: Rectangle {9, 11, 609, 345} and the attached pic will show the debug info. Below is the stack trace.

Note sure whether this matters: when I scroll and then step through in the debugger I hit WM_VSCROLL several times but OS.invalidateRect is not always called.

Thread [main] (Suspended (breakpoint at line 5609 in Table))	
	Table.WM_VSCROLL(int, int) line: 5609	
	Table(Control).windowProc(int, int, int, int) line: 3752	
	Table.windowProc(int, int, int, int) line: 5027	
	Display.windowProc(int, int, int, int) line: 4390	
	OS.DispatchMessageW(MSG) line: not available [native method]	
	OS.DispatchMessage(MSG) line: 2283	
	Display.readAndDispatch() line: 3317	
	AboutPluginsDialog(Window).runEventLoop(Shell) line: 825	
	AboutPluginsDialog(Window).open() line: 801	
	AboutDialog.buttonPressed(int) line: 117	
	Dialog$2.widgetSelected(SelectionEvent) line: 621	
	TypedListener.handleEvent(Event) line: 227	
	EventTable.sendEvent(Event) line: 66	
	Button(Widget).sendEvent(Event) line: 938	
	Display.runDeferredEvents() line: 3708	
	Display.readAndDispatch() line: 3319	
	AboutDialog(Window).runEventLoop(Shell) line: 825	
	AboutDialog(Window).open() line: 801	
	AboutHandler.execute(ExecutionEvent) line: 35	
	HandlerProxy.execute(ExecutionEvent) line: 239	
	Command.executeWithChecks(ExecutionEvent) line: 475	
	ParameterizedCommand.executeWithChecks(Object, Object) line: 429	
	HandlerService.executeCommand(ParameterizedCommand, Event) line: 165	
	SlaveHandlerService.executeCommand(ParameterizedCommand, Event) line: 247	
	ActionFactory$WorkbenchCommandAction(CommandAction).runWithEvent(Event) line: 178	
	ActionContributionItem.handleWidgetSelection(Event, boolean) line: 545	
	ActionContributionItem.access$2(ActionContributionItem, Event, boolean) line: 490	
	ActionContributionItem$5.handleEvent(Event) line: 402	
	EventTable.sendEvent(Event) line: 66	
	MenuItem(Widget).sendEvent(Event) line: 938	
	Display.runDeferredEvents() line: 3708	
	Display.readAndDispatch() line: 3319	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2389	
	Workbench.runUI() line: 2353	
	Workbench.access$4(Workbench) line: 2219	
	Workbench$4.run() line: 466	
	Realm.runWithDefault(Realm, Runnable) line: 289	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 461	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 106	
	EclipseAppHandle.run(Object) line: 169	
	EclipseAppLauncher.runApplication(Object) line: 106	
	EclipseAppLauncher.start(Object) line: 76	
	EclipseStarter.run(Object) line: 363	
	EclipseStarter.run(String[], Runnable) line: 176	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 585	
	Main.invokeFramework(String[], URL[]) line: 508	
	Main.basicRun(String[]) line: 447	
	Main.run(String[]) line: 1173	
	Main.main(String[]) line: 1148	
Comment 42 Dani Megert CLA 2007-08-09 14:41:37 EDT
Created attachment 75788 [details]
Debug variables
Comment 43 Steve Northover CLA 2007-08-09 18:03:36 EDT
1) Try doing "OS.InvalidateRect(handle, null, true)" always in Table.WM_VSCROLL(). Does the cheese go away (but it might flash)?

2) The SB_LINEDOWN and SB_LINEUP case is attempting to damage a single line.  Try multiplying itemHeight by 3 (or more).  Does the cheese go away?
Comment 44 Dani Megert CLA 2007-08-30 04:32:10 EDT
>1) Try doing "OS.InvalidateRect(handle, null, true)" always in
>Table.WM_VSCROLL().
Causes flickering but fixes the cheese once I stop scrolling.

>2) The SB_LINEDOWN and SB_LINEUP case is attempting to damage a single line. 
>Try multiplying itemHeight by 3 (or more).  Does the cheese go away?
Still cheese with x50 but no cheese if x100. But also here flickering.
Comment 45 Dani Megert CLA 2007-11-21 03:52:17 EST
Is there an update on this bug?
Comment 46 Steve Northover CLA 2009-03-16 11:34:54 EDT
*** Bug 249861 has been marked as a duplicate of this bug. ***
Comment 47 Eclipse Webmaster CLA 2019-09-06 16:19:15 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.