Skip to content

Avoid Rectangle allocation on every mouse move in CTabFolder#3225

Open
vogella wants to merge 1 commit intoeclipse-platform:masterfrom
vogella:topic/ctabfolder-avoid-rectangle-alloc-mousemove
Open

Avoid Rectangle allocation on every mouse move in CTabFolder#3225
vogella wants to merge 1 commit intoeclipse-platform:masterfrom
vogella:topic/ctabfolder-avoid-rectangle-alloc-mousemove

Conversation

@vogella
Copy link
Copy Markdown
Contributor

@vogella vogella commented Apr 12, 2026

Replace item.getBounds().contains(x, y) calls in onMouse() with a static containsPoint() helper that checks CTabItem fields directly, avoiding Rectangle allocation on every MouseMove, MouseDown, and MouseUp event.

See #3219

Replace item.getBounds().contains(x, y) calls in onMouse() with a
static containsPoint() helper that checks CTabItem fields directly,
avoiding Rectangle allocation on every MouseMove, MouseDown, and
MouseUp event.

See eclipse-platform#3219

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

Test Results

  170 files  ±0    170 suites  ±0   26m 0s ⏱️ +8s
4 692 tests ±0  4 671 ✅ ±0   21 💤 ±0  0 ❌ ±0 
6 670 runs  ±0  6 515 ✅ ±0  155 💤 ±0  0 ❌ ±0 

Results for commit 3c23899. ± Comparison against base commit 188aed6.

Rectangle bounds = tabItem.getBounds();
if (bounds.contains(x, y)){
if (containsPoint(tabItem, x, y)){
item = tabItem;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder, should there maybe be a break after this? I assume only one item can contain the point...

* Returns whether the given point (px, py) is contained within the bounds
* of the given CTabItem, without allocating a Rectangle object.
*/
static boolean containsPoint(CTabItem item, int px, int py) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used elsewhere that you've made it package private and not private?

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.

2 participants