This commit is contained in:
OrbisAI Security 2026-06-18 23:48:55 +00:00 committed by GitHub
commit 092e37a5e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View file

@ -114,7 +114,7 @@ void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output) {
xkb_layout_index_t current; xkb_layout_index_t current;
int32_t tagmask, state, numclients, focused_client, tag; int32_t tagmask, state, numclients, focused_client, tag;
const char *title, *appid, *symbol; const char *title, *appid, *symbol;
char kb_layout[32]; char kb_layout[KB_LAYOUT_ABBR_SIZE];
focused = focustop(monitor); focused = focustop(monitor);
zdwl_ipc_output_v2_send_active(ipc_output->resource, monitor == selmon); zdwl_ipc_output_v2_send_active(ipc_output->resource, monitor == selmon);

View file

@ -33,7 +33,7 @@ void get_layout_abbr(char *abbr, const char *full_name) {
// 1. 尝试在映射表中查找 // 1. 尝试在映射表中查找
for (int32_t i = 0; layout_mappings[i].full_name != NULL; i++) { for (int32_t i = 0; layout_mappings[i].full_name != NULL; i++) {
if (strcmp(full_name, layout_mappings[i].full_name) == 0) { if (strcmp(full_name, layout_mappings[i].full_name) == 0) {
strcpy(abbr, layout_mappings[i].abbr); snprintf(abbr, KB_LAYOUT_ABBR_SIZE, "%s", layout_mappings[i].abbr);
return; return;
} }
} }
@ -73,7 +73,7 @@ void get_layout_abbr(char *abbr, const char *full_name) {
abbr[2] = '\0'; abbr[2] = '\0';
} else { } else {
// 5. 最终回退:返回 "xx" // 5. 最终回退:返回 "xx"
strcpy(abbr, "xx"); snprintf(abbr, KB_LAYOUT_ABBR_SIZE, "xx");
} }
} }

View file

@ -102,6 +102,7 @@
#define MANGO_MAX(A, B) ((A) > (B) ? (A) : (B)) #define MANGO_MAX(A, B) ((A) > (B) ? (A) : (B))
#define MANGO_MIN(A, B) ((A) < (B) ? (A) : (B)) #define MANGO_MIN(A, B) ((A) < (B) ? (A) : (B))
#define GEZERO(A) ((A) >= 0 ? (A) : 0) #define GEZERO(A) ((A) >= 0 ? (A) : 0)
#define KB_LAYOUT_ABBR_SIZE 32
#define CLEANMASK(mask) (mask & ~WLR_MODIFIER_CAPS) #define CLEANMASK(mask) (mask & ~WLR_MODIFIER_CAPS)
#define INSIDEMON(A) \ #define INSIDEMON(A) \
(A->geom.x >= A->mon->m.x && A->geom.y >= A->mon->m.y && \ (A->geom.x >= A->mon->m.x && A->geom.y >= A->mon->m.y && \