Skip to content

Commit

Permalink
separator issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed Sep 23, 2022
1 parent a6e40c4 commit 2a8954a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ssrWin/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ static void on_cmd_scan_screen_qrcode(HWND hWnd) {
}

static void modify_popup_menu_items(struct main_wnd_data* wnd_data, HMENU hMenu) {
#define INSERT_POSITION 10
int cur_selected;
int node_count = ListView_GetItemCount(wnd_data->hListView);
int menu_count = GetMenuItemCount(hMenu);
Expand All @@ -673,6 +674,9 @@ static void modify_popup_menu_items(struct main_wnd_data* wnd_data, HMENU hMenu)
DeleteMenu(hMenu, item_id, MF_BYCOMMAND);
}
}
if (GetMenuItemID(hMenu, INSERT_POSITION) == 0) {
DeleteMenu(hMenu, INSERT_POSITION, MF_BYPOSITION);
}
for (index = node_count - 1; index >= 0; --index) {
wchar_t *tmp;
struct server_config* config;
Expand All @@ -684,10 +688,14 @@ static void modify_popup_menu_items(struct main_wnd_data* wnd_data, HMENU hMenu)
}
name = lstrlenA(config->remarks) ? config->remarks : config->remote_host;
tmp = utf8_to_wchar_string(name, &malloc);
InsertMenuW(hMenu, 10, MF_STRING | MF_BYPOSITION, (UINT)(MENU_ID_NODE_BEGINNING + index), tmp ? tmp : L"");
InsertMenuW(hMenu, INSERT_POSITION, MF_STRING | MF_BYPOSITION, (UINT)(MENU_ID_NODE_BEGINNING + index), tmp ? tmp : L"");
free(tmp);
}

if (node_count > 0) {
InsertMenu(hMenu, INSERT_POSITION + node_count, MF_SEPARATOR | MF_BYPOSITION, 0, NULL);
}

cur_selected = adjust_current_selected_item(wnd_data->cur_selected, node_count);
set_current_selected_item(wnd_data->hMainDlg, cur_selected, TRUE);

Expand Down

0 comments on commit 2a8954a

Please sign in to comment.