Skip to content

Conversation

@tmssngr
Copy link
Contributor

@tmssngr tmssngr commented Oct 1, 2025

Inlined sendOrPost for this special case making it more obvious that an (immediate) sendEvent is happening.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 1, 2025

Test Results

  118 files  + 3    118 suites  +3   14m 53s ⏱️ + 3m 52s
4 650 tests +37  4 633 ✅ +36  17 💤 +1  0 ❌ ±0 
  330 runs  +18    326 ✅ +17   4 💤 +1  0 ❌ ±0 

Results for commit abe2183. ± Comparison against base commit 4722846.

♻️ This comment has been updated with latest results.

// 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;
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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:

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.

Copy link
Contributor Author

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
@tmssngr tmssngr force-pushed the Control.flushQueueOnDnd-simplification branch from 762462d to abe2183 Compare October 31, 2025 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants