Skip to content

BrushPopup and Dialog autoscrollbars fixes#5485

Merged
dacap merged 3 commits into
aseprite:mainfrom
martincapello:misc-fixes
Oct 28, 2025
Merged

BrushPopup and Dialog autoscrollbars fixes#5485
dacap merged 3 commits into
aseprite:mainfrom
martincapello:misc-fixes

Conversation

@martincapello

@martincapello martincapello commented Oct 24, 2025

Copy link
Copy Markdown
Member

This PR contains 2 fixes in three commits:

  • 126f425 and e2a77f8 make the BrushPopup refresh when the "Saving Brush Here" button is pressed and an unlocked slot is present.
  • 4c92828 fixes Dialog's behavior when autoscrollbars property were set to true in Lua scripts. This is because of the reversion of the fix_bounds change (126f425), that made the dialogs to show up uncentered when autoscrollbars=true

aseprite-bot

This comment was marked as outdated.

Window's bounds origin must be set to (0,0) when using multiple
displays. I've changed that when introduced the Dialog's autoscrollbars
property, without noticing that I broke how the windows were located
inside their native window when using multiple displays
When the BrushPopup was open and there was an unlocked slot and then the
user pressed the "Save Brush Here" button, the popup was not refreshed
When the Dialog autoscrollbars property was set to true and multiple
displays were used, the dialog didn't show up centered on the screen

@aseprite-bot aseprite-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

if (type == LUA_TBOOLEAN)
autoScrollbars = lua_toboolean(L, -1);
if (type == LUA_TBOOLEAN) {
bool autoScrollbars = lua_toboolean(L, -1);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

warning: implicit conversion 'int' -> 'bool' [readability-implicit-bool-conversion]

Suggested change
bool autoScrollbars = lua_toboolean(L, -1);
bool autoScrollbars = lua_toboolean(L, -1) != 0;

if (type == LUA_TBOOLEAN)
autoScrollbars = lua_toboolean(L, -1);
if (type == LUA_TBOOLEAN) {
bool autoScrollbars = lua_toboolean(L, -1);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

warning: variable 'autoScrollbars' of type 'bool' can be declared 'const' [misc-const-correctness]

Suggested change
bool autoScrollbars = lua_toboolean(L, -1);
bool const autoScrollbars = lua_toboolean(L, -1);

@dacap

dacap commented Oct 27, 2025

Copy link
Copy Markdown
Member

How I can test both fixes? (step by step / script example)
Is the autoscrollbars fix related to #4758 or #5481?

@martincapello

martincapello commented Oct 28, 2025

Copy link
Copy Markdown
Member Author

How I can test both fixes? (step by step / script example)

Try the following in the current Aseprite version:
BrushPopup not refreshing:

  1. In any sprite you have open, click the "brush type" button.
  2. In the BrushPopup set to "unlocked" to any custom brush you have.
  3. Press the "Save Brush Here" button.
  4. You will see that the "unlocked" custom brush is not updated.

Then, after applying just the two first commits try the above again. In step 4 you should see that the BrushPopup gets updated. Also try the following script to see the issue that will be fixed after applying the remaining commit:

dlg = Dialog { title="Test dialog" }
for i = 1, 39 do
  dlg:entry { label="Entry " .. i}
end

dlg:button    { text="Apply"}
   :button    { text="Cancel"}

dlg:show{wait = false, autoscrollbars=true}

Once run you will see that the dialog is positioned at (0,0) instead of being centered. Make sure you are using the multiple displays option. This is fixed after applying the last commit.

Is the autoscrollbars fix related to #4758 or #5481?

No, it is not related to any of those issues, it is just a fix that makes the dialog with autoscrollbars behave as before reverting the fit_bounds change.

@dacap

dacap commented Oct 28, 2025

Copy link
Copy Markdown
Member

Try the following [...]

Thanks! I was able to reproduce the bugs and test the fixes. Looks great 👍

@dacap dacap merged commit 600dbb5 into aseprite:main Oct 28, 2025
12 checks passed
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