- 
                Notifications
    You must be signed in to change notification settings 
- Fork 185
Control.flushQueueOnDnd: simplify commit #2573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Control.flushQueueOnDnd: simplify commit #2573
Conversation
| // This is to preserve backwards Cocoa/Win32 compatibility. | ||
| Event mouseDownEvent = dragDetectionQueue.getFirst(); | ||
| mouseDownEvent.data = Boolean.valueOf(true); // force send MouseDown to avoid subsequent MouseMove before MouseDown. | ||
| mouseDownEvent.data = null; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting data to null is not needed too. Please remove it, it might have the positive side effect of not losing any other data that could have been there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is taken from sendOrPost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, formerly it was setting true into data so that this method would do a send and this method does also set data to null:
eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
Lines 5128 to 5140 in 0e04bc9
| private boolean sendOrPost(int type, Event event) { | |
| assert event.data != null : "event.data should have been a Boolean, but received null"; | |
| boolean send = (Boolean) event.data; | |
| event.data = null; | |
| if (send) { | |
| sendEvent (type, event); | |
| if (isDisposed ()) return false; | |
| } else { | |
| postEvent (type, event); | |
| } | |
| return event.doit; | |
| } | 
But I don't think there is a compelling reason to set data to null to maybe replace some other value. If there is another value in data (in the future), replacing it with null is like to be unhelpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You propose to change event.data while I want to keep it null as is. Maybe some application code relies on having event.data set null?
sendOrPost set event.data to null before sending, so keep that behavior
762462d    to
    abe2183      
    Compare
  
    
Inlined
sendOrPostfor this special case making it more obvious that an (immediate)sendEventis happening.