Opraven příliš rychlý marquee scroll
This commit is contained in:
+22
-36
@@ -1735,12 +1735,9 @@ static void run_file_manager(void) {
|
|||||||
int last_selected = -1;
|
int last_selected = -1;
|
||||||
int top = 0;
|
int top = 0;
|
||||||
unsigned long last_anim = timer_ticks();
|
unsigned long last_anim = timer_ticks();
|
||||||
unsigned long idle_spin = 0;
|
unsigned long tick_counter = 0;
|
||||||
unsigned long step_ticks = g_timer_hz / 5UL;
|
unsigned long step_ticks = 1;
|
||||||
|
unsigned long shift_interval = 10;
|
||||||
if (step_ticks == 0) {
|
|
||||||
step_ticks = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
aster_memset(fm_cwd, 0, sizeof(fm_cwd));
|
aster_memset(fm_cwd, 0, sizeof(fm_cwd));
|
||||||
aster_memcpy(fm_cwd, g_cwd, aster_strlen(g_cwd));
|
aster_memcpy(fm_cwd, g_cwd, aster_strlen(g_cwd));
|
||||||
@@ -1784,29 +1781,24 @@ static void run_file_manager(void) {
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
unsigned long delta;
|
unsigned long delta;
|
||||||
unsigned long steps;
|
|
||||||
key = keyboard_try_read_key();
|
key = keyboard_try_read_key();
|
||||||
now = timer_ticks();
|
now = timer_ticks();
|
||||||
|
|
||||||
|
// Timer-based posun - každých N tiků
|
||||||
if (now > last_anim) {
|
if (now > last_anim) {
|
||||||
delta = now - last_anim;
|
delta = now - last_anim;
|
||||||
if (delta >= step_ticks) {
|
if (delta >= step_ticks) {
|
||||||
steps = delta / step_ticks;
|
tick_counter += delta;
|
||||||
g_status_marquee_offset += (usize)steps;
|
if (tick_counter >= shift_interval) {
|
||||||
last_anim += steps * step_ticks;
|
g_status_marquee_offset++;
|
||||||
render_shell_statusbar();
|
tick_counter = 0;
|
||||||
|
render_shell_statusbar();
|
||||||
|
}
|
||||||
|
last_anim = now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
++idle_spin;
|
|
||||||
if (idle_spin >= 230000UL) {
|
|
||||||
idle_spin = 0;
|
|
||||||
++g_status_marquee_offset;
|
|
||||||
render_shell_statusbar();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key != -1) {
|
if (key != -1) {
|
||||||
idle_spin = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2191,11 +2183,12 @@ static void shell_edit_file(const char *path) {
|
|||||||
usize len;
|
usize len;
|
||||||
usize pos;
|
usize pos;
|
||||||
unsigned long last_anim = timer_ticks();
|
unsigned long last_anim = timer_ticks();
|
||||||
unsigned long idle_spin = 0;
|
unsigned long tick_counter = 0;
|
||||||
unsigned long step_ticks = g_timer_hz / 5UL;
|
unsigned long step_ticks = 1;
|
||||||
|
unsigned long shift_interval = 10;
|
||||||
char title[120];
|
char title[120];
|
||||||
usize tp = 0;
|
usize tp = 0;
|
||||||
const char *prefix = "Upravovani souboru ";
|
const char *prefix = "* Upravovani souboru:";
|
||||||
const char *base = path_basename(path);
|
const char *base = path_basename(path);
|
||||||
usize bi = 0;
|
usize bi = 0;
|
||||||
|
|
||||||
@@ -2232,33 +2225,26 @@ static void shell_edit_file(const char *path) {
|
|||||||
int key;
|
int key;
|
||||||
unsigned long now = timer_ticks();
|
unsigned long now = timer_ticks();
|
||||||
unsigned long delta;
|
unsigned long delta;
|
||||||
unsigned long steps;
|
|
||||||
key = keyboard_try_read_key();
|
key = keyboard_try_read_key();
|
||||||
|
|
||||||
if (now > last_anim) {
|
if (now > last_anim) {
|
||||||
delta = now - last_anim;
|
delta = now - last_anim;
|
||||||
if (delta >= step_ticks) {
|
if (delta >= step_ticks) {
|
||||||
steps = delta / step_ticks;
|
tick_counter += delta;
|
||||||
g_status_marquee_offset += (usize)steps;
|
if (tick_counter >= shift_interval) {
|
||||||
last_anim += steps * step_ticks;
|
g_status_marquee_offset++;
|
||||||
render_shell_statusbar();
|
tick_counter = 0;
|
||||||
|
render_shell_statusbar();
|
||||||
|
}
|
||||||
|
last_anim = now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
++idle_spin;
|
|
||||||
if (idle_spin >= 230000UL) {
|
|
||||||
idle_spin = 0;
|
|
||||||
++g_status_marquee_offset;
|
|
||||||
render_shell_statusbar();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key == -1) {
|
if (key == -1) {
|
||||||
__asm__ volatile ("pause");
|
__asm__ volatile ("pause");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
idle_spin = 0;
|
|
||||||
|
|
||||||
if (key == 27) {
|
if (key == 27) {
|
||||||
g_status_marquee_only = 0;
|
g_status_marquee_only = 0;
|
||||||
status_clear_left_hint();
|
status_clear_left_hint();
|
||||||
|
|||||||
Reference in New Issue
Block a user