Skip to content

Commit 8a9a566

Browse files
committed
gui: fix software panel flickering and adjust column layout
The software list panel suffered from noticeable flickering when scrolling due to unnecessary redraws: - The cycle button (Libraries/Devices/Resources) was redrawn on every scroll operation even though its label only changes when cycling through software types. Only redraw when the label actually changes. - The clear area for the list content extended into the scroll bar region, causing it to be erased and redrawn on each scroll. Reduce the clear width to stop before the scroll bar (SOFTWARE_PANEL_W - 16 instead of - 3). - Move cycle button initial drawing to draw_software_panel() to ensure it's visible on first display, since update_software_list() now skips redrawing when the label hasn't changed. Additionally, adjust column positions for better spacing: - Location column: 130 -> 126 - Address column: 204 -> 200 - Version column: 290 -> 284
1 parent 36c0601 commit 8a9a566

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

src/gui.c

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,12 @@ static void draw_software_panel(void)
793793
SOFTWARE_PANEL_W - 2, 14,
794794
get_string(MSG_SYSTEM_SOFTWARE));
795795

796+
/* Draw cycle button initially */
797+
Button *cycle_btn = find_button(BTN_SOFTWARE_CYCLE);
798+
if (cycle_btn) {
799+
draw_cycle_button(cycle_btn);
800+
}
801+
796802
update_software_list();
797803
}
798804

@@ -825,21 +831,24 @@ static void update_software_list(void)
825831
return;
826832
}
827833

828-
/* Clear list area */
834+
/* Clear list area (stop before scroll bar at -14) */
829835
SetAPen(rp, COLOR_PANEL_BG);
830836
RectFill(rp, SOFTWARE_PANEL_X + 2, list_top - 7,
831-
SOFTWARE_PANEL_X + SOFTWARE_PANEL_W - 3,
837+
SOFTWARE_PANEL_X + SOFTWARE_PANEL_W - 16,
832838
list_top + list_height - 5);
833839

834-
/* Update cycle button */
840+
/* Update cycle button only if label changed */
835841
Button *cycle_btn = find_button(BTN_SOFTWARE_CYCLE);
836842
if (cycle_btn) {
837-
cycle_btn->label = app->software_type == SOFTWARE_LIBRARIES ?
838-
get_string(MSG_LIBRARIES) :
839-
app->software_type == SOFTWARE_DEVICES ?
840-
get_string(MSG_DEVICES) :
841-
get_string(MSG_RESOURCES);
842-
draw_cycle_button(cycle_btn);
843+
const char *new_label = app->software_type == SOFTWARE_LIBRARIES ?
844+
get_string(MSG_LIBRARIES) :
845+
app->software_type == SOFTWARE_DEVICES ?
846+
get_string(MSG_DEVICES) :
847+
get_string(MSG_RESOURCES);
848+
if (cycle_btn->label != new_label) {
849+
cycle_btn->label = new_label;
850+
draw_cycle_button(cycle_btn);
851+
}
843852
}
844853

845854
/* Draw scroll arrows with triangles */
@@ -880,18 +889,18 @@ static void update_software_list(void)
880889

881890
/* Location */
882891
snprintf(buffer, 12, "%-10s", get_location_string(entry->location));
883-
Move(rp, SOFTWARE_PANEL_X + 130, y);
892+
Move(rp, SOFTWARE_PANEL_X + 126, y);
884893
Text(rp, (CONST_STRPTR)buffer, strlen(buffer));
885894

886895
/* Address */
887896
snprintf(buffer, 12, "$%08lX", (unsigned long)entry->address);
888897
SetAPen(rp, COLOR_HIGHLIGHT);
889-
Move(rp, SOFTWARE_PANEL_X + 204, y);
898+
Move(rp, SOFTWARE_PANEL_X + 200, y);
890899
Text(rp, (CONST_STRPTR)buffer, strlen(buffer));
891900

892901
/* Version */
893902
snprintf(buffer, sizeof(buffer), "V%d.%d", entry->version, entry->revision);
894-
Move(rp, SOFTWARE_PANEL_X + 290, y);
903+
Move(rp, SOFTWARE_PANEL_X + 284, y);
895904
Text(rp, (CONST_STRPTR)buffer, strlen(buffer));
896905

897906
y += 8;

0 commit comments

Comments
 (0)