mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 04:05:43 +01:00
Reinitialize the size calculation at view change
The volume bar and space sizes are recalculated at each time when the view mode is changed. This will fix the problem when the view with fewer volumes is switched to the view with more volumes.
This commit is contained in:
parent
063ff485e2
commit
30b608001f
1 changed files with 26 additions and 19 deletions
|
@ -1458,6 +1458,30 @@ mixer_init (void)
|
||||||
strcpy(mixer_device_name, snd_ctl_card_info_get_mixername(hw_info));
|
strcpy(mixer_device_name, snd_ctl_card_info_get_mixername(hw_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* init mixer screen
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
recalc_screen_size (void)
|
||||||
|
{
|
||||||
|
getmaxyx (mixer_window, mixer_max_y, mixer_max_x);
|
||||||
|
if (mixer_minimize)
|
||||||
|
{
|
||||||
|
mixer_max_x = MIXER_MIN_X;
|
||||||
|
mixer_max_y = MIXER_MIN_Y;
|
||||||
|
}
|
||||||
|
mixer_ofs_x = 2 /* extra begin padding: */ + 1;
|
||||||
|
|
||||||
|
/* required allocations */
|
||||||
|
mixer_n_vis_elems = (mixer_max_x - mixer_ofs_x * 2 + 1) / 9;
|
||||||
|
mixer_n_vis_elems = CLAMP (mixer_n_vis_elems, 1, mixer_n_view_elems);
|
||||||
|
mixer_extra_space = mixer_max_x - mixer_ofs_x * 2 + 1 - mixer_n_vis_elems * 9;
|
||||||
|
mixer_extra_space = MAX (0, mixer_extra_space / (mixer_n_vis_elems + 1));
|
||||||
|
if (MIXER_TEXT_Y + 10 < mixer_max_y)
|
||||||
|
mixer_cbar_height = 10 + MAX (0, mixer_max_y - MIXER_TEXT_Y - 10 ) / 2;
|
||||||
|
else
|
||||||
|
mixer_cbar_height = MAX (1, mixer_max_y - MIXER_TEXT_Y);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mixer_reinit (void)
|
mixer_reinit (void)
|
||||||
{
|
{
|
||||||
|
@ -1588,6 +1612,7 @@ __again:
|
||||||
}
|
}
|
||||||
|
|
||||||
mixer_n_view_elems = elem_index;
|
mixer_n_view_elems = elem_index;
|
||||||
|
recalc_screen_size();
|
||||||
mixer_focus_elem = 0;
|
mixer_focus_elem = 0;
|
||||||
if (focus_type >= 0) {
|
if (focus_type >= 0) {
|
||||||
for (elem_index = 0; elem_index < mixer_n_view_elems; elem_index++) {
|
for (elem_index = 0; elem_index < mixer_n_view_elems; elem_index++) {
|
||||||
|
@ -1630,25 +1655,7 @@ mixer_init_window (void)
|
||||||
keypad (mixer_window, TRUE);
|
keypad (mixer_window, TRUE);
|
||||||
GETCH_BLOCK (1);
|
GETCH_BLOCK (1);
|
||||||
|
|
||||||
/* init mixer screen
|
recalc_screen_size();
|
||||||
*/
|
|
||||||
getmaxyx (mixer_window, mixer_max_y, mixer_max_x);
|
|
||||||
if (mixer_minimize)
|
|
||||||
{
|
|
||||||
mixer_max_x = MIXER_MIN_X;
|
|
||||||
mixer_max_y = MIXER_MIN_Y;
|
|
||||||
}
|
|
||||||
mixer_ofs_x = 2 /* extra begin padding: */ + 1;
|
|
||||||
|
|
||||||
/* required allocations */
|
|
||||||
mixer_n_vis_elems = (mixer_max_x - mixer_ofs_x * 2 + 1) / 9;
|
|
||||||
mixer_n_vis_elems = CLAMP (mixer_n_vis_elems, 1, mixer_n_view_elems);
|
|
||||||
mixer_extra_space = mixer_max_x - mixer_ofs_x * 2 + 1 - mixer_n_vis_elems * 9;
|
|
||||||
mixer_extra_space = MAX (0, mixer_extra_space / (mixer_n_vis_elems + 1));
|
|
||||||
if (MIXER_TEXT_Y + 10 < mixer_max_y)
|
|
||||||
mixer_cbar_height = 10 + MAX (0, mixer_max_y - MIXER_TEXT_Y - 10 ) / 2;
|
|
||||||
else
|
|
||||||
mixer_cbar_height = MAX (1, mixer_max_y - MIXER_TEXT_Y);
|
|
||||||
|
|
||||||
mixer_clear (TRUE);
|
mixer_clear (TRUE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue