Bug 392700 - [GTK3] Java editor paint problems
Summary: [GTK3] Java editor paint problems
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.3   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.3 M7   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 399545 (view as bug list)
Depends on:
Blocks: 340067
  Show dependency tree
 
Reported: 2012-10-23 16:56 EDT by Silenio Quarti CLA
Modified: 2013-05-24 09:25 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Silenio Quarti CLA 2012-10-23 16:56:22 EDT
Try scrolling in the Eclipse editor with mouse wheel or by grabing the scrollbar thumb with the latest nightly (N20121022-1000). It leaves blured areas at the top and bottom of the text widget (depending on if scrolling up or down).
Comment 2 Silenio Quarti CLA 2012-10-25 11:22:09 EDT
I have removed the changes for the GTK2 code path. We cannot have this bug for next week M3 build.

http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=4de42eea287c8825d0a8fcad58d1afe3cfc7c290
Comment 3 Silenio Quarti CLA 2012-11-06 17:22:25 EST
Fixed by using gdk_window_scroll() on GTK3.

http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=033543d2c530f3ef9e2efb7e2d0271a91bde3d81
Comment 4 Silenio Quarti CLA 2012-11-07 15:17:59 EST
Scrolling seems to work after this fix, but there are still other problems. There is pixel corruption if a open an java editor and insert lines for example.
Comment 5 Grant Gayed CLA 2013-01-30 15:36:27 EST
(In reply to comment #4)
> Scrolling seems to work after this fix, but there are still other problems.
> There is pixel corruption if a open an java editor and insert lines for
> example.

I just saw this, the lines above the cursor show problems when I press Enter in the Java Editor.
Comment 6 Grant Gayed CLA 2013-01-30 15:37:12 EST
*** Bug 399545 has been marked as a duplicate of this bug. ***
Comment 7 Silenio Quarti CLA 2013-04-29 15:24:59 EDT
Simple test case:

import org.eclipse.swt.*;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.*;


public class ScrollTest {
public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display);

	final Canvas canvas = new Canvas(shell, SWT.NONE);
	canvas.setBounds(10, 10, 300, 300);
	
	final Color[] colors = new Color[]{
			display.getSystemColor(SWT.COLOR_RED),
			display.getSystemColor(SWT.COLOR_CYAN),
			display.getSystemColor(SWT.COLOR_GREEN),
			display.getSystemColor(SWT.COLOR_YELLOW),
			display.getSystemColor(SWT.COLOR_MAGENTA)
	};
	canvas.addListener(SWT.Paint, new Listener() {
		int i;
		public void handleEvent(Event event) {
			GC gc = event.gc;
			gc.setBackground(colors[i++ % colors.length]);
			gc.fillRectangle(-100, -100, 2000, 2000);
			gc.drawLine(event.x, event.y, event.x + event.width - 1, event.y + event.height - 1);
		}
	});
	
	canvas.addListener(SWT.MouseDown, new Listener() {
		public void handleEvent(Event event) {
			//DOWN
//			canvas.scroll(0, 17, 0, 0, 300, 300, true);

			//UP
//			canvas.scroll(0, 0, 0, 17, 300, 300, true);
			
			//ENTER
			canvas.scroll(0, 117, 0, 100, 300, 300, true);
		}
	});
	

	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	display.dispose();
}
}
Comment 8 Silenio Quarti CLA 2013-04-29 15:26:41 EDT
The problem is that gtk_window_scroll () always scroll the whole window. Run the test case above against GTK2 and GTK3 too see the difference.

Fixed

http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=99e4edefe372e2c463379777ecf1fc5a600cb35b
Comment 9 Silenio Quarti CLA 2013-04-30 10:48:10 EDT
I reverted my last change. They code only seems to work on Ubuntu 12.04.  There are different problems on Fedora 17, Fedora 18 and Ubuntu 12.10 (like black screens).
Comment 10 Silenio Quarti CLA 2013-04-30 16:29:51 EDT
This patch works Fedora 17/18 and Ubuntu 12.04/12.10.

http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=8020477095f7384b8e5f566a5db9fc33a8794ffd