opt: monitor rule prefer to use internal mode

This commit is contained in:
DreamMaoMao 2025-08-24 09:46:48 +08:00
parent 87b094c958
commit 095af2b3c8
2 changed files with 29 additions and 5 deletions

View file

@ -2583,6 +2583,7 @@ void reapply_monitor_rules(void) {
Monitor *m;
int ji, jk;
struct wlr_output_state state;
struct wlr_output_mode *internal_mode = NULL;
wlr_output_state_init(&state);
wl_list_for_each(m, &mons, link) {
@ -2611,9 +2612,11 @@ void reapply_monitor_rules(void) {
}
if (mr->width > 0 && mr->height > 0 && mr->refresh > 0) {
wlr_output_state_set_custom_mode(
&state, mr->width, mr->height,
(int)roundf(mr->refresh * 1000));
internal_mode = get_output_mode(m->wlr_output, mr->width,
mr->height, mr->refresh);
if (internal_mode) {
wlr_output_state_set_mode(&state, internal_mode);
}
}
wlr_output_state_set_scale(&state, mr->scale);