Skip to content

Commit c0a78db

Browse files
fix: improve keyboard operation
1 parent 21044e3 commit c0a78db

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

scripts/rebuild.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ foreach ($pidx in $pids) {
33
Stop-Process -Id $pidx -Force
44
}
55

6-
xmake f --toolchain=clang-cl -m releasedbg -y
6+
xmake f --toolchain=clang-cl -m releasedbg -y -c
77
xmake b --yes inject
88
xmake b --yes shell
99
if ($LASTEXITCODE -ne 0) {

src/shell/contextmenu/menu_widget.cc

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ void mb_shell::menu_item_normal_widget::render(ui::nanovg_context ctx) {
4747
if (focused()) {
4848
ctx.strokeColor(
4949
nvgRGBAf(c, c, c, *opacity / 255.f * 0.5)); // Half opacity
50-
ctx.strokeWidth(1.0f);
51-
ctx.strokeRoundedRect(*x + margin, *y, *width - margin * 2, *height,
52-
roundcorner);
50+
constexpr auto border_width = 1.0f;
51+
ctx.strokeWidth(border_width);
52+
ctx.strokeRoundedRect(*x + margin + border_width / 2,
53+
*y + border_width / 2,
54+
*width - margin * 2 - border_width,
55+
*height - border_width, roundcorner);
5356
}
5457

5558
// Draw left icon
@@ -407,7 +410,14 @@ void mb_shell::menu_widget::update(ui::update_context &ctx) {
407410
if (wid->item.submenu) {
408411
if (!wid->submenu_wid)
409412
wid->show_submenu(ctx);
410-
current_submenu->set_focus();
413+
if (!current_submenu->focus_within()) {
414+
if (auto child = current_submenu->get_child<
415+
menu_item_normal_widget>()) {
416+
child->set_focus();
417+
} else {
418+
current_submenu->set_focus();
419+
}
420+
}
411421
}
412422
}
413423
ctx.need_repaint = true;

0 commit comments

Comments
 (0)