Skip to content

Fix: Visuals::interact_cursor support in Button#7986

Merged
emilk merged 4 commits intoemilk:mainfrom
mango766:fix/interact-cursor-regression
Mar 25, 2026
Merged

Fix: Visuals::interact_cursor support in Button#7986
emilk merged 4 commits intoemilk:mainfrom
mango766:fix/interact-cursor-regression

Conversation

@mango766
Copy link
Copy Markdown
Contributor

Closes #7947

Problem

Visuals::interact_cursor stopped working for buttons after the AtomLayout refactor in commit 6eb7bb6. Setting interact_cursor to e.g. CursorIcon::PointingHand no longer changes the cursor when hovering over a Button.

Root Cause

When Button was rewritten to use AtomLayout in #5830, the cursor-override block at the end of the old Button::ui was not carried over to the new Button::atom_ui method.

The old code had:

if let Some(cursor) = ui.visuals().interact_cursor {
    if response.hovered() {
        ui.ctx().set_cursor_icon(cursor);
    }
}

This was the only place interact_cursor was checked, so the setting became entirely non-functional.

Fix

Re-add the same interact_cursor check in Button::atom_ui, right after painting and before widget_info, matching the original behavior.

The `Visuals::interact_cursor` support was accidentally dropped from
`Button` in commit 6eb7bb6 when the widget was rewritten to use
`AtomLayout`. This restores the original behavior so that setting
`interact_cursor` (e.g. to `CursorIcon::PointingHand`) actually
changes the cursor when hovering over buttons again.

Closes emilk#7947
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 18, 2026

Preview available at https://egui-pr-preview.github.io/pr/7986-fixinteract-cursor-regression
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

View snapshot changes at kitdiff

Copy link
Copy Markdown
Collaborator

@lucasmerlin lucasmerlin left a comment

Choose a reason for hiding this comment

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

Thanks!

@emilk emilk added this to the 0.34.0 milestone Mar 24, 2026
@emilk emilk added the bug Something is broken label Mar 24, 2026
@emilk emilk changed the title Fix: Restore Visuals::interact_cursor support in Button Fix: Visuals::interact_cursor support in Button Mar 24, 2026
@emilk emilk added the egui label Mar 24, 2026
@emilk emilk merged commit 02ff040 into emilk:main Mar 25, 2026
25 checks passed
Masterchef365 pushed a commit to Masterchef365/egui that referenced this pull request Apr 3, 2026
Closes emilk#7947

## Problem

`Visuals::interact_cursor` stopped working for buttons after the
`AtomLayout` refactor in commit 6eb7bb6. Setting `interact_cursor` to
e.g. `CursorIcon::PointingHand` no longer changes the cursor when
hovering over a `Button`.

## Root Cause

When `Button` was rewritten to use `AtomLayout` in emilk#5830, the
cursor-override block at the end of the old `Button::ui` was not carried
over to the new `Button::atom_ui` method.

The old code had:
```rust
if let Some(cursor) = ui.visuals().interact_cursor {
    if response.hovered() {
        ui.ctx().set_cursor_icon(cursor);
    }
}
```

This was the only place `interact_cursor` was checked, so the setting
became entirely non-functional.

## Fix

Re-add the same `interact_cursor` check in `Button::atom_ui`, right
after painting and before `widget_info`, matching the original behavior.

---------

Co-authored-by: easonysliu <[email protected]>
Co-authored-by: Emil Ernerfeldt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is broken egui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REGRESSION: Visuals::interact_cursor doesn't affect anything anymore

3 participants