Opened 3 years ago

Closed 3 years ago

Last modified 7 months ago

#7094 closed defect (fixed)

GUI: Pressed button keeps highlight after modal dialog opens

Reported by: salty-horse Owned by: salty-horse
Priority: low Component: GUI
Keywords: Cc:


Tested with latest git.

1) Launch ScummVM.
2) Choose "Add Game..."

The "Add Game" file browser will show up. The background dialog will be dark, but the "Add Game" button will be highlighted. It shouldn't be.

Ticket imported from: bugs/7094.

Change History (13)

comment:1 Changed 3 years ago by SF/zhe13

Hello, Sorry for late.
I am zhe13 from github and busy with my homework these days.

I think it is a problem that the button did not call the changePressedAnimation function immediately after sending msgs.

We can rewire the button class and add a callback function.

Another conditoin is that the pressed value was wrong. I will check it after my courses this afternoon.
See you soon~

BTW, how to change the avatar. This is my ex-girlfriend and I do not want to see her anymore :)

comment:2 Changed 3 years ago by salty-horse

You can change you avatar at (which you have used in the past if you have an avatar associated with your email).

comment:3 Changed 3 years ago by salty-horse

I'll wait for you to investigate the bug before looking into it myself :)

Please also specifically mention if you're tackling problem 1, problem 2, or both (I'm not sure how related they are - maybe it should be 2 different fixes)

comment:4 Changed 3 years ago by SF/zhe13

Emm I am tackling problem1 and I think it must be related to #7083 .

comment:5 Changed 3 years ago by SF/zhe13

I think Probelm 1 takes place because when the selecting dialogue is showing the pointer reactives handleMouseMoved() and sets itself with the flag"WIDGET_HILITED". After that thenew dialogue comes to the top layer and cuts down the interaction between mouse and Add_Game btn.

Can you give me some functions/params which can prevents situations like this or I just need to disable the button?

comment:6 Changed 3 years ago by salty-horse

I don't think disabling the button is the right approach, as the new dialog that's drawn on top already "greys out" all of the background. This would also require you to enable all the buttons again when the dialog gets focus.

I'll have a look and report back.

comment:7 Changed 3 years ago by SF/zhe13

I will keep tracking this issue and try to find out a proper solution.

comment:8 Changed 3 years ago by salty-horse

handleMouseMoved() isn't relevant for buttons. I think you mean handleMouseEntered. And it's not the issue. It's not called after the new dialog appears (You can verify it by adding a debug print in ButtonWidget's handleMouseEntered implementation.

I figured out the problem (#1) by adding some debug prints and playing around with the buttons. I will describe the process:

  • I added warning() prints inside Dialog::runModal() and Widget::updateState() (right where the WIDGET_HILITED flag is set).
  • Then I tried clicking on a button and seeing what happens. WIDGET_HILITED triggered after runModal. OK, that's what I expected.
  • Then I tried pressing on a button, moving outside it, moving back to the button, and releasing the press. I noticed the problem didn't occur. The button didn't try to highlight.

So, the problem is that when a button is pressed, a PRESSED flag is set in addition to the HILITED flag. When a button is unpressed, the PRESSED flag is unset, but the HILITED flag is untouched.

The solution is to unset WIDGET_HILITED inside ButtonWidget::setPressedState().

Do you want to submit a fix?

I'll edit this bug to just be about problem #1. Will file a new bug about problem #2.

comment:9 Changed 3 years ago by salty-horse

Summary: GUI: Buttons get wrong highlight when they are enabled/disabledGUI: Pressed button keeps highlight after modal dialog opens

comment:10 Changed 3 years ago by salty-horse

Done. The new bug is #7101.

comment:11 Changed 3 years ago by salty-horse

Owner: set to salty-horse
Resolution: fixed
Status: newclosed

comment:13 Changed 7 months ago by digitall

Component: GUI
Note: See TracTickets for help on using tickets.