Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 436766

Summary: SashForm Sash SWT.DRAG Event.detail different on swt 3.102 (and 3.103) compared to 3.100
Product: [Eclipse Project] Platform Reporter: Adrian G <adriangoldberg>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: ericwill
Version: 4.3.2Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Example source code none

Description Adrian G CLA 2014-06-06 01:57:37 EDT
Created attachment 244027 [details]
Example source code

I note that the handing of SWT.DRAG in org.eclipse.swt (3.100.1) is different to (3.102.1).
The 3.100.1 version makes more sense to me. A Sash drag event has an event.detail == SWT.DRAG, however in 3.102.1 it does not.

I have attached an example. I created a dummy ModifiedSashForm and added a print to console call at line 290. This shows the different properties of event.detail in the onDragSash(Event) method, depending on which version of swt is used.
Comment 1 Adrian G CLA 2014-06-07 11:06:57 EDT
I am using Linux with GTK3.

In SWT version 3.102.1 of the OS class initialization there is:
USE_CAIRO = useCairo || OS.GTK3;

and in the Sash class:
static int checkStyle (int style) {
	if (OS.USE_CAIRO) {
		style |= SWT.SMOOTH;
	}
	return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
}

in SWT version 3.100.1 in the Sash class the checkStyle method is:
static int checkStyle (int style) {
	return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
}

then in both version 3.100.1 and 3.102.1 Sash classes in the gtk_button_press_event(..) mthod is
..
	if ((style & SWT.SMOOTH) == 0) {
		event.detail = SWT.DRAG;
	}
..
so in 3.102.1 GTK3 environment SWT.DRAG is not enabled by default (unlike 3.100.1) - and thus in the SashForm onDragSash(Event event) a selection event is not differentiated from a drag event.

This is causing problems for me as I have a lot of on screen real estate to update - and I only want to update it at the end of the drag.

I see that the the current SWT version for Luna, 3.103 contains the same GTK3 SWT.DRAG problems as 3.102.
Comment 2 Eric Williams CLA 2019-02-21 15:28:18 EST
According to https://bugs.eclipse.org/bugs/show_bug.cgi?id=387641#c2

SWT.SMOOTH Sash's are a thing of the past. Also looking at the code I can tell that SWT.SMOOTH does nothing.

The solution to the bug is to stop using SWT.SMOOTH.