Ticket #3766 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

add_widget() doesn't remove focus from the previously focused widget

Reported by: mooffie Owned by: mooffie
Priority: major Milestone: 4.8.19
Component: mc-core Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master

Description

The problem:

When adding a new widget to a dialog, at runtime, add_widget() sets WST_FOCUSED on the new widget, but doesn't clear it from the previously focused widget. The result is two (or more) widgets that think they're the focused ones.

Seeing it:

Open the editor with some file. [You can use the mouse to carry out the following steps.] Turn off fullscreen for this WEdit and make is smaller. Now open another file in this same dialog (e.g., press C-n for a new file), and for this new WEdit too turn off fullscreen. Make this WEdit smaller so you can see the frames of both WEdits. You'll see that both frames have the color designated for a focused WEdit. Play with the mouse in both frames and you'll see that the problem gets fixed.

Note

The actual function is add_widget_autopos(), and that's how it's written in the commit message. For the ticket I wanted something "easier" in the title.

Change History

Changed 7 years ago by mooffie

comment:1 Changed 7 years ago by zaytsev

LGTM, only "in runtime", I think, is a typo in the original comment, and it should have been "at runtime", shouldn't it?

comment:2 Changed 7 years ago by mooffie

(Right. I didn't want to fix the "in runtime" already there, in case this patch got rejected, so I doubled it as a signpost. If I get to commit this I'll fix the two errors.)

comment:3 Changed 7 years ago by mooffie

  • Status changed from new to accepted
  • Owner set to mooffie
  • Branch state changed from no branch to on review

branch: 3766_add_widget_autopos
changeset:d031efb7f3ead623e92050529f71eda801739ede

Version 1, edited 7 years ago by mooffie (previous) (next) (diff)

comment:4 Changed 7 years ago by andrew_b

I propose another way: use widget_select() that changes focus and sets pointer to the new current widget.

comment:5 Changed 7 years ago by mooffie

(Folks: I fell ill. I'll be absent for several days.)

comment:6 Changed 7 years ago by zaytsev

Being sick sucks, get well soon.

comment:7 follow-up: ↓ 8 Changed 7 years ago by mooffie

I'm back! My flu is almost over.

@Andrew: I checked your patch and it works. Do you want me to commit it? (if you want me to also rename 'current' to 'new_current' (I think it'd be clearer), say so.)

comment:8 in reply to: ↑ 7 Changed 7 years ago by andrew_b

Replying to mooffie:

Do you want me to commit it? (if you want me to also rename 'current' to 'new_current' (I think it'd be clearer), say so.)

Yes, please.

Last edited 7 years ago by andrew_b (previous) (diff)

comment:9 Changed 7 years ago by zaytsev

I'm (obviously) +1 as long as you two are in agreement.

comment:10 Changed 7 years ago by mooffie

  • Milestone changed from Future Releases to 4.8.19

branch: 3766_add_widget_autopos
changeset:e83409b6d77a24b75e9d1d2f69ad96bc1c3d83f2

comment:11 Changed 7 years ago by mooffie

  • Branch state changed from on review to approved

comment:12 Changed 7 years ago by mooffie

  • Status changed from accepted to testing
  • Votes for changeset set to committed-master
  • Resolution set to fixed
  • Branch state changed from approved to merged

comment:13 Changed 7 years ago by mooffie

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.