From 99fad07f12cd7fe1c105874d8cd9c03a57e88b3b Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Wed, 17 Sep 2025 12:04:10 +0800 Subject: [PATCH] opt: optimzie func name --- src/config/parse_config.h | 4 ++-- src/mango.c | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/config/parse_config.h b/src/config/parse_config.h index 29787a3..30c0285 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -2606,8 +2606,8 @@ void reapply_monitor_rules(void) { } if (mr->width > 0 && mr->height > 0 && mr->refresh > 0) { - internal_mode = get_output_mode(m->wlr_output, mr->width, - mr->height, mr->refresh); + internal_mode = get_nearest_output_mode( + m->wlr_output, mr->width, mr->height, mr->refresh); if (internal_mode) { wlr_output_state_set_mode(&state, internal_mode); } else if (wlr_output_is_headless(m->wlr_output)) { diff --git a/src/mango.c b/src/mango.c index 8782cb0..c09c82f 100644 --- a/src/mango.c +++ b/src/mango.c @@ -647,9 +647,9 @@ static struct wlr_box setclient_coordinate_center(Client *c, int offsetx, int offsety); static unsigned int get_tags_first_tag(unsigned int tags); -static struct wlr_output_mode *get_output_mode(struct wlr_output *output, - int width, int height, - float refresh); +static struct wlr_output_mode * +get_nearest_output_mode(struct wlr_output *output, int width, int height, + float refresh); static void client_commit(Client *c); static void layer_commit(LayerSurface *l); @@ -2460,8 +2460,9 @@ void createlocksurface(struct wl_listener *listener, void *data) { client_notify_enter(lock_surface->surface, wlr_seat_get_keyboard(seat)); } -struct wlr_output_mode *get_output_mode(struct wlr_output *output, int width, - int height, float refresh) { +struct wlr_output_mode *get_nearest_output_mode(struct wlr_output *output, + int width, int height, + float refresh) { struct wlr_output_mode *mode, *nearest_mode = NULL; float min_diff = 99999.0f; @@ -2542,8 +2543,8 @@ void createmon(struct wl_listener *listener, void *data) { rr = r->rr; if (r->width > 0 && r->height > 0 && r->refresh > 0) { - internal_mode = get_output_mode(m->wlr_output, r->width, - r->height, r->refresh); + internal_mode = get_nearest_output_mode(m->wlr_output, r->width, + r->height, r->refresh); if (internal_mode) { custom_monitor_mode = true; wlr_output_state_set_mode(&state, internal_mode);