Opened 6 years ago

Closed 5 years ago

#1261 closed defect/bug (fixed)

toggle_announcer OSD changes state on each redraw

Reported by: mvglasow (2) Owned by: Singesang
Priority: major Milestone:
Component: osd/core Version: git master
Severity: normal Keywords:
Cc: http://wiki.navit-project.org/index.php/user:mvglasow, (2)

Description

To reproduce: Add a toggle_announcer OSD to your navit.xml. Then maximize/unmaximize the window (on a desktop OS), or on Android rotate the screen. You will notice that each of these operations will cause the icon to flip between the enabled and disabled state.

Looking at osd_core.c and osd.c, I see that the toggle_announcer item has no a real click handler, and the draw event indeed just flips the state on each redraw.

I guess we need a real click handler, which switches speech output on/off and then triggers a redraw. The redraw routine should then read the status of the speech engine to determine the correct icon to display.

Change History (4)

comment:1 Changed 6 years ago by mvglasow (2)

  • Cc http://wiki.navit-project.org/index.php/user:mvglasow (2) added

comment:2 Changed 5 years ago by mvglasow (2)

Turns out the click handler wasn't the problem...

The issue was that navit.c didn't call the callback function correctly, thus osd_nav_toggle_anouncer_draw() doesn't get a valid navit instance when called directly, thus it can't query the navit.speech.active attribute – any attempt to do so will crash.

However, the first time the function is invoked is during initialization. This is a direct call and gets a valid navit instance. Now someone worked around the original bug by making sure the attribute would get queried only the first time and stired locally. On all subsequent calls it would just flip its internal state, assuming that a redraw meant a state change.

Took me a while to figure that one out... due to its close relationship with the #1260 patch, I will include it there.

comment:3 Changed 5 years ago by jandegr

Hi I tested on Linux (r5909) and confirm the issue exestis and is fixed by the #1260 patch. thx.

comment:4 Changed 5 years ago by kazer

  • Resolution set to fixed
  • Status changed from new to closed

Thank you mvglasow, nice work here. Patch applied in r5910

Note: See TracTickets for help on using tickets.