From 48ded43e2ad773d4137c40151196af4ebd9c7e91 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sat, 5 Sep 2026 11:07:20 +0900 Subject: [PATCH] Fix menu text being erased when removing selection highlights Restore the saved area for opaque menus as well as translucent ones. Painting over highlights with the background color could erase glyph pixels in the selected row and the next row. Also match the original engine's menu item text position. --- src/selection.c | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/src/selection.c b/src/selection.c index ea1b39d..b5a2650 100644 --- a/src/selection.c +++ b/src/selection.c @@ -303,7 +303,7 @@ static void init_selwindow() { } for (i = 0; i < regnum; i++) { TRACE_MESSAGE("%d:%s\n", i +1, elm[i]); - ags_drawString(r.x +2, r.y + i * (sel.MsgFontSize +2) +1, elm[i], sel.MsgFontColor, sel.MsgFontSize, NULL); + ags_drawString(r.x +2, r.y + i * (sel.MsgFontSize +2) +2, elm[i], sel.MsgFontColor, sel.MsgFontSize, NULL); } ags_updateArea(saveArea.x, saveArea.y, saveArea.w, saveArea.h); @@ -376,31 +376,12 @@ static void lineEncloseElement(SDL_Rect *r, int col, bool thick) { static void encloseElement(int sw, int no) { SDL_Rect *r = &workR[no]; - if (sw == 0) { /* off */ - if (sel.WinBackgroundTransparent != 255) { - ags_restoreRegion(saveimg2, r->x, r->y); - ags_updateArea(r->x, r->y, r->w +2, r->h +2); - saveimg2 = NULL; - } else { - switch(sel.EncloseType) { - case 0: - lineEncloseElement(r, sel.WinBackgroundColor, true); break; - case 1: - lineEncloseElement(r, sel.WinBackgroundColor, false); break; - case 2: - ags_fillRectangle(r->x, r->y, r->w +2, r->h +2, sel.WinBackgroundColor); - ags_drawString(r->x +2, r->y +1, elm[no], sel.MsgFontColor, sel.MsgFontSize, NULL); - ags_updateArea(r->x, r->y, r->w +2, r->h +2); - break; - default: - break; - } - } - - } else { /* on */ - if (sel.WinBackgroundTransparent != 255) { - saveimg2 = ags_saveRegion(r->x, r->y, r->w +2, r->h +2); - } + if (sw == 0) { + ags_restoreRegion(saveimg2, r->x, r->y); + ags_updateArea(r->x, r->y, r->w +2, r->h +2); + saveimg2 = NULL; + } else { + saveimg2 = ags_saveRegion(r->x, r->y, r->w +2, r->h +2); switch(sel.EncloseType) { case 0: lineEncloseElement(r, sel.WinFrameColor, true); break; @@ -408,7 +389,7 @@ static void encloseElement(int sw, int no) { lineEncloseElement(r, 255, false); break; case 2: ags_fillRectangle(r->x, r->y, r->w +2, r->h +2, sel.MsgFontColor); - ags_drawString(r->x +2, r->y +1, elm[no], sel.WinBackgroundColor, sel.MsgFontSize, NULL); + ags_drawString(r->x +2, r->y +2, elm[no], sel.WinBackgroundColor, sel.MsgFontSize, NULL); ags_updateArea(r->x, r->y, r->w +2, r->h +2); break; default: