Bug 393793 - [GTK3] Scroll wheel does not work in editor or package explorer
Summary: [GTK3] Scroll wheel does not work in editor or package explorer
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 M6   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 340067
  Show dependency tree
 
Reported: 2012-11-07 12:20 EST by Silenio Quarti CLA
Modified: 2013-05-24 09:26 EDT (History)
0 users

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-11-07 12:20:07 EST
1) Run eclipse on GTK3 port (export SWT_GTK3=1)
2) Try to scroll vertically using the scroll wheel in an editor or tree view (package explorer)

Nothing happens.
Comment 1 Silenio Quarti CLA 2012-11-08 14:32:37 EST
I thought this was happening because we did not support GDK_SCROLL_SMOOTH, but there is something else wrong. The editor is not getting the scroll event. There are cases when the events come fine, for example, after closing all perspectives and reopening only the java perspective, I can scroll wheel on the package explorer.

Add GDK_SMOOTH_SCROLL support:

http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=79b4c494683ecd3609c3ab417806e1f053ca5e78
Comment 2 Silenio Quarti CLA 2012-11-09 10:19:55 EST
The delta_x and delta_y fields where added only on GTK 3.4. We need to use the helper function gdk_event_get_scroll_deltas() in order to be able to compile in versions < 3.4.

http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=92eda262fe6609e637257b664ef3791c831227e8
Comment 3 Silenio Quarti CLA 2013-03-21 17:33:53 EDT
This happens after a call to setRedraw(false)/setRedraw(true). Simple snippet. Works until you click on the shell background.

import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.*;


public class Test {
public static void main(String[] args) {
	final Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new GridLayout(1, false));
	
	final Composite composite = new Composite(shell, SWT.BORDER);
	composite.addListener(SWT.MouseWheel, new Listener() {
		public void handleEvent(Event event) {
			System.out.println("mouse wheel");
		}
	});
	
	shell.addListener(SWT.MouseDown, new Listener() {
		public void handleEvent(Event event) {
			System.out.println("fail");
			composite.setRedraw(false);
			composite.setRedraw(true);
		}
	});
	
	shell.setSize(300, 300);
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	display.dispose();
}
}
Comment 4 Silenio Quarti CLA 2013-03-21 18:01:19 EDT
The event SCROLL_MASK was lost in this call

OS.gdk_window_set_events (window, OS.gtk_widget_get_events (paintHandle ()));

Fixed

http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=2f1ae4577dc2ebb8f48083edff797d352d1b47ca